diff --git a/ecsact/cli/commands/build.cc b/ecsact/cli/commands/build.cc index d026d4f..08322e7 100644 --- a/ecsact/cli/commands/build.cc +++ b/ecsact/cli/commands/build.cc @@ -32,7 +32,7 @@ constexpr auto USAGE = R"docopt(Ecsact Build Command Usage: ecsact build (-h | --help) - ecsact build ... --recipe=... --output= [--allow-unresolved-imports] [--format=] [--temp_dir=] [--compiler_config=] [--report_filter=] + ecsact build ... --recipe=... --output= [--allow-unresolved-imports] [--format=] [--temp_dir=] [--compiler_config=] [--report_filter=] [--debug] Options: Ecsact files used to build Ecsact Runtime @@ -42,6 +42,7 @@ constexpr auto USAGE = R"docopt(Ecsact Build Command --compiler_config= Optionally specify the compiler by name or path -f --format= The format used to report progress of the build [default: text] --report_filter= Filtering out report logs [default: none] + --debug Compile with debug symbols )docopt"; // TODO(zaucy): Add this documentation to docopt (msvc regex fails) @@ -289,6 +290,7 @@ auto ecsact::cli::detail::build_command( // .files = file_paths, .work_dir = work_dir, .output_path = output_path, + .debug = args["--debug"].asBool(), .additional_plugin_dirs = additional_plugin_dirs, }; auto runtime_output_path = diff --git a/ecsact/cli/commands/build/recipe/cook.cc b/ecsact/cli/commands/build/recipe/cook.cc index 31a9929..365d551 100644 --- a/ecsact/cli/commands/build/recipe/cook.cc +++ b/ecsact/cli/commands/build/recipe/cook.cc @@ -344,6 +344,7 @@ struct compile_options { fs::path output_path; std::vector imports; std::vector exports; + bool debug; }; auto clang_gcc_compile(compile_options options) -> int { @@ -562,6 +563,9 @@ auto cl_compile(compile_options options) -> int { } cl_args.push_back("/link"); + if(options.debug) { + cl_args.push_back("/DEBUG"); + } cl_args.push_back("/DLL"); for(auto lib_dir : options.compiler.std_lib_paths) { @@ -769,6 +773,7 @@ auto ecsact::cli::cook_recipe( // .output_path = output_path, .imports = as_vec(recipe.imports()), .exports = as_vec(recipe.exports()), + .debug = recipe_options.debug, }); } else { exit_code = clang_gcc_compile({ @@ -780,6 +785,7 @@ auto ecsact::cli::cook_recipe( // .output_path = output_path, .imports = as_vec(recipe.imports()), .exports = as_vec(recipe.exports()), + .debug = recipe_options.debug, }); } diff --git a/ecsact/cli/commands/build/recipe/cook.hh b/ecsact/cli/commands/build/recipe/cook.hh index af6ee7e..b2eb4e0 100644 --- a/ecsact/cli/commands/build/recipe/cook.hh +++ b/ecsact/cli/commands/build/recipe/cook.hh @@ -11,6 +11,7 @@ struct cook_recipe_options { std::vector files; std::filesystem::path work_dir; std::filesystem::path output_path; + bool debug; /** Other directories to check for codegen plugins */ std::vector additional_plugin_dirs; diff --git a/test/build_recipe/test_build_recipe.cc b/test/build_recipe/test_build_recipe.cc index 41b9e2f..35468b3 100644 --- a/test/build_recipe/test_build_recipe.cc +++ b/test/build_recipe/test_build_recipe.cc @@ -38,6 +38,7 @@ TEST(Build, Success) { std::format("--recipe={}", test_build_recipe_path), "--output=test_ecsact_runtime"s, "--temp_dir=_test_build_recipe_temp"s, + "--debug"s, }); ASSERT_EQ(exit_code, 0);