Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit a6c43c8

Browse files
authored
fix: use zlib static (#872)
1 parent d2332da commit a6c43c8

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

cortex-cpp/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pre-package:
4040
ifeq ($(OS),Windows_NT)
4141
@powershell -Command "mkdir -p cortex-cpp;"
4242
@powershell -Command "cp build\cortex-cpp.exe .\cortex-cpp\;"
43-
@powershell -Command "cp build-deps\_install\bin\zlib.dll .\cortex-cpp\;"
4443
@powershell -Command "cp ..\.github\patches\windows\msvcp140.dll .\cortex-cpp\;"
4544
@powershell -Command "cp ..\.github\patches\windows\vcruntime140_1.dll .\cortex-cpp\;"
4645
@powershell -Command "cp ..\.github\patches\windows\vcruntime140.dll .\cortex-cpp\;"

cortex-cpp/cortex-cpp-deps/CMakeLists.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,26 @@ set(THIRD_PARTY_INSTALL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build-deps/_install)
1919
#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
2020
#
2121
# Add the external project
22-
set(ZLIB_USE_STATIC_LIBS OFF)
23-
find_package(ZLIB)
24-
if(NOT ZLIB_FOUND)
25-
set(ZLIB_USE_STATIC_LIBS ON)
26-
ExternalProject_Add(
27-
zlib
22+
if(NOT APPLE)
23+
ExternalProject_Add(
24+
zlib
2825
GIT_REPOSITORY https://github.com/madler/zlib.git
2926
GIT_TAG v1.2.11
3027
CMAKE_ARGS
3128
-DBUILD_SHARED_LIBS=OFF
3229
-DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH}
3330
-DCMAKE_BUILD_TYPE=RELEASE
31+
)
32+
33+
if(WIN32)
34+
SET(ZLIB_DYN_PATH "${THIRD_PARTY_INSTALL_PATH}/lib/zlib.lib")
35+
ExternalProject_Add_Step(
36+
zlib remove_dynamic_lib
37+
COMMAND ${CMAKE_COMMAND} -E rm -f ${ZLIB_DYN_PATH}
38+
DEPENDEES install
3439
)
3540
endif()
41+
endif()
3642

3743
ExternalProject_Add(
3844
brotli
@@ -76,7 +82,6 @@ ExternalProject_Add(
7682
CMAKE_ARGS
7783
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
7884
-DOPENSSL_USE_STATIC_LIBS=TRUE
79-
-DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS}
8085
-DBUILD_ORM=OFF
8186
-DBUILD_YAML_CONFIG=OFF
8287
-DBUILD_EXAMPLES=OFF
@@ -116,8 +121,9 @@ link_directories(${THIRD_PARTY_INSTALL_PATH}/lib)
116121
# Optionally link or add dependencies to your targets
117122
add_dependencies(drogon c-ares jsoncpp brotli)
118123

119-
if(ZLIB_USE_STATIC_LIBS)
124+
if(NOT APPLE)
120125
add_dependencies(drogon zlib)
121126
endif()
127+
122128
# target_link_libraries(<your-target> ...)
123129

0 commit comments

Comments
 (0)