-
Notifications
You must be signed in to change notification settings - Fork 11
Python Build #292
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
Open
johannes-spies
wants to merge
1
commit into
metatomic-core
Choose a base branch
from
metatomic-core-python-build
base: metatomic-core
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Python Build #292
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # This file allow the python module in metatomic-core to either use an | ||
| # externally-provided version of the shared metatomic library; or to build the | ||
| # code from source and bundle the shared library inside the wheel. | ||
| # | ||
| # The first case is used when distributing the code in conda (since we have a | ||
| # separate libmetatomic package), the second one is used everywhere else (for | ||
| # local development builds and for the PyPI distribution). | ||
|
|
||
| cmake_minimum_required(VERSION 3.22) | ||
| project(metatomic-python NONE) | ||
|
|
||
| option(METATOMIC_CORE_PYTHON_USE_EXTERNAL_LIB "Force the usage of an external version of metatomic-core" OFF) | ||
| set(METATOMIC_CORE_SOURCE_DIR "" CACHE PATH "Path to the sources of metatomic-core") | ||
|
|
||
| file(REMOVE ${CMAKE_INSTALL_PREFIX}/_external.py) | ||
|
|
||
| set(REQUIRED_METATOMIC_VERSION "0.1.0") | ||
| if(${METATOMIC_CORE_PYTHON_USE_EXTERNAL_LIB}) | ||
| # when building a source checkout, update version to include git information | ||
| # this will not apply when building a sdist | ||
| if (EXISTS ${CMAKE_SOURCE_DIR}/../../metatomic-core/cmake/dev-versions.cmake) | ||
| include(${CMAKE_SOURCE_DIR}/../../metatomic-core/cmake/dev-versions.cmake) | ||
| create_development_version("${REQUIRED_METATOMIC_VERSION}" REQUIRED_METATOMIC_VERSION "metatomic-core-v") | ||
| # strip any -dev/-rc suffix on the version since find_package does not support it | ||
| string(REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*).*" "\\1.\\2.\\3" REQUIRED_METATOMIC_VERSION ${REQUIRED_METATOMIC_VERSION}) | ||
| endif() | ||
|
|
||
| find_package(metatomic ${REQUIRED_METATOMIC_VERSION} REQUIRED) | ||
|
|
||
| get_target_property(METATOMIC_LOCATION metatomic::shared LOCATION) | ||
| message(STATUS "Using external metatomic-core v${metatomic_VERSION} at ${METATOMIC_LOCATION}") | ||
|
|
||
| # Get the prefix to use as cmake_prefix_path when trying to load this | ||
| # version of the library again | ||
| get_filename_component(METATOMIC_PREFIX "${METATOMIC_LOCATION}" DIRECTORY) | ||
| get_filename_component(METATOMIC_PREFIX "${METATOMIC_PREFIX}" DIRECTORY) | ||
|
|
||
| file(WRITE ${CMAKE_INSTALL_PREFIX}/_external.py | ||
| "EXTERNAL_METATOMIC_PATH = \"${METATOMIC_LOCATION}\"\n\n" | ||
| ) | ||
| file(APPEND ${CMAKE_INSTALL_PREFIX}/_external.py | ||
| "EXTERNAL_METATOMIC_PREFIX = \"${METATOMIC_PREFIX}\"\n" | ||
| ) | ||
|
|
||
| install(CODE "message(STATUS \"nothing to install\")") | ||
| else() | ||
| if ("${METATOMIC_CORE_SOURCE_DIR}" STREQUAL "") | ||
| message(FATAL_ERROR | ||
| "Missing METATOMIC_CORE_SOURCE_DIR, please specify where to \ | ||
| find the source code for metatomic-core" | ||
| ) | ||
| endif() | ||
|
|
||
| message(STATUS "Using internal metatomic-core from ${METATOMIC_CORE_SOURCE_DIR}") | ||
|
|
||
| set(BUILD_SHARED_LIBS ON) | ||
| set(METATOMIC_INSTALL_BOTH_STATIC_SHARED OFF) | ||
| # strip dynamic library for smaller wheels to download/install | ||
| set(EXTRA_RUST_FLAGS "-Cstrip=symbols") | ||
|
|
||
| add_subdirectory("${METATOMIC_CORE_SOURCE_DIR}" metatomic-core) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,5 @@ include AUTHORS | |
| include LICENSE | ||
|
|
||
| include git_version_info | ||
|
|
||
| include metatomic-core-cxx-*.tar.gz | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the back and forth here, I did not realized we were using the cmake files from our own metatomic-config.cmake …
Maybe the best solution here would be to install these to a different directory, i.e. to
CMAKE_INSTALL_PREFIX/lib/metatomic/externalinstead ofCMAKE_INSTALL_PREFIX? This way we can find the headers with normal cmake configuration, and also hide them from most users by default.@RMeli what do you think here?