From 34c8ff7b24171f9712ce3156013187257bb45327 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 01:40:01 -0700 Subject: src/CMakeLists: Small changes for increased readability --- src/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fdc33cd82..c33b0983a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,8 +5,10 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/") include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/jsoncpp/include") include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") -set(FOLDERS OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++) -set(FOLDERS ${FOLDERS} WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs) +set(FOLDERS + OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ + WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs +) set(BINDING_DEPENDECIES tolua @@ -261,9 +263,11 @@ endif () if (NOT MSVC) - target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks) - target_link_libraries(${EXECUTABLE} Protocol Generating Generating_Prefabs WorldStorage) - target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities PolarSSL++) + target_link_libraries(${EXECUTABLE} + OSSupport HTTPServer Bindings Items Blocks + Protocol Generating Generating_Prefabs WorldStorage + Mobs Entities Simulator UI BlockEntities PolarSSL++ + ) endif () if (WIN32) target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib) -- cgit v1.2.3 From 84fef3c1569b941e747c471b06b290876baa131e Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 14:08:49 -0700 Subject: src/CMakeLists.txt: Replaced glob with list of files On MSVC, CMake will traverse all the CMakeLists and add their source and header files to one conglomerate SOURCE list. --- src/CMakeLists.txt | 168 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 148 insertions(+), 20 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c33b0983a..dc6fec02f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,6 +82,131 @@ set(BINDING_DEPENDECIES World.h ) +SET (SRCS + BiomeDef.cpp + BlockArea.cpp + BlockID.cpp + BlockInfo.cpp + BoundingBox.cpp + ByteBuffer.cpp + ChatColor.cpp + Chunk.cpp + ChunkData.cpp + ChunkMap.cpp + ChunkSender.cpp + ChunkStay.cpp + ClientHandle.cpp + CommandOutput.cpp + CompositeChat.cpp + CraftingRecipes.cpp + Cuboid.cpp + DeadlockDetect.cpp + Enchantments.cpp + FastRandom.cpp + FurnaceRecipe.cpp + Globals.cpp + Group.cpp + GroupManager.cpp + Inventory.cpp + Item.cpp + ItemGrid.cpp + LightingThread.cpp + LineBlockTracer.cpp + LinearInterpolation.cpp + Log.cpp + MCLogger.cpp + Map.cpp + MapManager.cpp + MobCensus.cpp + MobFamilyCollecter.cpp + MobProximityCounter.cpp + MobSpawner.cpp + MonsterConfig.cpp + Noise.cpp + ProbabDistrib.cpp + RCONServer.cpp + Root.cpp + Scoreboard.cpp + Server.cpp + Statistics.cpp + StringCompression.cpp + StringUtils.cpp + Tracer.cpp + VoronoiMap.cpp + WebAdmin.cpp + World.cpp + main.cpp) + +SET (HDRS + AllocationPool.h + BiomeDef.h + BlockArea.h + BlockID.h + BlockInServerPluginInterface.h + BlockInfo.h + BlockTracer.h + BoundingBox.h + ByteBuffer.h + ChatColor.h + Chunk.h + ChunkData.h + ChunkDataCallback.h + ChunkDef.h + ChunkMap.h + ChunkSender.h + ChunkStay.h + ClientHandle.h + CommandOutput.h + CompositeChat.h + CraftingRecipes.h + Cuboid.h + DeadlockDetect.h + Defines.h + Enchantments.h + Endianness.h + FastRandom.h + ForEachChunkProvider.h + FurnaceRecipe.h + Globals.h + Group.h + GroupManager.h + Inventory.h + Item.h + ItemGrid.h + LeakFinder.h + LightingThread.h + LineBlockTracer.h + LinearInterpolation.h + LinearUpscale.h + Log.h + MCLogger.h + Map.h + MapManager.h + Matrix4.h + MemoryLeak.h + MersenneTwister.h + MobCensus.h + MobFamilyCollecter.h + MobProximityCounter.h + MobSpawner.h + MonsterConfig.h + Noise.h + ProbabDistrib.h + RCONServer.h + Root.h + Scoreboard.h + Server.h + StackWalker.h + Statistics.h + StringCompression.h + StringUtils.h + Tracer.h + Vector3.h + VoronoiMap.h + WebAdmin.h + World.h + XMLParser.h) + # List all the files that are generated as part of the Bindings build process set (BINDING_OUTPUTS ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Bindings.cpp @@ -159,38 +284,21 @@ if (NOT MSVC) add_subdirectory(${folder}) endforeach(folder) - file(GLOB SOURCE - "*.cpp" - "*.h" - ) - - list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp") + list(APPEND SOURCE "${SRCS}") + list(APPEND SOURCE "${HDRS}") # If building a windows version, but not using MSVC, add the resources directly to the makefile: if (WIN32) - FILE(GLOB ResourceFiles - "Resources/*.rc" - ) - list(APPEND SOURCE "${ResourceFiles}") + list(APPEND SOURCE "Resources/MCServer.rc") endif() else () # MSVC-specific handling: Put all files into one project, separate by the folders: - # Get all files in this folder: - file(GLOB_RECURSE SOURCE - "*.cpp" - "*.h" - "*.pkg" - ) - source_group("" FILES ${SOURCE}) - - LIST(APPEND SOURCE "Bindings/Bindings.cpp" "Bindings/Bindings.h") source_group(Bindings FILES "Bindings/Bindings.cpp" "Bindings/Bindings.h") # Add all subfolders as solution-folders: - list(APPEND FOLDERS "Resources") list(APPEND FOLDERS "Bindings") function(includefolder PATH) FILE(GLOB FOLDER_FILES @@ -204,9 +312,29 @@ else () endfunction(includefolder) foreach(folder ${FOLDERS}) + add_subdirectory(${folder}) includefolder(${folder}) + + # Get all source files in this folder: + get_directory_property(FOLDER_SRCS DIRECTORY ${folder} DEFINITION SRCS) + foreach (src ${FOLDER_SRCS}) + list(APPEND SOURCE "${folder}/${src}") + endforeach(src) + + # Get all headers in this folder: + get_directory_property(FOLDER_HDRS DIRECTORY ${folder} DEFINITION HDRS) + foreach (hdr ${FOLDER_HDRS}) + list(APPEND SOURCE "${folder}/${hdr}") + endforeach(hdr) endforeach(folder) + list(APPEND SOURCE "${SRCS}") + list(APPEND SOURCE "${HDRS}") + list(APPEND SOURCE "Bindings/AllToLua.pkg") + + includefolder("Resources") + source_group("" FILES ${SOURCE}) + include_directories("${PROJECT_SOURCE_DIR}") # Precompiled headers (1st part) -- cgit v1.2.3 From 832530469360020d5cc1bd0a4142c3450d4cd8f9 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 15:27:50 -0700 Subject: CMake: Add Bindings library from subdirectory --- src/CMakeLists.txt | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc6fec02f..afe766f13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/jsoncpp/include" include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") set(FOLDERS - OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ + OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ Bindings WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs ) @@ -250,26 +250,14 @@ set_source_files_properties(Bindings/Bindings.h PROPERTIES GENERATED TRUE) if (NOT MSVC) # Bindings need to reference other folders, so they are done here instead - + # lib dependencies are not included - - include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") - #add cpp files here - add_library(Bindings - Bindings/Bindings - Bindings/DeprecatedBindings - Bindings/LuaChunkStay - Bindings/LuaState - Bindings/LuaWindow - Bindings/ManualBindings - Bindings/Plugin - Bindings/PluginLua - Bindings/PluginManager - Bindings/WebPlugin - ) + include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") - target_link_libraries(Bindings lua sqlite tolualib polarssl) + foreach(folder ${FOLDERS}) + add_subdirectory(${folder}) + endforeach(folder) #clear file file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/BindingDependecies.txt) @@ -280,10 +268,6 @@ if (NOT MSVC) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "Bindings.cpp Bindings.h") - foreach(folder ${FOLDERS}) - add_subdirectory(${folder}) - endforeach(folder) - list(APPEND SOURCE "${SRCS}") list(APPEND SOURCE "${HDRS}") @@ -299,7 +283,6 @@ else () source_group(Bindings FILES "Bindings/Bindings.cpp" "Bindings/Bindings.h") # Add all subfolders as solution-folders: - list(APPEND FOLDERS "Bindings") function(includefolder PATH) FILE(GLOB FOLDER_FILES "${PATH}/*.cpp" -- cgit v1.2.3 From 3d368b015e2032f86130b8a3f4d05ca72287c63a Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 15:41:42 -0700 Subject: Blocks/CMakeLists.txt: Fixed header list after merge of master --- src/CMakeLists.txt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index afe766f13..2fe436125 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -248,17 +248,10 @@ set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE) set_source_files_properties(Bindings/Bindings.h PROPERTIES GENERATED TRUE) if (NOT MSVC) - # Bindings need to reference other folders, so they are done here instead - # lib dependencies are not included - include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") - foreach(folder ${FOLDERS}) - add_subdirectory(${folder}) - endforeach(folder) - #clear file file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/BindingDependecies.txt) foreach(dependecy ${BINDING_DEPENDECIES}) @@ -268,6 +261,10 @@ if (NOT MSVC) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "Bindings.cpp Bindings.h") + foreach(folder ${FOLDERS}) + add_subdirectory(${folder}) + endforeach(folder) + list(APPEND SOURCE "${SRCS}") list(APPEND SOURCE "${HDRS}") @@ -275,8 +272,6 @@ if (NOT MSVC) if (WIN32) list(APPEND SOURCE "Resources/MCServer.rc") endif() - - else () # MSVC-specific handling: Put all files into one project, separate by the folders: -- cgit v1.2.3 From 135dc333c131a9bde32609351e2b495c80b49f53 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 16:04:07 -0700 Subject: CMakeLists: Moved Bindings-specific code to subdir --- src/CMakeLists.txt | 122 +++-------------------------------------------------- 1 file changed, 7 insertions(+), 115 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2fe436125..6008d3174 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,78 +10,6 @@ set(FOLDERS WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs ) -set(BINDING_DEPENDECIES - tolua - ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/virtual_method_hooks.lua - ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/AllToLua.pkg - Bindings/gen_LuaState_Call.lua - Bindings/LuaFunctions.h - Bindings/LuaWindow.h - Bindings/Plugin.h - Bindings/PluginLua.h - Bindings/PluginManager.h - Bindings/WebPlugin.h - BiomeDef.h - BlockArea.h - BlockEntities/BlockEntity.h - BlockEntities/BlockEntityWithItems.h - BlockEntities/ChestEntity.h - BlockEntities/DispenserEntity.h - BlockEntities/DropSpenserEntity.h - BlockEntities/DropperEntity.h - BlockEntities/FurnaceEntity.h - BlockEntities/HopperEntity.h - BlockEntities/JukeboxEntity.h - BlockEntities/NoteEntity.h - BlockEntities/SignEntity.h - BlockEntities/MobHeadEntity.h - BlockEntities/FlowerPotEntity.h - BlockID.h - BoundingBox.h - ChatColor.h - ChunkDef.h - ClientHandle.h - CraftingRecipes.h - Cuboid.h - Defines.h - Enchantments.h - Entities/EntityEffect.h - Entities/Entity.h - Entities/Floater.h - Entities/Pawn.h - Entities/Painting.h - Entities/Pickup.h - Entities/Player.h - Entities/ProjectileEntity.h - Entities/ArrowEntity.h - Entities/ThrownEggEntity.h - Entities/ThrownEnderPearlEntity.h - Entities/ExpBottleEntity.h - Entities/ThrownSnowballEntity.h - Entities/FireChargeEntity.h - Entities/FireworkEntity.h - Entities/GhastFireballEntity.h - Entities/TNTEntity.h - Entities/ExpOrb.h - Entities/HangingEntity.h - Entities/ItemFrame.h - Generating/ChunkDesc.h - Group.h - Inventory.h - Item.h - ItemGrid.h - Mobs/Monster.h - OSSupport/File.h - Root.h - Server.h - StringUtils.h - Tracer.h - UI/Window.h - Vector3.h - WebAdmin.h - World.h -) - SET (SRCS BiomeDef.cpp BlockArea.cpp @@ -207,51 +135,19 @@ SET (HDRS World.h XMLParser.h) -# List all the files that are generated as part of the Bindings build process -set (BINDING_OUTPUTS - ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Bindings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Bindings.h - ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/LuaState_Call.inc -) - -include_directories(Bindings) -include_directories(.) - -if (WIN32) - ADD_CUSTOM_COMMAND( - OUTPUT ${BINDING_OUTPUTS} - - # Copy the Lua DLL into the Bindings folder, so that tolua can run from there: - COMMAND ${CMAKE_COMMAND} -E copy_if_different ../../MCServer/lua51.dll ./lua51.dll - - # Regenerate bindings: - COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ - - # add any new generation dependencies here - DEPENDS ${BINDING_DEPENDECIES} - ) -else () - ADD_CUSTOM_COMMAND( - # add any new generated bindings here - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Bindings.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Bindings.h - - # Regenerate bindings: - COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ - - # add any new generation dependencies here - DEPENDS ${BINDING_DEPENDECIES} - ) -endif () -set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE) -set_source_files_properties(Bindings/Bindings.h PROPERTIES GENERATED TRUE) +include_directories(".") if (NOT MSVC) # Bindings need to reference other folders, so they are done here instead # lib dependencies are not included include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include") + foreach(folder ${FOLDERS}) + add_subdirectory(${folder}) + endforeach(folder) + + get_directory_property(BINDING_DEPENDENCIES DIRECTORY "Bindings" DEFINITION BINDING_DEPENDENCIES) + #clear file file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/BindingDependecies.txt) foreach(dependecy ${BINDING_DEPENDECIES}) @@ -261,10 +157,6 @@ if (NOT MSVC) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "Bindings.cpp Bindings.h") - foreach(folder ${FOLDERS}) - add_subdirectory(${folder}) - endforeach(folder) - list(APPEND SOURCE "${SRCS}") list(APPEND SOURCE "${HDRS}") -- cgit v1.2.3 From 0960e6ae8ffe329ecd78b2f0f433fcb9e817a696 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 19:25:15 -0700 Subject: Moved Windows custom command to src/CMakeLists.txt --- src/CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6008d3174..168c576e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -230,6 +230,25 @@ endif() set(EXECUTABLE MCServer) +if (WIN32) + get_directory_property(BINDING_OUTPUTS DIRECTORY "Bindings" DEFINITION BINDING_OUTPUTS) + get_directory_property(BINDING_DEPENDENCIES DIRECTORY "Bindings" DEFINITION BINDING_DEPENDENCIES) + + ADD_CUSTOM_COMMAND( + OUTPUT ${BINDING_OUTPUTS} + + # Copy the Lua DLL into the Bindings folder, so that tolua can run from there: + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/MCServer/lua51.dll ./lua51.dll + + # Regenerate bindings: + COMMAND tolua -L Bindings/virtual_method_hooks.lua -o Bindings/Bindings.cpp -H Bindings/Bindings.h Bindings/AllToLua.pkg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + + # add any new generation dependencies here + DEPENDS ${BINDING_DEPENDECIES} + ) +endif() + add_executable(${EXECUTABLE} ${SOURCE}) -- cgit v1.2.3 From 9e7958e7fbb5a2477e04d30724730e15335b969f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 19 Jul 2014 13:22:16 +0200 Subject: Fixed MSVC bindings generation. --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 168c576e2..9feaf64fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -230,7 +230,7 @@ endif() set(EXECUTABLE MCServer) -if (WIN32) +if (MSVC) get_directory_property(BINDING_OUTPUTS DIRECTORY "Bindings" DEFINITION BINDING_OUTPUTS) get_directory_property(BINDING_DEPENDENCIES DIRECTORY "Bindings" DEFINITION BINDING_DEPENDENCIES) @@ -241,8 +241,8 @@ if (WIN32) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/MCServer/lua51.dll ./lua51.dll # Regenerate bindings: - COMMAND tolua -L Bindings/virtual_method_hooks.lua -o Bindings/Bindings.cpp -H Bindings/Bindings.h Bindings/AllToLua.pkg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ # add any new generation dependencies here DEPENDS ${BINDING_DEPENDECIES} -- cgit v1.2.3 From 5194eef07d4fdb166af295bd5e6360d95175ff32 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Jul 2014 17:35:09 +0200 Subject: CMake: generates a list of all source files. This will be used for the style-checking script. --- src/CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9feaf64fe..f494b52e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -228,6 +228,26 @@ else () set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /DEBUG") endif() + +# Generate a list of all source files: +set(ALLFILES "") +foreach(folder ${FOLDERS}) + get_directory_property(FOLDER_SRCS DIRECTORY ${folder} DEFINITION SRCS) + foreach (src ${FOLDER_SRCS}) + list(APPEND ALLFILES "${folder}/${src}") + endforeach(src) + + get_directory_property(FOLDER_HDRS DIRECTORY ${folder} DEFINITION HDRS) + foreach (hdr ${FOLDER_HDRS}) + list(APPEND ALLFILES "${folder}/${hdr}") + endforeach(hdr) +endforeach(folder) +foreach(arg ${ALLFILES}) + set(ALLFILESLINES "${ALLFILESLINES}${arg}\n") +endforeach() +FILE(WRITE "AllFiles.lst" "${ALLFILESLINES}") + + set(EXECUTABLE MCServer) if (MSVC) -- cgit v1.2.3