diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Bindings/CMakeLists.txt | 27 | ||||
-rw-r--r-- | src/CMakeLists.txt | 33 |
2 files changed, 37 insertions, 23 deletions
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt index 5c79225cc..05d4c7e4f 100644 --- a/src/Bindings/CMakeLists.txt +++ b/src/Bindings/CMakeLists.txt @@ -56,7 +56,6 @@ set (BINDING_OUTPUTS ) set(BINDING_DEPENDENCIES - tolua ../Bindings/AllToLua.pkg ../Bindings/BindingsProcessor.lua ../Bindings/LuaFunctions.h @@ -139,17 +138,21 @@ set(BINDING_DEPENDENCIES ) if (NOT MSVC) - ADD_CUSTOM_COMMAND( - # add any new generated bindings here - OUTPUT ${BINDING_OUTPUTS} - - # Regenerate bindings: - COMMAND tolua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - - # add any new generation dependencies here - DEPENDS ${BINDING_DEPENDENCIES} - ) + if (HAS_LUA_INTERPRETER) + ADD_CUSTOM_COMMAND( + OUTPUT ${BINDING_OUTPUTS} + COMMAND lua BindingsProcessor.lua + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${BINDING_DEPENDENCIES} + ) + else() + ADD_CUSTOM_COMMAND( + OUTPUT ${BINDING_OUTPUTS} + COMMAND tolua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${BINDING_DEPENDENCIES} tolua + ) + endif() endif () set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5bf55c81f..075d48968 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -252,6 +252,10 @@ else () foreach (hdr ${FOLDER_HDRS}) list(APPEND SOURCE "${folder}/${hdr}") endforeach(hdr) + + # Include this folder's CMakeLists.txt in the project: + list(APPEND SOURCE "${folder}/CMakeLists.txt") + source_group("${folder}" FILES "${folder}/CMakeLists.txt") endforeach(folder) list(APPEND SOURCE "${SRCS}") @@ -315,19 +319,26 @@ if (MSVC) list (APPEND BINDINGS_DEPENDENCIES "Bindings/${dep}") endforeach(dep) - 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}/Server/lua51.dll ./lua51.dll + if (HAS_LUA_INTERPRETER) + ADD_CUSTOM_COMMAND( + OUTPUT ${BINDING_OUTPUTS} + COMMAND lua BindingsProcessor.lua + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ + DEPENDS ${BINDINGS_DEPENDENCIES} + ) + else() + ADD_CUSTOM_COMMAND( + OUTPUT ${BINDING_OUTPUTS} - # Regenerate bindings: - COMMAND tolua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ + # 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}/Server/lua51.dll ./lua51.dll - # add any new generation dependencies here - DEPENDS ${BINDINGS_DEPENDENCIES} - ) + # Regenerate bindings: + COMMAND tolua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ + DEPENDS ${BINDINGS_DEPENDENCIES} tolua + ) + endif() endif() add_executable(${EXECUTABLE} ${SOURCE}) |