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

wheel building with scikit build core #3087

Open
wants to merge 90 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
e9101ab
draft scikit build core wheel
shimwell Jul 19, 2024
e857f45
renamed executable
shimwell Jul 19, 2024
61b7035
linking libopenmc with openmc in cmakelists
jon-proximafusion Jul 19, 2024
12cb43d
Merge branch 'scikit_build_core_wheel' of github.com:shimwell/openmc …
jon-proximafusion Jul 19, 2024
2541d50
updated docs for pip install that compiles
jon-proximafusion Jul 19, 2024
f15e80f
pip install with cmake args in ci
jon-proximafusion Jul 23, 2024
3c98d8a
added missing ,
jon-proximafusion Jul 23, 2024
0aafd44
no need for manual creation of build dir
jon-proximafusion Jul 23, 2024
12b4221
[skip ci] merged develop
shimwell Jul 26, 2024
9ef3beb
[skip ci] adding apt packages for read the docs
shimwell Jul 26, 2024
40ceaad
[skip ci] trying ubuntu 22.04
shimwell Jul 26, 2024
2c8cf71
[skip ci] added missing s
shimwell Jul 26, 2024
4c0075f
adding gha actions
shimwell Jul 26, 2024
4de0d94
upper case ON for cmake args
shimwell Jul 26, 2024
688d688
added quotes to cmake args
shimwell Jul 26, 2024
07a4dcd
keeping same filename
shimwell Jul 26, 2024
9253977
running just pytest
shimwell Jul 26, 2024
1f01694
[skip ci] corrected cmake arg passing example
shimwell Jul 26, 2024
6850217
added diagnosis prints
shimwell Jul 27, 2024
a601de8
Merge branch 'scikit_build_core_wheel' of github.com:shimwell/openmc …
shimwell Jul 27, 2024
97a3f22
removed 2nd pip install which was overwritting
shimwell Jul 27, 2024
3ae207d
Merge branch 'develop' into scikit_build_core_wheel
shimwell Aug 14, 2024
e40cf3b
merge in develop
shimwell Aug 14, 2024
0213392
matching simulation results from ci
jon-proximafusion Aug 14, 2024
6e3e47e
using debug instead of on for DCMAKE_BUILD_TYPE
shimwell Sep 12, 2024
b4b4e3a
scikit-build-core added
ahnaf-tahmid-chowdhury Sep 17, 2024
79ae016
Add rpath
ahnaf-tahmid-chowdhury Sep 20, 2024
394b0f9
Install by scikit-build-core
ahnaf-tahmid-chowdhury Sep 24, 2024
12aec22
update python install doc
ahnaf-tahmid-chowdhury Sep 24, 2024
564cb5f
add support for dev mode
ahnaf-tahmid-chowdhury Sep 24, 2024
1f1faca
update dev doc with skbuild support
ahnaf-tahmid-chowdhury Sep 24, 2024
f4e0faa
Merge branch 'openmc-dev:develop' into scikit_build_core_wheel
shimwell Sep 24, 2024
f88e5ef
Merge branch 'scikit-build-core' into scikit_build_core_wheel
ahnaf-tahmid-chowdhury Sep 24, 2024
f114265
back to -j4 for make
jon-proximafusion Sep 25, 2024
c577d50
adding cmake args to pip install command
jon-proximafusion Sep 25, 2024
ec7e11f
[skip ci] cmake args actual openmc options
jon-proximafusion Sep 25, 2024
03a6744
add manylinux docker
ahnaf-tahmid-chowdhury Sep 30, 2024
556adbb
add gcc and mpi build
ahnaf-tahmid-chowdhury Sep 30, 2024
ef1ca2f
Add openmc options and add more docs
ahnaf-tahmid-chowdhury Sep 30, 2024
ead096d
install openmpi on openmpi stage
ahnaf-tahmid-chowdhury Sep 30, 2024
8a7362e
add /usr/local/lib64 to path
ahnaf-tahmid-chowdhury Sep 30, 2024
9985fab
add workflow
ahnaf-tahmid-chowdhury Sep 30, 2024
65ae22c
remove setup.py
ahnaf-tahmid-chowdhury Sep 30, 2024
ac5648c
remove test stage
ahnaf-tahmid-chowdhury Oct 1, 2024
db8265f
add pypi
ahnaf-tahmid-chowdhury Oct 1, 2024
a205ef7
move python deps to last
ahnaf-tahmid-chowdhury Oct 1, 2024
7036ec6
fix pytest-cov issue
ahnaf-tahmid-chowdhury Oct 2, 2024
1d8e951
fix pytest-cov issue
ahnaf-tahmid-chowdhury Oct 2, 2024
0043634
no need abi
ahnaf-tahmid-chowdhury Oct 2, 2024
9e65e4a
fix path
ahnaf-tahmid-chowdhury Oct 2, 2024
1985003
move openmc to src
ahnaf-tahmid-chowdhury Oct 3, 2024
303f596
no need to copy lib to openmc
ahnaf-tahmid-chowdhury Oct 3, 2024
1813d6e
remove BUILD_EXAMPLES
ahnaf-tahmid-chowdhury Oct 3, 2024
2cbce3b
python deps stage
ahnaf-tahmid-chowdhury Oct 3, 2024
a88e926
Merge remote-tracking branch 'upstream/develop' into scikit_build_cor…
ahnaf-tahmid-chowdhury Oct 3, 2024
d588670
pip install numpy
ahnaf-tahmid-chowdhury Oct 3, 2024
4b08da7
fail-fast: false
ahnaf-tahmid-chowdhury Oct 3, 2024
db2bb3f
sdist.include = ["src/openmc/**"]
ahnaf-tahmid-chowdhury Oct 3, 2024
63e1b26
set DATAROOTDIR
ahnaf-tahmid-chowdhury Oct 4, 2024
cbca837
add vendor packages
ahnaf-tahmid-chowdhury Oct 4, 2024
995c840
add more dirs
ahnaf-tahmid-chowdhury Oct 4, 2024
d68bac5
CMAKE_INSTALL_DATADIR
ahnaf-tahmid-chowdhury Oct 4, 2024
07126a0
no need OpenMCTargets for skbuild
ahnaf-tahmid-chowdhury Oct 5, 2024
bf0f400
install rpath if var is defined
ahnaf-tahmid-chowdhury Oct 5, 2024
12acf73
eval $(ncrystal-config --setup)
ahnaf-tahmid-chowdhury Oct 5, 2024
bf334ce
sdist include *.h5
ahnaf-tahmid-chowdhury Oct 8, 2024
e3398a4
Merge remote-tracking branch 'upstream/develop' into scikit_build_cor…
ahnaf-tahmid-chowdhury Oct 8, 2024
4e69397
setup openmc lib for skbuild
ahnaf-tahmid-chowdhury Oct 17, 2024
4a69b09
prepare for merge
ahnaf-tahmid-chowdhury Oct 17, 2024
3b80c4c
Merge remote-tracking branch 'upstream/develop' into scikit_build_cor…
ahnaf-tahmid-chowdhury Oct 17, 2024
d0740ce
move openmc to src again
ahnaf-tahmid-chowdhury Oct 17, 2024
fbda530
update lib paths
ahnaf-tahmid-chowdhury Oct 17, 2024
0d3f6f2
add include
ahnaf-tahmid-chowdhury Oct 18, 2024
15e34f9
Merge remote-tracking branch 'upstream/develop' into scikit_build_cor…
ahnaf-tahmid-chowdhury Oct 19, 2024
af0f1d5
add openmc.in
ahnaf-tahmid-chowdhury Oct 19, 2024
e2802f3
use OpenMC targets
ahnaf-tahmid-chowdhury Oct 19, 2024
db1d8d1
install source version
ahnaf-tahmid-chowdhury Oct 19, 2024
7a0a56d
add SKBUILDScripts.cmake
ahnaf-tahmid-chowdhury Oct 20, 2024
8dabae4
update get_core_path
ahnaf-tahmid-chowdhury Oct 20, 2024
b8f634c
add /usr/local/lib/ to lib path
ahnaf-tahmid-chowdhury Oct 20, 2024
73cd266
remove file openmc_exec
ahnaf-tahmid-chowdhury Oct 20, 2024
ea6fab9
remove openmc_exec
ahnaf-tahmid-chowdhury Oct 20, 2024
e519189
Allow CMAKE_INSTALL_RPATH_USE_LINK_PATH
ahnaf-tahmid-chowdhury Oct 20, 2024
32d96e2
renamed to GenerateScript.cmake
ahnaf-tahmid-chowdhury Oct 20, 2024
f52ff64
remove SKBUILDScripts
ahnaf-tahmid-chowdhury Oct 20, 2024
d1f8ae3
revert
ahnaf-tahmid-chowdhury Oct 22, 2024
ddb6c96
update to 1.8
ahnaf-tahmid-chowdhury Oct 22, 2024
c1bcb8c
reduced diff
jon-proximafusion Nov 8, 2024
f7441af
Merge branch 'develop' into scikit_build_core_wheel
jon-proximafusion Nov 8, 2024
6065c69
reducing diff
jon-proximafusion Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ jobs:

- name: test
shell: bash
run: |
CTEST_OUTPUT_ON_FAILURE=1 make test -C $GITHUB_WORKSPACE/build/
$GITHUB_WORKSPACE/tools/ci/gha-script.sh
run: $GITHUB_WORKSPACE/tools/ci/gha-script.sh

- name: after_success
shell: bash
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/docker-publish-manylinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Build & Publish Manylinux Images

on:
# allows us to run workflows manually
workflow_dispatch:
push:
paths:
- "tools/ci/manylinux.dockerfile"
- ".github/workflows/docker-publish-manylinux.yml"

jobs:
build-dependency-and-test-img:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
manylinux_image: [
manylinux_2_28_x86_64
]
compiler: [
gcc,
openmpi
]

name: Installing Dependencies, Building OpenMC and running tests
steps:
- name: default environment
run: |
echo "tag-latest-on-default=false" >> "$GITHUB_ENV"

- name: condition on trigger parameters
if: ${{ github.repository_owner == 'openmc-dev' && github.ref == 'refs/heads/develop' }}
run: |
echo "tag-latest-on-default=true" >> "$GITHUB_ENV"

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Configure docker image tag
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/
image_base_tag+=openmc-${{ matrix.manylinux_image }}
image_base_tag+=-${{ matrix.compiler}}
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"

- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ${{ env.image_base_tag }}
stages: base, dependencies, python-dependencies
server-stage: openmc
quiet: false
parallel: true
tag-latest-on-default: ${{ env.tag-latest-on-default }}
dockerfile: tools/ci/manylinux.dockerfile
build-args: >
MANYLINUX_IMAGE=${{ matrix.manylinux_image }},
COMPILER=${{ matrix.compiler }}
push_stable_ci_img:
needs: [build-dependency-and-test-img]
runs-on: ubuntu-latest

strategy:
matrix:
manylinux_image: [
manylinux_2_28_x86_64
]
compiler: [
gcc,
openmpi
]

name: Pushing final images
steps:
- name: Log in to the Container registry
if: ${{ github.repository_owner == 'openmc-dev' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure docker image tag
if: ${{ github.repository_owner == 'openmc-dev' }}
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/
image_base_tag+=openmc-${{ matrix.manylinux_image }}
image_base_tag+=-${{ matrix.compiler}}
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"

- name: Push Image as latest img
if: ${{ github.repository_owner == 'openmc-dev' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/[email protected]
with:
src: ${{ env.image_base_tag }}/openmc:latest
dst: ${{ env.image_base_tag }}:latest

- name: Push Image as latest img
if: ${{ github.repository_owner == 'openmc-dev' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/[email protected]
with:
src: ${{ env.image_base_tag }}:latest
dst: ${{ env.image_base_tag }}:stable
57 changes: 57 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish wheels to PyPI

on:
# allows running workflows manually
workflow_dispatch:

release:
types: [published]

jobs:
main:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: manylinux_x86_64
- os: macos-13
arch: macosx_x86_64
- os: macos-14
arch: macosx_arm64

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp*-${{ matrix.arch }}"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/${{ github.repository_owner }}/openmc-manylinux_2_28_x86_64-gcc/python-dependencies:latest
CIBW_ARCHS_MACOS: "native"
CIBW_BEFORE_BUILD_MACOS: |
brew install llvm cmake xtensor hdf5 python libomp libpng
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=${{ matrix.os == 'macos-14' && '14.0' || '13.0' }}
DYLD_LIBRARY_PATH=/usr/local/opt/gcc/lib/gcc/current/:$DYLD_LIBRARY_PATH
CXX=$(brew --prefix llvm)/bin/clang++
HDF5_ROOT=$(brew --prefix hdf5)
CIBW_BUILD_FRONTEND: "build"
with:
package-dir: openmc
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"

- name: Publish package to PyPI
if: success()
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload wheelhouse/*.whl
7 changes: 6 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
version: 2

build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "3.10"
apt_packages:
- g++
- cmake
- libhdf5-dev
- libpng-dev

sphinx:
configuration: docs/source/conf.py
Expand Down
131 changes: 103 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(openmc C CXX)

# Set version numbers
Expand All @@ -16,6 +16,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Set module path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

# Conditionally find Python if building with scikit-build-core
if(SKBUILD)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
endif()

# Enable correct usage of CXX_EXTENSIONS
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
cmake_policy(SET CMP0128 NEW)
Expand All @@ -36,6 +41,17 @@ option(OPENMC_USE_MCPL "Enable MCPL"
option(OPENMC_USE_NCRYSTAL "Enable support for NCrystal scattering" OFF)
option(OPENMC_USE_UWUW "Enable UWUW" OFF)

message(STATUS "OPENMC_USE_OPENMP ${OPENMC_USE_OPENMP}")
message(STATUS "OPENMC_BUILD_TESTS ${OPENMC_BUILD_TESTS}")
message(STATUS "OPENMC_ENABLE_PROFILE ${OPENMC_ENABLE_PROFILE}")
message(STATUS "OPENMC_ENABLE_COVERAGE ${OPENMC_ENABLE_COVERAGE}")
message(STATUS "OPENMC_USE_DAGMC ${OPENMC_USE_DAGMC}")
message(STATUS "OPENMC_USE_LIBMESH ${OPENMC_USE_LIBMESH}")
message(STATUS "OPENMC_USE_MPI ${OPENMC_USE_MPI}")
message(STATUS "OPENMC_USE_MCPL ${OPENMC_USE_MCPL}")
message(STATUS "OPENMC_USE_NCRYSTAL ${OPENMC_USE_NCRYSTAL}")
message(STATUS "OPENMC_USE_UWUW ${OPENMC_USE_UWUW}")

# Warnings for deprecated options
shimwell marked this conversation as resolved.
Show resolved Hide resolved
foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh")
if(DEFINED ${OLD_OPT})
Expand Down Expand Up @@ -310,23 +326,52 @@ include(GNUInstallDirs)
# installed one in CMAKE_INSTALL_PREFIX. Ref:
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling

# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
if(SKBUILD)
# Find necessary packages
find_package(
Python
COMPONENTS Interpreter
REQUIRED
)
# By default, scikit-build will install everything to ${SKBUILD_PLATLIB_DIR}/openmc
# Install include and bin directories to ${SKBUILD_PLATLIB_DIR}/openmc/SKBUILD_SUBDIR
set(SKBUILD_SUBDIR core/)
set(CMAKE_INSTALL_BINDIR ${SKBUILD_SUBDIR}${CMAKE_INSTALL_BINDIR})
set(CMAKE_INSTALL_INCLUDEDIR ${SKBUILD_SUBDIR}${CMAKE_INSTALL_INCLUDEDIR})
set(CMAKE_INSTALL_DATADIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_DATADIR})
set(CMAKE_INSTALL_DOCDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_DOCDIR})
set(CMAKE_INSTALL_INFODIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_INFODIR})
set(CMAKE_INSTALL_MANDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_MANDIR})
set(CMAKE_INSTALL_LOCALEDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_LOCALEDIR})
set(CMAKE_INSTALL_LOCALSTATEDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_LOCALSTATEDIR})
set(CMAKE_INSTALL_RUNSTATEDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_RUNSTATEDIR})
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(OPENMC_LIBRARY_RPATH "@loader_path")
set(OPENMC_BINARY_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
elseif(UNIX)
set(OPENMC_LIBRARY_RPATH "$ORIGIN")
set(OPENMC_BINARY_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
else()
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
endif()
#===============================================================================
# libopenmc
#===============================================================================
Expand Down Expand Up @@ -465,14 +510,22 @@ endif()

target_include_directories(libopenmc
PUBLIC
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${HDF5_INCLUDE_DIRS}
)

# Set compile flags
target_compile_options(libopenmc PRIVATE ${cxxflags})

if(OPENMC_LIBRARY_RPATH)
set_target_properties(
libopenmc
PROPERTIES
INSTALL_RPATH "${OPENMC_LIBRARY_RPATH}"
)
endif()

# Add include directory for configured version file
target_include_directories(libopenmc
PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
Expand Down Expand Up @@ -581,15 +634,13 @@ target_compile_features(openmc PUBLIC cxx_std_17)
target_compile_features(libopenmc PUBLIC cxx_std_17)
set_target_properties(openmc libopenmc PROPERTIES CXX_EXTENSIONS OFF)

#===============================================================================
# Python package
#===============================================================================

add_custom_command(TARGET libopenmc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:libopenmc>
${CMAKE_CURRENT_SOURCE_DIR}/openmc/lib/$<TARGET_FILE_NAME:libopenmc>
COMMENT "Copying libopenmc to Python module directory")
if(OPENMC_BINARY_RPATH)
set_target_properties(
openmc
PROPERTIES
INSTALL_RPATH "${OPENMC_BINARY_RPATH}"
)
endif()

#===============================================================================
# Install executable, scripts, manpage, license
Expand All @@ -598,17 +649,41 @@ add_custom_command(TARGET libopenmc POST_BUILD
configure_file(cmake/OpenMCConfig.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfig.cmake" @ONLY)
configure_file(cmake/OpenMCConfigVersion.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfigVersion.cmake" @ONLY)

set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
if(SKBUILD)
set(INSTALL_CONFIGDIR ${SKBUILD_DATA_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
else()
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
endif()

install(TARGETS openmc libopenmc
EXPORT openmc-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${SKBUILD_SUBDIR}${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${SKBUILD_SUBDIR}${CMAKE_INSTALL_LIBDIR}
)

set(INSTALL_TARGETDIR ${SKBUILD_SUBDIR}${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
install(EXPORT openmc-targets
FILE OpenMCTargets.cmake
NAMESPACE OpenMC::
DESTINATION ${INSTALL_CONFIGDIR})
DESTINATION ${INSTALL_TARGETDIR}
)

# Collect scripts
file(GLOB SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*")

# Install scripts to bin directory
if(SKBUILD)
install(PROGRAMS ${SCRIPTS} DESTINATION ${SKBUILD_SCRIPTS_DIR})
else()
install(PROGRAMS ${SCRIPTS} DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

# Install openmc script
if(SKBUILD)
configure_file(cmake/openmc.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/openmc" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/openmc" DESTINATION ${SKBUILD_SCRIPTS_DIR})
endif()

install(FILES
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfig.cmake"
Expand Down
Loading
Loading