Added post-build custom command when setting up main executable to facilitate debugging and running the main executable within Xcode itself.
This commit is contained in:
Родитель
10b4fd2438
Коммит
d37cb04fd9
|
@ -381,14 +381,22 @@ macro (setup_main_executable)
|
|||
setup_executable ()
|
||||
endif ()
|
||||
|
||||
# Define a custom target to check for resource modification
|
||||
if (IOS)
|
||||
if (APPLE)
|
||||
get_target_property (TARGET_LOC ${TARGET_NAME} LOCATION)
|
||||
string (REGEX REPLACE "/Contents/MacOS" "" TARGET_LOC ${TARGET_LOC}) # The regex replacement is temporary workaround to correct the wrong location caused by CMake/Xcode generator bug
|
||||
add_custom_target (RESOURCE_CHECK_${TARGET_NAME} ALL
|
||||
\(\( `find ${RESOURCE_FILES} -newer ${TARGET_LOC} 2>/dev/null |wc -l` \)\) && touch -cm ${SOURCE_FILES} || exit 0
|
||||
COMMENT "This is a dummy target to check for changes in the Resource folders")
|
||||
add_dependencies (${TARGET_NAME} RESOURCE_CHECK_${TARGET_NAME})
|
||||
if (IOS)
|
||||
# Define a custom target to check for resource modification
|
||||
string (REGEX REPLACE "/Contents/MacOS" "" TARGET_LOC ${TARGET_LOC}) # The regex replacement is temporary workaround to correct the wrong location caused by CMake/Xcode generator bug
|
||||
add_custom_target (RESOURCE_CHECK_${TARGET_NAME} ALL
|
||||
\(\( `find ${RESOURCE_FILES} -newer ${TARGET_LOC} 2>/dev/null |wc -l` \)\) && touch -cm ${SOURCE_FILES} || exit 0
|
||||
COMMENT "This is a dummy target to check for changes in the Resource folders")
|
||||
add_dependencies (${TARGET_NAME} RESOURCE_CHECK_${TARGET_NAME})
|
||||
else ()
|
||||
# Create symbolic links to allow debugging/running the main executable within Xcode itself
|
||||
string (REGEX REPLACE "\\)/.*$" ")" TARGET_LOC ${TARGET_LOC})
|
||||
add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
|
||||
COMMAND for dir in CoreData Data\; do cmake -E create_symlink ../../../../Bin/$$dir ${TARGET_LOC}/$$dir\; done
|
||||
COMMENT "Create symbolic links to allow debugging/running the main executable within Xcode itself")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
|
|
|
@ -36,27 +36,16 @@ rm -rf {../build,.,build}/CMakeCache.txt {../build,.,build}/CMakeFiles
|
|||
cmake -E chdir Build cmake -G "Xcode" $SOURCE $@
|
||||
|
||||
# Below temporary fix may no longer be required by newer version of CMake
|
||||
sed -i.bak 's/lastKnownFileType = sourcecode; name = "as_callfunc_arm_xcode.S"/lastKnownFileType = sourcecode.asm; name = "as_callfunc_arm_xcode.S"/g' Build/Urho3D.xcodeproj/project.pbxproj
|
||||
sed -i.bak 's/lastKnownFileType = sourcecode; name = "as_callfunc_arm_xcode.S"/lastKnownFileType = sourcecode.asm; name = "as_callfunc_arm_xcode.S"/g' Build/*.xcodeproj/project.pbxproj
|
||||
|
||||
# Apple always uses OpenGL
|
||||
sed 's/OpenGL/Direct3D9/g' Docs/Doxyfile.in >Doxyfile
|
||||
|
||||
if [ $1 == "-DIOS=1" ]
|
||||
then
|
||||
if [ $1 == "-DIOS=1" ]; then
|
||||
# Due to a bug in the CMake/Xcode generator where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
|
||||
# below temporary fix is required in order to solve the auto-linking issue when dependent libraries is changed.
|
||||
sed -i.bak 's/\/Contents\/MacOS//g' Build/CMakeScripts/XCODE_DEPEND_HELPER.make
|
||||
echo -e "\tsed -i.bak 's/\/Contents\/MacOS//g' CMakeScripts/XCODE_DEPEND_HELPER.make" >> Build/CMakeScripts/ReRunCMake.make
|
||||
else
|
||||
# Create symbolic links in the respective Xcode configuration subdir to allow running Urho3D within the xcode itself
|
||||
mkdir -p Build/Tools/Urho3D
|
||||
cd Build/Tools/Urho3D
|
||||
for conf in Debug RelWithDebInfo Release; do
|
||||
if [ ! -d $conf ]; then mkdir $conf; fi
|
||||
for dir in CoreData Data; do
|
||||
cmake -E create_symlink ../../../../Bin/$dir $conf/$dir
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# vi: set ts=4 sw=4 expandtab:
|
||||
|
|
Загрузка…
Ссылка в новой задаче