Skip to content

Commit dd252ff

Browse files
authored
feat: always build with ECSACT_BUILD define (#98)
When building with 'ecsact build' there will always be a C/C++ define called `ECSACT_BUILD`
1 parent 882be18 commit dd252ff

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

ecsact/cli/commands/build/recipe/cook.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ auto clang_gcc_compile(compile_options options) -> int {
393393
return 1;
394394
}
395395

396+
compile_proc_args.push_back("-DECSACT_BUILD");
397+
396398
for(auto def : generated_defines) {
397399
compile_proc_args.push_back(std::format("-D{}", def));
398400
}
@@ -504,6 +506,7 @@ auto cl_compile(compile_options options) -> int {
504506
cl_args.push_back("/nologo");
505507
cl_args.push_back("/std:c++20");
506508
cl_args.push_back("/diagnostics:column");
509+
cl_args.push_back("/DECSACT_BUILD");
507510

508511
// TODO(zaucy): Add debug mode
509512
// if(options.debug) {

test/build_recipe/ecsact_build_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
#include "local_dep.hh"
55

6+
// This define is _always_ defined when using the Ecsact CLI build command
7+
#ifndef ECSACT_BUILD
8+
# error "This test should only have been built through 'ecsact build'"
9+
#endif
10+
611
ecsact_registry_id ecsact_create_registry( //
712
const char*
813
) {

test/build_recipe/ecsact_build_test_merge.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#include "ecsact/runtime/dynamic.h"
22

3+
// This define is _always_ defined when using the Ecsact CLI build command
4+
#ifndef ECSACT_BUILD
5+
# error "This test should only have been built through 'ecsact build'"
6+
#endif
7+
38
void ecsact_system_execution_context_get(struct ecsact_system_execution_context*, ecsact_component_like_id, void*) {
49
}
510

0 commit comments

Comments
 (0)