diff --git a/releasenotes.md b/releasenotes.md index 1e2b6dd86..b16344429 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -6,6 +6,7 @@ - Error when using $vaarg/$vacount/$vasplat and similar in a macro without vaargs #2510. - Add splat defaults for designated initialization #2441. - Add new builtins `$$str_snakecase` `$$str_replace` and `$$str_pascalcase`. +- `"build-dir"` option now available for `project.json`, added to project. #2323 ### Fixes - Bug in `io::write_using_write_byte`. diff --git a/src/build/project.c b/src/build/project.c index c844b7ed1..0ac857e72 100644 --- a/src/build/project.c +++ b/src/build/project.c @@ -9,6 +9,7 @@ const char *project_default_keys[][2] = { {"authors", "Authors, optionally with email."}, {"benchfn", "Override the benchmark function."}, + {"build-dir", "Build location, where intermediate files are placed by default, relative to project file."}, {"c-include-dirs", "Set the include directories for C sources."}, {"c-sources", "Set the C sources to be compiled."}, {"cc", "Set C compiler (defaults to 'cc')."}, @@ -77,6 +78,7 @@ const int project_default_keys_count = ELEMENTLEN(project_default_keys); const char* project_deprecated_target_keys[] = { "xxxxxxxxxx" }; const char* project_target_keys[][2] = { {"benchfn", "Override the benchmark function."}, + {"build-dir", "Build location, where intermediate files are placed by default, relative to project file."}, {"c-include-dirs", "C sources include directories for the target."}, {"c-include-dirs-override", "Additional C sources include directories for the target, overriding global settings."}, {"c-sources", "Additional C sources to be compiled for the target."}, @@ -182,6 +184,7 @@ static void load_into_build_target(BuildParseContext context, JSONObject *json, target->run_dir = get_string(context, json, "run-dir", target->run_dir); // The output directory target->output_dir = get_string(context, json, "output", target->output_dir); + target->build_dir = get_string(context, json, "build-dir", target->build_dir); if (context.target) { diff --git a/src/build/project_creation.c b/src/build/project_creation.c index e4dc1a357..6eba5c6dd 100644 --- a/src/build/project_creation.c +++ b/src/build/project_creation.c @@ -27,6 +27,8 @@ const char* JSON_EXE = " // \"c-sources\": [ \"csource/**\" ],\n" " // Include directories for C sources relative to the project file.\n" " // \"c-include-dirs\": [ \"csource/include\" ],\n" + " // Build location, relative to project file.\n" + " \"build-dir\": \"build\",\n" " // Output location, relative to project file.\n" " \"output\": \"build\",\n" " // Architecture and OS target.\n" diff --git a/src/build/project_manipulation.c b/src/build/project_manipulation.c index a75ee4a61..59e042294 100644 --- a/src/build/project_manipulation.c +++ b/src/build/project_manipulation.c @@ -540,6 +540,7 @@ void view_project(BuildOptions *build_options) VIEW_STRING_ARRAY("Source paths", "sources", ", "); VIEW_STRING_ARRAY("C source paths", "c-sources", ", "); VIEW_STRING("Output location", "output"); + VIEW_STRING("Build location", "build-dir"); VIEW_STRING("Output extension", "extension"); VIEW_SETTING("Default optimization level", "opt", optimization_levels);