|
|
@@ -1473,14 +1473,14 @@ macro (setup_executable)
|
|
|
# Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
|
|
|
if (NOT ARG_PRIVATE)
|
|
|
if (WEB AND DEST_BUNDLE_DIR)
|
|
|
- set (LOCATION $<TARGET_FILE_DIR:${TARGET_NAME}>)
|
|
|
- unset (FILES)
|
|
|
set (EXTS data html.map html.mem js wasm)
|
|
|
if (SELF_EXECUTABLE_SHELL)
|
|
|
install (PROGRAMS $<TARGET_FILE:${TARGET_NAME}> DESTINATION ${DEST_BUNDLE_DIR})
|
|
|
else ()
|
|
|
list (APPEND EXTS html)
|
|
|
endif ()
|
|
|
+ set (LOCATION $<TARGET_FILE_DIR:${TARGET_NAME}>)
|
|
|
+ unset (FILES)
|
|
|
foreach (EXT ${EXTS})
|
|
|
list (APPEND FILES ${LOCATION}/${TARGET_NAME}.${EXT})
|
|
|
endforeach ()
|
|
|
@@ -1650,7 +1650,55 @@ macro (setup_main_executable)
|
|
|
endif ()
|
|
|
setup_executable (${EXE_TYPE} ${ARG_UNPARSED_ARGUMENTS})
|
|
|
endif ()
|
|
|
- # Only need to install the resource directories once in case they are referenced by multiple targets
|
|
|
+ # Setup custom resource checker target
|
|
|
+ if ((EXE_TYPE STREQUAL MACOSX_BUNDLE OR URHO3D_PACKAGING) AND RESOURCE_DIRS)
|
|
|
+ if (URHO3D_PACKAGING)
|
|
|
+ # Urho3D project builds the PackageTool as required; downstream project uses PackageTool found in the Urho3D build tree or Urho3D SDK
|
|
|
+ find_Urho3d_tool (PACKAGE_TOOL PackageTool
|
|
|
+ HINTS ${CMAKE_BINARY_DIR}/bin/tool ${URHO3D_HOME}/bin/tool
|
|
|
+ DOC "Path to PackageTool" MSG_MODE WARNING)
|
|
|
+ if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
|
|
|
+ set (PACKAGING_DEP DEPENDS PackageTool)
|
|
|
+ endif ()
|
|
|
+ set (PACKAGING_COMMENT " and packaging")
|
|
|
+ endif ()
|
|
|
+ # Share a same custom target that checks for a same resource dirs list
|
|
|
+ foreach (DIR ${RESOURCE_DIRS})
|
|
|
+ string (MD5 MD5 ${DIR})
|
|
|
+ set (MD5ALL ${MD5ALL}${MD5})
|
|
|
+ if (CMAKE_HOST_WIN32)
|
|
|
+ # On Windows host, always assumes there are changes so resource dirs would be repackaged in each build, however, still make sure the *.pak timestamp is not altered unnecessarily
|
|
|
+ if (URHO3D_PACKAGING)
|
|
|
+ set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME}.new -c -q && ${CMAKE_COMMAND} -E copy_if_different ${RESOURCE_${DIR}_PATHNAME}.new ${RESOURCE_${DIR}_PATHNAME} && ${CMAKE_COMMAND} -E remove ${RESOURCE_${DIR}_PATHNAME}.new)
|
|
|
+ endif ()
|
|
|
+ list (APPEND COMMANDS COMMAND ${CMAKE_COMMAND} -E touch ${DIR} ${PACKAGING_COMMAND})
|
|
|
+ else ()
|
|
|
+ # On Unix-like hosts, detect the changes in the resource directory recursively so they are only repackaged and/or rebundled (Xcode only) as necessary
|
|
|
+ if (URHO3D_PACKAGING)
|
|
|
+ set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME} -c -q)
|
|
|
+ set (OUTPUT_COMMAND test -e ${RESOURCE_${DIR}_PATHNAME} || \( true ${PACKAGING_COMMAND} \))
|
|
|
+ else ()
|
|
|
+ set (OUTPUT_COMMAND true) # Nothing to output
|
|
|
+ endif ()
|
|
|
+ list (APPEND COMMANDS COMMAND echo Checking ${DIR}... && bash -c \"\(\( `find ${DIR} -newer ${DIR} |wc -l` \)\)\" && touch -cm ${DIR} ${PACKAGING_COMMAND} || ${OUTPUT_COMMAND})
|
|
|
+ endif ()
|
|
|
+ endforeach ()
|
|
|
+ string (MD5 MD5ALL ${MD5ALL})
|
|
|
+ # Ensure the resource check is done before building the main executable target
|
|
|
+ if (NOT RESOURCE_CHECK_${MD5ALL})
|
|
|
+ set (RESOURCE_CHECK RESOURCE_CHECK)
|
|
|
+ while (TARGET ${RESOURCE_CHECK})
|
|
|
+ string (RANDOM RANDOM)
|
|
|
+ set (RESOURCE_CHECK RESOURCE_CHECK_${RANDOM})
|
|
|
+ endwhile ()
|
|
|
+ set (RESOURCE_CHECK_${MD5ALL} ${RESOURCE_CHECK} CACHE INTERNAL "Resource check hash map")
|
|
|
+ endif ()
|
|
|
+ if (NOT TARGET ${RESOURCE_CHECK_${MD5ALL}})
|
|
|
+ add_custom_target (${RESOURCE_CHECK_${MD5ALL}} ALL ${COMMANDS} ${PACKAGING_DEP} COMMENT "Checking${PACKAGING_COMMENT} resource directories")
|
|
|
+ endif ()
|
|
|
+ add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
|
|
|
+ endif ()
|
|
|
+ # Only need to install the resource directories once in case they are referenced by multiple targets
|
|
|
if (RESOURCE_DIRS AND DEST_SHARE_DIR)
|
|
|
foreach (DIR ${RESOURCE_DIRS})
|
|
|
list (FIND INSTALLED_RESOURCE_DIRS ${DIR} FOUND_INDEX)
|
|
|
@@ -1748,54 +1796,6 @@ macro (_setup_target)
|
|
|
set_target_properties (${TARGET_NAME} PROPERTIES ${TARGET_PROPERTIES})
|
|
|
unset (TARGET_PROPERTIES)
|
|
|
endif ()
|
|
|
- # Setup custom resource checker target
|
|
|
- if ((EXE_TYPE STREQUAL MACOSX_BUNDLE OR URHO3D_PACKAGING) AND RESOURCE_DIRS)
|
|
|
- if (URHO3D_PACKAGING)
|
|
|
- # Urho3D project builds the PackageTool as required; downstream project uses PackageTool found in the Urho3D build tree or Urho3D SDK
|
|
|
- find_Urho3d_tool (PACKAGE_TOOL PackageTool
|
|
|
- HINTS ${CMAKE_BINARY_DIR}/bin/tool ${URHO3D_HOME}/bin/tool
|
|
|
- DOC "Path to PackageTool" MSG_MODE WARNING)
|
|
|
- if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
|
|
|
- set (PACKAGING_DEP DEPENDS PackageTool)
|
|
|
- endif ()
|
|
|
- set (PACKAGING_COMMENT " and packaging")
|
|
|
- endif ()
|
|
|
- # Share a same custom target that checks for a same resource dirs list
|
|
|
- foreach (DIR ${RESOURCE_DIRS})
|
|
|
- string (MD5 MD5 ${DIR})
|
|
|
- set (MD5ALL ${MD5ALL}${MD5})
|
|
|
- if (CMAKE_HOST_WIN32)
|
|
|
- # On Windows host, always assumes there are changes so resource dirs would be repackaged in each build, however, still make sure the *.pak timestamp is not altered unnecessarily
|
|
|
- if (URHO3D_PACKAGING)
|
|
|
- set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME}.new -c -q && ${CMAKE_COMMAND} -E copy_if_different ${RESOURCE_${DIR}_PATHNAME}.new ${RESOURCE_${DIR}_PATHNAME} && ${CMAKE_COMMAND} -E remove ${RESOURCE_${DIR}_PATHNAME}.new)
|
|
|
- endif ()
|
|
|
- list (APPEND COMMANDS COMMAND ${CMAKE_COMMAND} -E touch ${DIR} ${PACKAGING_COMMAND})
|
|
|
- else ()
|
|
|
- # On Unix-like hosts, detect the changes in the resource directory recursively so they are only repackaged and/or rebundled (Xcode only) as necessary
|
|
|
- if (URHO3D_PACKAGING)
|
|
|
- set (PACKAGING_COMMAND && echo Packaging ${DIR}... && ${PACKAGE_TOOL} ${DIR} ${RESOURCE_${DIR}_PATHNAME} -c -q)
|
|
|
- set (OUTPUT_COMMAND test -e ${RESOURCE_${DIR}_PATHNAME} || \( true ${PACKAGING_COMMAND} \))
|
|
|
- else ()
|
|
|
- set (OUTPUT_COMMAND true) # Nothing to output
|
|
|
- endif ()
|
|
|
- list (APPEND COMMANDS COMMAND echo Checking ${DIR}... && bash -c \"\(\( `find ${DIR} -newer ${DIR} |wc -l` \)\)\" && touch -cm ${DIR} ${PACKAGING_COMMAND} || ${OUTPUT_COMMAND})
|
|
|
- endif ()
|
|
|
- endforeach ()
|
|
|
- string (MD5 MD5ALL ${MD5ALL})
|
|
|
- # Ensure the resource check is done before building the main executable target
|
|
|
- if (NOT RESOURCE_CHECK_${MD5ALL})
|
|
|
- set (RESOURCE_CHECK RESOURCE_CHECK)
|
|
|
- while (TARGET ${RESOURCE_CHECK})
|
|
|
- string (RANDOM RANDOM)
|
|
|
- set (RESOURCE_CHECK RESOURCE_CHECK_${RANDOM})
|
|
|
- endwhile ()
|
|
|
- set (RESOURCE_CHECK_${MD5ALL} ${RESOURCE_CHECK} CACHE INTERNAL "Resource check hash map")
|
|
|
- endif ()
|
|
|
- if (NOT TARGET ${RESOURCE_CHECK_${MD5ALL}})
|
|
|
- add_custom_target (${RESOURCE_CHECK_${MD5ALL}} ALL ${COMMANDS} ${PACKAGING_DEP} COMMENT "Checking${PACKAGING_COMMENT} resource directories")
|
|
|
- endif ()
|
|
|
- add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
|
|
|
- endif ()
|
|
|
# Create symbolic links in the build tree
|
|
|
if (ANDROID)
|
|
|
foreach (I AndroidManifest.xml build.xml custom_rules.xml project.properties src res assets jni)
|