cppiniter 1.0.7__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cppiniter-1.0.7/cppiniter.egg-info → cppiniter-1.1.0}/PKG-INFO +1 -1
- {cppiniter-1.0.7 → cppiniter-1.1.0}/README.md +8 -2
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/cppiniter.py +19 -6
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/.clang-tidy +3 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/CMakeLists.txt +41 -11
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/conanfile.py +17 -4
- cppiniter-1.1.0/cppiniter/files/example/CMakeLists.txt +15 -0
- {cppiniter-1.0.7/cppiniter/files/src → cppiniter-1.1.0/cppiniter/files/example}/main.cpp +1 -4
- cppiniter-1.1.0/cppiniter/files/src/CMakeLists.txt +43 -0
- cppiniter-1.1.0/cppiniter/files/src/main.cpp +14 -0
- cppiniter-1.1.0/cppiniter/files/src/project_name/export.h +36 -0
- cppiniter-1.1.0/cppiniter/files/src/project_name/project_name.cpp +0 -0
- cppiniter-1.1.0/cppiniter/files/src/project_name/project_name.h +0 -0
- cppiniter-1.1.0/cppiniter/files/src/project_name/version.h.in +11 -0
- cppiniter-1.1.0/cppiniter/files/src/version.h.in +11 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0/cppiniter.egg-info}/PKG-INFO +1 -1
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter.egg-info/SOURCES.txt +7 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/setup.py +1 -1
- cppiniter-1.0.7/cppiniter/files/src/CMakeLists.txt +0 -30
- {cppiniter-1.0.7 → cppiniter-1.1.0}/LICENSE +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/MANIFEST.in +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/__init__.py +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/.clang-format +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/.gitignore +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/.pre-commit-config.yaml +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/CMakeSettings.json +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/README.md +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/test/CMakeLists.txt +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/test/main.cpp +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter/files/version.properties +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter.egg-info/dependency_links.txt +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter.egg-info/entry_points.txt +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter.egg-info/requires.txt +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/cppiniter.egg-info/top_level.txt +0 -0
- {cppiniter-1.0.7 → cppiniter-1.1.0}/setup.cfg +0 -0
|
@@ -21,12 +21,12 @@ pip3 install cppiniter
|
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
Usage:
|
|
24
|
-
cppiniter [<dir>] [--name=<name>] [--
|
|
24
|
+
cppiniter [<dir>] [--name=<name>] [--exe]
|
|
25
25
|
|
|
26
26
|
Options:
|
|
27
27
|
<dir> 项目目录,默认为当前目录
|
|
28
28
|
--name=<name> 项目名,默认为项目目录名
|
|
29
|
-
--
|
|
29
|
+
--exe 项目目标为C++应用程序,默认为库
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## 目录结构
|
|
@@ -60,6 +60,12 @@ project
|
|
|
60
60
|
│ │
|
|
61
61
|
│ └── main.cpp # 加快doctest的编译速度
|
|
62
62
|
│
|
|
63
|
+
├── example # 所有的示例程序文件应该放在这个目录下面
|
|
64
|
+
│ │
|
|
65
|
+
│ ├── CMakeLists.txt
|
|
66
|
+
│ │
|
|
67
|
+
│ └── main.cpp
|
|
68
|
+
│
|
|
63
69
|
├── doc # 文档保存目录
|
|
64
70
|
│
|
|
65
71
|
└── build # 我们应该保持一棵干净的源码树,所有编译动作应该单独在这个目录进行。这个目录应加入gitignore
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"""cppiniter init a cpp project struction
|
|
5
5
|
|
|
6
6
|
Usage:
|
|
7
|
-
cppiniter [<dir>] [--name=<name>] [--
|
|
7
|
+
cppiniter [<dir>] [--name=<name>] [--exe]
|
|
8
8
|
|
|
9
9
|
Options:
|
|
10
10
|
<dir> 项目目录,默认为当前目录
|
|
11
11
|
--name=<name> 项目名,默认为项目目录名
|
|
12
|
-
--
|
|
12
|
+
--exe 项目目标为C++应用程序,默认为库
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
import os
|
|
@@ -24,12 +24,15 @@ from datetime import datetime
|
|
|
24
24
|
|
|
25
25
|
IGNORE_FILES = set([".git", "LICENSE"])
|
|
26
26
|
EMPTY_DIR = ("build", "doc")
|
|
27
|
+
RENAME_FILES = {"src/project_name/project_name.h": "src/project_name/{{project_name}}.h", "src/project_name/project_name.cpp": "src/project_name/{{project_name}}.cpp", "src/project_name": "src/{{project_name}}"}
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def install(args):
|
|
30
31
|
ignores = ["*.pyc", "__pycache__"]
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
if args["is_exe"]:
|
|
34
|
+
ignores.append("example")
|
|
35
|
+
ignores.append("test")
|
|
33
36
|
|
|
34
37
|
dir = os.path.dirname(os.path.realpath(__file__))
|
|
35
38
|
shutil.copytree(os.path.join(dir, "files"),
|
|
@@ -38,6 +41,16 @@ def install(args):
|
|
|
38
41
|
dirs_exist_ok=True)
|
|
39
42
|
for i in EMPTY_DIR:
|
|
40
43
|
os.mkdir(os.path.join(args["project_dir"], i))
|
|
44
|
+
for key, value in RENAME_FILES.items():
|
|
45
|
+
src_path = os.path.join(args["project_dir"], key)
|
|
46
|
+
dst_path = os.path.join(args["project_dir"], pystache.render(value, args))
|
|
47
|
+
os.rename(src_path, dst_path)
|
|
48
|
+
|
|
49
|
+
if args["is_exe"]:
|
|
50
|
+
shutil.rmtree(os.path.join(args["project_dir"], "src", args["project_name"]))
|
|
51
|
+
else:
|
|
52
|
+
os.remove(os.path.join(args["project_dir"], "src", "main.cpp"))
|
|
53
|
+
os.remove(os.path.join(args["project_dir"], "src", "version.h.in"))
|
|
41
54
|
|
|
42
55
|
|
|
43
56
|
def render(dir, args):
|
|
@@ -56,7 +69,7 @@ def render(dir, args):
|
|
|
56
69
|
def preprocess(args):
|
|
57
70
|
project_dir = args["<dir>"]
|
|
58
71
|
project_name = args["--name"]
|
|
59
|
-
|
|
72
|
+
is_exe = args["--exe"]
|
|
60
73
|
author = subprocess.check_output(["git", "config", "--get", "user.name"]
|
|
61
74
|
).decode(sys.stdout.encoding).strip()
|
|
62
75
|
email = subprocess.check_output(["git", "config", "--get", "user.email"]
|
|
@@ -84,7 +97,7 @@ def preprocess(args):
|
|
|
84
97
|
|
|
85
98
|
project_name_uppercase = project_name.upper()
|
|
86
99
|
project_name_camelcase = ''.join(project_name.title() for word in project_name.split('_'))
|
|
87
|
-
return {"project_name": project_name, "project_name_uppercase": project_name_uppercase, "project_name_camelcase": project_name_camelcase, "project_dir": project_dir, "
|
|
100
|
+
return {"project_name": project_name, "project_name_uppercase": project_name_uppercase, "project_name_camelcase": project_name_camelcase, "project_dir": project_dir, "is_exe": is_exe, "date_time": date_time, "author": author, "email": email}
|
|
88
101
|
|
|
89
102
|
|
|
90
103
|
def execute(dir):
|
|
@@ -10,6 +10,9 @@ Checks: "*,
|
|
|
10
10
|
-hicpp-special-member-functions,
|
|
11
11
|
-readability-identifier-length,
|
|
12
12
|
-misc-no-recursion,
|
|
13
|
+
-hicpp-no-array-decay,
|
|
14
|
+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
|
15
|
+
-llvm-include-order,
|
|
13
16
|
"
|
|
14
17
|
WarningsAsErrors: ''
|
|
15
18
|
HeaderFilterRegex: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Automatically generated by cppiniter {{{date_time}}}
|
|
3
3
|
######################################################################
|
|
4
4
|
|
|
5
|
-
cmake_minimum_required (VERSION 3.
|
|
5
|
+
cmake_minimum_required (VERSION 3.25)
|
|
6
6
|
project ({{{project_name}}})
|
|
7
7
|
|
|
8
8
|
include(GNUInstallDirs)
|
|
@@ -21,6 +21,9 @@ if(NOT DEFINED VERSION_NAME)
|
|
|
21
21
|
|
|
22
22
|
set(VERSION_NAME "T.${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}.0")
|
|
23
23
|
endif()
|
|
24
|
+
if(DEFINED ENV{GIT_COMMIT})
|
|
25
|
+
set(VERSION_NAME "${VERSION_NAME}-$ENV{GIT_COMMIT}")
|
|
26
|
+
endif()
|
|
24
27
|
message(STATUS "${PROJECT_NAME} version ${VERSION_NAME}")
|
|
25
28
|
add_definitions(-DVERSION_NAME="${VERSION_NAME}")
|
|
26
29
|
|
|
@@ -35,6 +38,8 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
|
35
38
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
36
39
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
37
40
|
|
|
41
|
+
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
|
42
|
+
|
|
38
43
|
if(WIN32)
|
|
39
44
|
add_definitions(-DWINVER=0x0601)
|
|
40
45
|
add_definitions(-D_WIN32_WINNT=0x0601)
|
|
@@ -42,35 +47,60 @@ endif()
|
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
45
|
-
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -Og -g3 -
|
|
50
|
+
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -Og -g3 -Wall -Wextra -Wno-sign-compare")
|
|
46
51
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
|
47
52
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
48
|
-
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -Og -g3 -
|
|
53
|
+
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -Og -g3 -Wall -Wextra -Wno-sign-compare")
|
|
49
54
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
|
55
|
+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,ALL")
|
|
50
56
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
51
57
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS=1)
|
|
52
58
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
|
|
53
59
|
|
|
54
|
-
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE)
|
|
55
|
-
|
|
56
60
|
string (REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
57
61
|
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} /EHsc /utf-8 /MP /Zc:__cplusplus")
|
|
58
|
-
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG}
|
|
59
|
-
|
|
62
|
+
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_DEBUG} /wd4244 /wd4018 /wd4267 /wd4307")
|
|
63
|
+
if (BUILD_SHARED_LIBS)
|
|
64
|
+
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
|
65
|
+
else()
|
|
66
|
+
string (REGEX REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
|
67
|
+
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_RELEASE} /Z7")
|
|
68
|
+
endif()
|
|
69
|
+
|
|
60
70
|
|
|
61
71
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
|
|
62
72
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
|
63
73
|
endif()
|
|
64
74
|
|
|
65
75
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
66
|
-
set(CMAKE_INSTALL_PREFIX ${
|
|
76
|
+
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install/ CACHE PATH "default install prefix" FORCE)
|
|
67
77
|
endif()
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
{{^is_exe}}
|
|
80
|
+
option(BUILD_TEST "build test" OFF)
|
|
81
|
+
option(BUILD_EXAMPLE "build example" OFF)
|
|
82
|
+
{{/is_exe}}
|
|
70
83
|
|
|
71
84
|
add_subdirectory(src)
|
|
72
|
-
{{
|
|
85
|
+
{{^is_exe}}
|
|
73
86
|
if(BUILD_TEST)
|
|
74
87
|
add_subdirectory (test)
|
|
75
88
|
endif()
|
|
76
|
-
|
|
89
|
+
|
|
90
|
+
if(BUILD_EXAMPLE)
|
|
91
|
+
add_subdirectory (example)
|
|
92
|
+
endif()
|
|
93
|
+
|
|
94
|
+
if (BUILD_EXAMPLE OR BUILD_TEST)
|
|
95
|
+
if (WIN32)
|
|
96
|
+
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
|
|
97
|
+
set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
|
|
98
|
+
|
|
99
|
+
file(GLOB DLLS ${CMAKE_BINARY_DIR}/*.dll)
|
|
100
|
+
INSTALL(FILES ${DLLS} DESTINATION bin)
|
|
101
|
+
elseif(APPLE)
|
|
102
|
+
file(GLOB DYLIBS ${CMAKE_BINARY_DIR}/*.dylib)
|
|
103
|
+
INSTALL(FILES ${DYLIBS} DESTINATION lib)
|
|
104
|
+
endif()
|
|
105
|
+
endif()
|
|
106
|
+
{{/is_exe}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from conan import ConanFile
|
|
2
2
|
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain, CMakeDeps
|
|
3
3
|
from conan.tools.scm import Git
|
|
4
|
-
from conan.tools.files import update_conandata
|
|
4
|
+
from conan.tools.files import update_conandata, copy
|
|
5
5
|
import os
|
|
6
6
|
|
|
7
7
|
|
|
@@ -17,7 +17,8 @@ class {{{project_name_camelcase}}}Conan(ConanFile):
|
|
|
17
17
|
options = {"shared": [True, False], "test": [True, False]}
|
|
18
18
|
default_options = {"shared": True, "test": False}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
@property
|
|
21
|
+
def version_name(self):
|
|
21
22
|
type_dict = {"stable": "R", "snapshot": "D", "testing": "T"}
|
|
22
23
|
type = type_dict.get(self.channel, "S")
|
|
23
24
|
hash = os.getenv("GIT_COMMIT", "")[:6]
|
|
@@ -46,14 +47,26 @@ class {{{project_name_camelcase}}}Conan(ConanFile):
|
|
|
46
47
|
cmake_layout(self)
|
|
47
48
|
|
|
48
49
|
def generate(self):
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if self.settings.os == "Windows":
|
|
51
|
+
tc = CMakeToolchain(self, generator="Ninja")
|
|
52
|
+
else:
|
|
53
|
+
tc = CMakeToolchain(self)
|
|
54
|
+
|
|
55
|
+
if self.version:
|
|
56
|
+
tc.variables["VERSION_NAME"] = self.version_name
|
|
51
57
|
tc.variables["BUILD_TEST"] = self.options.test
|
|
52
58
|
tc.generate()
|
|
53
59
|
|
|
54
60
|
deps = CMakeDeps(self)
|
|
55
61
|
deps.generate()
|
|
56
62
|
|
|
63
|
+
if self.settings.os == "Windows":
|
|
64
|
+
for dep in self.dependencies.values():
|
|
65
|
+
for bindir in dep.cpp_info.bindirs:
|
|
66
|
+
copy(self, "*.dll", bindir, self.build_folder)
|
|
67
|
+
copy(self, "*.dylib", bindir, self.build_folder)
|
|
68
|
+
|
|
69
|
+
|
|
57
70
|
def build(self):
|
|
58
71
|
cmake = CMake(self)
|
|
59
72
|
cmake.configure()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
######################################################################
|
|
2
|
+
# Automatically generated by cppiniter {{{date_time}}}
|
|
3
|
+
######################################################################
|
|
4
|
+
|
|
5
|
+
add_executable(example)
|
|
6
|
+
|
|
7
|
+
target_include_directories(example INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
|
8
|
+
|
|
9
|
+
file(GLOB SRC "*/*.h"
|
|
10
|
+
"*/*.cpp"
|
|
11
|
+
"*.hpp"
|
|
12
|
+
"*.cpp")
|
|
13
|
+
target_sources(example PRIVATE ${SRC})
|
|
14
|
+
|
|
15
|
+
target_link_libraries(${TARGET} PRIVATE {{{project_name}}})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
######################################################################
|
|
2
|
+
# Automatically generated by cppiniter {{{date_time}}}
|
|
3
|
+
######################################################################
|
|
4
|
+
|
|
5
|
+
{{#is_exe}}
|
|
6
|
+
add_executable({{{project_name}}})
|
|
7
|
+
{{/is_exe}}
|
|
8
|
+
{{^is_exe}}
|
|
9
|
+
add_library({{{project_name}}})
|
|
10
|
+
|
|
11
|
+
if(BUILD_SHARED_LIBS)
|
|
12
|
+
target_compile_definitions({{{project_name}}} PRIVATE {{{project_name_uppercase}} {{{project_name_uppercase}}_EXPORTS)
|
|
13
|
+
endif()
|
|
14
|
+
{{/is_exe}}
|
|
15
|
+
|
|
16
|
+
target_include_directories({{{project_name}}} PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_BINARY_DIR})
|
|
17
|
+
|
|
18
|
+
{{#is_exe}}
|
|
19
|
+
configure_file(${CMAKE_CURRENT_LIST_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
|
|
20
|
+
{{/is_exe}}
|
|
21
|
+
{{^is_exe}}
|
|
22
|
+
configure_file(${CMAKE_CURRENT_LIST_DIR}/{{{project_name}}}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
|
|
23
|
+
{{/is_exe}}
|
|
24
|
+
list(APPEND SRC ${CMAKE_CURRENT_LIST_DIR}/{{{project_name}}}/version.cpp)
|
|
25
|
+
|
|
26
|
+
file(GLOB SRC "*/*.h"
|
|
27
|
+
"*/*.cpp"
|
|
28
|
+
"*.hpp"
|
|
29
|
+
"*.cpp")
|
|
30
|
+
target_sources({{{project_name}}} PRIVATE ${SRC})
|
|
31
|
+
|
|
32
|
+
find_package(fmt REQUIRED CONFIG)
|
|
33
|
+
|
|
34
|
+
target_link_libraries(${TARGET} fmt::fmt)
|
|
35
|
+
|
|
36
|
+
INSTALL(TARGETS {{{project_name}}}
|
|
37
|
+
RUNTIME DESTINATION bin
|
|
38
|
+
LIBRARY DESTINATION lib
|
|
39
|
+
ARCHIVE DESTINATION lib)
|
|
40
|
+
|
|
41
|
+
if(MSVC AND BUILD_SHARED_LIBS)
|
|
42
|
+
install(FILES $<TARGET_PDB_FILE:{{{project_name}}}> DESTINATION lib)
|
|
43
|
+
endif()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// clang-format off
|
|
4
|
+
// Generic helper definitions for shared library support
|
|
5
|
+
#if defined _WIN32 || defined __CYGWIN__
|
|
6
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_IMPORT __declspec(dllimport)
|
|
7
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_EXPORT __declspec(dllexport)
|
|
8
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_LOCAL
|
|
9
|
+
#else
|
|
10
|
+
#if __GNUC__ >= 4
|
|
11
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
|
|
12
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
|
|
13
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
|
14
|
+
#else
|
|
15
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_IMPORT
|
|
16
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_EXPORT
|
|
17
|
+
#define {{{project_name_uppercase}}}_HELPER_DLL_LOCAL
|
|
18
|
+
#endif
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Now we use the generic helper definitions above to define {{{project_name_uppercase}}}_API and {{{project_name_uppercase}}}_LOCAL.
|
|
22
|
+
// {{{project_name_uppercase}}}_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
|
|
23
|
+
// {{{project_name_uppercase}}}_LOCAL is used for non-api symbols.
|
|
24
|
+
|
|
25
|
+
#ifdef {{{project_name_uppercase}}}_DLL // defined if {{{project_name_uppercase}}} is compiled as a DLL
|
|
26
|
+
#ifdef {{{project_name_uppercase}}}_DLL_EXPORTS // defined if we are building the {{{project_name_uppercase}}} DLL (instead of using it)
|
|
27
|
+
#define {{{project_name_uppercase}}}_API {{{project_name_uppercase}}}_HELPER_DLL_EXPORT
|
|
28
|
+
#else
|
|
29
|
+
#define {{{project_name_uppercase}}}_API {{{project_name_uppercase}}}_HELPER_DLL_IMPORT
|
|
30
|
+
#endif // {{{project_name_uppercase}}}_DLL_EXPORTS
|
|
31
|
+
#define {{{project_name_uppercase}}}_LOCAL {{{project_name_uppercase}}}_HELPER_DLL_LOCAL
|
|
32
|
+
#else // {{{project_name_uppercase}}}_DLL is not defined: this means {{{project_name_uppercase}}} is a static lib.
|
|
33
|
+
#define {{{project_name_uppercase}}}_API
|
|
34
|
+
#define {{{project_name_uppercase}}}_LOCAL
|
|
35
|
+
#endif // {{{project_name_uppercase}}}_DLL
|
|
36
|
+
// clang-format on
|
|
File without changes
|
|
File without changes
|
|
@@ -19,7 +19,14 @@ cppiniter/files/CMakeSettings.json
|
|
|
19
19
|
cppiniter/files/README.md
|
|
20
20
|
cppiniter/files/conanfile.py
|
|
21
21
|
cppiniter/files/version.properties
|
|
22
|
+
cppiniter/files/example/CMakeLists.txt
|
|
23
|
+
cppiniter/files/example/main.cpp
|
|
22
24
|
cppiniter/files/src/CMakeLists.txt
|
|
23
25
|
cppiniter/files/src/main.cpp
|
|
26
|
+
cppiniter/files/src/version.h.in
|
|
27
|
+
cppiniter/files/src/project_name/export.h
|
|
28
|
+
cppiniter/files/src/project_name/project_name.cpp
|
|
29
|
+
cppiniter/files/src/project_name/project_name.h
|
|
30
|
+
cppiniter/files/src/project_name/version.h.in
|
|
24
31
|
cppiniter/files/test/CMakeLists.txt
|
|
25
32
|
cppiniter/files/test/main.cpp
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
######################################################################
|
|
2
|
-
# Automatically generated by cppiniter {{{date_time}}}
|
|
3
|
-
######################################################################
|
|
4
|
-
|
|
5
|
-
{{#is_lib}}
|
|
6
|
-
add_library({{{project_name}}})
|
|
7
|
-
{{/is_lib}}
|
|
8
|
-
{{^is_lib}}
|
|
9
|
-
add_executable({{{project_name}}})
|
|
10
|
-
{{/is_lib}}
|
|
11
|
-
|
|
12
|
-
target_include_directories({{{project_name}}} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
|
13
|
-
|
|
14
|
-
file(GLOB SRC "*/*.h"
|
|
15
|
-
"*/*.cpp"
|
|
16
|
-
"*.hpp"
|
|
17
|
-
"*.cpp")
|
|
18
|
-
target_sources({{{project_name}}} PRIVATE ${SRC})
|
|
19
|
-
|
|
20
|
-
find_package(fmt REQUIRED CONFIG)
|
|
21
|
-
|
|
22
|
-
target_link_libraries(${TARGET} fmt::fmt)
|
|
23
|
-
|
|
24
|
-
target_link_libraries({{{project_name}}} ${CONAN_LIBS})
|
|
25
|
-
|
|
26
|
-
# install
|
|
27
|
-
INSTALL(TARGETS {{{project_name}}}
|
|
28
|
-
RUNTIME DESTINATION bin
|
|
29
|
-
LIBRARY DESTINATION lib
|
|
30
|
-
ARCHIVE DESTINATION lib)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|