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/Bindings/CMakeLists.txt | 111 ++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 122 +++--------------------------------------- src/PolarSSL++/CMakeLists.txt | 12 +++-- 3 files changed, 125 insertions(+), 120 deletions(-) (limited to 'src') diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt index da6a6919a..723487ff0 100644 --- a/src/Bindings/CMakeLists.txt +++ b/src/Bindings/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 2.6) project (MCServer) include_directories ("${PROJECT_SOURCE_DIR}/../") +include_directories (".") SET (SRCS Bindings.cpp @@ -31,6 +32,116 @@ SET (HDRS tolua++.h ) +# List all the files that are generated as part of the Bindings build process +set (BINDING_OUTPUTS + ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h + ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc +) + +set(BINDING_DEPENDECIES + tolua + ../Bindings/virtual_method_hooks.lua + ../Bindings/AllToLua.pkg + ../Bindings/gen_LuaState_Call.lua + ../Bindings/LuaFunctions.h + ../Bindings/LuaState_Call.inc + ../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 +) + +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} + + # add any new generation dependencies here + DEPENDS ${BINDING_DEPENDECIES} + ) +else () + ADD_CUSTOM_COMMAND( + # add any new generated bindings here + OUTPUT ${BINDING_OUTPUTS} + + # Regenerate bindings: + COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + + # 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) + if(NOT MSVC) add_library(Bindings ${SRCS} ${HDRS}) 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}") diff --git a/src/PolarSSL++/CMakeLists.txt b/src/PolarSSL++/CMakeLists.txt index 9a59cdb2c..39d41292d 100644 --- a/src/PolarSSL++/CMakeLists.txt +++ b/src/PolarSSL++/CMakeLists.txt @@ -3,7 +3,7 @@ project (MCServer) include_directories ("${PROJECT_SOURCE_DIR}/../") -set(SOURCES +set(SRCS AesCfb128Decryptor.cpp AesCfb128Encryptor.cpp BlockingSslClientSocket.cpp @@ -18,7 +18,7 @@ set(SOURCES X509Cert.cpp ) -set(HEADERS +set(HDRS AesCfb128Decryptor.h AesCfb128Encryptor.h BlockingSslClientSocket.h @@ -33,8 +33,10 @@ set(HEADERS X509Cert.h ) -add_library(PolarSSL++ ${SOURCES} ${HEADERS}) +if(NOT MSVC) + add_library(PolarSSL++ ${SRCS} ${HDRS}) -if (UNIX) - target_link_libraries(PolarSSL++ polarssl) + if (UNIX) + target_link_libraries(PolarSSL++ polarssl) + endif() endif() -- cgit v1.2.3