cmake osx updates

This commit is contained in:
Jacker 2019-11-02 23:23:33 +02:00
parent 4af62c84eb
commit 2221972d84

View file

@ -4,7 +4,7 @@ include(CheckIncludeFile)
set(LIBS_BINARYDIR_DIR ${PROJECT_BINARY_DIR}/libs)
set(LIBS_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads)
# note/FIXME/clarify:
# note/FIXME/clarify:
# when features are disabled this script is still
# adding the related targets? F.e. LUA_FEATURE is Off and BUNDLED_LUA On
# see usage of BUNDLED_LUA below (BUNDLED_OPENSSL, BUNDLED OPENAL ...)
@ -38,13 +38,13 @@ if(WIN32)
if(NOT NASM_EXECUTABLE)
message(FATAL_ERROR "NASM not found")
endif()
# FIXME: there is no findPerl cmake script in project?! (at least for *NIX)
FIND_PACKAGE(perl REQUIRED)
if(NOT PERL_FOUND)
message(FATAL_ERROR "Perl not found")
endif()
if(WIN32)
if(64BITS)
set(openssl_plat VC-WIN64)
@ -195,7 +195,7 @@ if(WIN32)
else(VSTUDIO)
set(CURL_BUNDLED_LIBRARY "${binary_dir}/libcurl${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif(VSTUDIO)
# -DHTTP_ONLY=1
ExternalProject_Add(bundled_curl
DEPENDS bundled_openssl
@ -413,7 +413,7 @@ elseif(UNIX)
if(CROSS_COMPILE32)
if(APPLE)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=10.7\ -O3\ -m32 LDFLAGS=-mmacosx-version-min=10.7\ -m32)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -m32 LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -m32)
else()
set(CROSS_COMPILE32_FLAGS CFLAGS=-m32 LDFLAGS=-m32)
endif()
@ -424,7 +424,7 @@ elseif(UNIX)
# notes: - cflag -mcmodel=large might be an option too
# - this has to be done in all dependant CMakeLists-txt files see glew/CMakeLists.txt
if(APPLE)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=10.7\ -O3\ -fPIC LDFLAGS=-mmacosx-version-min=10.7)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -fPIC LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
set(CROSS_COMPILE32_FLAGS "CFLAGS=-fPIC")
endif()
@ -465,9 +465,9 @@ elseif(UNIX)
# also generates libcrypto.a
set(OPENSSL_BUNDLED_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libs/openssl/lib/libssl.a")
set(OPENSSL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/openssl/include")
endif()
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
@ -563,9 +563,14 @@ elseif(UNIX)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lua/src
)
else()
if(CROSS_COMPILE32)
set(LUA_BUILD CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -m32\ -DLUA_USE_MACOSX LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -m32)
else()
set(LUA_BUILD CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -DLUA_USE_MACOSX LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/lua/src/liblua.a
COMMAND make clean || true
COMMAND make ${LUA_MAKE_TARGET} CFLAGS=-mmacosx-version-min=10.7\ -O3\ -m32\ -DLUA_USE_MACOSX LDFLAGS=-mmacosx-version-min=10.7\ -m32
COMMAND make ${LUA_MAKE_TARGET} ${LUA_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lua/src
)
endif()
@ -634,7 +639,7 @@ elseif(UNIX)
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/openal
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.7" -DLIBTYPE=STATIC
-DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}" -DLIBTYPE=STATIC
-DALSOFT_UTILS=0 -DALSOFT_NO_CONFIG_UTIL=1 -DALSOFT_EXAMPLES=0 -DALSOFT_TESTS=0
-DALSOFT_CONFIG=0 -DALSOFT_HRTF_DEFS=0
INSTALL_COMMAND ""
@ -679,7 +684,7 @@ if(BUNDLED_SDL AND BUILD_CLIENT)
# URL https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
BINARY_DIR ${LIBS_BINARYDIR_DIR}/sdl2
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7"
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DVIDEO_OPENGLES=${SDL_WITH_GLES} -DSDL_SHARED=OFF -DSDL_RENDER=OFF -DRENDER_D3D=OFF -DFORCE_STATIC_VCRT=ON
-DCMAKE_INSTALL_PREFIX=${LIBS_BINARYDIR_DIR}/sdl2
PREFIX ${LIBS_BINARYDIR_DIR}/sdl2
@ -692,7 +697,7 @@ if(BUNDLED_SDL AND BUILD_CLIENT)
# URL https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
BINARY_DIR ${LIBS_BINARYDIR_DIR}/sdl2
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7"
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DVIDEO_OPENGLES=${SDL_WITH_GLES} -DSDL_SHARED=OFF -DSDL_RENDER=OFF -DRENDER_D3D=OFF -DFORCE_STATIC_VCRT=ON
-DCMAKE_INSTALL_PREFIX=${LIBS_BINARYDIR_DIR}/sdl2
PREFIX ${LIBS_BINARYDIR_DIR}/sdl2
@ -708,7 +713,7 @@ if(BUNDLED_SDL AND BUILD_CLIENT)
BINARY_DIR ${LIBS_BINARYDIR_DIR}/sdl2
BUILD_BYPRODUCTS ${SDL32_BUNDLED_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7"
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DVIDEO_OPENGLES=${SDL_WITH_GLES} -DSDL_SHARED=OFF -DSDL_RENDER=OFF -DRENDER_D3D=OFF -DFORCE_STATIC_VCRT=ON
-DCMAKE_INSTALL_PREFIX=${LIBS_BINARYDIR_DIR}/sdl2
PREFIX ${LIBS_BINARYDIR_DIR}/sdl2
@ -817,7 +822,7 @@ if(BUNDLED_FREETYPE AND BUILD_CLIENT)
BUILD_BYPRODUCTS ${BUNDLED_FREETYPE_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7"
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=ON -DCMAKE_DISABLE_FIND_PACKAGE_PNG=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=ON
-DFT_WITH_ZLIB=OFF -DFT_WITH_BZIP2=OFF -DFT_WITH_PNG=OFF -DFT_WITH_HARFBUZZ=OFF -DDISABLE_FORCE_DEBUG_POSTFIX=ON
INSTALL_COMMAND ""
@ -889,7 +894,7 @@ if(BUNDLED_JANSSON AND (BUILD_CLIENT OR BUILD_SERVER))
BUILD_BYPRODUCTS ${BUNDLED_JANSSON_LIBRARY}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7"
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DJANSSON_WITHOUT_TESTS=1 -DBUILD_DOCS=0 -DJANSSON_STATIC_CRT=1
-DJANSSON_BUILD_DOCS=0
INSTALL_COMMAND ""