Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ updates:
# Check for updates once a week
schedule:
interval: "weekly"
# Group actions version bumps into a single PR
groups:
actions-deps:
patterns:
- "*"

2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
fetch-depth: 0 # Fetch full history for git describe to work

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
FMT_REF: "11.1.4"

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
fetch-depth: 0 # unshallow for setuptools-scm.get_version to discover tags

Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
path: C:\vcpkg\installed
key: ${{ matrix.os }}-${{ env.cache-name }}-a

- uses: pypa/cibuildwheel@v3.4.1
- uses: pypa/cibuildwheel@v4.1.0
if: startsWith(matrix.os, 'ubuntu-')
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
Expand Down Expand Up @@ -334,7 +334,7 @@ jobs:
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"

- uses: pypa/cibuildwheel@v3.4.1
- uses: pypa/cibuildwheel@v4.1.0
if: startsWith(matrix.os, 'macos-')
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
Expand Down
71 changes: 65 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ endif()
# ##############################################################################
option(AL_PYTHON_BINDINGS "Build Python bindings" OFF)

# When ON, the al C++ library is not built here; instead it is located with
# find_package(al-core CONFIG). Enables a two-stage build where libimas-core
# (the C/C++ library) and imas-core (the Python wrapper) are packaged
# separately, e.g. as two conda packages.
option(AL_USE_INSTALLED_CORE
"Link Python bindings against a pre-installed al-core (find_package)" OFF)


# Configuration options for shared libraries
# ##############################################################################
Expand Down Expand Up @@ -127,8 +134,31 @@ if(WIN32)
find_package(dlfcn-win32 CONFIG REQUIRED)
endif()

# build AL_CORE library only if backend is enabled
if(AL_BACKEND_HDF5 OR AL_BACKEND_MDSPLUS OR AL_BACKEND_UDA OR AL_BACKEND_UDAFAT OR AL_PYTHON_BINDINGS)
# Two-stage build entry: locate a pre-installed al-core instead of building it.
# Exposes target `al-core::al` and an unqualified alias `al` so the python/
# subdirectory and any consumers can link to `al` transparently.
if(AL_USE_INSTALLED_CORE)
find_package(al-core CONFIG)
if(NOT al-core_FOUND)
message(FATAL_ERROR
"AL_USE_INSTALLED_CORE=ON requires an installed al-core that ships "
"al-coreConfig.cmake (introduced in IMAS-Core 5.7.1 or later). "
"find_package(al-core CONFIG) could not locate it.\n"
"Point CMAKE_PREFIX_PATH (or al-core_DIR) at an install prefix that "
"contains lib/cmake/al-core/al-coreConfig.cmake — typically the "
"stage-1 install tree of this branch. Releases built before this "
"change (e.g. IMAS-Core/5.6.0) only ship al-core.pc and will NOT "
"satisfy AL_USE_INSTALLED_CORE; either install stage 1 from source "
"or wait for a release that includes the CMake package config.")
endif()
if(NOT TARGET al)
add_library(al ALIAS al-core::al)
endif()
endif()

# build AL_CORE library only if backend is enabled and we are not reusing an
# already-installed al-core
if((AL_BACKEND_HDF5 OR AL_BACKEND_MDSPLUS OR AL_BACKEND_UDA OR AL_BACKEND_UDAFAT OR AL_PYTHON_BINDINGS) AND NOT AL_USE_INSTALLED_CORE)

# Core dependencies
set(Boost_USE_MULTITHREADED FALSE)
Expand Down Expand Up @@ -199,14 +229,43 @@ add_dependencies( imas_print_version al )
# ##############################################################################

# Install al library
include(GNUInstallDirs)
install(
TARGETS al
EXPORT al-coreTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT core
)

# Export CMake package config so downstream projects (notably the Python
# wrapper built with AL_USE_INSTALLED_CORE=ON) can `find_package(al-core CONFIG)`.
include(CMakePackageConfigHelpers)
set(_al_core_cmake_dir ${CMAKE_INSTALL_LIBDIR}/cmake/al-core)
install(
EXPORT al-coreTargets
FILE al-coreTargets.cmake
NAMESPACE al-core::
DESTINATION ${_al_core_cmake_dir}
)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/al-coreConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/al-coreConfig.cmake
INSTALL_DESTINATION ${_al_core_cmake_dir}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/al-coreConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/al-coreConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/al-coreConfigVersion.cmake
DESTINATION ${_al_core_cmake_dir}
)

# TODO: put public heades in a separate directory?
install(
FILES ${PUBLIC_HEADER_FILES}
Expand Down Expand Up @@ -234,20 +293,20 @@ install(
)

# Install common files
# Note: The environment variable $AL_COMMON_PATH must be set to this installation directory at runtime
install(DIRECTORY common TYPE DATA)

# Install Dummy
install(TARGETS imas_print_version DESTINATION bin)

# Scikit-build-core entry point for python bindings
endif() # AL core library: (AL_BACKEND_* OR AL_PYTHON_BINDINGS) AND NOT AL_USE_INSTALLED_CORE

# Scikit-build-core entry point for python bindings — works whether `al` was
# just built here or imported via find_package(al-core).
# ##############################################################################
if(AL_PYTHON_BINDINGS)
include(skbuild.cmake)
endif()

endif() # AL core library (AL_BACKEND_HDF5 OR AL_BACKEND_MDSPLUS OR AL_BACKEND_UDA OR AL_BACKEND_UDAFAT OR AL_PYTHON_BINDINGS)


# MDSplus models
# ##############################################################################
Expand Down
8 changes: 8 additions & 0 deletions cmake/al-coreConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(Boost COMPONENTS filesystem)

include("${CMAKE_CURRENT_LIST_DIR}/al-coreTargets.cmake")

check_required_components(al-core)
35 changes: 14 additions & 21 deletions common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,30 @@ During the CMake configure step of any of the other Access Layer repositories
(`al-core`, `al-fortran`, etc.) this folder is imported by CMake:

```cmake
# Configuration options for common assets
# Configuration options for common repos
################################################################################
option( AL_DOWNLOAD_DEPENDENCIES "Automatically download assets from the AL git repository" ON )
set( AL_CORE_GIT_REPOSITORY "git@github.com:iterorganization/IMAS-Core.git" CACHE STRING "Git repository of AL-core" )
set( AL_CORE_VERSION "main" CACHE STRING "Git commit/tag/branch of AL-core" )

include(FetchContent)

# Load common assets
################################################################################
if( DEFINED ENV{AL_COMMON_PATH} )
# Take common assets from the path in this environment variable instead of al-core
set( AL_COMMON_PATH $ENV{AL_COMMON_PATH} )
if( ${AL_DOWNLOAD_DEPENDENCIES} )
# Download common assets from the ITER git:
FetchContent_Declare(
al-core
GIT_REPOSITORY "${AL_CORE_GIT_REPOSITORY}"
GIT_TAG "${AL_CORE_VERSION}"
)
else()
if( ${AL_DOWNLOAD_DEPENDENCIES} )
# Download common assets from the ITER git:
FetchContent_Declare(
al-core
GIT_REPOSITORY "${AL_CORE_GIT_REPOSITORY}"
GIT_TAG "${AL_CORE_VERSION}"
)
else()
FetchContent_Declare(
al-core
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../al-core"
)
endif()
FetchContent_MakeAvailable( al-core )
set( AL_COMMON_PATH "${al-core_SOURCE_DIR}/common" )
FetchContent_Declare(
al-core
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../al-core"
)
endif()
add_subdirectory( ${AL_COMMON_PATH} _common )
FetchContent_MakeAvailable( al-core )
add_subdirectory( "${al-core_SOURCE_DIR}/common" _common )
```

Contrary to what the name implies, the `GIT_TAG` can be a branch name, tag
Expand Down
7 changes: 1 addition & 6 deletions common/cmake/ALCommonConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ option( AL_DOCS_ONLY "Don't build anything, except the Sphinx-based High Level I
# No longer need to find SaxonHE - saxonche is installed automatically via pip in virtual environments

if( NOT AL_DOWNLOAD_DEPENDENCIES )
if( DEFINED ENV{AL_COMMON_PATH} )
set( _DEV OFF )
else()
set( _DEV ON )
endif()
option( AL_DEVELOPMENT_LAYOUT "Look into parent directories for dependencies" ${_DEV} )
option( AL_DEVELOPMENT_LAYOUT "Look into parent directories for dependencies" ON )
endif()

# Enable CTest?
Expand Down
Loading
Loading