Skip to content

Commit 9caed5f

Browse files
committed
Exclude code generation from regular build
1 parent 2f81e60 commit 9caed5f

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,13 @@ set(OBJECT_LIST
7171
"Plugin"
7272
"Stream"
7373
"VolumeControl"
74-
)
74+
)
75+
76+
add_custom_target("gen")
7577

7678
foreach(CLASS IN LISTS OBJECT_LIST)
7779
add_custom_command(
78-
DEPENDS
79-
"${PROJECT_SOURCE_DIR}/src/${CLASS}.json"
80-
"${PROJECT_SOURCE_DIR}/script/generate-accessors.py"
81-
OUTPUT
82-
"${PROJECT_SOURCE_DIR}/src/${CLASS}.g.cpp"
80+
TARGET "gen"
8381
COMMAND cd "${PROJECT_SOURCE_DIR}" &&
8482
"${PROJECT_SOURCE_DIR}/script/generate-accessors.py"
8583
-i "src/${CLASS}.json"
@@ -95,11 +93,7 @@ foreach(CLASS IN LISTS OBJECT_LIST)
9593
endforeach()
9694

9795
add_custom_command(
98-
DEPENDS
99-
"${PROJECT_SOURCE_DIR}/src/Bridge.json"
100-
"${PROJECT_SOURCE_DIR}/script/generate-bridge.py"
101-
OUTPUT
102-
"${PROJECT_SOURCE_DIR}/src/Bridge.g.cpp"
96+
TARGET "gen"
10397
COMMAND cd "${PROJECT_SOURCE_DIR}" &&
10498
"${PROJECT_SOURCE_DIR}/script/generate-bridge.py"
10599
-i "src/Bridge.json"
@@ -113,10 +107,7 @@ list(APPEND SOURCE_LIST
113107
)
114108

115109
add_custom_command(
116-
DEPENDS
117-
"${PROJECT_SOURCE_DIR}/script/generate-strings.py"
118-
OUTPUT
119-
"${PROJECT_SOURCE_DIR}/src/Strings.g.cpp"
110+
TARGET "gen"
120111
COMMAND cd "${PROJECT_SOURCE_DIR}" &&
121112
"${PROJECT_SOURCE_DIR}/script/generate-strings.py"
122113
-c "${CMAKE_CXX_COMPILER}"

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,31 @@ CODESIGN_ID ?= \
1212

1313
all: release_build
1414

15-
release_build:
15+
release_cmake:
1616
mkdir -p build/Release
1717
cd build/Release && $(CMAKE) $(CMAKE_ARGS) -DCMAKE_BUILD_TYPE=Release ../..
18+
19+
release_build: release_cmake
1820
cd build/Release && make -j$(NUM_CPU)
1921

20-
debug_build:
22+
debug_cmake:
2123
mkdir -p build/Debug
2224
cd build/Debug && $(CMAKE) $(CMAKE_ARGS) \
2325
-DCMAKE_BUILD_TYPE=Debug \
2426
-DENABLE_SANITIZERS=ON \
2527
-DBUILD_TESTING=ON \
2628
-DBUILD_DOCUMENTATION=ON \
2729
../..
30+
31+
debug_build: debug_cmake
2832
cd build/Debug && make -j$(NUM_CPU)
2933

3034
.PHONY: test
3135
test: debug_build
3236
cd build/Debug && make test ARGS="-V"
3337

34-
install:
35-
cd build/Release && make install
38+
gen: debug_cmake
39+
cd build/Debug && make gen
3640

3741
.PHONY: example
3842
example:
@@ -41,6 +45,9 @@ example:
4145
-DCMAKE_BUILD_TYPE=Release -DCODESIGN_ID="$(CODESIGN_ID)" ../../example
4246
cd build/Example && make -j$(NUM_CPU)
4347

48+
install:
49+
cd build/Release && make install
50+
4451
clean:
4552
rm -rf build
4653
rm -rf html

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,19 @@ Build and run tests:
508508
make test
509509
```
510510

511+
Run code generation:
512+
513+
```
514+
make gen
515+
```
516+
511517
Remove build results:
512518

513519
```
514520
make clean
515521
```
516522

517-
Also remove generated files:
523+
Remove build results and generated files:
518524

519525
```
520526
make clobber

0 commit comments

Comments
 (0)