Skip to content

Commit 0bc1fb2

Browse files
authored
Add a simple regression test (#7)
- Remove regression test with GridTools dependencies and add a simple one (needs to be extended) - Cleanup some dependencies
1 parent bbe984b commit 0bc1fb2

27 files changed

Lines changed: 57 additions & 729 deletions

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ file(STRINGS "version.txt" __C_BINDINGS_VERSION)
44
project(c_bindings VERSION ${__C_BINDINGS_VERSION} LANGUAGES CXX)
55
unset(__C_BINDINGS_VERSION)
66

7-
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
8-
97
include(CTest)
108

119
set(REQUIRED_BOOST_VERSION 1.58)
1210
find_package(Boost ${REQUIRED_BOOST_VERSION} REQUIRED)
1311

14-
include(bindings)
12+
# if used via FetchContent/add_subdirectory() we need to make the add_bindings_library() available here
13+
include(${CMAKE_CURRENT_LIST_DIR}/cmake/bindings.cmake)
1514

1615
if (BUILD_TESTING)
1716
add_subdirectory(tests)
1817
endif()
1918

20-
include(export)
19+
include(${CMAKE_CURRENT_LIST_DIR}/cmake/export.cmake)

cmake/bindings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function(generate_gt_bindings)
22
set(__C_BINDINGS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
33
set(__C_BINDINGS_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake)
44
set(__C_BINDINGS_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
5-
configure_file(cmake/gt_bindings.cmake.in
5+
configure_file(${PROJECT_SOURCE_DIR}/cmake/gt_bindings.cmake.in
66
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/bindings_for_build/gt_bindings.cmake
77
@ONLY)
88
unset(__C_BINDINGS_SOURCE_DIR)

include/c_bindings/export.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <boost/mpl/at.hpp>
1616
#include <boost/preprocessor.hpp>
1717

18-
#include "../common/boost_pp_generic_macros.hpp"
1918
#include "function_wrapper.hpp"
2019
#include "generator.hpp"
2120

include/c_bindings/fortran_array_view.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <type_traits>
1616

1717
#include "../common/for_each.hpp"
18-
#include "../meta/macros.hpp"
1918
#include "../meta/make_indices.hpp"
2019
#include "../meta/type_traits.hpp"
2120

@@ -78,7 +77,7 @@ namespace gridtools {
7877
descriptor.rank = std::rank<Arr>::value;
7978
descriptor.is_acc_present = false;
8079

81-
using indices = GT_META_CALL(meta::make_indices, std::rank<Arr>);
80+
using indices = typename meta::make_indices<std::rank<Arr>>::type;
8281
gridtools::for_each<indices>(
8382
std::bind(_impl::fill_extent_f<Arr>{}, std::placeholders::_1, std::ref(descriptor)));
8483

include/c_bindings/generator.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <boost/type_index.hpp>
2525

2626
#include "../common/copy_into_variadic.hpp"
27+
#include "../common/for_each.hpp"
2728
#include "../common/is_there_in_sequence_if.hpp"
2829

2930
#include "function_wrapper.hpp"

include/common/boost_pp_generic_macros.hpp

Lines changed: 0 additions & 75 deletions
This file was deleted.

include/common/copy_into_variadic.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include <boost/mpl/copy.hpp>
1313
#include <boost/mpl/inserter.hpp>
1414

15-
// #include "../defs.hpp" TODO
16-
1715
namespace gridtools {
1816

1917
namespace _impl {

tests/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if(NOT googletest_POPULATED)
1212
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
1313
endif()
1414

15-
1615
function(compile_test name src)
1716
add_executable(${name} ${src})
1817
target_include_directories(${name} PRIVATE ${PROJECT_SOURCE_DIR}/include)
@@ -25,4 +24,4 @@ endfunction()
2524
enable_testing()
2625

2726
add_subdirectory(unit_tests)
28-
#add_subdirectory(regression)
27+
add_subdirectory(regression)

tests/regression/CMakeLists.txt

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
1-
if (GT_ENABLE_BACKEND_X86)
2-
if(GT_SINGLE_PRECISION)
3-
set(prec float)
4-
else()
5-
set(prec double)
6-
endif()
1+
enable_language(Fortran) #TODO conditionally
72

8-
gt_add_bindings_library(implementation_${prec} SOURCES implementation.cpp FORTRAN_MODULE_NAME implementation)
9-
target_link_libraries(implementation_${prec} PUBLIC GridToolsTestX86)
10-
gt_add_bindings_library(implementation_wrapper_${prec} SOURCES implementation_wrapper.cpp FORTRAN_MODULE_NAME implementation_wrapper)
11-
target_link_libraries(implementation_wrapper_${prec} PUBLIC GridToolsTestX86)
12-
13-
if (CMAKE_C_COMPILER_LOADED)
14-
add_executable(driver driver.c)
15-
target_link_libraries(driver implementation_${prec}_c)
16-
endif()
17-
18-
if (CMAKE_Fortran_COMPILER_LOADED)
19-
include(fortran_helpers)
20-
21-
add_executable(fdriver fdriver.f90)
22-
target_link_libraries(fdriver implementation_${prec}_fortran)
23-
set_target_properties(fdriver PROPERTIES LINKER_LANGUAGE Fortran)
24-
gt_enable_fortran_preprocessing_on_target(fdriver)
25-
26-
add_executable(fdriver_wrapper fdriver_wrapper.f90)
27-
target_link_libraries(fdriver_wrapper implementation_wrapper_${prec}_fortran)
28-
set_target_properties(fdriver_wrapper PROPERTIES LINKER_LANGUAGE Fortran)
29-
gt_enable_fortran_preprocessing_on_target(fdriver_wrapper)
30-
endif()
31-
endif(GT_ENABLE_BACKEND_X86)
3+
add_subdirectory(simple)

tests/regression/TODO

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)