Skip to content

Commit 7bc299a

Browse files
committed
feat: update templates
1 parent afec8f0 commit 7bc299a

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

.tmplr.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,37 @@ steps:
5656
to: src/pr_module.cpp
5757
- copy: .github/pragma_module_info.json.tmpl
5858
to: .github/pragma_module_info.json
59-
- copy: CMakeLists.txt.tmpl
60-
to: CMakeLists.txt
6159
- copy: examples/ex_load_pragma_module.tmpl.lua
6260
to: examples/ex_load_pragma_module.lua
6361

62+
- write: |
63+
module_type raw: {{ module_type }}
64+
module_type_norm: {{ module_type | trim | lowercase }}
65+
match_shared: {{ module_type | matches: "(?i)^shared$" }}
66+
match_client: {{ module_type | matches: "(?i)^client$" }}
67+
match_server: {{ module_type | matches: "(?i)^server$" }}
68+
to: tmplr-debug.txt
69+
70+
- if:
71+
eval: '{{ module_type | matches: server }}'
72+
copy: CMakeLists.server.txt.tmpl
73+
to: CMakeLists.txt
74+
else:
75+
if:
76+
eval: '{{ module_type | matches: client }}'
77+
copy: CMakeLists.client.txt.tmpl
78+
to: CMakeLists.txt
79+
else:
80+
copy: CMakeLists.shared.txt.tmpl
81+
to: CMakeLists.txt
82+
6483
- remove: README.tmpl.md
6584
- remove: Install.cmake.tmpl
6685
- remove: src/pr_module.cpp.tmpl
6786
- remove: .github/pragma_module_info.json.tmpl
68-
- remove: CMakeLists.txt.tmpl
87+
- remove: CMakeLists.shared.txt.tmpl
88+
- remove: CMakeLists.server.txt.tmpl
89+
- remove: CMakeLists.client.txt.tmpl
6990
- remove: template_pragma_module.json
7091
- remove: examples/ex_load_pragma_module.tmpl.lua
7192
- remove: .gitignore
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
include(${CMAKE_SOURCE_DIR}/cmake/pr_common.cmake)
22

33
set(PROJ_NAME {{ tmplr.module_name }})
4-
set(MODULE_TYPE {{ tmplr.module_type }})
54

65
pr_add_module(${PROJ_NAME} "{{ tmplr.install_directory }}")
76

87
pr_add_dependency(${PROJ_NAME} shared TARGET PUBLIC)
9-
if("${MODULE_TYPE}" STREQUAL "client")
10-
pr_add_dependency(${PROJ_NAME} client TARGET PUBLIC)
11-
elseif("${MODULE_TYPE}" STREQUAL "server")
12-
pr_add_dependency(${PROJ_NAME} server TARGET PUBLIC)
13-
endif()
8+
pr_add_dependency(${PROJ_NAME} client TARGET PUBLIC)
149

1510
pr_init_module(${PROJ_NAME})
1611

CMakeLists.server.txt.tmpl

Whitespace-only changes.

CMakeLists.shared.txt.tmpl

Whitespace-only changes.

0 commit comments

Comments
 (0)