mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-21 05:05:00 -07:00
Add ODIN_BUILD_PROJECT_NAME and //+build-project-name
This allows for condition inclusion of files, similar to `+build` or `ODIN_BUILD`, but relies on the directory name of the project to be the same as specified
Example:
odin build foo/bar/baz
ODIN_BUILD_PROJECT_NAME == "baz"
//+build_project_name baz
This commit is contained in:
@@ -225,6 +225,7 @@ struct BuildContext {
|
||||
String ODIN_VENDOR; // compiler vendor
|
||||
String ODIN_VERSION; // compiler version
|
||||
String ODIN_ROOT; // Odin ROOT
|
||||
String ODIN_BUILD_PROJECT_NAME; // Odin main/initial package's directory name
|
||||
bool ODIN_DEBUG; // Odin in debug mode
|
||||
bool ODIN_DISABLE_ASSERT; // Whether the default 'assert' et al is disabled in code or not
|
||||
bool ODIN_DEFAULT_TO_NIL_ALLOCATOR; // Whether the default allocator is a "nil" allocator or not (i.e. it does nothing)
|
||||
@@ -1537,6 +1538,12 @@ bool init_build_paths(String init_filename) {
|
||||
enable_target_feature({}, bc->target_features_string);
|
||||
}
|
||||
|
||||
{
|
||||
String build_project_name = last_path_element(bc->build_paths[BuildPath_Main_Package].basename);
|
||||
GB_ASSERT(build_project_name.len > 0);
|
||||
bc->ODIN_BUILD_PROJECT_NAME = build_project_name;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user