mirror of https://github.com/mamba-org/mamba.git
Added mamba as dynamic build of micromamba (#3060)
This commit is contained in:
parent
7709425155
commit
4f2d1ebd43
|
@ -105,8 +105,8 @@ jobs:
|
|||
run: |
|
||||
python -m pytest libmambapy/tests/ ${{ runner.debug == 'true' && '-v' || '--exitfirst' }}
|
||||
|
||||
umamba_integration_tests_unix:
|
||||
name: Test integration micromamba
|
||||
mamba_integration_tests_unix:
|
||||
name: Test integration mamba
|
||||
needs: ["build_shared_unix"]
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
|
@ -131,9 +131,9 @@ jobs:
|
|||
if: startsWith(inputs.os, 'macos')
|
||||
run: |
|
||||
brew install fish xonsh
|
||||
- name: micromamba python based tests
|
||||
- name: mamba python based tests
|
||||
run: |
|
||||
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/micromamba
|
||||
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/mamba
|
||||
unset CONDARC # Interferes with tests
|
||||
python -m pytest micromamba/tests/ \
|
||||
${{ runner.debug == 'true' && '-v --capture=tee-sys' || '--exitfirst' }}
|
||||
|
|
|
@ -113,8 +113,8 @@ jobs:
|
|||
run: |
|
||||
python -m pytest libmambapy/tests/ ${{ runner.debug == 'true' && '-v' || '--exitfirst' }}
|
||||
|
||||
umamba_integration_tests_win:
|
||||
name: Test integration micromamba
|
||||
mamba_integration_tests_win:
|
||||
name: Test integration mamba
|
||||
needs: ["build_shared_win"]
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
|
@ -132,16 +132,16 @@ jobs:
|
|||
environment-file: ./build/environment.lock
|
||||
environment-name: build_env
|
||||
init-shell: bash cmd.exe powershell
|
||||
- name: Install micromamba
|
||||
- name: Install mamba
|
||||
shell: bash -elo pipefail {0}
|
||||
run: |
|
||||
cmake --install build/ --prefix local/
|
||||
- name: micromamba python based tests with pwsh
|
||||
- name: mamba python based tests with pwsh
|
||||
shell: pwsh
|
||||
run: |
|
||||
$env:PYTHONIOENCODING='UTF-8'
|
||||
$env:MAMBA_ROOT_PREFIX = Join-Path -Path $pwd -ChildPath 'mambaroot'
|
||||
$env:TEST_MAMBA_EXE = Join-Path -Path $pwd -ChildPath 'local\bin\micromamba.exe'
|
||||
$env:TEST_MAMBA_EXE = Join-Path -Path $pwd -ChildPath 'local\bin\mamba.exe'
|
||||
$env:MAMBA_TEST_SHELL_TYPE='powershell'
|
||||
Remove-Item -Path "env:CONDARC"
|
||||
python -m pytest micromamba/tests/ `
|
||||
|
|
|
@ -13,9 +13,12 @@ project(mamba)
|
|||
# Build options
|
||||
# =============
|
||||
|
||||
option(BUILD_SHARED "Build shared libmamba library" OFF)
|
||||
option(BUILD_STATIC "Build static libmamba library with static linkage to its dependencies" OFF)
|
||||
option(BUILD_LIBMAMBA "Build libmamba library" OFF)
|
||||
option(BUILD_LIBMAMBAPY "Build libmamba Python bindings" OFF)
|
||||
option(BUILD_LIBMAMBA_TESTS "Build libmamba C++ tests" OFF)
|
||||
option(BUILD_MAMBA "Build mamba" OFF)
|
||||
option(BUILD_MICROMAMBA "Build micromamba" OFF)
|
||||
option(BUILD_MAMBA_PACKAGE "Build mamba package utility" OFF)
|
||||
option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" OFF)
|
||||
|
@ -59,6 +62,16 @@ endif()
|
|||
# Variants
|
||||
# ========
|
||||
|
||||
# mamba is a dynamic build of micromamba
|
||||
if(BUILD_MAMBA)
|
||||
set(BUILD_SHARED ON)
|
||||
endif()
|
||||
|
||||
# micromamba requires static linkage
|
||||
if(BUILD_MICROMAMBA)
|
||||
set(BUILD_STATIC ON)
|
||||
endif()
|
||||
|
||||
# libmamba library and tests
|
||||
if(BUILD_LIBMAMBA)
|
||||
add_subdirectory(libmamba)
|
||||
|
@ -70,7 +83,7 @@ if(BUILD_LIBMAMBAPY)
|
|||
endif()
|
||||
|
||||
# micromamba
|
||||
if(BUILD_MICROMAMBA)
|
||||
if(BUILD_MICROMAMBA OR BUILD_MAMBA)
|
||||
add_subdirectory(micromamba)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"displayName": "Mamba Unix Shared Debug",
|
||||
"inherits": [
|
||||
"conda-unix",
|
||||
"mamba-all",
|
||||
"libmamba-all",
|
||||
"mamba-shared",
|
||||
"mamba-debug"
|
||||
],
|
||||
|
@ -14,7 +14,7 @@
|
|||
"displayName": "Mamba Unix Shared Release",
|
||||
"inherits": [
|
||||
"conda-unix",
|
||||
"mamba-all",
|
||||
"libmamba-all",
|
||||
"mamba-shared",
|
||||
"mamba-release"
|
||||
],
|
||||
|
@ -31,7 +31,7 @@
|
|||
{
|
||||
"displayName": "Mamba Win Shared Release",
|
||||
"inherits": [
|
||||
"mamba-all",
|
||||
"libmamba-all",
|
||||
"mamba-shared",
|
||||
"mamba-release"
|
||||
],
|
||||
|
|
|
@ -5,17 +5,16 @@
|
|||
"BUILD_LIBMAMBA": "ON",
|
||||
"BUILD_LIBMAMBAPY": "ON",
|
||||
"BUILD_LIBMAMBA_TESTS": "ON",
|
||||
"BUILD_MAMBA_PACKAGE": "ON",
|
||||
"BUILD_MICROMAMBA": "ON",
|
||||
"BUILD_MICROMAMBA_SERVER": "ON"
|
||||
"BUILD_MAMBA_PACKAGE": "ON"
|
||||
},
|
||||
"description": "Base profile for building everything in Mamba",
|
||||
"displayName": "Mamba All",
|
||||
"description": "Base profile for building libmamba and related",
|
||||
"displayName": "libmamba All",
|
||||
"hidden": true,
|
||||
"name": "mamba-all"
|
||||
"name": "libmamba-all"
|
||||
},
|
||||
{
|
||||
"cacheVariables": {
|
||||
"BUILD_MAMBA": "ON",
|
||||
"BUILD_SHARED": "ON"
|
||||
},
|
||||
"hidden": true,
|
||||
|
@ -23,6 +22,8 @@
|
|||
},
|
||||
{
|
||||
"cacheVariables": {
|
||||
"BUILD_MICROMAMBA": "ON",
|
||||
"BUILD_MICROMAMBA_SERVER": "ON",
|
||||
"BUILD_STATIC": "ON"
|
||||
},
|
||||
"hidden": true,
|
||||
|
|
|
@ -58,9 +58,6 @@ message(STATUS "libmamba binary version: v${LIBMAMBA_BINARY_VERSION}")
|
|||
# Build options
|
||||
# =============
|
||||
|
||||
option(BUILD_TESTS "Build libmamba C++ tests" OFF)
|
||||
option(BUILD_SHARED "Build shared libmamba library" OFF)
|
||||
option(BUILD_STATIC "Build static libmamba library with static linkage to its dependencies" OFF)
|
||||
set(
|
||||
BUILD_LOG_LEVEL
|
||||
"TRACE"
|
||||
|
@ -74,6 +71,7 @@ if(NOT ${BUILD_LOG_LEVEL} MATCHES "^(TRACE|DEBUG|INFO|WARN|ERROR|CRITICAL|OFF)$"
|
|||
)
|
||||
endif()
|
||||
|
||||
# TODO: move this into the mamba_create_target macro
|
||||
if(BUILD_STATIC)
|
||||
add_definitions("-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${BUILD_LOG_LEVEL}")
|
||||
add_definitions(-DLIBMAMBA_STATIC_DEPS)
|
||||
|
|
|
@ -9,24 +9,6 @@ cmake_policy(SET CMP0025 NEW) # Introduced in cmake 3.0
|
|||
cmake_policy(SET CMP0077 NEW) # Introduced in cmake 3.13
|
||||
project(micromamba)
|
||||
|
||||
# Build options
|
||||
# =============
|
||||
option(BUILD_MICROMAMBA_SERVER "Build the micromamba server" OFF)
|
||||
|
||||
if(BUILD_STATIC AND NOT BUILD_SHARED)
|
||||
set(
|
||||
MICROMAMBA_LINKAGE
|
||||
"STATIC"
|
||||
CACHE STRING "micromamba linkage against libraries"
|
||||
)
|
||||
else()
|
||||
set(
|
||||
MICROMAMBA_LINKAGE
|
||||
"DYNAMIC"
|
||||
CACHE STRING "micromamba linkage against libraries"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Source files
|
||||
# ============
|
||||
|
||||
|
@ -68,30 +50,60 @@ if(UNIX AND BUILD_MICROMAMBA_SERVER)
|
|||
add_definitions(-DMICROMAMBA_SERVER)
|
||||
endif()
|
||||
|
||||
add_executable(micromamba ${MICROMAMBA_SRCS} ${MICROMAMBA_HEADERS})
|
||||
|
||||
mamba_target_add_compile_warnings(micromamba WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR})
|
||||
mamba_target_set_lto(micromamba MODE ${MAMBA_LTO})
|
||||
|
||||
if(NOT (TARGET mamba::libmamba-dyn OR TARGET mamba::libmamba-static))
|
||||
find_package(libmamba REQUIRED)
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${MICROMAMBA_LINKAGE}" linkage_upper)
|
||||
message(STATUS "Micromamba linkage: ${MICROMAMBA_LINKAGE}")
|
||||
|
||||
if(${MICROMAMBA_LINKAGE} STREQUAL "STATIC")
|
||||
set(libmamba_target mamba::libmamba-static)
|
||||
else()
|
||||
set(libmamba_target mamba::libmamba-dyn)
|
||||
endif()
|
||||
# Targets and link
|
||||
# ================
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(reproc REQUIRED)
|
||||
find_package(reproc++ REQUIRED)
|
||||
|
||||
target_link_libraries(micromamba PRIVATE ${libmamba_target} Threads::Threads reproc reproc++)
|
||||
macro(mambaexe_create_target target_name linkage output_name)
|
||||
string(TOUPPER "${linkage}" linkage_upper)
|
||||
if(NOT ${linkage_upper} MATCHES "^(SHARED|STATIC)$")
|
||||
message(FATAL_ERROR "Invalid library linkage: ${linkage}")
|
||||
endif()
|
||||
|
||||
set_property(TARGET micromamba PROPERTY CXX_STANDARD 17)
|
||||
# Output
|
||||
# ======
|
||||
add_executable(${target_name} ${MICROMAMBA_SRCS} ${MICROMAMBA_HEADERS})
|
||||
mamba_target_add_compile_warnings(${target_name} WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR})
|
||||
mamba_target_set_lto(${target_name} MODE ${MAMBA_LTO})
|
||||
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD 17)
|
||||
|
||||
install(TARGETS micromamba)
|
||||
target_link_libraries(${target_name} PRIVATE Threads::Threads reproc reproc++)
|
||||
|
||||
# Static build
|
||||
# ============
|
||||
if(${linkage_upper} STREQUAL "STATIC")
|
||||
if(NOT (TARGET mamba::libmamba-static))
|
||||
find_package(libmamba REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(${target_name} PRIVATE mamba::libmamba-static)
|
||||
# Dynamic build
|
||||
# =============
|
||||
else()
|
||||
if(NOT (TARGET mamba::libmamba-dyn))
|
||||
find_package(libmamba REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(${target_name} PRIVATE mamba::libmamba-dyn)
|
||||
endif()
|
||||
|
||||
list(APPEND mambaexe_targets ${target_name})
|
||||
endmacro()
|
||||
|
||||
set(mambaexe_targets "")
|
||||
|
||||
if(BUILD_SHARED)
|
||||
message(STATUS "Adding executable mamba")
|
||||
mambaexe_create_target(mamba SHARED mamba)
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC)
|
||||
message(STATUS "Adding executable micromamba")
|
||||
mambaexe_create_target(micromamba STATIC micromamba)
|
||||
endif()
|
||||
|
||||
# Installation
|
||||
# ============
|
||||
|
||||
install(TARGETS ${mambaexe_targets})
|
||||
|
|
|
@ -329,7 +329,7 @@ def test_shell_init(
|
|||
path = Path(paths[plat][interpreter]).expanduser()
|
||||
with open(path) as fi:
|
||||
x = fi.read()
|
||||
assert "micromamba" in x
|
||||
assert "mamba" in x
|
||||
assert find_path_in_str(tmp_root_prefix, x)
|
||||
prev_text = x
|
||||
|
||||
|
|
Loading…
Reference in New Issue