mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Cherry-pick internal zlib MR from SRB2/next
cmake: build zlib manually in internal build See merge request STJr/SRB2!1856 (cherry picked from commit 3597957af13878854c02305a0aec5ca744209ef2) # Conflicts: # thirdparty/CMakeLists.txt
This commit is contained in:
parent
32f747fd5a
commit
0d49cc1768
1 changed files with 46 additions and 24 deletions
70
thirdparty/CMakeLists.txt
vendored
70
thirdparty/CMakeLists.txt
vendored
|
|
@ -57,30 +57,52 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||||
VERSION 1.2.13
|
VERSION 1.2.13
|
||||||
URL "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.zip"
|
URL "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.zip"
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
OPTIONS
|
DOWNLOAD_ONLY YES
|
||||||
# The assembly optimizations are unmaintained and slated to be removed
|
|
||||||
"ASM686 Off"
|
|
||||||
"AMD64 Off"
|
|
||||||
"SKIP_INSTALL_ALL ON"
|
|
||||||
)
|
)
|
||||||
file(MAKE_DIRECTORY "${zlib_BINARY_DIR}/include")
|
if(ZLIB_ADDED)
|
||||||
file(COPY "${zlib_SOURCE_DIR}/zlib.h" DESTINATION "${zlib_BINARY_DIR}/include")
|
set(ZLIB_SRCS
|
||||||
file(COPY "${zlib_BINARY_DIR}/zconf.h" DESTINATION "${zlib_BINARY_DIR}/include")
|
crc32.h
|
||||||
# honestly this should probably be built like png is
|
deflate.h
|
||||||
set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL ON)
|
gzguts.h
|
||||||
set_target_properties(minigzip PROPERTIES EXCLUDE_FROM_ALL ON)
|
inffast.h
|
||||||
set_target_properties(example PROPERTIES EXCLUDE_FROM_ALL ON)
|
inffixed.h
|
||||||
# zlib cmake also adds these 64 targets separately
|
inflate.h
|
||||||
if(HAVE_OFF64_T)
|
inftrees.h
|
||||||
set_target_properties(minigzip64 PROPERTIES EXCLUDE_FROM_ALL ON)
|
trees.h
|
||||||
set_target_properties(example64 PROPERTIES EXCLUDE_FROM_ALL ON)
|
zutil.h
|
||||||
endif()
|
|
||||||
target_include_directories(zlib INTERFACE "${zlib_BINARY_DIR}/include")
|
adler32.c
|
||||||
target_include_directories(zlibstatic INTERFACE "${zlib_BINARY_DIR}/include")
|
compress.c
|
||||||
if(SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES)
|
crc32.c
|
||||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
deflate.c
|
||||||
else()
|
gzclose.c
|
||||||
add_library(ZLIB::ZLIB ALIAS zlibstatic)
|
gzlib.c
|
||||||
|
gzread.c
|
||||||
|
gzwrite.c
|
||||||
|
inflate.c
|
||||||
|
infback.c
|
||||||
|
inftrees.c
|
||||||
|
inffast.c
|
||||||
|
trees.c
|
||||||
|
uncompr.c
|
||||||
|
zutil.c
|
||||||
|
)
|
||||||
|
list(TRANSFORM ZLIB_SRCS PREPEND "${ZLIB_SOURCE_DIR}/")
|
||||||
|
|
||||||
|
configure_file("${ZLIB_SOURCE_DIR}/zlib.pc.cmakein" "${ZLIB_BINARY_DIR}/zlib.pc" @ONLY)
|
||||||
|
configure_file("${ZLIB_SOURCE_DIR}/zconf.h.cmakein" "${ZLIB_BINARY_DIR}/include/zconf.h" @ONLY)
|
||||||
|
|
||||||
|
add_library(ZLIB ${SRB2_INTERNAL_LIBRARY_TYPE} ${ZLIB_SRCS})
|
||||||
|
set_target_properties(ZLIB PROPERTIES
|
||||||
|
VERSION 1.2.13
|
||||||
|
OUTPUT_NAME "z"
|
||||||
|
)
|
||||||
|
target_include_directories(ZLIB PRIVATE "${ZLIB_SOURCE_DIR}")
|
||||||
|
target_include_directories(ZLIB PUBLIC "${ZLIB_BINARY_DIR}/include")
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_definitions(ZLIB PRIVATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
endif()
|
||||||
|
add_library(ZLIB::ZLIB ALIAS ZLIB)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -474,7 +496,7 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||||
target_compile_options(openmpt PRIVATE "-g0")
|
target_compile_options(openmpt PRIVATE "-g0")
|
||||||
endif()
|
endif()
|
||||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
|
||||||
target_link_libraries(openmpt PRIVATE rpcrt4)
|
target_link_libraries(openmpt PRIVATE Rpcrt4)
|
||||||
endif()
|
endif()
|
||||||
target_compile_features(openmpt PRIVATE cxx_std_11)
|
target_compile_features(openmpt PRIVATE cxx_std_11)
|
||||||
target_compile_definitions(openmpt PRIVATE -DLIBOPENMPT_BUILD)
|
target_compile_definitions(openmpt PRIVATE -DLIBOPENMPT_BUILD)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue