Skip to content

Commit ff0d4c2

Browse files
committed
Proper CMake hookup
* Issues with deleting .view files
1 parent 6c9f328 commit ff0d4c2

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

CMakeModule/CMakeLists.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(RezachtNative)
3+
project(RezachtCore)
4+
5+
file(GLOB_RECURSE VIEW_FILES "views/*.view")
6+
add_custom_target(
7+
run_rezacht
8+
COMMAND bash ./tools/buildall.sh
9+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
10+
DEPENDS tools/rezacht.sh ${VIEW_FILES}
11+
COMMENT "Applying advanced Rezacht Core technology"
12+
)
413

514
file(GLOB_RECURSE GENERATED_SOURCES "generated/*.g.c")
615
add_library(generated writer.c ${GENERATED_SOURCES})
16+
add_dependencies(generated run_rezacht)
717
target_include_directories(generated PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
818

919
add_executable(generated_test test.c)
1020
target_link_libraries(generated_test PRIVATE generated)
11-
12-
file(GLOB_RECURSE VIEW_FILES "views/*.view")
13-
foreach(file ${VIEW_FILES})
14-
add_custom_command(
15-
TARGET generated PRE_BUILD
16-
COMMAND bash ./tools/rezacht.sh ${file}
17-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
18-
DEPENDS tools/rezacht.sh ${VIEW_FILES}
19-
COMMENT "Running rezacht.sh on ${file}"
20-
)
21-
endforeach()

CMakeModule/generated/SubComponent.view.g.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
writer_append(writer, "<!--SubComponent-->");
88
writer_append(writer, ("<div"));writer_append(writer, " class=\"");writer_append(writer, "d-flex");writer_append(writer, ("\">"));
99
writer_append(writer, ("<h4>"));
10-
writer_append(writer, state->content ? state->content : "");
10+
writer_append(writer, state->content);
1111
writer_append(writer, "</h4>");
1212
writer_append(writer, "</div>");
1313
writer_append(writer, "\n");

CMakeModule/tools/buildall.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
find ./generated -type f -name "*.g.h" -exec rm -f {} +
4+
find ./generated -type f -name "*.g.c" -exec rm -f {} +
5+
6+
find ./views -type f -name "*.view" -exec ./tools/rezacht.sh {} \;

CMakeModule/views/SubComponent.view

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ state {
33
}
44

55
div(| class = {"d-flex"} |
6-
h4({state->content ? state->content : ""})
6+
h4({state->content})
77
)
88

99
<>

0 commit comments

Comments
 (0)