Skip to content

Commit

Permalink
feat: always build with ECSACT_BUILD define (#98)
Browse files Browse the repository at this point in the history
When building with 'ecsact build' there will always be a C/C++ define
called `ECSACT_BUILD`
  • Loading branch information
zaucy authored May 15, 2024
1 parent 882be18 commit dd252ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ecsact/cli/commands/build/recipe/cook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ auto clang_gcc_compile(compile_options options) -> int {
return 1;
}

compile_proc_args.push_back("-DECSACT_BUILD");

for(auto def : generated_defines) {
compile_proc_args.push_back(std::format("-D{}", def));
}
Expand Down Expand Up @@ -504,6 +506,7 @@ auto cl_compile(compile_options options) -> int {
cl_args.push_back("/nologo");
cl_args.push_back("/std:c++20");
cl_args.push_back("/diagnostics:column");
cl_args.push_back("/DECSACT_BUILD");

// TODO(zaucy): Add debug mode
// if(options.debug) {
Expand Down
5 changes: 5 additions & 0 deletions test/build_recipe/ecsact_build_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include "local_dep.hh"

// This define is _always_ defined when using the Ecsact CLI build command
#ifndef ECSACT_BUILD
# error "This test should only have been built through 'ecsact build'"
#endif

ecsact_registry_id ecsact_create_registry( //
const char*
) {
Expand Down
5 changes: 5 additions & 0 deletions test/build_recipe/ecsact_build_test_merge.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "ecsact/runtime/dynamic.h"

// This define is _always_ defined when using the Ecsact CLI build command
#ifndef ECSACT_BUILD
# error "This test should only have been built through 'ecsact build'"
#endif

void ecsact_system_execution_context_get(struct ecsact_system_execution_context*, ecsact_component_like_id, void*) {
}

Expand Down

0 comments on commit dd252ff

Please # to comment.