Skip to content

Commit 62dbe0e

Browse files
committed
auto-generate ginkgo.hpp
1 parent 6868594 commit 62dbe0e

File tree

8 files changed

+22
-307
lines changed

8 files changed

+22
-307
lines changed

.github/bot-pr-format-base.sh

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ git config user.name "ginkgo-bot"
1414

1515
# save scripts from develop
1616
cp .clang-format .pre-commit-config.yaml /tmp
17-
cp dev_tools/scripts/update_ginkgo_header.sh /tmp
1817

1918
# checkout current PR head
2019
LOCAL_BRANCH=format-tmp-$HEAD_BRANCH
@@ -23,7 +22,6 @@ git checkout -b $LOCAL_BRANCH fork/$HEAD_BRANCH
2322
# restore files from develop
2423
cp /tmp/.clang-format .
2524
cp /tmp/.pre-commit-config.yaml .
26-
cp /tmp/update_ginkgo_header.sh dev_tools/scripts/
2725

2826
# make base pre-commit config available
2927
git add .pre-commit-config.yaml

.pre-commit-config.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,3 @@ repos:
3030
examples/external-lib-interfacing/external-lib-interfacing.cpp|
3131
core/base/workspace_aliases.hpp
3232
)$
33-
- id: update-ginkgo-header
34-
name: update ginkgo header
35-
entry: dev_tools/scripts/update_ginkgo_header.sh
36-
language: script
37-
types: [header]
38-
pass_filenames: false
39-
files: ^include/ginkgo/core

CMakeLists.txt

+2-10
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ include(cmake/build_type_helpers.cmake)
123123
include(cmake/build_helpers.cmake)
124124
include(cmake/install_helpers.cmake)
125125
include(cmake/compiler_features.cmake)
126+
include(cmake/generate_ginkgo_hpp.cmake)
126127

127128
if(MSVC)
128129
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
@@ -322,6 +323,7 @@ else()
322323
set(GINKGO_DPCPP_MAJOR_VERSION "0")
323324
set(GINKGO_DPCPP_MINOR_VERSION "0")
324325
endif()
326+
ginkgo_generate_ginkgo_hpp()
325327
configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/config.hpp.in
326328
${Ginkgo_BINARY_DIR}/include/ginkgo/config.hpp @ONLY)
327329
configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/extensions/kokkos/config.hpp.in
@@ -401,16 +403,6 @@ if(GINKGO_DEVEL_TOOLS)
401403
VERBATIM)
402404
endif()
403405

404-
# MacOS needs to install bash, gnu-sed, findutils and coreutils
405-
# format_header needs clang-format 6.0.0+
406-
find_program(BASH bash)
407-
if(NOT "${BASH}" STREQUAL "BASH-NOTFOUND" AND GINKGO_DEVEL_TOOLS)
408-
add_custom_target(generate_ginkgo_header ALL
409-
COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/update_ginkgo_header.sh
410-
WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR})
411-
endif()
412-
unset(BASH CACHE)
413-
414406

415407
# Installation
416408
include(cmake/information_helpers.cmake)

cmake/generate_ginkgo_hpp.cmake

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function(ginkgo_generate_ginkgo_hpp)
2+
file(GLOB_RECURSE headers CONFIGURE_DEPENDS ${Ginkgo_SOURCE_DIR}/include/ginkgo/*.hpp)
3+
set(GKO_PUBLIC_HEADER_CONTENTS)
4+
foreach(file IN LISTS headers)
5+
file(RELATIVE_PATH file ${Ginkgo_SOURCE_DIR}/include "${file}")
6+
# just making sure it uses / path separators
7+
file(TO_CMAKE_PATH file "${file}")
8+
if((file MATCHES "^ginkgo/extensions/.*$") OR
9+
(file MATCHES "^ginkgo/core/stop/residual_norm_reduction.hpp$") OR
10+
(file MATCHES "^ginkgo/core/solver/.*_trs.hpp$"))
11+
continue()
12+
endif()
13+
set(GKO_PUBLIC_HEADER_CONTENTS "${GKO_PUBLIC_HEADER_CONTENTS}#include <${file}>\n")
14+
endforeach()
15+
configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/ginkgo.hpp.in
16+
${Ginkgo_BINARY_DIR}/include/ginkgo/ginkgo.hpp @ONLY)
17+
endfunction()

dev_tools/scripts/update_ginkgo_header.sh

-136
This file was deleted.

doc/helpers.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function(ginkgo_doc_gen name in pdf mainpage-in)
5454
)
5555
list(APPEND doxygen_base_input
5656
${PROJECT_BINARY_DIR}/include/ginkgo/config.hpp
57+
${PROJECT_BINARY_DIR}/include/ginkgo/ginkgo.hpp
5758
${DIR_BASE}/include
5859
${MAINPAGE}
5960
)
@@ -79,6 +80,7 @@ function(ginkgo_doc_gen name in pdf mainpage-in)
7980
)
8081
list(APPEND doxygen_depend
8182
${PROJECT_BINARY_DIR}/include/ginkgo/config.hpp
83+
${PROJECT_BINARY_DIR}/include/ginkgo/ginkgo.hpp
8284
)
8385
if(GINKGO_DOC_GENERATE_EXAMPLES)
8486
list(APPEND doxygen_depend

include/ginkgo/ginkgo.hpp

-150
This file was deleted.

include/ginkgo/ginkgo.hpp.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
#include <ginkgo/config.hpp>
10-
#PUBLIC_HEADER_PLACE_HOLDER
11-
10+
@GKO_PUBLIC_HEADER_CONTENTS@
1211

1312
#endif // GKO_GINKGO_HPP_

0 commit comments

Comments
 (0)