Skip to content

Commit ed8e04b

Browse files
authored
Enables Jenkins (#4)
A minimal jenkins setup with environment for daint, kesch and tave (default gcc compilers).
1 parent 3f610d0 commit ed8e04b

8 files changed

Lines changed: 74 additions & 16 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
88

99
include(CTest)
1010

11+
set(REQUIRED_BOOST_VERSION 1.58)
12+
find_package(Boost ${REQUIRED_BOOST_VERSION} REQUIRED)
13+
1114
include(bindings)
1215

1316
if (BUILD_TESTING)

cmake/gt_bindings.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ set(BINDINGS_INCLUDE_DIR @BINDINGS_INCLUDE_DIR@)
3636
add_library(c_bindings_generator ${BINDINGS_SOURCE_DIR}/c_bindings/generator.cpp)
3737
# PUBLIC to make export.hpp available in the sources passed to add_bindings_library()
3838
target_include_directories(c_bindings_generator PUBLIC ${BINDINGS_INCLUDE_DIR})
39+
target_compile_features(c_bindings_generator PUBLIC cxx_std_11)
40+
target_link_libraries(c_bindings_generator PUBLIC Boost::boost)
3941

4042
add_library(c_bindings_handle ${BINDINGS_SOURCE_DIR}/c_bindings/handle.cpp)
4143
target_include_directories(c_bindings_handle PRIVATE ${BINDINGS_INCLUDE_DIR})
44+
target_compile_features(c_bindings_handle PRIVATE cxx_std_11)
45+
target_link_libraries(c_bindings_generator PRIVATE Boost::boost) #TODO make an interface target for options
4246

4347
# gt_enable_bindings_library_fortran()
4448
#

cmake/gt_c_bindings-config.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ get_filename_component(GT_C_BINDINGS_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE
44

55
message(STATUS "GridTools C Bindings version @PROJECT_VERSION@ found at ${GT_C_BINDINGS_CONFIG_CMAKE_DIR}")
66

7+
include(CMakeFindDependencyMacro)
8+
find_dependency(Boost @REQUIRED_BOOST_VERSION@)
9+
710
set_and_check(gt_c_bindings_MODULE_PATH @PACKAGE_gt_c_bindings_MODULE_PATH@)
811
set_and_check(gt_c_bindings_SOURCES_PATH @PACKAGE_gt_c_bindings_SOURCES_PATH@)
912
set_and_check(gt_c_bindings_INCLUDE_PATH @PACKAGE_gt_c_bindings_INCLUDE_PATH@)
13+
14+
include(${gt_c_bindings_MODULE_PATH}/gt_bindings.cmake)

example/simple/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
cmake_minimum_required(VERSION 3.12.4) #TODO replace with generated version
2-
32
project(simple_example LANGUAGES CXX C Fortran)
43

4+
# 1) find installed c_bindings version
55
find_package(gt_c_bindings)
66

7-
# 3) find installed GridTools version
8-
find_package(gt_c_bindings)
9-
# @GridTools_VERSION@ REQUIRED
10-
# HINTS @CMAKE_INSTALL_PREFIX@/lib/cmake)
11-
# 4) extend the CMake module path such that bindings generator can be include within CMake
12-
list(APPEND CMAKE_MODULE_PATH "${gt_c_bindings_MODULE_PATH}")
13-
14-
# 5) include c bindings module
15-
include(gt_bindings)
16-
7+
# 2) create a library with bindings
178
gt_add_bindings_library(simple SOURCES simple.cpp)
18-
# target_link_libraries(simple PRIVATE gt_c_bindings::gt_c_bindings)
199

10+
# 3) link the library to a fortran executable
2011
add_executable(driver driver.f90)
2112
target_link_libraries(driver simple_fortran)

include/c_bindings/generator.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
#include "../common/copy_into_variadic.hpp"
2727
#include "../common/is_there_in_sequence_if.hpp"
28-
#include "../meta/transform.hpp"
2928

3029
#include "function_wrapper.hpp"
3130

include/common/any_moveable.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include <typeinfo>
1515
#include <utility>
1616

17-
//#include "generic_metafunctions/utility.hpp"
18-
1917
namespace gridtools {
2018

2119
struct bad_any_cast : std::bad_cast {

jenkins/build.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# Abort on error
3+
set -e
4+
5+
HOST=$(hostname)
6+
7+
if [[ "$HOST" == kesch* || "$HOST" == escha* ]]; then
8+
module load craype-network-infiniband
9+
module load craype-haswell
10+
module load craype-accel-nvidia35
11+
module load cray-libsci
12+
module load cudatoolkit/8.0.61
13+
module load mvapich2gdr_gnu/2.2_cuda_8.0
14+
module load gcc/5.4.0-2.26
15+
module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.12.4
16+
export BOOST_ROOT=/project/c14/install/kesch/boost/boost_1_67_0
17+
export CUDATOOLKIT_HOME=$CUDA_PATH
18+
export CUDA_ARCH=sm_37
19+
elif [[ "$HOST" == tave* ]]; then
20+
module switch PrgEnv-cray PrgEnv-gnu
21+
module rm CMake
22+
module load /users/jenkins/easybuild/tave/modules/all/CMake/3.12.4
23+
export BOOST_ROOT=/project/c14/install/kesch/boost/boost_1_67_0
24+
elif [[ "$HOST" == daint* ]]; then
25+
module load daint-gpu
26+
module load cudatoolkit/9.2.148_3.19-6.0.7.1_2.1__g3d9acc8
27+
module switch PrgEnv-cray PrgEnv-gnu
28+
module rm CMake
29+
module load /users/jenkins/easybuild/daint/haswell/modules/all/CMake/3.12.4
30+
export BOOST_ROOT=/project/c14/install/daint/boost/boost_1_67_0
31+
export CUDA_ARCH=sm_60
32+
else
33+
echo "Unknown host ${HOST}, using current environment."
34+
fi
35+
36+
cwd=$(pwd)
37+
38+
# install c_bindings
39+
mkdir -p build && cd build
40+
cmake .. -DCMAKE_INSTALL_PREFIX=${cwd}/install
41+
nice -15 make -j8 install
42+
ctest .
43+
44+
# compile examples using the installation
45+
cd ${cwd}/example/simple
46+
mkdir -p build && cd build
47+
cmake .. -Dgt_c_bindings_DIR=${cwd}/install/lib/cmake
48+
nice -15 make -j8
49+
./driver
50+

tests/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
include(FetchContent)
2+
option(INSTALL_GTEST OFF)
3+
mark_as_advanced(INSTALL_GTEST)
24
FetchContent_Declare(
35
googletest
46
GIT_REPOSITORY https://github.com/google/googletest.git
57
GIT_TAG release-1.8.1
68
)
7-
FetchContent_MakeAvailable(googletest)
9+
FetchContent_GetProperties(googletest)
10+
if(NOT googletest_POPULATED)
11+
FetchContent_Populate(googletest)
12+
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
13+
endif()
14+
815

916
function(compile_test name src)
1017
add_executable(${name} ${src})
1118
target_include_directories(${name} PRIVATE ${PROJECT_SOURCE_DIR}/include)
1219
target_link_libraries(${name} PRIVATE gtest_main)
1320
target_link_libraries(${name} PRIVATE c_bindings_handle)
1421
target_link_libraries(${name} PRIVATE c_bindings_generator)
22+
add_test(NAME ${name} COMMAND ${name})
1523
endfunction()
1624

1725
enable_testing()

0 commit comments

Comments
 (0)