Skip to content

Commit 879f16b

Browse files
authored
Remove GT_LEGACY mode (#47)
cpp_bindgen v1.1.0 will be the release to work with GT 2.0 (which doesn't come with a packaged cpp_bindgen). Therefore we remove the legacy mode.
1 parent ca41a43 commit 879f16b

File tree

16 files changed

+1
-332
lines changed

16 files changed

+1
-332
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ mark_as_advanced(CMAKE_EXPORT_NO_PACKAGE_REGISTRY)
1212
set(REQUIRED_BOOST_VERSION 1.58)
1313
find_package(Boost ${REQUIRED_BOOST_VERSION} REQUIRED)
1414

15-
if(NOT CPP_BINDGEN_GT_LEGACY)
16-
set(CPP_BINDGEN_GT_LEGACY OFF)
17-
endif()
18-
1915
# if used via FetchContent/add_subdirectory() we need to make the add_bindings_library() available here
2016
include(${CMAKE_CURRENT_LIST_DIR}/cmake/bindings.cmake)
2117

cmake/cpp_bindgen.cmake.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ add_library(cpp_bindgen_interface INTERFACE)
4141
target_include_directories(cpp_bindgen_interface INTERFACE $<BUILD_INTERFACE:${__CPP_BINDGEN_INCLUDE_DIR}> $<INSTALL_INTERFACE:include>)
4242
target_compile_features(cpp_bindgen_interface INTERFACE cxx_std_11)
4343
target_compile_definitions(cpp_bindgen_interface INTERFACE BOOST_PP_VARIADICS=1)
44-
if(CPP_BINDGEN_GT_LEGACY)
45-
target_compile_definitions(cpp_bindgen_interface INTERFACE CPP_BINDGEN_GT_LEGACY)
46-
endif()
4744

4845
add_library(cpp_bindgen_generator STATIC ${__CPP_BINDGEN_SOURCE_DIR}/cpp_bindgen/generator.cpp)
4946
# PUBLIC to make export.hpp available in the sources passed to add_bindings_library()

include/cpp_bindgen/array_descriptor.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ enum bindgen_fortran_array_kind {
2222
bindgen_fk_Double,
2323
bindgen_fk_LongDouble,
2424
bindgen_fk_SignedChar,
25-
26-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
27-
gt_fk_Bool = bindgen_fk_Bool,
28-
gt_fk_Int = bindgen_fk_Int,
29-
gt_fk_Short = bindgen_fk_Int,
30-
gt_fk_Long = bindgen_fk_Long,
31-
gt_fk_LongLong = bindgen_fk_LongLong,
32-
gt_fk_Float = bindgen_fk_Float,
33-
gt_fk_Double = bindgen_fk_Double,
34-
gt_fk_LongDouble = bindgen_fk_LongDouble,
35-
gt_fk_SignedChar = bindgen_fk_SignedChar
36-
#endif
3725
};
3826
typedef enum bindgen_fortran_array_kind bindgen_fortran_array_kind;
3927

@@ -46,7 +34,3 @@ struct bindgen_fortran_array_descriptor {
4634
// TODO: add support for strides, bounds end type bindgen_fortran_array_descriptor
4735
};
4836
typedef struct bindgen_fortran_array_descriptor bindgen_fortran_array_descriptor;
49-
50-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
51-
typedef struct bindgen_fortran_array_descriptor gt_fortran_array_descriptor;
52-
#endif

include/cpp_bindgen/export_gt_legacy.hpp

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

include/cpp_bindgen/fortran_array_view.hpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,9 @@ namespace cpp_bindgen {
100100
return descriptor;
101101
}
102102

103-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
104-
template <class T>
105-
enable_if_t<(T::gt_view_rank::value > 0) && std::is_arithmetic<typename T::gt_view_element_type>::value &&
106-
(T::gt_is_acc_present::value == T::gt_is_acc_present::value),
107-
bindgen_fortran_array_descriptor>
108-
get_fortran_view_meta(T *) {
109-
bindgen_fortran_array_descriptor descriptor;
110-
descriptor.type = fortran_array_element_kind<typename T::gt_view_element_type>::value;
111-
descriptor.rank = T::gt_view_rank::value;
112-
descriptor.is_acc_present = T::gt_is_acc_present::value;
113-
114-
return descriptor;
115-
}
116-
#endif
117103
template <class T>
118104
using bindgen_fortran_array_view_t = decltype(
119105
bindgen_make_fortran_array_view(std::declval<bindgen_fortran_array_descriptor *>(), std::declval<T *>()));
120-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
121-
template <class T>
122-
using gt_fortran_array_view_t =
123-
decltype(gt_make_fortran_array_view(std::declval<gt_fortran_array_descriptor *>(), std::declval<T *>()));
124-
#endif
125106

126107
} // namespace get_fortran_view_meta_impl
127108
using get_fortran_view_meta_impl::get_fortran_view_meta;
@@ -184,15 +165,6 @@ namespace cpp_bindgen {
184165
T>::value>> //
185166
> : std::true_type {};
186167

187-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
188-
template <class T>
189-
struct is_fortran_array_convertible<T,
190-
void_t<get_fortran_view_meta_impl::gt_fortran_array_view_t<T>,
191-
enable_if_t<std::is_same<get_fortran_view_meta_impl::gt_fortran_array_view_t<T>,
192-
T>::value>> //
193-
> : std::true_type {};
194-
#endif
195-
196168
/**
197169
* @brief A type is fortran_array_bindable if it is fortran_array_convertible
198170
*
@@ -248,23 +220,4 @@ namespace cpp_bindgen {
248220
return bindgen_make_fortran_array_view(descriptor, (T *){nullptr});
249221
}
250222

251-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
252-
template <class T>
253-
enable_if_t<std::is_same<get_fortran_view_meta_impl::gt_fortran_array_view_t<T>, T>::value,
254-
get_fortran_view_meta_impl::gt_fortran_array_view_t<T>>
255-
make_fortran_array_view(bindgen_fortran_array_descriptor *descriptor) {
256-
return gt_make_fortran_array_view(descriptor, (T *){nullptr});
257-
}
258-
#endif
259223
} // namespace cpp_bindgen
260-
261-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
262-
namespace gridtools {
263-
namespace c_bindings {
264-
using cpp_bindgen::fortran_array_element_kind;
265-
using cpp_bindgen::is_fortran_array_bindable;
266-
using cpp_bindgen::is_fortran_array_view_inspectable;
267-
using cpp_bindgen::is_fortran_array_wrappable;
268-
} // namespace c_bindings
269-
} // namespace gridtools
270-
#endif

include/cpp_bindgen/handle.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@ struct bindgen_handle;
1414
#ifdef __cplusplus
1515

1616
extern "C" void bindgen_release(bindgen_handle const *);
17-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
18-
extern "C" void gt_release(bindgen_handle const *);
19-
#endif
2017

2118
#else
2219

2320
typedef struct bindgen_handle bindgen_handle;
2421
void bindgen_release(bindgen_handle *);
25-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
26-
typedef struct bindgen_handle gt_handle;
27-
void gt_release(bindgen_handle *);
28-
#endif
2922

3023
#endif

jenkins/build.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,3 @@ mkdir -p build && cd build
6868
cmake ..
6969
nice make -j8
7070
./driver
71-
72-
# test gt legacy mode (don't run it on kesch because CUDA 8 is not supported in legacy mode)
73-
if [[ "$HOST" != kesch* ]]; then
74-
cd ${cwd}
75-
mkdir -p build_legacy && cd build_legacy
76-
cmake .. -DCMAKE_INSTALL_PREFIX=${cwd}/install -DCPP_BINDGEN_GT_LEGACY=ON
77-
nice make -j8 install
78-
$RUN_PREFIX ctest .
79-
fi

src/cpp_bindgen/handle.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,3 @@
1212
#include <cpp_bindgen/handle_impl.hpp>
1313

1414
void bindgen_release(bindgen_handle const *obj) { delete obj; }
15-
16-
#ifdef CPP_BINDGEN_GT_LEGACY // remove once GT is at v2.0
17-
void gt_release(bindgen_handle const *obj) { bindgen_release(obj); }
18-
#endif

src/cpp_bindgen/handle.f90

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,3 @@ subroutine bindgen_release(h) bind(c)
1515
end
1616
end interface
1717
end
18-
19-
! remove once GT is at v2.0
20-
#ifdef CPP_BINDGEN_GT_LEGACY
21-
module gt_handle
22-
implicit none
23-
interface
24-
subroutine gt_release(h) bind(c, name="bindgen_release")
25-
use iso_c_binding
26-
type(c_ptr), value :: h
27-
end
28-
end interface
29-
end
30-
#endif

tests/regression/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@ add_subdirectory(simple)
66

77
if(CMAKE_Fortran_COMPILER_LOADED)
88
add_subdirectory(array)
9-
10-
if(CPP_BINDGEN_GT_LEGACY)
11-
add_subdirectory(array_gt_legacy)
12-
endif()
139
endif()

0 commit comments

Comments
 (0)