From a06cc76c9bd4b526d77220571258e32df2ec62e1 Mon Sep 17 00:00:00 2001 From: Dmitry Atamanov Date: Sun, 17 Sep 2023 22:59:56 +0500 Subject: [PATCH] Support additional keys in projects. --- resources/examples/nolibc/project.json | 72 +++++- src/build/build_options.h | 1 + src/build/project.c | 79 +++++-- src/build/project_creation.c | 294 +++++++++++++++---------- 4 files changed, 306 insertions(+), 140 deletions(-) diff --git a/resources/examples/nolibc/project.json b/resources/examples/nolibc/project.json index b3d8c461e..efdd711b0 100644 --- a/resources/examples/nolibc/project.json +++ b/resources/examples/nolibc/project.json @@ -1,21 +1,79 @@ { + // Language version of C3. + "langrev": "1", + // Warnings used for all targets. + "warnings": [ "no-unused" ], + // Directories where C3 library files may be found. + "dependency-search-paths": [ ], + // Libraries to use for all targets. + "dependencies": [ ], + // Authors, optionally with email. "authors": [ "Dmitry Atamanov https://github.com/data-man" ], + // Version using semantic versioning. "version": "0.0.1 Omega", + // Sources compiled for all targets. "sources": [ "./**" ], + // C sources if the project also compiles C sources + // relative to the project file. + // "c-sources": [ "csource/**" ], + // Output location, relative to project file. + "output": ".", + // Architecture and OS target. + // You can use 'c3c --list-targets' to list all valid targets. + "target": "linux-x64", + // Targets. "targets": { "hello_world": { "type": "executable", - "opt": "O3", - "nolibc": true, - "nostdlib": true + "debug-info": "none", + "link-libc": false, + "opt": "O0", + "safe": false, + "system-linker": true, + "use-stdlib": false, }, }, - "debug-info": "none", - "target": "linux-x64", + // Global settings. + // C compiler if the project also compiles C sources + // defaults to 'cc'. + "cc": "cc", + // CPU name, used for optimizations in the LLVM backend. + "cpu": "generic", + // Debug information, may be "none", "full" and "line-tables". + "debug-info": "full", + // FP math behaviour: "strict", "relaxed", "fast". + "fp-math": "strict", + // Link libc other default libraries. + "link-libc": true, + // Memory environment: "normal", "small", "tiny", "none". + "memory-env": "normal", + // Optimization: "O0", "O1", "O2", "O3", "O4", "O5", "Os", "Oz". + "opt": "O0", + // Code optimization level: "none", "less", "more", "max". + "optlevel": "none", + // Code size optimization: "none", "small", "tiny". + "optsize": "none", + // Relocation model: "none", "pic", "PIC", "pie", "PIE". "reloc": "none", + // Trap on signed and unsigned integer wrapping for testing. "trap-on-wrap": false, + // Turn safety (contracts, runtime bounds checking, null pointer checks etc). + "safe": true, + // Compile all modules together, enables more inlining. + "single-module": true, + // Use / don't use soft float, value is otherwise target default. "soft-float": false, + // Strip unused code and globals from the output. + "strip-unused": true, + // The size of the symtab, which limits the amount + // of symbols that can be used. Should usually not be changed. + "symtab": 1048576, + // Use the system linker. + "system-linker": false, + // Include the standard library. + "use-stdlib": true, + // Set general level of x64 cpu: "baseline", "ssse3", "sse4", "avx1", "avx2-v1", "avx2-v2", "avx512", "native". + "x86cpu": "native", + // Set max type of vector use: "none", "mmx", "sse", "avx", "avx512", "native". "x86vec": "sse", - "cpu": "generic", - "output": "." } \ No newline at end of file diff --git a/src/build/build_options.h b/src/build/build_options.h index c948f14ee..d5add48be 100644 --- a/src/build/build_options.h +++ b/src/build/build_options.h @@ -91,6 +91,7 @@ typedef enum TRUST_INCLUDE, TRUST_FULL } TrustLevel; + typedef enum { COMPILE_NORMAL, diff --git a/src/build/project.c b/src/build/project.c index 912dd245b..497767821 100644 --- a/src/build/project.c +++ b/src/build/project.c @@ -16,32 +16,40 @@ const char *project_default_keys[] = { "debug-info", "dependencies", "dependency-search-paths", + "features", + "fp-math", "langrev", - "link-args", "linked-libraries", "linker-search-paths", + "link-args", + "link-libc", "macossdk", "memory-env", "no-entry", - "nolibc", - "nostdlib", "opt", + "optlevel", + "optsize", "output", "panicfn", "reloc", + "safe", + "single-module", "soft-float", "sources", + "strip-unused", "symtab", + "system-linker", "target", "targets", "trap-on-wrap", + "use-stdlib", "version", "warnings", "wincrt", "winsdk", - "x86-stack-struct-return", + "x86cpu", "x86vec", - "features" + "x86-stack-struct-return", }; const int project_default_keys_count = sizeof(project_default_keys) / sizeof(char*); @@ -58,36 +66,44 @@ const char* project_target_keys[] = { "dependencies-override", "dependency-search-paths-add", "dependency-search-paths-override", + "features", + "fp-math", "langrev", - "link-args-add", - "link-args-override", "linked-libraries-add", "linked-libraries-override", "linker-search-paths-add", "linker-search-paths-override", + "link-args-add", + "link-args-override", + "link-libc", "macossdk", "memory-env", "no-entry", - "nolibc", - "nostdlib", "opt", + "optlevel", + "optsize", "output" "panicfn", "reloc", + "safe", + "single-module", "soft-float", "sources-add", "sources-override", + "strip-unused", "symtab", + "system-linker", "target", "trap-on-wrap", "type", + "use-stdlib", "version", "warnings", "wincrt", "winsdk", - "x86-stack-struct-return", + "x86cpu", "x86vec", - "features", + "x86-stack-struct-return", }; const int project_target_keys_count = sizeof(project_target_keys) / sizeof(char*); @@ -298,6 +314,25 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg DebugInfo info = get_valid_string_setting(json, "debug-info", type, debug_infos, 0, 3, "one of 'full' 'line-table' or 'none'."); if (info > -1) target->debug_info = info; + // Optimization Level + static const char *opt_level_settings[4] = { + [OPTIMIZATION_NONE] = "none", + [OPTIMIZATION_LESS] = "less", + [OPTIMIZATION_MORE] = "more", + [OPTIMIZATION_AGGRESSIVE] = "max", + }; + OptimizationLevel optlevel = (OptimizationLevel)get_valid_string_setting(json, "optlevel", type, opt_level_settings, 0, 4, "`none`, `less`, `more`, `max`."); + target->optlevel = optlevel; + + // Size optimization Level + static const char *opt_size_settings[3] = { + [SIZE_OPTIMIZATION_NONE] = "none", + [SIZE_OPTIMIZATION_SMALL] = "small", + [SIZE_OPTIMIZATION_TINY] = "tiny", + }; + SizeOptimizationLevel optsize = (SizeOptimizationLevel)get_valid_string_setting(json, "optsize", type, opt_size_settings, 0, 4, "`none`, `small`, `tiny`."); + target->optsize = optsize; + static const char *opt_settings[8] = { [OPT_SETTING_O0] = "O0", [OPT_SETTING_O1] = "O1", @@ -311,6 +346,12 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg OptimizationSetting opt = (OptimizationSetting)get_valid_string_setting(json, "opt", type, opt_settings, 0, 8, "'O0', 'O1' etc."); update_build_target_with_opt_level(target, opt); + // Safety level + target->feature.safe_mode = (SafetyLevel)get_valid_bool(json, "safe", type, target->feature.safe_mode); + + // Single module + target->single_module = (SingleModule)get_valid_bool(json, "single-module", type, target->single_module); + MemoryEnvironment env = get_valid_string_setting(json, "memory-env", type, memory_environment, 0, 4, "one of 'normal', 'small', 'tiny' or 'none'."); if (env > -1) target->memory_environment = env; @@ -352,7 +393,7 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg if (wincrt > -1) target->win.crt_linking = (WinCrtLinking)wincrt; // fp-math - 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` or `fast`."); if (fpmath > -1) target->feature.fp_math = fpmath; const char **features = get_valid_array(json, "features", type, false); @@ -368,15 +409,15 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg } // 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; // x86vec - int x86cpu = get_valid_string_setting(json, "x86cpu", type, x86_cpu_set, 0, 8, "baseline, ssse3, sse4, avx1, avx2-v1, avx2-v2, avx512 or native"); + int x86cpu = get_valid_string_setting(json, "x86cpu", type, x86_cpu_set, 0, 8, "`baseline`, `ssse3`, `sse4`, `avx1`, `avx2-v1`, `avx2-v2`, `avx512` or `native`."); if (x86cpu > -1) target->feature.x86_cpu_set = x86cpu; // riscvfloat - int riscv_float = get_valid_string_setting(json, "riscvfloat", type, riscv_capability, 0, 3, "none, float or double"); + int riscv_float = get_valid_string_setting(json, "riscvfloat", type, riscv_capability, 0, 3, "`none`, `float` or `double`."); if (riscv_float > -1) target->feature.riscv_float_capability = riscv_float; // winsdk @@ -410,7 +451,13 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg target->panicfn = panicfn; // link-libc - target->link_libc = (LinkLibc)get_valid_bool(json, "nolibc", type, target->link_libc); + target->link_libc = (LinkLibc)get_valid_bool(json, "link-libc", type, target->link_libc); + + // strip-unused + target->strip_unused = (StripUnused)get_valid_bool(json, "strip-unused", type, target->strip_unused); + + // system-linker + target->system_linker = (SystemLinker)get_valid_bool(json, "system-linker", type, target->system_linker); // no-entry target->no_entry = get_valid_bool(json, "no-entry", type, target->no_entry); diff --git a/src/build/project_creation.c b/src/build/project_creation.c index e26a19442..e9b495cf6 100644 --- a/src/build/project_creation.c +++ b/src/build/project_creation.c @@ -13,176 +13,236 @@ const char* JSON_EXE = "{\n" - " // language version of C3\n" + " // Language version of C3.\n" " \"langrev\": \"1\",\n" - " // warnings used for all targets\n" + " // Warnings used for all targets.\n" " \"warnings\": [ \"no-unused\" ],\n" - " // directories where C3 library files may be found\n" + " // Directories where C3 library files may be found.\n" " \"dependency-search-paths\": [ \"lib\" ],\n" - " // libraries to use for all targets\n" + " // Libraries to use for all targets.\n" " \"dependencies\": [ ],\n" - " // authors, optionally with email\n" + " // Authors, optionally with email.\n" " \"authors\": [ \"John Doe \" ],\n" - " // Version using semantic versioning\n" + " // Version using semantic versioning.\n" " \"version\": \"0.1.0\",\n" - " // sources compiled for all targets\n" + " // Sources compiled for all targets.\n" " \"sources\": [ \"src/**\" ],\n" - " // Targets\n" + " // C sources if the project also compiles C sources\n" + " // relative to the project file.\n" + " // \"c-sources\": [ \"csource/**\" ],\n" + " // Output location, relative to project file.\n" + " \"output\": \"../build\",\n" + " // Architecture and OS target.\n" + " // You can use 'c3c --list-targets' to list all valid targets.\n" + " // \"target\": \"windows-x64\",\n" + " // Targets.\n" " \"targets\": {\n" " \"%s\": {\n" - " // executable or library\n" - " \"type\": \"executable\"\n" - " // additional libraries, sources\n" - " // and overrides of global settings here\n" + " // Executable or library.\n" + " \"type\": \"executable\",\n" + " // Additional libraries, sources\n" + " // and overrides of global settings here.\n" " },\n" - " }\n" - " /*\n" - " // Debug information, may be 'none', 'full' and 'line-tables'\n" + " },\n" + " // Global settings.\n" + " // C compiler if the project also compiles C sources\n" + " // defaults to 'cc'.\n" + " \"cc\": \"cc\",\n" + " // CPU name, used for optimizations in the LLVM backend.\n" + " \"cpu\": \"generic\",\n" + " // Debug information, may be \"none\", \"full\" and \"line-tables\".\n" " \"debug-info\": \"full\",\n" - " // Architecture and OS target:\n" - " \"target\": \"windows-x64\",\n" - " // The size of the symtab, which limits the amount\n" - " // of symbols that can be used. Should usually not\n" - " // be changed.\n" - " \"symtab\": 4194304,\n" - " // \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\"\n" + " // FP math behaviour: \"strict\", \"relaxed\", \"fast\".\n" + " \"fp-math\": \"strict\",\n" + " // Link libc other default libraries.\n" + " \"link-libc\": true,\n" + " // Memory environment: \"normal\", \"small\", \"tiny\", \"none\".\n" + " \"memory-env\": \"normal\",\n" + " // Optimization: \"O0\", \"O1\", \"O2\", \"O3\", \"O4\", \"O5\", \"Os\", \"Oz\".\n" + " \"opt\": \"O0\",\n" + " // Code optimization level: \"none\", \"less\", \"more\", \"max\".\n" + " \"optlevel\": \"none\",\n" + " // Code size optimization: \"none\", \"small\", \"tiny\".\n" + " \"optsize\": \"none\",\n" + " // Relocation model: \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\".\n" " \"reloc\": \"none\",\n" - " // Trap on signed and unsigned integer wrapping\n" - " // for testing\n" + " // Trap on signed and unsigned integer wrapping for testing.\n" " \"trap-on-wrap\": false,\n" - " // Use / don't use soft float, value is otherwise target default\n" + " // Turn safety (contracts, runtime bounds checking, null pointer checks etc).\n" + " \"safe\": true,\n" + " // Compile all modules together, enables more inlining.\n" + " \"single-module\": true,\n" + " // Use / don't use soft float, value is otherwise target default.\n" " \"soft-float\": false,\n" - " // Vector settings on x86: none/native/mmx/sse/avx/avx512\n" + " // Strip unused code and globals from the output.\n" + " \"strip-unused\": true,\n" + " // The size of the symtab, which limits the amount\n" + " // of symbols that can be used. Should usually not be changed.\n" + " \"symtab\": 1048576,\n" + " // Use the system linker.\n" + " \"system-linker\": false,\n" + " // Include the standard library.\n" + " \"use-stdlib\": true,\n" + " // Set general level of x64 cpu: \"baseline\", \"ssse3\", \"sse4\", \"avx1\", \"avx2-v1\", \"avx2-v2\", \"avx512\", \"native\".\n" + " \"x86cpu\": \"native\",\n" + " // Set max type of vector use: \"none\", \"mmx\", \"sse\", \"avx\", \"avx512\", \"native\".\n" " \"x86vec\": \"sse\",\n" - " // CPU name, used for optimizations in the LLVM backend\n" - " \"cpu\": \"generic\",\n" - " // Output location, relative to project file\n" - " \"output\": \"../build\",\n" - " // C compiler if the project also compiles c sources\n" - " // defaults to 'cc'\n" - " \"cc\": \"cc\",\n" - " // c sources if the project also compiles c sources\n" - " // relative to the project file\n" - " \"c-sources\": [\n" - " \"csource/**\"\n" - " ]\n" - " */\n" "}"; const char* JSON_STATIC = "{\n" - " // language version of C3\n" + " // Language version of C3.\n" " \"langrev\": \"1\",\n" - " // warnings used for all targets\n" + " // Warnings used for all targets.\n" " \"warnings\": [ \"no-unused\" ],\n" - " // directories where C3 library files may be found\n" + " // Directories where C3 library files may be found.\n" " \"dependency-search-paths\": [ \"lib\" ],\n" - " // libraries to use for all targets\n" + " // Libraries to use for all targets.\n" " \"dependencies\": [ ],\n" - " // authors, optionally with email\n" + " // Authors, optionally with email.\n" " \"authors\": [ \"John Doe \" ],\n" - " // Version using semantic versioning\n" + " // Version using semantic versioning.\n" " \"version\": \"0.1.0\",\n" - " // sources compiled for all targets\n" + " // Sources compiled for all targets.\n" " \"sources\": [ \"src/**\" ],\n" - " // Targets\n" + " // C sources if the project also compiles C sources\n" + " // relative to the project file.\n" + " // \"c-sources\": [ \"csource/**\" ],\n" + " // Output location, relative to project file.\n" + " \"output\": \"../build\",\n" + " // Architecture and OS target.\n" + " // You can use 'c3c --list-targets' to list all valid targets.\n" + " // \"target\": \"windows-x64\",\n" + " // Targets.\n" " \"targets\": {\n" " \"%s\": {\n" - " // executable or library\n" - " \"type\": \"static-lib\"\n" - " // additional libraries, sources\n" - " // and overrides of global settings here\n" + " // Executable or library.\n" + " \"type\": \"static-lib\",\n" + " // Additional libraries, sources\n" + " // and overrides of global settings here.\n" " },\n" - " }\n" - " /*\n" - " // Debug information, may be 'none', 'full' and 'line-tables'\n" + " },\n" + " // Global settings.\n" + " // C compiler if the project also compiles C sources\n" + " // defaults to 'cc'.\n" + " \"cc\": \"cc\",\n" + " // CPU name, used for optimizations in the LLVM backend.\n" + " \"cpu\": \"generic\",\n" + " // Debug information, may be \"none\", \"full\" and \"line-tables\".\n" " \"debug-info\": \"full\",\n" - " // Architecture and OS target:\n" - " \"target\": \"windows-x64\",\n" - " // The size of the symtab, which limits the amount\n" - " // of symbols that can be used. Should usually not\n" - " // be changed.\n" - " \"symtab\": 4194304,\n" - " // \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\"\n" + " // FP math behaviour: \"strict\", \"relaxed\", \"fast\".\n" + " \"fp-math\": \"strict\",\n" + " // Link libc other default libraries.\n" + " \"link-libc\": true,\n" + " // Memory environment: \"normal\", \"small\", \"tiny\", \"none\".\n" + " \"memory-env\": \"normal\",\n" + " // Optimization: \"O0\", \"O1\", \"O2\", \"O3\", \"O4\", \"O5\", \"Os\", \"Oz\".\n" + " \"opt\": \"O0\",\n" + " // Code optimization level: \"none\", \"less\", \"more\", \"max\".\n" + " \"optlevel\": \"none\",\n" + " // Code size optimization: \"none\", \"small\", \"tiny\".\n" + " \"optsize\": \"none\",\n" + " // Relocation model: \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\".\n" " \"reloc\": \"none\",\n" - " // Trap on signed and unsigned integer wrapping\n" - " // for testing\n" + " // Trap on signed and unsigned integer wrapping for testing.\n" " \"trap-on-wrap\": false,\n" - " // Use / don't use soft float, value is otherwise target default\n" + " // Turn safety (contracts, runtime bounds checking, null pointer checks etc).\n" + " \"safe\": true,\n" + " // Compile all modules together, enables more inlining.\n" + " \"single-module\": true,\n" + " // Use / don't use soft float, value is otherwise target default.\n" " \"soft-float\": false,\n" - " // Vector settings on x86: none/native/mmx/sse/avx/avx512\n" + " // Strip unused code and globals from the output.\n" + " \"strip-unused\": true,\n" + " // The size of the symtab, which limits the amount\n" + " // of symbols that can be used. Should usually not be changed.\n" + " \"symtab\": 1048576,\n" + " // Use the system linker.\n" + " \"system-linker\": false,\n" + " // Include the standard library.\n" + " \"use-stdlib\": true,\n" + " // Set general level of x64 cpu: \"baseline\", \"ssse3\", \"sse4\", \"avx1\", \"avx2-v1\", \"avx2-v2\", \"avx512\", \"native\".\n" + " \"x86cpu\": \"native\",\n" + " // Set max type of vector use: \"none\", \"mmx\", \"sse\", \"avx\", \"avx512\", \"native\".\n" " \"x86vec\": \"sse\",\n" - " // CPU name, used for optimizations in the LLVM backend\n" - " \"cpu\": \"generic\",\n" - " // Output location, relative to project file\n" - " \"output\": \"../build\",\n" - " // C compiler if the project also compiles c sources\n" - " // defaults to 'cc'\n" - " \"cc\": \"cc\",\n" - " // c sources if the project also compiles c sources\n" - " // relative to the project file\n" - " \"c-sources\": [\n" - " \"csource/**\"\n" - " ]\n" - " */\n" "}"; const char* JSON_DYNAMIC = "{\n" - " // language version of C3\n" + " // Language version of C3.\n" " \"langrev\": \"1\",\n" - " // warnings used for all targets\n" + " // Warnings used for all targets.\n" " \"warnings\": [ \"no-unused\" ],\n" - " // directories where C3 library files may be found\n" + " // Directories where C3 library files may be found.\n" " \"dependency-search-paths\": [ \"lib\" ],\n" - " // libraries to use for all targets\n" + " // Libraries to use for all targets.\n" " \"dependencies\": [ ],\n" - " // authors, optionally with email\n" + " // Authors, optionally with email.\n" " \"authors\": [ \"John Doe \" ],\n" - " // Version using semantic versioning\n" + " // Version using semantic versioning.\n" " \"version\": \"0.1.0\",\n" - " // sources compiled for all targets\n" + " // Sources compiled for all targets.\n" " \"sources\": [ \"src/**\" ],\n" - " // Targets\n" + " // C sources if the project also compiles C sources\n" + " // relative to the project file.\n" + " // \"c-sources\": [ \"csource/**\" ],\n" + " // Output location, relative to project file.\n" + " \"output\": \"../build\",\n" + " // Architecture and OS target.\n" + " // You can use 'c3c --list-targets' to list all valid targets.\n" + " // \"target\": \"windows-x64\",\n" + " // Targets.\n" " \"targets\": {\n" " \"%s\": {\n" - " // executable or library\n" - " \"type\": \"dynamic-lib\"\n" - " // additional libraries, sources\n" - " // and overrides of global settings here\n" + " // Executable or library.\n" + " \"type\": \"dynamic-lib\",\n" + " // Additional libraries, sources\n" + " // and overrides of global settings here.\n" " },\n" - " }\n" - " /*\n" - " // Debug information, may be 'none', 'full' and 'line-tables'\n" + " },\n" + " // Global settings.\n" + " // C compiler if the project also compiles C sources\n" + " // defaults to 'cc'.\n" + " \"cc\": \"cc\",\n" + " // CPU name, used for optimizations in the LLVM backend.\n" + " \"cpu\": \"generic\",\n" + " // Debug information, may be \"none\", \"full\" and \"line-tables\".\n" " \"debug-info\": \"full\",\n" - " // Architecture and OS target:\n" - " \"target\": \"windows-x64\",\n" - " // The size of the symtab, which limits the amount\n" - " // of symbols that can be used. Should usually not\n" - " // be changed.\n" - " \"symtab\": 4194304,\n" - " // \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\"\n" + " // FP math behaviour: \"strict\", \"relaxed\", \"fast\".\n" + " \"fp-math\": \"strict\",\n" + " // Link libc other default libraries.\n" + " \"link-libc\": true,\n" + " // Memory environment: \"normal\", \"small\", \"tiny\", \"none\".\n" + " \"memory-env\": \"normal\",\n" + " // Optimization: \"O0\", \"O1\", \"O2\", \"O3\", \"O4\", \"O5\", \"Os\", \"Oz\".\n" + " \"opt\": \"O0\",\n" + " // Code optimization level: \"none\", \"less\", \"more\", \"max\".\n" + " \"optlevel\": \"none\",\n" + " // Code size optimization: \"none\", \"small\", \"tiny\".\n" + " \"optsize\": \"none\",\n" + " // Relocation model: \"none\", \"pic\", \"PIC\", \"pie\", \"PIE\".\n" " \"reloc\": \"none\",\n" - " // Trap on signed and unsigned integer wrapping\n" - " // for testing\n" + " // Trap on signed and unsigned integer wrapping for testing.\n" " \"trap-on-wrap\": false,\n" - " // Use / don't use soft float, value is otherwise target default\n" + " // Turn safety (contracts, runtime bounds checking, null pointer checks etc).\n" + " \"safe\": true,\n" + " // Compile all modules together, enables more inlining.\n" + " \"single-module\": true,\n" + " // Use / don't use soft float, value is otherwise target default.\n" " \"soft-float\": false,\n" - " // Vector settings on x86: none/native/mmx/sse/avx/avx512\n" + " // Strip unused code and globals from the output.\n" + " \"strip-unused\": true,\n" + " // The size of the symtab, which limits the amount\n" + " // of symbols that can be used. Should usually not be changed.\n" + " \"symtab\": 1048576,\n" + " // Use the system linker.\n" + " \"system-linker\": false,\n" + " // Include the standard library.\n" + " \"use-stdlib\": true,\n" + " // Set general level of x64 cpu: \"baseline\", \"ssse3\", \"sse4\", \"avx1\", \"avx2-v1\", \"avx2-v2\", \"avx512\", \"native\".\n" + " \"x86cpu\": \"native\",\n" + " // Set max type of vector use: \"none\", \"mmx\", \"sse\", \"avx\", \"avx512\", \"native\".\n" " \"x86vec\": \"sse\",\n" - " // CPU name, used for optimizations in the LLVM backend\n" - " \"cpu\": \"generic\",\n" - " // Output location, relative to project file\n" - " \"output\": \"../build\",\n" - " // C compiler if the project also compiles c sources\n" - " // defaults to 'cc'\n" - " \"cc\": \"cc\",\n" - " // c sources if the project also compiles c sources\n" - " // relative to the project file\n" - " \"c-sources\": [\n" - " \"csource/**\"\n" - " ]\n" - " */\n" "}"; const char* MAIN_TEMPLATE =