Skip to content
Open
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
210 changes: 190 additions & 20 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
mempool: [on, off]
cxx_standard: [17]
python: [off]
installation_test: [off]
exclude:
- kokkos: off
mempool: on
Expand All @@ -34,6 +35,12 @@ jobs:
mpi: on
cxx_standard: 20
python: on
#run one config as installation test
- compiler: g++
mpi: on
kokkos: on
mempool: on
installation_test: on
env:
CXX: ${{matrix.compiler}}
MPICH_CXX: ${{matrix.compiler}}
Expand Down Expand Up @@ -106,7 +113,7 @@ jobs:
-Bbuild
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_INSTALL_PREFIX=build/install
-DBUILD_SHARED_LIBS=${{ matrix.python }}
-DBUILD_SHARED_LIBS=${{ matrix.installation_test == 'on' || matrix.python }}

- name: Build Kokkos
if: ${{ matrix.kokkos == 'on' }}
Expand All @@ -129,57 +136,220 @@ jobs:
-DCMAKE_INSTALL_PREFIX=build/install
-DADIOS2_USE_CUDA=OFF
-DADIOS2_USE_ZFP=OFF
-DBUILD_SHARED_LIBS=${{ matrix.python }}
-DBUILD_SHARED_LIBS=${{ matrix.installation_test == 'on' || matrix.python }}

- name: Build ADIOS2
if: ${{ matrix.mpi == 'on' }}
shell: bash
run: cmake --build $GITHUB_WORKSPACE/ADIOS2/build --target install

- name: cache hdf5
id: cache-hdf5
if: ${{ matrix.installation_test == 'on' }}
uses: actions/cache@v3
with:
path: ${{runner.temp}}/hdf5
key: build-hdf5-${{ matrix.compiler }}

- name: clone hdf5
if: ${{ matrix.installation_test == 'on' && steps.cache-hdf5.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}
run: git clone https://github.com/HDFGroup/hdf5.git hdf5

- name: build and install hdf5
if: ${{ matrix.installation_test == 'on' && steps.cache-hdf5.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}/hdf5
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_INSTALL_PREFIX=install \
-DBUILD_SHARED_LIBS=ON \
-DHDF5_BUILD_HL_LIB=ON \
-DHDF5_ENABLE_PARALLEL=ON \
-DHDF5_ENABLE_ZLIB_SUPPORT=ON
cmake --build . -j 4 --target install

- name: cache netcdf
id: cache-netcdf
if: ${{ matrix.installation_test == 'on' }}
uses: actions/cache@v3
with:
path: ${{runner.temp}}/netcdf-c
key: build-netcdf-${{ matrix.compiler }}

- name: clone netcdf
if: ${{ matrix.installation_test == 'on' && steps.cache-netcdf.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}
run: git clone https://github.com/Unidata/netcdf-c.git netcdf-c

- name: build and install netcdf
if: ${{ matrix.installation_test == 'on' && steps.cache-netcdf.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}/netcdf-c
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_INSTALL_PREFIX=install \
-DBUILD_SHARED_LIBS=ON \
-DHDF5_ROOT=${{runner.temp}}/hdf5/build/install \
-DNETCDF_ENABLE_HDF5=ON \
-DNETCDF_ENABLE_DAP=OFF \
-DNETCDF_ENABLE_LOGGING=ON \
-DNETCDF_ENABLE_LIBXML2=OFF
cmake --build . -j 4 --target install

- name: cache seacas
id: cache-seacas
if: ${{ matrix.installation_test == 'on' }}
uses: actions/cache@v3
with:
path: ${{runner.temp}}/seacas
key: build-seacas-${{ matrix.compiler }}

- name: clone seacas
if: ${{ matrix.installation_test == 'on' && steps.cache-seacas.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}
run: git clone --depth 1 https://github.com/sandialabs/seacas.git seacas

- name: build and install seacas
if: ${{ matrix.installation_test == 'on' && steps.cache-seacas.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}/seacas
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_INSTALL_PREFIX=install \
-DBUILD_SHARED_LIBS=ON \
-DSeacas_ENABLE_SEACASExodus=ON \
-DSeacas_ENABLE_Fortran=OFF \
-DSeacas_ENABLE_TESTS=OFF \
-DTPL_ENABLE_Netcdf=ON \
-DTPL_ENABLE_MPI=ON \
-DTPL_ENABLE_Pthread=OFF \
-DNetCDF_ROOT=${{runner.temp}}/netcdf-c/build/install \
-DHDF5_ROOT=${{runner.temp}}/hdf5/build/install \
-DHDF5_NO_SYSTEM_PATHS=YES
cmake --build . -j 4 --target install

- name: cache libMeshb
id: cache-libmeshb
if: ${{ matrix.installation_test == 'on' }}
uses: actions/cache@v3
with:
path: ${{runner.temp}}/libmeshb
key: build-libmeshb-${{ matrix.compiler }}

- name: clone libMeshb
if: ${{ matrix.installation_test == 'on' && steps.cache-libmeshb.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}
run: git clone --branch v7.80 --depth 1 https://github.com/LoicMarechal/libMeshb.git libmeshb

- name: build and install libMeshb
if: ${{ matrix.installation_test == 'on' && steps.cache-libmeshb.outputs.cache-hit != 'true' }}
working-directory: ${{runner.temp}}/libmeshb
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=install \
-DBUILD_SHARED_LIBS=ON
cmake --build . -j 4 --target install

- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/omega_h
run: |
export CMAKE_PREFIX_PATH="${{runner.temp }}/gmsh/install:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="${{runner.temp }}/gmsh/install/lib:$LD_LIBRARY_PATH"
export CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/ADIOS2/build/install:$CMAKE_PREFIX_PATH"
if [ "${{ matrix.python }}" == "on" ]; then
export CMAKE_PREFIX_PATH="$(python -m pybind11 --cmakedir):$CMAKE_PREFIX_PATH"
fi
cmake . -Bbuild \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DOmega_h_USE_MPI=${{ matrix.mpi }} \
-DOmega_h_USE_Kokkos=${{ matrix.kokkos }} \
-DKokkos_PREFIX=$GITHUB_WORKSPACE/kokkos/build/install \
-DOmega_h_USE_pybind11=${{ matrix.python }} \
-DOmega_h_USE_Gmsh=ON \
-DGmsh_INCLUDE_DIRS=${{runner.temp }}/gmsh/install/include \
-DGmsh_LIBRARIES=${{runner.temp }}/gmsh/install/lib/libgmsh.so.4.14.1 \
-DOmega_h_USE_ADIOS2=${{ matrix.mpi }} \
-DBUILD_TESTING=ON \
-DBUILD_SHARED_LIBS=${{ matrix.python }} \
-DENABLE_CTEST_MEMPOOL=${{ matrix.mempool }}
if [ "${{ matrix.installation_test }}" == "on" ]; then
cmake . -Bbuild \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/omega_h/build/install \
-DOmega_h_USE_MPI=ON \
-DOmega_h_USE_Kokkos=ON \
-DKokkos_PREFIX=$GITHUB_WORKSPACE/kokkos/build/install \
-DOmega_h_USE_Gmsh=ON \
-DGmsh_INCLUDE_DIRS=${{runner.temp }}/gmsh/install/include \
-DGmsh_LIBRARIES=${{runner.temp }}/gmsh/install/lib/libgmsh.so.4.14.1 \
-DOmega_h_USE_ADIOS2=ON \
-DOmega_h_USE_libMeshb=ON \
-DlibMeshb_PREFIX=${{runner.temp}}/libmeshb/build/install \
-DOmega_h_USE_SEACASExodus=ON \
-DSEACASExodus_PREFIX=${{runner.temp}}/seacas/build/install \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON
else
cmake . -Bbuild \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DOmega_h_USE_MPI=${{ matrix.mpi }} \
-DOmega_h_USE_Kokkos=${{ matrix.kokkos }} \
-DKokkos_PREFIX=$GITHUB_WORKSPACE/kokkos/build/install \
-DOmega_h_USE_pybind11=${{ matrix.python }} \
-DOmega_h_USE_Gmsh=ON \
-DGmsh_INCLUDE_DIRS=${{runner.temp }}/gmsh/install/include \
-DGmsh_LIBRARIES=${{runner.temp }}/gmsh/install/lib/libgmsh.so.4.14.1 \
-DOmega_h_USE_ADIOS2=${{ matrix.mpi }} \
-DBUILD_TESTING=ON \
-DBUILD_SHARED_LIBS=${{ matrix.python }} \
-DENABLE_CTEST_MEMPOOL=${{ matrix.mempool }}
fi

- name: Build
if: ${{ matrix.installation_test != 'on' }}
working-directory: ${{github.workspace}}/omega_h/build
shell: bash
run: cmake --build . -j2

- name: Test
if: ${{ matrix.installation_test != 'on' }}
working-directory: ${{github.workspace}}/omega_h/build
shell: bash
run: ctest
run: |
export LD_LIBRARY_PATH="${{runner.temp}}/gmsh/install/lib:$GITHUB_WORKSPACE/kokkos/build/install/lib:$GITHUB_WORKSPACE/ADIOS2/build/install/lib:$LD_LIBRARY_PATH"
ctest

- name: Test Python
if: ${{ matrix.python == 'on' }}
working-directory: ${{github.workspace}}/omega_h/build
shell: bash
run: |
export LD_LIBRARY_PATH="${{runner.temp}}/gmsh/install/lib:$GITHUB_WORKSPACE/kokkos/build/install/lib:$GITHUB_WORKSPACE/ADIOS2/build/install/lib:$LD_LIBRARY_PATH"
export PYTHONPATH=${{github.workspace}}/omega_h/build/src:$PYTHONPATH
pytest ${{github.workspace}}/omega_h/pytest

- name: Install
if: ${{ matrix.installation_test == 'on' }}
working-directory: ${{github.workspace}}/omega_h/build
shell: bash
run: cmake --build . -j2 --target install

- name: Test Installation
if: ${{ matrix.installation_test == 'on' }}
working-directory: ${{github.workspace}}/omega_h/example/external_installation
shell: bash
run: |
export CMAKE_PREFIX_PATH="${{runner.temp}}/gmsh/install:$GITHUB_WORKSPACE/ADIOS2/build/install:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="${{github.workspace}}/omega_h/build/install/lib:${{runner.temp}}/gmsh/install/lib:$GITHUB_WORKSPACE/kokkos/build/install/lib:$GITHUB_WORKSPACE/ADIOS2/build/install/lib:${{runner.temp}}/hdf5/build/install/lib:${{runner.temp}}/netcdf-c/build/install/lib:${{runner.temp}}/seacas/build/install/lib:${{runner.temp}}/libmeshb/build/install/lib:$LD_LIBRARY_PATH"
mkdir build
cd build
cmake .. -DOmega_h_DIR=${{github.workspace}}/omega_h/build/install/lib/cmake/Omega_h
cmake --build .
ctest --output-on-failure

- name: Print
if: always()
if: ${{ matrix.installation_test != 'on' && always() }}
run: cat ${{github.workspace}}/omega_h/build/Testing/Temporary/LastTest.log
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ if (Omega_h_ENABLE_DEMANGLED_STACKTRACE)
endif()

if (Omega_h_USE_MPI)
enable_language(C)
set(MPI_REQUIRED_VERSION 3)
bob_add_dependency(PUBLIC NAME MPI COMPONENTS CXX TARGETS MPI::MPI_CXX)
if (Omega_h_USE_ADIOS2)
enable_language(C)
set(MPI_REQUIRED_VERSION 3)
bob_add_dependency(PUBLIC NAME MPI COMPONENTS C CXX TARGETS MPI::MPI_CXX)
else()
set(MPI_REQUIRED_VERSION 3)
bob_add_dependency(PUBLIC NAME MPI COMPONENTS CXX TARGETS MPI::MPI_CXX)
endif()
endif()

set(Omega_h_USE_ZLIB_DEFAULT ON)
Expand Down Expand Up @@ -87,6 +92,10 @@ bob_add_dependency(PUBLIC NAME SEACASExodus TARGETS SEACASExodus::all_libs)
set(Omega_h_USE_pybind11_DEFAULT OFF)
bob_public_dep(pybind11)

set(Omega_h_USE_ADIOS2_DEFAULT OFF)
set(ADIOS2_PREFIX_DEFAULT ${ADIOS2_DIR})
bob_add_dependency(PUBLIC NAME ADIOS2 TARGETS adios2::adios2)

if(Omega_h_USE_Kokkos)
bob_option(Omega_h_USE_Kokkos_Sort "Use Kokkos sort_by_key instead of vendor (Thrust, SYCL, etc.) provided sorting APIs." ON)
if(Omega_h_USE_Kokkos_Sort AND Kokkos_VERSION VERSION_LESS 4.3)
Expand Down
19 changes: 17 additions & 2 deletions cmake/FindGmsh.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,23 @@ if(Gmsh_EXECUTABLE)
endif()
endif()

find_path(Gmsh_INCLUDE_DIRS NAMES gmsh.h)
find_library(Gmsh_LIBRARIES NAMES gmsh)
# Get hints from executable location
if(Gmsh_EXECUTABLE)
get_filename_component(Gmsh_BINARY_DIR "${Gmsh_EXECUTABLE}" DIRECTORY)
get_filename_component(Gmsh_PREFIX_HINT "${Gmsh_BINARY_DIR}" DIRECTORY)
endif()

find_path(Gmsh_INCLUDE_DIRS
NAMES gmsh.h
HINTS ${Gmsh_PREFIX_HINT}
PATH_SUFFIXES include
)

find_library(Gmsh_LIBRARIES
NAMES gmsh
HINTS ${Gmsh_PREFIX_HINT}
PATH_SUFFIXES lib lib64
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Expand Down
15 changes: 15 additions & 0 deletions cmake/bob.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,28 @@ endmacro(latest_find_dependency)"
set(FIND_DEPS_CONTENT)
foreach(dep IN LISTS ${PROJECT_NAME}_DEPS)
string(REPLACE ";" " " FIND_DEP_ARGS "${${dep}_find_package_args}")
# Enable C language before finding MPI if MPI requires C component
if(dep STREQUAL "MPI" AND FIND_DEP_ARGS MATCHES "C")
set(FIND_DEPS_CONTENT
"${FIND_DEPS_CONTENT}
enable_language(C)"
)
endif()
set(FIND_DEPS_CONTENT
"${FIND_DEPS_CONTENT}
latest_find_dependency(${dep} ${FIND_DEP_ARGS})"
)
endforeach()
foreach(dep IN LISTS ${PROJECT_NAME}_DEPS)
if(EXISTS "${PROJECT_SOURCE_DIR}/cmake/Find${dep}.cmake")
install(FILES
"${PROJECT_SOURCE_DIR}/cmake/Find${dep}.cmake"
DESTINATION ${BOB_LIB_DESTINATION}/cmake/${PROJECT_NAME})
Comment thread
Sichao25 marked this conversation as resolved.
endif()
endforeach()
set(CONFIG_CONTENT
"set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION})
list(APPEND CMAKE_MODULE_PATH \"\${CMAKE_CURRENT_LIST_DIR}\")
${LATEST_FIND_DEPENDENCY}
${FIND_DEPS_CONTENT}
set(${PROJECT_NAME}_EXPORTED_TARGETS \"${${PROJECT_NAME}_EXPORTED_TARGETS}\")
Expand Down
21 changes: 21 additions & 0 deletions example/external_installation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.10)
project(TestOmegaHConfig CXX)

set(CMAKE_CXX_EXTENSIONS OFF)

# Enable testing
enable_testing()

# Find Omega_h package
find_package(Omega_h REQUIRED)

# Create test executable
add_executable(test_export test_export.cpp)

# Link with Omega_h
target_link_libraries(test_export Omega_h::omega_h)

# Add test
add_test(NAME test_export COMMAND test_export)
set_tests_properties(test_export PROPERTIES
PASS_REGULAR_EXPRESSION "Test completed successfully!")
Loading
Loading