diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7111081 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: main + pull_request: + branches: main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Unset CC and CXX + run: | + test -n $CC && unset CC + test -n $CXX && unset CXX + + - name: Install deps + run: | + sudo apt-get update + sudo apt-get install cmake mpich liblapack-dev libboost-filesystem-dev libboost-system-dev python3 clang + sudo pip install numpy pyamg + - name: build Cedar setup + run: | + mkdir build + cd build + cmake -DENABLE_UNIT_TESTS=yes -DCMAKE_CXX_COMPILER=clang++ .. + - name: make and test Cedar + run: | + cd build + make && make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c2a39e..208812a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,10 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.19) project(cedar VERSION 0.1.0 LANGUAGES CXX C Fortran) set(CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) +set(MPI_LANGUAGE C Fortran) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) @@ -57,7 +58,7 @@ FIND_PACKAGE(Boost 1.44 REQUIRED COMPONENTS system filesystem) FIND_PACKAGE(BLAS REQUIRED) FIND_PACKAGE(LAPACK REQUIRED) -find_package(MPI REQUIRED) +find_package(MPI COMPONENTS C Fortran REQUIRED) if (ENABLE_PLANE_AGG) find_package(Argobots REQUIRED) @@ -82,9 +83,8 @@ target_link_libraries(cedar PUBLIC ${Boost_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} - ${MPI_C_LIBRARIES} - ${MPI_CXX_LIBRARIES} - ${MPI_Fortran_LIBRARIES}) + PUBLIC MPI::MPI_C + MPI::MPI_Fortran) include_directories(${json_location}) include_directories(${tausch_location}) target_compile_definitions(cedar PUBLIC WITH_TAUSCH) @@ -136,8 +136,7 @@ if(ENABLE_EXAMPLES) endif() if(ENABLE_UNIT_TESTS) - find_package(PythonLibs REQUIRED) - find_package(NumPy REQUIRED) + find_package(Python3 COMPONENTS Interpreter Development NumPy) message(STATUS ${PYTHON_INCLUDE_DIR}) list(APPEND cedar-deps ${PYTHON_LIBRARY}) include_directories(${PYTHON_INCLUDE_DIR} ${PYTHON_NUMPY_INCLUDE_DIR})