1
0
mirror of https://github.com/dolphin-emu/dolphin synced 2024-07-08 20:25:52 +00:00

Applied compile and link flags from SCons build for OS X to CMake build.

The following changes were made:
Restricted the "-march=core2" option to i386 because the first Intel Macs
had Intel Core CPUs, not Core2.
Removed the "-mdynamic-no-pic" flag as GCC lists it as a PPC specific flag.
Removed "-Wl,-read_only_relocs,suppress" because it seems to be related
to "-mdynamic-no-pic" and I see no need for it.
Removed "-Wextra-tokens -Wnewline-eof" because they are GCC specific and
not OS X specific.
This commit is contained in:
Maarten ter Huurne 2011-12-11 21:27:06 +01:00
parent 9ede977a56
commit 344ca5d360
2 changed files with 37 additions and 2 deletions

View File

@ -113,9 +113,44 @@ if (APPLE)
# might prevent building a distributable binary.
set(CMAKE_SYSTEM_PREFIX_PATH /usr)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++")
# Some of our code contains Objective C constructs.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++")
# Avoid mistaking an object file for a source file on the link command line.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
# Identify the target system:
# Ask for 32/64-bit fat binary.
set(TARGET_FLAGS "-arch x86_64 -arch i386")
# Minimum OS X version.
# This is inserted into the Info.plist as well.
# Note that the SDK determines the maximum version of which optional
# features can be used, not the minimum required version to run.
set(OSX_MIN_VERSION "10.5.4")
set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}")
set(TARGET_FLAGS "${TARGET_FLAGS} -isysroot /Developer/SDKs/MacOSX10.6.sdk")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk")
# Specify target CPUs.
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_i386 -msse3")
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_i386 -march=prescott")
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -mssse3")
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -march=core2")
message("target flags: ${TARGET_FLAGS}")
# Target flags apply to both C and C++ compilation.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_FLAGS}")
# TODO: It seems that CMake passes compile flags to the linker anyway.
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TARGET_FLAGS}")
message("C++ flags: ${CMAKE_CXX_FLAGS}")
# Linker flags.
# Drop unreachable code and data.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs")
# Reserve the minimum size for the zero page.
# Our JIT requires virtual memory space below 2GB, while the default zero
# page on x86_64 is 4GB in size.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pagezero_size,0x1000")
find_library(APPKIT_LIBRARY AppKit)
find_library(APPSERV_LIBRARY ApplicationServices)
find_library(ATB_LIBRARY AudioToolbox)

View File

@ -54,7 +54,7 @@
<key>NSHumanReadableCopyright</key>
<string>Licensed under GPL version 2</string>
<key>LSMinimumSystemVersion</key>
<string>10.5.4</string>
<string>${OSX_MIN_VERSION}</string>
<key>LSRequiresCarbon</key>
<true/>
<key>CSResourcesFileMapped</key>