Skip to content

Commit 506910a

Browse files
authored
improve single header generation (#8)
- add automatic version to the generated cib.hpp header - reorganize tests to mirror production code directory structure - move include guards so they are in natural locations in generated cib.hpp
1 parent 99084b9 commit 506910a

File tree

15 files changed

+33
-25
lines changed

15 files changed

+33
-25
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/generated-includes/
22
/build/
33
/Testing/
4-
/cmake-build*
4+
/cmake-build*
5+
/venv/

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ target_sources(Cib
2121

2222
add_custom_command(
2323
DEPENDS
24+
${CMAKE_SOURCE_DIR}/tools/gen_release_header.py
2425
${CMAKE_SOURCE_DIR}/include/cib/*
2526
${CMAKE_SOURCE_DIR}/include/cib/detail/*
2627
COMMAND

include/cib/builder_meta.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_BUILDER_META_HPP
2-
#define COMPILE_TIME_INIT_BUILD_BUILDER_META_HPP
3-
4-
51
#include "detail/compiler.hpp"
62

73
#include <utility>
84

95

6+
#ifndef COMPILE_TIME_INIT_BUILD_BUILDER_META_HPP
7+
#define COMPILE_TIME_INIT_BUILD_BUILDER_META_HPP
8+
9+
1010
namespace cib {
1111
template<
1212
typename BuilderT,

include/cib/built.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_BUILT_HPP
2-
#define COMPILE_TIME_INIT_BUILD_BUILT_HPP
1+
#include "builder_meta.hpp"
32

43

5-
#include "builder_meta.hpp"
4+
#ifndef COMPILE_TIME_INIT_BUILD_BUILT_HPP
5+
#define COMPILE_TIME_INIT_BUILD_BUILT_HPP
66

77

88
namespace cib {

include/cib/callback.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_CALLBACK_HPP
2-
#define COMPILE_TIME_INIT_BUILD_CALLBACK_HPP
3-
4-
51
#include "builder_meta.hpp"
62
#include "detail/meta.hpp"
73
#include "detail/compiler.hpp"
@@ -10,6 +6,10 @@
106
#include <type_traits>
117

128

9+
#ifndef COMPILE_TIME_INIT_BUILD_CALLBACK_HPP
10+
#define COMPILE_TIME_INIT_BUILD_CALLBACK_HPP
11+
12+
1313
namespace cib {
1414
/**
1515
* Extension point/builder for simple callbacks.

include/cib/cib.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232
/*
3333
* cib - Compile-time Initialization and Build
34+
* ..~~VERSION~~..
35+
*
36+
* For the documentation and the latest version, see the official github repo:
3437
* https://github.com/intel/compile-time-init-build
3538
*/
3639

include/cib/config.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_CONFIG_HPP
2-
#define COMPILE_TIME_INIT_BUILD_CONFIG_HPP
3-
4-
51
#include "detail/compiler.hpp"
62
#include "detail/meta.hpp"
73
#include "builder_meta.hpp"
@@ -10,6 +6,10 @@
106
#include <type_traits>
117

128

9+
#ifndef COMPILE_TIME_INIT_BUILD_CONFIG_HPP
10+
#define COMPILE_TIME_INIT_BUILD_CONFIG_HPP
11+
12+
1313
namespace cib {
1414
namespace detail {
1515
template<typename Lhs, typename Rhs>

include/cib/detail/meta.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_META_HPP
2-
#define COMPILE_TIME_INIT_BUILD_META_HPP
3-
4-
51
#include "compiler.hpp"
62

73
#include <tuple>
84
#include <type_traits>
95

106

7+
#ifndef COMPILE_TIME_INIT_BUILD_META_HPP
8+
#define COMPILE_TIME_INIT_BUILD_META_HPP
9+
10+
1111
namespace cib::detail {
1212
template<int value>
1313
CIB_CONSTEXPR auto int_ = std::integral_constant<int, value>{};

include/cib/nexus.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#ifndef COMPILE_TIME_INIT_BUILD_NEXUS_HPP
2-
#define COMPILE_TIME_INIT_BUILD_NEXUS_HPP
3-
4-
51
#include "detail/compiler.hpp"
62
#include "detail/meta.hpp"
73
#include "built.hpp"
84

95
#include <type_traits>
106

117

8+
#ifndef COMPILE_TIME_INIT_BUILD_NEXUS_HPP
9+
#define COMPILE_TIME_INIT_BUILD_NEXUS_HPP
10+
11+
1212
namespace cib {
1313
template<typename ConfigT>
1414
struct initialized_builders {

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(compile_time_init_build)
33

44
set(CMAKE_CXX_STANDARD 17)
55

6-
add_executable(tests test_meta.cpp test_builder_meta.cpp test_callback.cpp test_nexus.cpp)
6+
add_executable(tests detail/meta.cpp builder_meta.cpp callback.cpp nexus.cpp)
77

88
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
99
target_compile_options(tests

0 commit comments

Comments
 (0)