mirror of https://github.com/mamba-org/mamba.git
Use CMake targets for reproc (#2883)
* Use CMake targets for reproc * Use reproc-cpp-static on Windows * Upper pin on Mamba
This commit is contained in:
parent
474be8b9b0
commit
0fbb0e4fab
|
@ -138,6 +138,7 @@ jobs:
|
|||
fmt
|
||||
yaml-cpp-static>=0.8.0
|
||||
libsolv-static>=0.7.24
|
||||
reproc-cpp-static>=14.2.4.post0
|
||||
- name: build micromamba
|
||||
shell: cmd /C call {0}
|
||||
run: |
|
||||
|
|
|
@ -323,6 +323,8 @@ find_package(spdlog REQUIRED)
|
|||
find_package(tl-expected REQUIRED)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(reproc REQUIRED)
|
||||
find_package(reproc++ REQUIRED)
|
||||
|
||||
macro(libmamba_create_target target_name linkage output_name)
|
||||
string(TOUPPER "${linkage}" linkage_upper)
|
||||
|
@ -357,6 +359,21 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
message(" -> Statically linking against libmamba (static) dependencies")
|
||||
|
||||
mamba_target_check_type(yaml-cpp::yaml-cpp STATIC_LIBRARY FATAL_ERROR)
|
||||
mamba_target_check_type(reproc STATIC_LIBRARY FATAL_ERROR)
|
||||
mamba_target_check_type(reproc++ STATIC_LIBRARY FATAL_ERROR)
|
||||
|
||||
target_compile_definitions(${target_name} PUBLIC SPDLOG_FMT_EXTERNAL)
|
||||
|
||||
target_link_libraries(
|
||||
${target_name}
|
||||
PUBLIC
|
||||
fmt::fmt-header-only
|
||||
spdlog::spdlog_header_only
|
||||
yaml-cpp::yaml-cpp
|
||||
PRIVATE
|
||||
reproc
|
||||
reproc++
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
|
||||
|
@ -386,9 +403,6 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
liblzma.a
|
||||
|
||||
libnghttp2.a
|
||||
|
||||
libreproc++.a
|
||||
libreproc.a
|
||||
)
|
||||
if (APPLE)
|
||||
set(REQUIRED_STATIC_DEPS ${REQUIRED_STATIC_DEPS} libc++.a)
|
||||
|
@ -432,16 +446,11 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
target_link_options(${target_name} PUBLIC -static-libstdc++ -static-libgcc)
|
||||
endif()
|
||||
|
||||
|
||||
add_compile_definitions(SPDLOG_FMT_EXTERNAL)
|
||||
target_link_libraries(
|
||||
${target_name}
|
||||
PUBLIC
|
||||
${STATIC_DEPS}
|
||||
${MAMBA_FORCE_DYNAMIC_LIBS}
|
||||
fmt::fmt-header-only
|
||||
spdlog::spdlog_header_only
|
||||
yaml-cpp::yaml-cpp
|
||||
)
|
||||
|
||||
elseif (WIN32)
|
||||
|
@ -460,7 +469,6 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
|
||||
find_library(LIBSOLV_BUILD_STATICRARIES NAMES solv_static)
|
||||
find_library(LIBSOLVEXT_BUILD_STATICRARIES NAMES solvext_static)
|
||||
find_package(reproc++ CONFIG REQUIRED)
|
||||
|
||||
find_library(LIBXML2_LIBRARY NAMES libxml2)
|
||||
find_library(ICONV_LIBRARY NAMES libiconv iconv)
|
||||
|
@ -479,21 +487,12 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
${BZIP2_LIBRARIES}
|
||||
${LIBLZMA_LIBRARIES}
|
||||
CURL::libcurl
|
||||
fmt::fmt-header-only
|
||||
# Since conda-forge spdlog is built with a bundled version of fmt we use the
|
||||
# header only version to avoid chasing after the correct fmt version mathching
|
||||
# the one used in the bundle
|
||||
spdlog::spdlog_header_only
|
||||
yaml-cpp::yaml-cpp
|
||||
${LIBSOLV_BUILD_STATICRARIES}
|
||||
${LIBSOLVEXT_BUILD_STATICRARIES}
|
||||
${sodium_LIBRARY_RELEASE}
|
||||
reproc++
|
||||
reproc
|
||||
)
|
||||
|
||||
add_compile_definitions(
|
||||
SPDLOG_FMT_EXTERNAL
|
||||
LIBARCHIVE_STATIC
|
||||
CURL_STATICLIB
|
||||
SOLV_BUILD_STATIC
|
||||
|
@ -513,9 +512,12 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
find_package(zstd REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(reproc++ CONFIG REQUIRED)
|
||||
|
||||
set(LIBMAMBA_LIBRARIES_DEPS
|
||||
target_compile_definitions(${target_name} PUBLIC SPDLOG_FMT_EXTERNAL)
|
||||
|
||||
target_link_libraries(
|
||||
${target_name}
|
||||
PUBLIC
|
||||
${LIBSOLV_LIBRARIES}
|
||||
${LIBSOLVEXT_LIBRARIES}
|
||||
${LibArchive_LIBRARIES}
|
||||
|
@ -525,19 +527,15 @@ macro(libmamba_create_target target_name linkage output_name)
|
|||
zstd::libzstd_shared
|
||||
BZip2::BZip2
|
||||
yaml-cpp::yaml-cpp
|
||||
reproc++
|
||||
reproc
|
||||
fmt::fmt
|
||||
# Since conda-forge spdlog is built with a bundled version of fmt we use the
|
||||
# header only version to avoid chasing after the correct fmt version mathching
|
||||
# the one used in the bundle
|
||||
spdlog::spdlog_header_only
|
||||
PRIVATE
|
||||
reproc
|
||||
reproc++
|
||||
)
|
||||
|
||||
add_compile_definitions(SPDLOG_FMT_EXTERNAL)
|
||||
target_link_libraries(${target_name} PUBLIC
|
||||
${LIBMAMBA_LIBRARIES_DEPS}
|
||||
${MAMBA_FORCE_DYNAMIC_LIBS})
|
||||
endif ()
|
||||
|
||||
target_compile_features(${target_name} PUBLIC cxx_std_17)
|
||||
|
|
|
@ -12,7 +12,7 @@ dependencies:
|
|||
- libcurl >=7.86
|
||||
- doctest
|
||||
- cpp-expected
|
||||
- reproc-cpp
|
||||
- reproc-cpp >=14.2.4.post0
|
||||
- yaml-cpp >=0.8.0
|
||||
- cli11 >=2.2
|
||||
- spdlog
|
||||
|
|
|
@ -82,7 +82,10 @@ mamba_target_add_compile_warnings(test_libmamba WARNING_AS_ERROR ${MAMBA_WARNING
|
|||
|
||||
target_include_directories(
|
||||
test_libmamba
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/libmamba/src"
|
||||
PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${CMAKE_SOURCE_DIR}/libmamba/src"
|
||||
)
|
||||
|
||||
find_package(doctest REQUIRED)
|
||||
|
@ -90,8 +93,13 @@ find_package(Threads REQUIRED)
|
|||
|
||||
target_link_libraries(
|
||||
test_libmamba
|
||||
PUBLIC ${libmamba_target}
|
||||
PRIVATE doctest::doctest Threads::Threads
|
||||
PUBLIC
|
||||
${libmamba_target}
|
||||
reproc
|
||||
reproc++
|
||||
PRIVATE
|
||||
doctest::doctest
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
# Copy data directory into binary dir to avoid modifications
|
||||
|
|
|
@ -13,7 +13,7 @@ dependencies:
|
|||
- gtest
|
||||
- gmock
|
||||
- cpp-expected
|
||||
- reproc-cpp
|
||||
- reproc-cpp >=14.2.4.post0
|
||||
- yaml-cpp >=0.8.0
|
||||
- cli11 >=2.2
|
||||
- spdlog
|
||||
|
|
|
@ -13,7 +13,7 @@ dependencies:
|
|||
- gtest
|
||||
- gmock
|
||||
- cpp-expected
|
||||
- reproc-cpp
|
||||
- reproc-cpp >=14.2.4.post0
|
||||
- yaml-cpp >= 0.8.0
|
||||
- cli11 >=2.2
|
||||
- spdlog
|
||||
|
@ -24,7 +24,7 @@ dependencies:
|
|||
- pybind11-stubgen <1.0
|
||||
- pytest >=7.3
|
||||
- pyyaml
|
||||
- conda
|
||||
- conda <23.9.0
|
||||
- conda-content-trust
|
||||
- cryptography<40.0 # Or breaks conda-content-trust
|
||||
- pip:
|
||||
|
|
|
@ -69,18 +69,28 @@ if(NOT (TARGET libmamba OR TARGET libmamba-static))
|
|||
find_package(libmamba REQUIRED)
|
||||
endif ()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(micromamba PRIVATE Threads::Threads)
|
||||
|
||||
string(TOUPPER "${MICROMAMBA_LINKAGE}" linkage_upper)
|
||||
message(STATUS "Micromamba linkage: ${MICROMAMBA_LINKAGE}")
|
||||
|
||||
if (${MICROMAMBA_LINKAGE} STREQUAL "STATIC")
|
||||
target_link_libraries(micromamba PRIVATE libmamba-static)
|
||||
set(libmamba_target "libmamba-static")
|
||||
else ()
|
||||
target_link_libraries(micromamba PRIVATE libmamba)
|
||||
set(libmamba_target "libmamba")
|
||||
endif ()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(reproc REQUIRED)
|
||||
find_package(reproc++ REQUIRED)
|
||||
|
||||
target_link_libraries(
|
||||
micromamba
|
||||
PRIVATE
|
||||
${libmamba_target}
|
||||
Threads::Threads
|
||||
reproc
|
||||
reproc++
|
||||
)
|
||||
|
||||
set_property(TARGET micromamba PROPERTY CXX_STANDARD 17)
|
||||
|
||||
install(TARGETS micromamba)
|
||||
|
|
|
@ -14,7 +14,7 @@ dependencies:
|
|||
- gtest
|
||||
- gmock
|
||||
- cpp-expected
|
||||
- reproc-cpp
|
||||
- reproc-cpp >=14.2.4.post0
|
||||
- yaml-cpp >=0.8.0
|
||||
- cli11 >=2.2
|
||||
- pytest >=7.3.0
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"dependencies": [
|
||||
"zstd",
|
||||
"curl",
|
||||
"reproc",
|
||||
{
|
||||
"name": "winreg",
|
||||
"platform": "windows"
|
||||
|
|
Loading…
Reference in New Issue