Fixed static and shared library build using Xcode.
This commit is contained in:
Родитель
2b024be205
Коммит
a01faa3ef2
|
@ -51,17 +51,19 @@ foreach (TARGET ${STATIC_LIBRARY_TARGETS})
|
|||
get_filename_component (INT_DIR ${INT_DIR} PATH)
|
||||
if (MSVC)
|
||||
string (REPLACE /$(Configuration) "" INT_DIR ${INT_DIR})
|
||||
elseif (XCODE)
|
||||
string (REPLACE /$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) "" INT_DIR ${INT_DIR})
|
||||
endif ()
|
||||
set (INT_DIR ${INT_DIR}/CMakeFiles/${TARGET}.dir)
|
||||
|
||||
foreach (SOURCE ${SOURCES})
|
||||
get_filename_component (NAME ${SOURCE} NAME)
|
||||
if (NAME MATCHES \\.c.*$)
|
||||
if (MSVC)
|
||||
string (REGEX REPLACE \\.c.*$ "" NAME ${NAME})
|
||||
if (NAME MATCHES \\.c.*$|\\.m$)
|
||||
if (MSVC OR XCODE)
|
||||
string (REGEX REPLACE \\.c.*$|\\.m$ "" NAME ${NAME})
|
||||
endif ()
|
||||
set (SYS_DIR "")
|
||||
if (NOT MSVC)
|
||||
if (NOT MSVC AND NOT XCODE)
|
||||
get_filename_component (PATH ${SOURCE} PATH)
|
||||
foreach (DIR OpenGL Direct3D9 source src generated)
|
||||
if (PATH MATCHES /${DIR}$)
|
||||
|
|
|
@ -4,14 +4,14 @@ set (TARGET_NAME SDL)
|
|||
# Define source files
|
||||
file (GLOB C_FILES
|
||||
src/*.c src/atomic/*.c src/audio/*.c src/audio/disk/*.c src/audio/dummy/*.c src/cpuinfo/*.c src/events/*.c src/file/*.c
|
||||
src/haptic/*.c src/joystick/*.c src/joystick/dummy/*.c src/libm/*.c src/power/*.c src/stdlib/*.c
|
||||
src/haptic/*.c src/joystick/*.c src/libm/*.c src/power/*.c src/stdlib/*.c
|
||||
src/thread/*.c src/timer/*.c src/video/*.c src/video/dummy/*.c
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
file (GLOB SYS_C_FILES
|
||||
src/audio/directsound/*.c src/haptic/windows/*.c src/joystick/windows/*.c src/core/windows/*.c src/loadso/windows/*.c
|
||||
src/power/windows/*.c src/thread/windows/*.c src/thread/generic/SDL_syscond.c src/timer/windows/*.c src/video/windows/*.c
|
||||
src/power/windows/*.c src/thread/windows/*.c src/thread/generic/SDL_syscond.c src/timer/windows/*.c src/video/windows/*.c src/joystick/dummy/*.c
|
||||
)
|
||||
CHECK_INCLUDE_FILES (wbemcli.h HAVE_WBEMCLI_H)
|
||||
if (HAVE_WBEMCLI_H)
|
||||
|
@ -26,7 +26,7 @@ if (WIN32)
|
|||
elseif (IOS)
|
||||
file (GLOB SYS_C_FILES
|
||||
src/audio/coreaudio/*.c src/file/cocoa/*.m src/joystick/iphoneos/*.m src/loadso/dlopen/*.c src/power/uikit/*.m
|
||||
src/thread/pthread/*.c src/timer/unix/*.c src/video/uikit/*.m src/video/uikit/*.c src/haptic/dummy/*.c
|
||||
src/thread/pthread/*.c src/timer/unix/*.c src/video/uikit/*.m src/video/uikit/*.c src/haptic/dummy/*.c src/joystick/dummy/*.c
|
||||
)
|
||||
elseif (APPLE)
|
||||
file (GLOB SYS_C_FILES
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release" CACHE STRING "Configurations" FORCE)
|
||||
|
||||
# Set the build type if not explicitly set, for single-configuration generator only
|
||||
if (NOT MSVC AND NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_BUILD_TYPE)
|
||||
if (CMAKE_GENERATOR STREQUAL Xcode)
|
||||
set (XCODE TRUE)
|
||||
endif ()
|
||||
if (NOT MSVC AND NOT XCODE AND NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
endif ()
|
||||
|
||||
|
@ -97,7 +100,7 @@ if (IOS)
|
|||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
|
||||
set (MACOSX_BUNDLE_GUI_IDENTIFIER "com.googlecode.urho3d")
|
||||
set (CMAKE_OSX_SYSROOT "iphoneos") # Set to "Latest iOS"
|
||||
elseif (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
elseif (XCODE)
|
||||
# MacOSX-Xcode-specific setup
|
||||
if (NOT ENABLE_64BIT)
|
||||
set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
|
||||
|
@ -276,12 +279,18 @@ macro (setup_library)
|
|||
set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS URHO3D_STATIC_DEFINE)
|
||||
endif ()
|
||||
|
||||
# Specific to VS generator
|
||||
if (MSVC)
|
||||
# Specific to VS generator
|
||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir)
|
||||
add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
|
||||
COMMAND copy /B \"$(ProjectDir)$(IntDir)*.obj\" \"$(ProjectDir)CMakeFiles\\${TARGET_NAME}.dir\"
|
||||
COMMENT "Copying object files to a common location also used by Makefile generator")
|
||||
elseif (XCODE)
|
||||
# Specific to Xcode generator
|
||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir)
|
||||
add_custom_command (TARGET ${TARGET_NAME} PRE_LINK
|
||||
COMMAND cp -p "$(OBJECT_FILE_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/*.o" ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir
|
||||
COMMENT "Copying object files to a common location also used by Makefile generator")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
|
|
@ -27,6 +27,7 @@ then
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче