Skip to content

Commit

Permalink
fix: use zlib static (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
vansangpfiev authored and jan-service-account committed Jul 12, 2024
1 parent d2332da commit a8932fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/cortex-js-openai-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:

jobs:
openai-python-tests:
runs-on: [self-hosted, Linux, ubuntu-desktop]
runs-on: ubuntu-20-04-openai-api-collection-test
steps:
- name: Getting the repo
uses: actions/checkout@v4
Expand All @@ -35,11 +35,7 @@ jobs:
with:
node-version: 20

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: yarn install && yarn build
- run: npm install -g yarn && yarn install && yarn build
working-directory: ./cortex-js

- name: Run test
Expand All @@ -53,8 +49,8 @@ jobs:
git clone https://github.com/openai/openai-python.git -b $OPENAI_API_PYTHON_TAG
cd openai-python
pip install -r requirements-dev.lock
pip install pytest-reportportal pytest-html
pip3 install -r requirements-dev.lock
pip3 install pytest-reportportal pytest-html
mv ../coverage/conftest.py tests/conftest.py
mv ../coverage/endpoint_mapping.json tests/endpoints_mapping.json
Expand Down
1 change: 0 additions & 1 deletion cortex-cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pre-package:
ifeq ($(OS),Windows_NT)
@powershell -Command "mkdir -p cortex-cpp;"
@powershell -Command "cp build\cortex-cpp.exe .\cortex-cpp\;"
@powershell -Command "cp build-deps\_install\bin\zlib.dll .\cortex-cpp\;"
@powershell -Command "cp ..\.github\patches\windows\msvcp140.dll .\cortex-cpp\;"
@powershell -Command "cp ..\.github\patches\windows\vcruntime140_1.dll .\cortex-cpp\;"
@powershell -Command "cp ..\.github\patches\windows\vcruntime140.dll .\cortex-cpp\;"
Expand Down
22 changes: 14 additions & 8 deletions cortex-cpp/cortex-cpp-deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ set(THIRD_PARTY_INSTALL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build-deps/_install)
#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
#
# Add the external project
set(ZLIB_USE_STATIC_LIBS OFF)
find_package(ZLIB)
if(NOT ZLIB_FOUND)
set(ZLIB_USE_STATIC_LIBS ON)
ExternalProject_Add(
zlib
if(NOT APPLE)
ExternalProject_Add(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.2.11
CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH}
-DCMAKE_BUILD_TYPE=RELEASE
)

if(WIN32)
SET(ZLIB_DYN_PATH "${THIRD_PARTY_INSTALL_PATH}/lib/zlib.lib")
ExternalProject_Add_Step(
zlib remove_dynamic_lib
COMMAND ${CMAKE_COMMAND} -E rm -f ${ZLIB_DYN_PATH}
DEPENDEES install
)
endif()
endif()

ExternalProject_Add(
brotli
Expand Down Expand Up @@ -76,7 +82,6 @@ ExternalProject_Add(
CMAKE_ARGS
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DOPENSSL_USE_STATIC_LIBS=TRUE
-DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS}
-DBUILD_ORM=OFF
-DBUILD_YAML_CONFIG=OFF
-DBUILD_EXAMPLES=OFF
Expand Down Expand Up @@ -116,8 +121,9 @@ link_directories(${THIRD_PARTY_INSTALL_PATH}/lib)
# Optionally link or add dependencies to your targets
add_dependencies(drogon c-ares jsoncpp brotli)

if(ZLIB_USE_STATIC_LIBS)
if(NOT APPLE)
add_dependencies(drogon zlib)
endif()

# target_link_libraries(<your-target> ...)

0 comments on commit a8932fd

Please sign in to comment.