Change OSX build system to be homebrew-based

This commit is contained in:
Marianne Gagnon 2018-06-05 19:56:15 -04:00
parent 5e798ad6d4
commit cb8f519bd9
3 changed files with 20 additions and 53 deletions

View File

@ -28,6 +28,14 @@ option(USE_SYSTEM_GLEW "Use system GLEW instead of the built-in version, when av
CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON
"NOT SERVER_ONLY;NOT APPLE" OFF)
if(APPLE)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt)
include_directories(/usr/local/opt/fribidi/include/)
include_directories(/usr/local/opt/openssl@1.1/include/)
include_directories(/usr/local/opt/openssl@1.1/include/openssl/)
include_directories(/usr/local/opt/freetype/include/freetype2/)
endif()
if((UNIX AND NOT APPLE) AND NOT SERVER_ONLY)
option(ENABLE_WAYLAND_DEVICE "Enable Wayland device for linux build" ON)
@ -150,7 +158,13 @@ else()
endif()
# Find system GLEW library or build it if missing
if(NOT USE_GLES2 AND NOT SERVER_ONLY)
if (APPLE)
find_package(glew)
if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
endif()
elseif(NOT USE_GLES2 AND NOT SERVER_ONLY)
add_definitions(-DGLEW_NO_GLU)
if((UNIX AND NOT APPLE) AND USE_SYSTEM_GLEW)
find_package(PkgConfig)
@ -284,29 +298,12 @@ else()
endif()
# OpenAL
if(APPLE)
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
# CMake pick the library it wants essentially means I can't build.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework OpenAL")
set(OPENAL_LIBRARY)
else()
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
endif()
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
# OggVorbis
if(APPLE)
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
# CMake pick the library it wants essentially means I can't build.
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -I/Library/Frameworks/Ogg.framework/Versions/A/Headers -I/Library/Frameworks/Vorbis.framework/Versions/A/Headers")
else()
find_package(OggVorbis REQUIRED)
include_directories(${OGGVORBIS_INCLUDE_DIRS})
endif()
find_package(OggVorbis REQUIRED)
include_directories(${OGGVORBIS_INCLUDE_DIRS})
# Freetype
find_package(Freetype)
@ -525,15 +522,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
endif()
if(APPLE)
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
# CMake pick the library it wants essentially means I can't build.
set_target_properties(supertuxkart PROPERTIES LINK_FLAGS "-arch x86_64 -F/Library/Frameworks -framework OpenAL -framework Ogg -framework Vorbis")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/Library/Frameworks/OpenAL.framework/Versions/A/Headers")
endif()
if(USE_FRIBIDI)
target_link_libraries(supertuxkart ${FRIBIDI_LIBRARIES})
add_definitions(-DENABLE_BIDI)

View File

@ -9,14 +9,7 @@
# FRIBIDI_LIBRARIES
# Fribidi library list
if(APPLE)
set(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h PATHS /Library/Frameworks/fribidi.framework/Headers)
find_library(FRIBIDI_LIBRARY NAMES fribidi PATHS /Library/Frameworks/fribidi.framework)
set(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
include_directories(/Library/Frameworks/fribidi.framework/Headers)
#add_definitions(-framework fribidi)
set(FRIBIDI_FOUND 1)
elseif(UNIX)
if(UNIX)
include(FindPkgConfig)
pkg_check_modules(FRIBIDI fribidi)
else()

View File

@ -17,20 +17,6 @@ find_library(OGGVORBIS_VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${PRO
find_library(OGGVORBIS_VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
find_library(OGGVORBIS_VORBISENC_LIBRARY NAMES vorbisenc libvorbisenc PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
if (APPLE)
set(OGGVORBIS_OGG_INCLUDE_DIR "/Library/Frameworks/Ogg.framework/Headers/")
set(OGGVORBIS_VORBIS_INCLUDE_DIR "/Library/Frameworks/Vorbis.framework/Headers/")
endif()
if(APPLE AND NOT OGGVORBIS_VORBISFILE_LIBRARY)
# Seems to be the same on Apple systems
set(OGGVORBIS_VORBISFILE_LIBRARY ${OGGVORBIS_VORBIS_LIBRARY})
endif()
if(APPLE AND NOT OGGVORBIS_VORBISENC_LIBRARY)
# Seems to be the same on Apple systems
set(OGGVORBIS_VORBISENC_LIBRARY ${OGGVORBIS_VORBIS_LIBRARY})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OggVorbis DEFAULT_MSG