XCode doesnt support files per configuration, using the old method (#3789)
- some warn fixes - fixed release linking issue Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
+37
-21
@@ -330,28 +330,44 @@ function(ly_add_target)
|
||||
set(runtime_dependencies_list SHARED MODULE EXECUTABLE APPLICATION)
|
||||
if(NOT ly_add_target_IMPORTED AND linking_options IN_LIST runtime_dependencies_list)
|
||||
|
||||
# the stamp file will be the one that triggers the execution of the custom rule. At the end
|
||||
# of running the copy of runtime dependencies, the stamp file is touched so the timestamp is updated.
|
||||
# Adding a config as part of the name since the stamp file is added to the VS project.
|
||||
# Note the STAMP_OUTPUT_FILE need to match with the one used in runtime dependencies (e.g. RuntimeDependencies_common.cmake)
|
||||
set(STAMP_OUTPUT_FILE ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${ly_add_target_NAME}_$<CONFIG>.stamp)
|
||||
add_custom_command(
|
||||
OUTPUT ${STAMP_OUTPUT_FILE}
|
||||
DEPENDS "$<GENEX_EVAL:$<TARGET_PROPERTY:${ly_add_target_NAME},RUNTIME_DEPENDENCIES_DEPENDS>>"
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${ly_add_target_NAME}.cmake
|
||||
COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..."
|
||||
VERBATIM
|
||||
)
|
||||
# XCode generator doesnt support different source files per configuration, so we cannot have
|
||||
# the runtime dependencies using file-tracking, instead, we will have them as a post build step
|
||||
if(CMAKE_GENERATOR MATCHES Xcode)
|
||||
|
||||
add_custom_command(TARGET ${ly_add_target_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${ly_add_target_NAME}.cmake
|
||||
COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..."
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/runtime_dependencies/${ly_add_target_NAME}.cmake
|
||||
COMMENT "Copying runtime dependencies..."
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Unfortunately the VS generator cannot deal with generation expressions as part of the file name, wrapping the
|
||||
# stamp file on each configuration so it gets properly excluded by the generator
|
||||
unset(stamp_files_per_config)
|
||||
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
|
||||
set(stamp_file_conf ${CMAKE_BINARY_DIR}/runtime_dependencies/${conf}/${ly_add_target_NAME}_${conf}.stamp)
|
||||
set_source_files_properties(${stamp_file_conf} PROPERTIES GENERATED TRUE SKIP_AUTOGEN TRUE)
|
||||
list(APPEND stamp_files_per_config $<$<CONFIG:${conf}>:${stamp_file_conf}>)
|
||||
endforeach()
|
||||
target_sources(${ly_add_target_NAME} PRIVATE ${stamp_files_per_config})
|
||||
else()
|
||||
|
||||
# the stamp file will be the one that triggers the execution of the custom rule. At the end
|
||||
# of running the copy of runtime dependencies, the stamp file is touched so the timestamp is updated.
|
||||
# Adding a config as part of the name since the stamp file is added to the VS project.
|
||||
# Note the STAMP_OUTPUT_FILE need to match with the one used in runtime dependencies (e.g. RuntimeDependencies_common.cmake)
|
||||
set(STAMP_OUTPUT_FILE ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${ly_add_target_NAME}_$<CONFIG>.stamp)
|
||||
add_custom_command(
|
||||
OUTPUT ${STAMP_OUTPUT_FILE}
|
||||
DEPENDS "$<GENEX_EVAL:$<TARGET_PROPERTY:${ly_add_target_NAME},RUNTIME_DEPENDENCIES_DEPENDS>>"
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${ly_add_target_NAME}.cmake
|
||||
COMMENT "Copying ${ly_add_target_NAME} runtime dependencies to output..."
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Unfortunately the VS generator cannot deal with generation expressions as part of the file name, wrapping the
|
||||
# stamp file on each configuration so it gets properly excluded by the generator
|
||||
unset(stamp_files_per_config)
|
||||
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
|
||||
set(stamp_file_conf ${CMAKE_BINARY_DIR}/runtime_dependencies/${conf}/${ly_add_target_NAME}_${conf}.stamp)
|
||||
set_source_files_properties(${stamp_file_conf} PROPERTIES GENERATED TRUE SKIP_AUTOGEN TRUE)
|
||||
list(APPEND stamp_files_per_config $<$<CONFIG:${conf}>:${stamp_file_conf}>)
|
||||
endforeach()
|
||||
target_sources(${ly_add_target_NAME} PRIVATE ${stamp_files_per_config})
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user