# OSX Stuff # Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4 # and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support. IF(APPLE) # These are just defaults/recommendations, but how we want to build # out of the box. But the user needs to be able to change these options. # So we must only set the values the first time CMake is run, or we # will overwrite any changes the user sets. # FORCE is used because the options are not reflected in the UI otherwise. # Seems like a good place to add version specific compiler flags too. IF(NOT OSGEARTH_CONFIG_HAS_BEEN_RUN_BEFORE) # This is really fragile, but CMake doesn't provide the OS system # version information we need. (Darwin versions can be changed # independently of OS X versions.) # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically. IF(EXISTS /Developer/SDKs/10.5.sdk) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) ELSE(EXISTS /Developer/SDKs/10.5.sdk) IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) # No Universal Binary support # Should break down further to set the -mmacosx-version-min, # but the SDK detection is too unreliable here. ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) ENDIF(EXISTS /Developer/SDKs/10.5.sdk) ENDIF(NOT OSGEARTH_CONFIG_HAS_BEEN_RUN_BEFORE) OPTION(OSGEARTH_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF) OPTION(OSGEARTH_BUILD_FRAMEWORKS "Compile frameworks instead of dylibs" OFF) SET(OSGEARTH_BUILD_FRAMEWORKS_INSTALL_NAME_DIR "@executable_path/../Frameworks" CACHE STRING "Install name dir for compiled frameworks") # MacOS required this in order to find the protobuf_generate_cpp function: set(OSGEARTH_PROTOBUF_FORCE_CONFIG_MODE ON) ENDIF()