mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Feature flags possible to add in project.json. See #991
This commit is contained in:
@@ -11,5 +11,7 @@ fn int main()
|
|||||||
printf("Hello World!\n");
|
printf("Hello World!\n");
|
||||||
bar::test();
|
bar::test();
|
||||||
printf("Hello double: %d\n", test_doubler(11));
|
printf("Hello double: %d\n", test_doubler(11));
|
||||||
|
if ($feature(ABCD)) io::printn("ABCD");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
// libraries to use
|
// libraries to use
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
|
||||||
|
"features": ["ABCD"],
|
||||||
|
|
||||||
// c compiler
|
// c compiler
|
||||||
"cc": "cc",
|
"cc": "cc",
|
||||||
// c sources
|
// c sources
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const char *project_default_keys[] = {
|
|||||||
"winsdk",
|
"winsdk",
|
||||||
"x86-stack-struct-return",
|
"x86-stack-struct-return",
|
||||||
"x86vec",
|
"x86vec",
|
||||||
|
"features"
|
||||||
};
|
};
|
||||||
|
|
||||||
const int project_default_keys_count = sizeof(project_default_keys) / sizeof(char*);
|
const int project_default_keys_count = sizeof(project_default_keys) / sizeof(char*);
|
||||||
@@ -86,6 +87,7 @@ const char* project_target_keys[] = {
|
|||||||
"winsdk",
|
"winsdk",
|
||||||
"x86-stack-struct-return",
|
"x86-stack-struct-return",
|
||||||
"x86vec",
|
"x86vec",
|
||||||
|
"features",
|
||||||
};
|
};
|
||||||
|
|
||||||
const int project_target_keys_count = sizeof(project_target_keys) / sizeof(char*);
|
const int project_target_keys_count = sizeof(project_target_keys) / sizeof(char*);
|
||||||
@@ -357,6 +359,18 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg
|
|||||||
int fpmath = get_valid_string_setting(json, "fp-math", type, fp_math, 0, 3, "strict, relaxed, fast");
|
int fpmath = get_valid_string_setting(json, "fp-math", type, fp_math, 0, 3, "strict, relaxed, fast");
|
||||||
if (fpmath > -1) target->feature.fp_math = fpmath;
|
if (fpmath > -1) target->feature.fp_math = fpmath;
|
||||||
|
|
||||||
|
const char **features = get_valid_array(json, "features", type, false);
|
||||||
|
if (features)
|
||||||
|
{
|
||||||
|
FOREACH_BEGIN(const char *feature, features)
|
||||||
|
if (!str_is_valid_constant(feature))
|
||||||
|
{
|
||||||
|
error_exit("Error reading 'features': '%s' is not a valid feature name.", feature);
|
||||||
|
}
|
||||||
|
vec_add(target->feature_list, feature);
|
||||||
|
FOREACH_END();
|
||||||
|
}
|
||||||
|
|
||||||
// x86vec
|
// x86vec
|
||||||
int x86vec = get_valid_string_setting(json, "x86vec", type, x86_vector_capability, 0, 6, "none, native, mmx, sse, avx or avx512");
|
int x86vec = get_valid_string_setting(json, "x86vec", type, x86_vector_capability, 0, 6, "none, native, mmx, sse, avx or avx512");
|
||||||
if (x86vec > -1) target->feature.x86_vector_capability = x86vec;
|
if (x86vec > -1) target->feature.x86_vector_capability = x86vec;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define COMPILER_VERSION "0.4.645"
|
#define COMPILER_VERSION "0.4.646"
|
||||||
Reference in New Issue
Block a user