Skip to content
Permalink
Browse files

Merge pull request #1435 from comex/osx-build

OS X CMake improvements
  • Loading branch information...
comex committed Nov 14, 2014
2 parents 8c26b02 + efb2f36 commit 68c5758151f696c36b5184ef8bf541bacb68140f
Showing with 21 additions and 5 deletions.
  1. +16 −4 CMakeLists.txt
  2. +5 −1 Source/UnitTests/CMakeLists.txt
@@ -11,6 +11,9 @@ option(ENABLE_QT "Enable Qt (use the experimental Qt interface)" OFF)
option(ENABLE_PCH "Use PCH to speed up compilation" ON)
option(ENABLE_LTO "Enables Link Time Optimization" OFF)
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
if(APPLE)
option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF)
endif()

option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)

@@ -219,10 +222,18 @@ if(ENABLE_LTO)
endif()

if(APPLE)
# Ignore MacPorts and Fink and any other locally installed packages that
# might prevent building a distributable binary.
set(CMAKE_SYSTEM_PREFIX_PATH /usr)
set(ENV{PATH} /usr/bin:/bin:/usr/sbin:/sbin)
if(NOT OSX_USE_DEFAULT_SEARCH_PATH)
# Hack up the path to prioritize the path to built-in OS libraries to
# increase the chance of not depending on a bunch of copies of them
# installed by MacPorts, Fink, Homebrew, etc, and ending up copying
# them into the bundle. Since we optionally depend on libraries which
# are not part of OS X (ffmpeg, libusb, etc.), however, don't remove
# the default path entirely as was done in a previous version of this
# file. This is still kinda evil, since it defeats the user's path
# settings...
# See http://www.cmake.org/cmake/help/v3.0/command/find_program.html
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr")
endif()

# Some of our code contains Objective C constructs.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
@@ -278,6 +289,7 @@ if(APPLE)
find_library(COREAUDIO_LIBRARY CoreAudio)
find_library(COREFUND_LIBRARY CoreFoundation)
find_library(CORESERV_LIBRARY CoreServices)
find_library(FOUNDATION_LIBRARY foundation)
find_library(IOB_LIBRARY IOBluetooth)
find_library(IOK_LIBRARY IOKit)
find_library(QUICKTIME_LIBRARY QuickTime)
@@ -1,3 +1,7 @@
set(LIBS core gtest)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND LIBS ${FOUNDATION_LIBRARY} ${CORESERV_LIBRARY})
endif()
macro(add_dolphin_test target srcs)
# Since this is a Core dependency, it can't be linked as a library and has
# to be linked as an object file. Otherwise CMake inserts the library after
@@ -9,7 +13,7 @@ macro(add_dolphin_test target srcs)
add_custom_command(TARGET Test_${target}
PRE_LINK
COMMAND mkdir -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests)
target_link_libraries(Test_${target} core gtest)
target_link_libraries(Test_${target} ${LIBS})
add_dependencies(unittests Test_${target})
add_test(NAME ${target} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests/${target})
endmacro(add_dolphin_test)

0 comments on commit 68c5758

Please sign in to comment.
You can’t perform that action at this time.