Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions CMakeLists.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile option -fPIC is not supported on Windows.

Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,45 @@ cmake_dependent_option(CUPDLPX_BUILD_TESTS "Build the cuPDLPx test suite" OFF
# -----------------------------------------------------------------------------
# Core dependencies (required for Julia/Yggdrasil and Python)
find_package(CUDAToolkit REQUIRED)
find_package(ZLIB REQUIRED)

include(FetchContent)
# 1. Try to find ZLIB in the system first (Standard for Linux/Mac)
find_package(ZLIB QUIET)

if(ZLIB_FOUND)
message(STATUS "Found System ZLIB: ${ZLIB_LIBRARIES}")
else()
# 2. If not found (Common on Windows), fetch from source
message(STATUS "ZLIB not found in system. Fetching from source...")

FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.3
)
FetchContent_MakeAvailable(zlib)

# 3. Create alias ZLIB::ZLIB to match your CORE_LINK_LIBS usage
if(NOT TARGET ZLIB::ZLIB)
if(TARGET zlibstatic)
# Prefer zlibstatic to ensure static linking (avoids DLL issues on Windows)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
# Expose include directories so zlib.h can be found
target_include_directories(zlibstatic INTERFACE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
else()
# Fallback if the target is simply named 'zlib'
add_library(ZLIB::ZLIB ALIAS zlib)
target_include_directories(zlib INTERFACE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
endif()
endif()
endif()

if (CUPDLPX_BUILD_PYTHON)
# Dependencies required only for Python bindings
find_package(pybind11 CONFIG REQUIRED)
find_package(Python3 COMPONENTS Interpreter REQUIRED) # For versioning script and pybind11
endif()

include(FetchContent)

set(PSLP_VERSION_TAG "v0.0.4")

FetchContent_Declare(
Expand Down