-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add recipe for Sparrow Python bindings
- Loading branch information
Showing
3 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,94 @@ | ||
{% set name = "utilities" %} | ||
{% set pkg_name = "scine-" + name + "-python" %} | ||
{% set version = "4.0.0" %} | ||
|
||
package: | ||
name: {{ pkg_name }} | ||
version: {{ version }} | ||
|
||
source: | ||
- url: https://github.com/qcscine/utilities/archive/refs/tags/{{ version }}.tar.gz | ||
sha256: 3bcabd8f4270f0c1efd235a0d22506f4750b0ccffa99184d4362b95a1da7a1d4 | ||
fn: {{ name }}.tar.gz | ||
patches: | ||
- skip_library_build.patch | ||
- url: https://github.com/qcscine/development-utils/archive/refs/tags/4.0.0.tar.gz | ||
sha256: 54002c2082b6bb75672ec66bf9cf3935bbdf6b085ed9b4d7174cbdedb7c2275d | ||
fn: dev.tar.gz | ||
folder: dev | ||
patches: | ||
- pybind11_pin.patch | ||
|
||
build: | ||
number: 0 | ||
skip: true # [win or osx] | ||
script: | ||
- set -ex | ||
- > | ||
cmake | ||
${CMAKE_ARGS} | ||
-B _build -G Ninja | ||
-DPython_EXECUTABLE="{{PYTHON}}" | ||
-DPython3_EXECUTABLE="{{PYTHON}}" | ||
-DSCINE_MARCH="" | ||
-DSCINE_SKIP_LIBRARY=ON | ||
-DSCINE_BUILD_TESTS=OFF | ||
-DSCINE_BUILD_PYTHON_BINDINGS=ON | ||
- cmake --build _build | ||
- cmake --install _build | ||
|
||
run_exports: | ||
- {{ pin_subpackage(pkg_name, max_pin='x') }} | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
- pkg-config | ||
- llvm-openmp # [osx] | ||
- libgomp # [linux] | ||
host: | ||
- boost-cpp | ||
- eigen | ||
- gtest | ||
- gmock | ||
- libblas | ||
- pip | ||
- pybind11 | ||
- pybind11-abi | ||
- python | ||
- scine-core | ||
- scine-utilsos | ||
- yaml-cpp | ||
run: | ||
- boost-cpp | ||
- eigen | ||
- numpy | ||
- pybind11 | ||
- python | ||
- yaml-cpp | ||
|
||
test: | ||
imports: | ||
- scine_utilities | ||
source_files: | ||
- src/Utils/Python/Tests/ | ||
requires: | ||
- pip | ||
commands: | ||
- python -m pip check | ||
- pytest src/Utils/Python/Tests/ | ||
|
||
about: | ||
license: BSD-3-Clause | ||
license_file: LICENSE.txt | ||
summary: | | ||
Contains functionality which is used in most SCINE modules (Python bindings). | ||
home: https://scine.ethz.ch/ | ||
dev_url: https://github.com/qcscine/utilities | ||
|
||
extra: | ||
recipe-maintainers: | ||
- awvwgk |
This file contains 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,13 @@ | ||
diff --git a/cmake/ImportPybind11.cmake b/cmake/ImportPybind11.cmake | ||
index 34d009c..a819e4c 100644 | ||
--- a/cmake/ImportPybind11.cmake | ||
+++ b/cmake/ImportPybind11.cmake | ||
@@ -6,7 +6,7 @@ | ||
macro(import_pybind11) | ||
# If the target already exists, do nothing | ||
if(NOT TARGET pybind11::pybind11) | ||
- find_package(pybind11 2.6.2 EXACT QUIET) | ||
+ find_package(pybind11) | ||
if(TARGET pybind11::pybind11) | ||
message(STATUS "Found pybind11 at ${pybind11_DIR}") | ||
else() |
This file contains 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,64 @@ | ||
diff --git a/src/Utils/CMakeLists.txt b/src/Utils/CMakeLists.txt | ||
index f435593..cfc8fb7 100644 | ||
--- a/src/Utils/CMakeLists.txt | ||
+++ b/src/Utils/CMakeLists.txt | ||
@@ -29,6 +29,7 @@ if(SCINE_PARALLELIZE) | ||
find_package(OpenMP REQUIRED) | ||
endif() | ||
|
||
+if(NOT SCINE_SKIP_LIBRARY) | ||
# Obey standard CMake behavior regarding shared/static libraries | ||
add_library(UtilsOS ${UTILS_HEADERS} ${UTILS_CPPS}) | ||
if(NOT BUILD_SHARED_LIBS) | ||
@@ -119,6 +120,10 @@ if(SCINE_BUILD_TESTS) | ||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
endif() | ||
+else() | ||
+include(ImportUtilsOS) | ||
+import_utils_os() | ||
+endif() | ||
|
||
# Python bindings | ||
if(SCINE_BUILD_PYTHON_BINDINGS) | ||
@@ -164,11 +169,13 @@ if(SCINE_BUILD_PYTHON_BINDINGS) | ||
${CMAKE_CURRENT_BINARY_DIR}/scine_utilities/__init__.py | ||
) | ||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Python/README.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
+ if(NOT SCINE_SKIP_LIBRARY) | ||
add_custom_command(TARGET UtilsOSModule POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:UtilsOSModule> ${CMAKE_CURRENT_BINARY_DIR}/scine_utilities | ||
COMMENT "Copying UtilsOS module into python package directory" | ||
) | ||
add_dependencies(scine_utilities UtilsOSModule) | ||
+ endif() | ||
|
||
# Figure out which targets need to be copied along | ||
set(_py_targets_to_copy Scine::Core) # Core is always shared | ||
@@ -187,11 +194,13 @@ if(SCINE_BUILD_PYTHON_BINDINGS) | ||
string(APPEND utils_PY_DEPS ", \"${_target_filename}\"") | ||
endforeach() | ||
|
||
+ if(NOT SCINE_SKIP_LIBRARY) | ||
add_custom_command(TARGET UtilsOS POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy ${_py_target_gen_exprs} ${CMAKE_CURRENT_BINARY_DIR}/scine_utilities | ||
COMMENT "Copying dependent shared libraries into python package directory" | ||
) | ||
message(STATUS "Targets to copy for python bindings: ${_py_targets_to_copy}") | ||
+ endif() | ||
unset(_py_targets_to_copy) | ||
|
||
# Typing stubs | ||
@@ -227,10 +236,12 @@ if(SCINE_BUILD_PYTHON_BINDINGS) | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doc-py | ||
DOCTEST | ||
) | ||
+ if(NOT SCINE_SKIP_LIBRARY) | ||
# The UtilsOSModule is technically also a dependency of the documentation | ||
if(TARGET scine_utilitiesDocumentation) | ||
add_dependencies(scine_utilitiesDocumentation UtilsOSModule) | ||
endif() | ||
+ endif() | ||
endif() | ||
|
||
if(SCINE_BUILD_PYTHON_BINDINGS) |