Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only full shared or full static build #2342

Merged
merged 1 commit into from
Mar 3, 2023
Merged

Conversation

JohanMabille
Copy link
Member

@JohanMabille JohanMabille commented Mar 2, 2023

This PR simplifies the cmake and removes an hybrid build that might be problematic because of mixing different runtimes.

  • Removed the BUILD_STATIC_DEPS option
  • The BUILD_STATIC option is now equivalent to the old BUILD_STATIC_DEPS
  • Target linkage is now the same as the build type (so we do not mix static and shared anymore)
  • In case we build both shared and static libraries, binaries (micromamba and mamba-package) will link with the shared libraries by default. To change that, the options MICROMAMBA_LINKAGE and MAMBA_PACKAGE_LINKAGE can be set to STATIC

@JohanMabille JohanMabille self-assigned this Mar 2, 2023
@jonashaag
Copy link
Collaborator

fyi @pavelzw

@wolfv
Copy link
Member

wolfv commented Mar 3, 2023

Looks good to me!

@@ -48,19 +47,15 @@ message(STATUS "libmamba binary version: v${LIBMAMBA_BINARY_VERSION}")

option(BUILD_TESTS "Build libmamba C++ tests" OFF)
option(BUILD_SHARED "Build shared libmamba library" OFF)
option(BUILD_STATIC "Build static libmamba library" OFF)
option(BUILD_STATIC_DEPS "Build static libmamba library with static linkage to its dependencies" OFF)
option(BUILD_STATIC "Build static libmamba library with static linkage to its dependencies" OFF)
Copy link
Member

Choose a reason for hiding this comment

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

Should we take this opportunity to introduce an prefix on options: MAMBA_BUILD_STATIC etc. ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know, MAMBA_BUILD_MICROMAMBA sounds a bit weird. And there is already a lot to type to build micromamba for instance

Copy link
Member

Choose a reason for hiding this comment

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

MAMBA_BUILD_MICRO?

Copy link
Member Author

Choose a reason for hiding this comment

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

still weird. And I don't think we need this prefix as long as this is not used as a framework in another repo building with cmake.

libmamba/CMakeLists.txt Show resolved Hide resolved
libmamba/CMakeLists.txt Show resolved Hide resolved
endif ()
endif ()

if (NOT (BUILD_SHARED OR BUILD_STATIC OR BUILD_STATIC_DEPS))
if (NOT (BUILD_SHARED OR BUILD_STATIC))
Copy link
Member

Choose a reason for hiding this comment

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

Should there be s single option, where true means static, false means shared?

Copy link
Member

Choose a reason for hiding this comment

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

yeah I think we should default to SHARED

Copy link
Member Author

Choose a reason for hiding this comment

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

I think BUILD_SHARED and BUILD_STATIC are more expressive. And you may want to build both at the same time.

Copy link
Member

Choose a reason for hiding this comment

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

Ha right, it's too target, not one that transmute

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I think we should default to SHARED

But in that case if you want to build the static version only, you need to pass two options ( BUILD_SHARED=OFF and BUILD_STATIC=ON) instead of a single one

Copy link
Member Author

Choose a reason for hiding this comment

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

I can add options like:

  • BUILD_ALL_SHARED
  • BUILD_ALL_STATIC

The only question is should we build tests with these targets? (sometimes you just want to build micromamba for reproducing an issue or debugging, and you don't want tot build the tests).

@AntoinePrv AntoinePrv merged commit b38377a into mamba-org:main Mar 3, 2023
@JohanMabille JohanMabille deleted the cmake branch March 3, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants