Skip to content

Commit ecd8a3d

Browse files
authored
Remove cpp_ in cpp_bindgen_add_library and friends (#29)
1 parent 7836eeb commit ecd8a3d

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Currently the documentation of **cpp_bindgen** is part of the [GridTools documen
88

99
### Installation instructions
1010

11-
You can easily integrate **cpp_bindgen** in your CMake project with the following snippet which makes the function `cpp_bindgen_add_library()` available.
11+
You can easily integrate **cpp_bindgen** in your CMake project with the following snippet which makes the function `bindgen_add_library()` available.
1212

1313
```cmake
1414
include(FetchContent)

cmake/cpp_bindgen.cmake.in

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Usage of this module:
44
#
5-
# cpp_bindgen_add_library(<library-name> SOURCES <sources>[...] [FORTRAN_OUTPUT_DIR fortran_dir] [C_OUTPUT_DIR c_dir] [FORTRAN_MODULE_NAME name])
5+
# bindgen_add_library(<library-name> SOURCES <sources>[...] [FORTRAN_OUTPUT_DIR fortran_dir] [C_OUTPUT_DIR c_dir] [FORTRAN_MODULE_NAME name])
66
#
77
# Arguments:
88
# SOURCES: sources of the library
@@ -18,9 +18,9 @@
1818
# If GT_ENABLE_BINDINGS_GENERATION is not defined already it will be made available after including this file.
1919
#
2020
# In the default case (GT_ENABLE_BINDINGS_GENERATION=ON), the bindings files are generated in the directory
21-
# where the CMakeLists.txt with the call to cpp_bindgen_add_library() is located.
21+
# where the CMakeLists.txt with the call to bindgen_add_library() is located.
2222
#
23-
# Targets generated by cpp_bindgen_add_library(<library-name> ...):
23+
# Targets generated by bindgen_add_library(<library-name> ...):
2424
# - <library_name> library build from <Sources...> without bindings (ususally this target is not used)
2525
# - <library_name>_declarations will run the generator for this library
2626
# - <library_name>_c the C-bindings with <library_name> linked to it
@@ -53,14 +53,14 @@ target_link_libraries(cpp_bindgen_handle PUBLIC cpp_bindgen_interface)
5353
unset(__CPP_BINDGEN_SOURCE_DIR)
5454
unset(__CPP_BINDGEN_INCLUDE_DIR)
5555

56-
# cpp_bindgen_enable_fortran_library()
56+
# bindgen_enable_fortran_library()
5757
#
5858
# Create a target to compile the generated Fortran module.
59-
# In the default case, when Fortran is enabled on the call to cpp_bindgen_add_library(), this target is automatically created.
59+
# In the default case, when Fortran is enabled on the call to bindgen_add_library(), this target is automatically created.
6060
# In case when the Fortran language was not enabled, we cannot create a library (add_library()) with Fortran files.
6161
# However if the user wants to use the target at a later stage, e.g. in testing (with Fortran enabled), the target can
62-
# be created by a call to cpp_bindgen_enable_fortran_library().
63-
function(cpp_bindgen_enable_fortran_library target_name)
62+
# be created by a call to bindgen_enable_fortran_library().
63+
function(bindgen_enable_fortran_library target_name)
6464
set(__CPP_BINDGEN_SOURCE_DIR @__CPP_BINDGEN_SOURCE_DIR@)
6565
set(__CPP_BINDGEN_CMAKE_DIR @__CPP_BINDGEN_CMAKE_DIR@)
6666

@@ -70,7 +70,7 @@ function(cpp_bindgen_enable_fortran_library target_name)
7070
target_link_libraries(fortran_bindings_handle PUBLIC cpp_bindgen_handle)
7171
target_include_directories(fortran_bindings_handle PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
7272
include(${__CPP_BINDGEN_CMAKE_DIR}/fortran_helpers.cmake)
73-
cpp_bindgen_enable_fortran_preprocessing_on_target(fortran_bindings_handle)
73+
bindgen_enable_fortran_preprocessing_on_target(fortran_bindings_handle)
7474
endif()
7575
if(NOT TARGET ${target_name}_fortran)
7676
set_source_files_properties(GT_${${target_name}_fortran_bindings_path} PROPERTIES GENERATED TRUE)
@@ -84,7 +84,7 @@ function(cpp_bindgen_enable_fortran_library target_name)
8484
endif()
8585
endfunction()
8686

87-
function(cpp_bindgen_add_library target_name)
87+
function(bindgen_add_library target_name)
8888
set(options)
8989
set(one_value_args FORTRAN_OUTPUT_DIR C_OUTPUT_DIR FORTRAN_MODULE_NAME)
9090
set(multi_value_args SOURCES)
@@ -158,8 +158,8 @@ function(cpp_bindgen_add_library target_name)
158158

159159
# bindings Fortran library
160160
# Export the name of the generated file. The variable needs to exist in the whole cmake!
161-
# Reason: see description of cpp_bindgen_enable_fortran_library().
161+
# Reason: see description of bindgen_enable_fortran_library().
162162
set(GT_${target_name}_fortran_bindings_path ${bindings_fortran_decl_filename}
163163
CACHE INTERNAL "Path to the generated Fortran file for ${target_name}")
164-
cpp_bindgen_enable_fortran_library(${target_name} TRUE)
164+
bindgen_enable_fortran_library(${target_name} TRUE)
165165
endfunction()

cmake/fortran_helpers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function(cpp_bindgen_enable_fortran_openacc_on_target target)
1+
function(bindgen_enable_fortran_openacc_on_target target)
22
# TODO check if find_package(OpenACC) solves this problem
33
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
44
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-h acc>)
@@ -10,7 +10,7 @@ function(cpp_bindgen_enable_fortran_openacc_on_target target)
1010
endif()
1111
endfunction()
1212

13-
function(cpp_bindgen_enable_fortran_preprocessing_on_target target)
13+
function(bindgen_enable_fortran_preprocessing_on_target target)
1414
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
1515
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-eF>)
1616
else()

example/simple/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(simple_example LANGUAGES CXX C Fortran)
55
find_package(cpp_bindgen)
66

77
# 2) create a library with bindings
8-
cpp_bindgen_add_library(simple SOURCES simple.cpp)
8+
bindgen_add_library(simple SOURCES simple.cpp)
99

1010
# 3) link the library to a fortran executable
1111
add_executable(driver driver.f90)

example/simple_fetch_content/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(NOT cpp_bindgen_POPULATED)
1919
endif()
2020

2121
# 2) create a library with bindings. This will generate the files simple.h and simple.f90 which can be included within C and Fortran. In CMake you can use them by linking against `simple_c`or `simple_fortran`.
22-
cpp_bindgen_add_library(simple SOURCES simple.cpp)
22+
bindgen_add_library(simple SOURCES simple.cpp)
2323

2424
# 3) link the generated library to a fortran executable
2525
add_executable(driver driver.f90)

tests/regression/array/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cpp_bindgen_add_library(bindgen_regression_array SOURCES implementation.cpp)
1+
bindgen_add_library(bindgen_regression_array SOURCES implementation.cpp)
22

33
add_executable(bindgen_regression_array_driver_fortran driver.f90)
44
target_link_libraries(bindgen_regression_array_driver_fortran bindgen_regression_array_fortran)
@@ -12,12 +12,12 @@ add_test(NAME bindgen_regression_array_driver_fortran
1212
AND "${CMAKE_Fortran_COMPILER_VERSION}" VERSION_GREATER_EQUAL "6"
1313
)
1414

15-
cpp_bindgen_add_library(bindgen_regression_array_cu SOURCES implementation.cu)
16-
cpp_bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_cu_fortran)
15+
bindgen_add_library(bindgen_regression_array_cu SOURCES implementation.cu)
16+
bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_cu_fortran)
1717

1818
add_executable(bindgen_regression_array_driver_cu_fortran driver_cu.f90)
1919
target_link_libraries(bindgen_regression_array_driver_cu_fortran bindgen_regression_array_cu_fortran)
20-
cpp_bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_driver_cu_fortran)
20+
bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_driver_cu_fortran)
2121

2222
# TODO
2323
# we don't add this test on purpose for now, because it is likely that this test does not work

tests/regression/array_gt_legacy/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cpp_bindgen_add_library(bindgen_regression_array_gt_legacy SOURCES implementation.cpp)
1+
bindgen_add_library(bindgen_regression_array_gt_legacy SOURCES implementation.cpp)
22

33
add_executable(bindgen_regression_array_gt_legacy_driver_fortran driver.f90)
44
target_link_libraries(bindgen_regression_array_gt_legacy_driver_fortran bindgen_regression_array_gt_legacy_fortran)

tests/regression/simple/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cpp_bindgen_add_library(bindgen_regression_simple SOURCES simple.cpp)
1+
bindgen_add_library(bindgen_regression_simple SOURCES simple.cpp)
22

33
if(CMAKE_Fortran_COMPILER_LOADED)
44
add_executable(bindgen_regression_simple_driver_fortran driver.f90)

0 commit comments

Comments
 (0)