Improve build robustness. Prevent make clean to remove toluabind.c.

This commit is contained in:
Yao Wei Tjong 姚伟忠 2015-09-03 20:14:23 +08:00
parent d8fcc094b9
commit 2731e48405
3 changed files with 11 additions and 11 deletions

View File

@ -636,7 +636,7 @@ include (GenerateExportHeader)
# Macro for precompiling header (On MSVC, the dummy C++ or C implementation file for precompiling the header file would be generated if not already exists)
# This macro should be called before the CMake target has been added
# Typically, user should indirectly call this macro by using the 'PCH' option when calling define_source_file() macro
# Typically, user should indirectly call this macro by using the 'PCH' option when calling define_source_files() macro
macro (enable_pch HEADER_PATHNAME)
# No op when PCH support is not enabled
if (URHO3D_PCH)

View File

@ -56,17 +56,16 @@ endif ()
set (TARGET_NAME tolua++)
# Define generated source files
if (EXISTS ${CMAKE_BINARY_DIR}/bin/tool/tolua++)
file (GLOB TOLUA lua/*.lua)
add_custom_command (OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/toluabind.c
COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -o toluabind.c -H toluabind.h -n tolua tolua_scons.pkg
DEPENDS ${TOLUA} tolua_scons.pkg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating toluabind.c and toluabind.h")
endif ()
file (GLOB TOLUA lua/*.lua)
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.c
COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -o ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.c -H ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.h -n tolua tolua_scons.pkg || ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/toluabind.c ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.c
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.c ${CMAKE_CURRENT_SOURCE_DIR}/toluabind.c
DEPENDS ${TOLUA} tolua_scons.pkg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating toluabind.c and toluabind.h")
# Define source files
define_source_files (GLOB_CPP_PATTERNS *.c)
define_source_files (EXTRA_CPP_FILES tolua.c ${CMAKE_CURRENT_BINARY_DIR}/generated/toluabind.c)
# Define dependency libs
set (LIBS toluapp Lua${JIT})

View File

@ -44,7 +44,8 @@ endif ()
# Define generated source files
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/librevision.h)
execute_process (COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/librevision.h)
execute_process (COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_QUIET ERROR_QUIET)
endif ()
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/librevision.h
COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetUrho3DRevision.cmake