Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ jobs:
# all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
xcode: ['14.1', '15.0']
build_type: [Release]
shared: [OFF, ON]
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer

steps:
- uses: actions/checkout@v4

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D OPEN_ATMOS_BUILD_SHARED_LIBS=${{ matrix.shared }} -D CMAKE_POLICY_VERSION_MINIMUM=3.5

- name: Build
run: cmake --build build --parallel 10
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- { cpp: g++-14, c: gcc-14}
- { cpp: clang++, c: clang}
build_type: [Release]
shared: [OFF, ON]
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
Expand All @@ -31,7 +32,7 @@ jobs:
uses: actions/checkout@v4

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_POLICY_VERSION_MINIMUM=3.5
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D OPEN_ATMOS_BUILD_SHARED_LIBS=${{ matrix.shared }} -D CMAKE_POLICY_VERSION_MINIMUM=3.5

- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
build_type: [Release]
architecture: [Win32, x64]
shared: [OFF, ON]

steps:
- name: Checkout code
Expand All @@ -39,7 +40,7 @@ jobs:
architecture: 'x64'

- name: Run Cmake
run: cmake -S . -B build -A ${{ matrix.architecture }} -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DOPEN_ATMOS_ENABLE_PYTHON_LIBRARY=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
run: cmake -S . -B build -A ${{ matrix.architecture }} -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D OPEN_ATMOS_BUILD_SHARED_LIBS=${{ matrix.shared }} -DCMAKE_POLICY_VERSION_MINIMUM="3.5"

- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")

option(OPEN_ATMOS_ENABLE_TESTS "Build the tests" ON)
option(OPEN_ATMOS_ENABLE_PYTHON_LIBRARY "Build the python library" ON)
option(OPEN_ATMOS_BUILD_SHARED_LIBS "Build as a shared library" OFF)

set(OPEN_ATMOS_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(OPEN_ATMOS_LIB_DIR ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
Expand Down
8 changes: 8 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ FetchContent_Declare(yaml-cpp
)

set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
set(YAML_BUILD_SHARED_LIBS ${OPEN_ATMOS_BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)

FetchContent_MakeAvailable(yaml-cpp)

# Set output directories for yaml-cpp
set_target_properties(yaml-cpp PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${OPEN_ATMOS_LIB_DIR}
LIBRARY_OUTPUT_DIRECTORY ${OPEN_ATMOS_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY ${OPEN_ATMOS_LIB_DIR}
)

################################################################################
# pybind11

Expand Down
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ else()
set(PYTHON_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}")
endif()

install(TARGETS mechanism_configuration_python LIBRARY DESTINATION .)
install(TARGETS mechanism_configuration_python mechanism_configuration LIBRARY DESTINATION .)
15 changes: 11 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@
# version
configure_file(version.hpp.in ${PROJECT_SOURCE_DIR}/include/mechanism_configuration/version.hpp @ONLY)

add_library(mechanism_configuration)
if(OPEN_ATMOS_BUILD_SHARED_LIBS OR OPEN_ATMOS_ENABLE_PYTHON_LIBRARY)
set(OPEN_ATMOS_LIBRARY_TYPE SHARED)
else()
set(OPEN_ATMOS_LIBRARY_TYPE STATIC)
endif()

add_library(mechanism_configuration ${OPEN_ATMOS_LIBRARY_TYPE})
add_library(open_atmos::mechanism_configuration ALIAS mechanism_configuration)

target_compile_features(mechanism_configuration PUBLIC cxx_std_20)

if(OPEN_ATMOS_ENABLE_PYTHON_LIBRARY)
# Add the -fPIC flag for position-independent code if we are building the python library
# so that it links correctly on linux
if(OPEN_ATMOS_BUILD_SHARED_LIBS OR OPEN_ATMOS_ENABLE_PYTHON_LIBRARY)
# Add the -fPIC flag for position-independent code if we are building shared libraries
# or the python library so that it links correctly on linux
set_target_properties(mechanism_configuration PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

Expand Down Expand Up @@ -44,6 +50,7 @@ if (APPLE)
# set the rpath for the shared library
set_target_properties(mechanism_configuration PROPERTIES
INSTALL_RPATH "@loader_path"
BUILD_WITH_INSTALL_RPATH TRUE
)
elseif(UNIX)
# set the rpath for the shared library
Expand Down
Loading