Prefer static libs from Externals on OS X.

Several people had trouble building against systemwide installed libs.
And even if the build succeeds, the resulting bundle would not work on
other Macs.
This commit is contained in:
Maarten ter Huurne 2011-12-19 00:54:45 +01:00
parent 4ecb48eaf8
commit 6f27a29d51

View File

@ -288,7 +288,7 @@ else()
endif() endif()
if(X11_FOUND) if(X11_FOUND)
check_lib(XRANDR Xrandr) check_lib(XRANDR Xrandr)
endif() endif()
if(XRANDR_FOUND) if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1) add_definitions(-DHAVE_XRANDR=1)
@ -358,23 +358,27 @@ include_directories(Source/Core/VideoUICommon/Src)
add_subdirectory(Externals/Bochs_disasm) add_subdirectory(Externals/Bochs_disasm)
include_directories(Externals/Bochs_disasm) include_directories(Externals/Bochs_disasm)
check_lib(LZO lzo2 lzo/lzo1x.h QUIET) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
endif()
if(LZO_FOUND) if(LZO_FOUND)
message("Using shared lzo") message("Using shared lzo")
else() else()
message("Shared lzo not found, falling back to the static library") message("Using static lzo from Externals")
add_subdirectory(Externals/LZO) add_subdirectory(Externals/LZO)
include_directories(Externals/LZO) include_directories(Externals/LZO)
set(LZO lzo2) set(LZO lzo2)
endif() endif()
include(FindSDL OPTIONAL) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(FindSDL OPTIONAL)
endif()
if(SDL_FOUND) if(SDL_FOUND)
message("Using shared SDL") message("Using shared SDL")
include_directories(${SDL_INCLUDE_DIR}) include_directories(${SDL_INCLUDE_DIR})
else(SDL_FOUND) else(SDL_FOUND)
# TODO: Use the prebuilt one on Windows # TODO: Use the prebuilt one on Windows
message("Shared SDL not found, falling back to the static library") message("Using static SDL from Externals")
include_directories(Externals/SDL Externals/SDL/include) include_directories(Externals/SDL Externals/SDL/include)
add_subdirectory(Externals/SDL) add_subdirectory(Externals/SDL)
endif(SDL_FOUND) endif(SDL_FOUND)
@ -382,20 +386,24 @@ endif(SDL_FOUND)
set(SFML_FIND_VERSION TRUE) set(SFML_FIND_VERSION TRUE)
set(SFML_FIND_VERSION_MAJOR 1) set(SFML_FIND_VERSION_MAJOR 1)
set(SFML_FIND_VERSION_MINOR 5) set(SFML_FIND_VERSION_MINOR 5)
include(FindSFML OPTIONAL) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(FindSFML OPTIONAL)
endif()
if(SFML_FOUND AND NOT SFML_VERSION_MAJOR) # SFML 1.x doesn't define SFML_VERSION_MAJOR if(SFML_FOUND AND NOT SFML_VERSION_MAJOR) # SFML 1.x doesn't define SFML_VERSION_MAJOR
message("Using shared SFML") message("Using shared SFML")
else() else()
message("Shared SFML < 2.0 not found, falling back to the static library") message("Using static SFML ${SFML_FIND_VERSION_MAJOR}.${SFML_FIND_VERSION_MINOR} from Externals")
add_subdirectory(Externals/SFML) add_subdirectory(Externals/SFML)
include_directories(Externals/SFML/include) include_directories(Externals/SFML/include)
endif() endif()
check_lib(SOIL SOIL SOIL/SOIL.h QUIET) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
endif()
if(SOIL_FOUND) if(SOIL_FOUND)
message("Using shared SOIL") message("Using shared SOIL")
else() else()
message("Shared SOIL not found, falling back to the static library") message("Using static SOIL from Externals")
add_subdirectory(Externals/SOIL) add_subdirectory(Externals/SOIL)
include_directories(Externals/SOIL) include_directories(Externals/SOIL)
endif() endif()
@ -419,16 +427,20 @@ if(WIN32)
find_library(GLEW glew32s PATHS Externals/GLew) find_library(GLEW glew32s PATHS Externals/GLew)
include_directories(Externals/GLew/include) include_directories(Externals/GLew/include)
else() else()
check_lib(GLEW GLEW GL/glew.h) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
check_lib(GLEW GLEW GL/glew.h)
endif()
if(NOT GLEW_FOUND) if(NOT GLEW_FOUND)
message("Shared GLEW not found, falling back to the static library") message("Using static GLEW from Externals")
add_subdirectory(Externals/GLew) add_subdirectory(Externals/GLew)
include_directories(Externals/GLew/include) include_directories(Externals/GLew/include)
endif(NOT GLEW_FOUND) endif(NOT GLEW_FOUND)
check_lib(CG Cg Cg/cg.h) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
check_lib(CG Cg Cg/cg.h)
endif()
if(NOT CG_FOUND) if(NOT CG_FOUND)
message("Shared Cg not found, falling back to the static library") message("Using static Cg from Externals")
include_directories(Externals) include_directories(Externals)
endif(NOT CG_FOUND) endif(NOT CG_FOUND)
check_lib(CGGL CgGL Cg/cgGL.h) check_lib(CGGL CgGL Cg/cgGL.h)
@ -444,8 +456,10 @@ endif()
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF) option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
if(NOT DISABLE_WX) if(NOT DISABLE_WX)
include(FindwxWidgets OPTIONAL) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv) include(FindwxWidgets OPTIONAL)
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
endif()
if(wxWidgets_FOUND) if(wxWidgets_FOUND)
EXECUTE_PROCESS( EXECUTE_PROCESS(
@ -491,7 +505,7 @@ if(NOT DISABLE_WX)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
message(FATAL_ERROR "wxWidgets not found. It is required to build the GUI") message(FATAL_ERROR "wxWidgets not found. It is required to build the GUI")
endif() endif()
message("Shared wxWidgets not found, falling back to the static library") message("Using static wxWidgets from Externals")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-D__WXOSX_COCOA__) add_definitions(-D__WXOSX_COCOA__)
include_directories(Externals/wxWidgets3) include_directories(Externals/wxWidgets3)