From d9e46424725d1f878a0d0767098be33220fa0e74 Mon Sep 17 00:00:00 2001 From: Interfiber Date: Sun, 29 Sep 2024 14:53:51 -0400 Subject: [PATCH 01/10] document profile support --- spec/ext/GRBC_EXT_profiles.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/ext/GRBC_EXT_profiles.md diff --git a/spec/ext/GRBC_EXT_profiles.md b/spec/ext/GRBC_EXT_profiles.md new file mode 100644 index 0000000..81451db --- /dev/null +++ b/spec/ext/GRBC_EXT_profiles.md @@ -0,0 +1,31 @@ +# GRBC_EXT_profiles +compiler profile support in grbc + +## About +Author: Interfiber +Release Date: 9/29/24 + +## Example +```lua +-- Load extension, by default the debug profile is selected +grbc_ext("GRBC_EXT_profiles") + +-- Set the profile, make sure this is at the top of the file! +-- See below for default profiles +grbc_set_profile("debug") + + +``` + +## Profiles +For more detailed information see ```src/ext_profiles.cc``` + +### debug +Standard debug profile, ```-O1```, and debug symbol generation + +### release_with_debug_symbols +Release build but with debug symbol generation, uses ```-O3``` + +## release +Release build with ```-O3``` + From dfcf57aae1cd8eca79319e2a89b501c150f88cf1 Mon Sep 17 00:00:00 2001 From: Interfiber Date: Sun, 29 Sep 2024 15:24:13 -0400 Subject: [PATCH 02/10] task support --- CMakeLists.txt | 2 +- HConfig | 9 ++++++++- build.ninja | 20 ++++++++++++++++++-- include/grbc/generator.h | 6 ++++++ include/grbc/ninja.h | 5 +++++ include/grbc/spec.h | 21 ++++++++++++++++++++- include/grbc/state.h | 3 ++- spec/datatypes.md | 14 ++++++++++++++ spec/functions.md | 5 ++++- src/main.cc | 9 +++++++++ src/ninja.cc | 40 +++++++++++++++++++++++++++++++++++----- src/task.cc | 12 ++++++++++++ 12 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 src/task.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 48dbda7..3e91ebc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,5 +7,5 @@ add_subdirectory("vendor/sol2") include_directories("include") include_directories("vendor/sol2/include") -add_executable(grbc src/main.cc src/utils.cc src/file.cc src/target_exe.cc src/platform.cc src/ninja.cc src/generator.cc src/target_lib.cc src/package.cc src/ext.cc src/ext_pkg_config.cc) +add_executable(grbc src/main.cc src/utils.cc src/file.cc src/target_exe.cc src/platform.cc src/ninja.cc src/generator.cc src/target_lib.cc src/package.cc src/ext.cc src/ext_pkg_config.cc src/task.cc src/ext_profiles.cc) target_link_libraries(grbc sol2 lua) \ No newline at end of file diff --git a/HConfig b/HConfig index 6f06b5c..8b10ad9 100644 --- a/HConfig +++ b/HConfig @@ -46,7 +46,8 @@ local grbc_lib = grbc_library(LibraryConfig.new({ grbc_file("src/generator.cc"), grbc_file("src/target_lib.cc"), grbc_file("src/package.cc"), - grbc_file("src/ext.cc") + grbc_file("src/ext.cc"), + grbc_file("src/task.cc") }, lib_type = LibraryType.Static, @@ -88,5 +89,11 @@ local grbc_exe = grbc_executable(ExecutableConfig.new({ include_dirs = {} })) +grbc_task(TaskConfig.new({ + name = "Clean build", + task_id = "clean", + shell_script = "ninja -t clean" +})) + -- Output the final build script grbc_build("ninja") diff --git a/build.ninja b/build.ninja index 8df481d..dd58c6b 100644 --- a/build.ninja +++ b/build.ninja @@ -1,4 +1,5 @@ -### GRBC BUILT-IN NINJA GENERATOR ### +### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ### +### GENERATED ON: 1727637831 ### ## Default variables ## @@ -99,9 +100,14 @@ build $builddir/src/package.o: cxx src/package.cc build $builddir/src/ext.o: cxx src/ext.cc p_cflags = -Iinclude -Ivendor/sol2/include +## Compile: src/task.cc ## + +build $builddir/src/task.o: cxx src/task.cc + p_cflags = -Iinclude -Ivendor/sol2/include + ## Link: libgrbc.a ## -build $builddir/libgrbc.a: archive $builddir/src/file.o $builddir/src/ninja.o $builddir/src/platform.o $builddir/src/target_exe.o $builddir/src/utils.o $builddir/src/generator.o $builddir/src/target_lib.o $builddir/src/package.o $builddir/src/ext.o +build $builddir/libgrbc.a: archive $builddir/src/file.o $builddir/src/ninja.o $builddir/src/platform.o $builddir/src/target_exe.o $builddir/src/utils.o $builddir/src/generator.o $builddir/src/target_lib.o $builddir/src/package.o $builddir/src/ext.o $builddir/src/task.o ## Compile: src/main.cc ## @@ -114,3 +120,13 @@ build $builddir/grbc: link_cxx $builddir/src/main.o | $builddir/libgrbc.a $buil p_linker_flags = -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a -O3 -Lbuild -Wl,-rpath,build:. p_cflags = +## clean ## +rule clean_task + command = ninja -t clean + description = Running task: Clean build (clean) + +build clean: clean_task + +build all: phony $builddir/libgrbc_extensions.a $builddir/libgrbc.a $builddir/grbc + +default all diff --git a/include/grbc/generator.h b/include/grbc/generator.h index 9f0385e..c978001 100644 --- a/include/grbc/generator.h +++ b/include/grbc/generator.h @@ -38,6 +38,12 @@ struct GeneratorTarget { std::vector link_target_commands; }; +struct GeneratorTask { + std::string description, id; + + std::string shell_script; +}; + typedef GeneratorResult (*Generator_Run)(); struct Generator { diff --git a/include/grbc/ninja.h b/include/grbc/ninja.h index ed03cec..1485c4e 100644 --- a/include/grbc/ninja.h +++ b/include/grbc/ninja.h @@ -49,3 +49,8 @@ ninja_build_rule_link_exe_target(const GeneratorLinkTargetCommand &link_cmd); */ std::string ninja_build_rule_link_lib_target(const GeneratorLinkTargetCommand &link_cmd); + +/** + * Generate a line which describes the given task + */ +std::string ninja_build_rule_task(const GeneratorTask &task); \ No newline at end of file diff --git a/include/grbc/spec.h b/include/grbc/spec.h index 2c49d0c..83fc198 100644 --- a/include/grbc/spec.h +++ b/include/grbc/spec.h @@ -128,6 +128,23 @@ struct ExecutableConfig { std::vector include_dirs{}; }; +struct TaskConfig { + TaskConfig(const sol::table &table) { + name = table.get("name"); + task_id = table.get("task_id"); + shell_script = table.get("shell_script"); + } + + /// Name of the task + std::string name; + + /// ID of the task + std::string task_id; + + /// Shell script content for this task + std::string shell_script; +}; + struct LibraryConfig { LibraryConfig(const sol::table &table) { name = table.get("name"); @@ -253,4 +270,6 @@ bool grbc_has_ext(const std::string &extension_id); std::string grbc_platform_file(PlatformType platform_type, const std::string &file_name); -bool grbc_is_ext_loaded(const std::string &extension_name); \ No newline at end of file +bool grbc_is_ext_loaded(const std::string &extension_name); + +void grbc_task(const TaskConfig &config); \ No newline at end of file diff --git a/include/grbc/state.h b/include/grbc/state.h index 52fd4b0..fdf06d6 100644 --- a/include/grbc/state.h +++ b/include/grbc/state.h @@ -11,6 +11,7 @@ struct GState { Platform current_platform{}; sol::state lua; + std::vector tasks; std::vector targets; std::vector generators; @@ -19,7 +20,7 @@ struct GState { std::vector extensions; std::string global_compiler_flags = ""; - std::string global_linker_flags = ""; + std::string global_linker_flags = " "; std::string ninja_output; diff --git a/spec/datatypes.md b/spec/datatypes.md index 0c1fd2e..12c9779 100644 --- a/spec/datatypes.md +++ b/spec/datatypes.md @@ -162,4 +162,18 @@ enum LanguageType { LanguageType_CPP, LanguageType_C }; +``` + +## TaskConfig +```c++ +struct TaskConfig { + /// Name of the task, can have spaces unlike task_id + string task_name; + + /// ID used when invoking the task, ex: ```ninja task:helloworld``` + string task_id; + + /// Shell script to be executed when this task is called + string shell_script; +}; ``` \ No newline at end of file diff --git a/spec/functions.md b/spec/functions.md index a61496c..49e6450 100644 --- a/spec/functions.md +++ b/spec/functions.md @@ -80,4 +80,7 @@ Generate a compiler flag to define a variable Get the given extension for a library file on the current platform ## [X] grbc_bake_package_config(config: PackageConfig) -> Package -Convert a PackageConfig into a Package \ No newline at end of file +Convert a PackageConfig into a Package + +## [X] grbc_task(config: TaskConfig) -> Void +Create a task and add it to the build script \ No newline at end of file diff --git a/src/main.cc b/src/main.cc index 592572a..8690e95 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,8 @@ #include "grbc/ext_pkg_config.h" #include "grbc/ext_profiles.h" #include "grbc/state.h" +#include +#include #define SOL_ALL_SAFETIES_ON 1 #include "grbc/helpers.h" @@ -80,6 +82,12 @@ int main() { &Package::compiler_flags, "linker_flags", &Package::linker_flags); + // TaskConfig + lua.new_usertype( + "TaskConfig", sol::constructors(), "name", + &TaskConfig::name, "task_id", &TaskConfig::task_id, "shell_script", + &TaskConfig::shell_script); + lua.set("grbc_want_version", grbc_want_version); lua.set("grbc_exception", grbc_exception); lua.set("grbc_get_config", grbc_get_config); @@ -107,6 +115,7 @@ int main() { lua.set("grbc_has_ext", grbc_has_ext); lua.set("grbc_platform_file", grbc_platform_file); lua.set("grbc_is_ext_loaded", grbc_is_ext_loaded); + lua.set("grbc_task", grbc_task); // Load generators diff --git a/src/ninja.cc b/src/ninja.cc index 2740699..8ecbdde 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -74,7 +74,8 @@ ninja_build_rule_compile_file(const GeneratorCompileCommand &compile_cmd) { result += "build $builddir/" + compile_cmd.object_file + ": " + compiler_rule + " " + compile_cmd.source_file + "\n"; - result += " p_cflags = " + compile_cmd.compiler_flags + GState::get().global_compiler_flags + "\n\n"; + result += " p_cflags = " + compile_cmd.compiler_flags + + GState::get().global_compiler_flags + "\n\n"; return result; } @@ -104,7 +105,8 @@ ninja_build_rule_link_lib_target(const GeneratorLinkTargetCommand &link_cmd) { result += "build $builddir/" + link_cmd.output_name + ": link_cxx " + file_list + "\n"; - result += " p_linker_flags = " + link_cmd.linker_flags + " -shared" + GState::get().global_linker_flags + "\n"; + result += " p_linker_flags = " + link_cmd.linker_flags + " -shared" + + GState::get().global_linker_flags + "\n"; result += " p_cflags = " + GState::get().global_compiler_flags + "\n\n"; } else { result += "build $builddir/" + link_cmd.output_name + ": archive " + @@ -129,7 +131,8 @@ ninja_build_rule_link_exe_target(const GeneratorLinkTargetCommand &link_cmd) { if (!link_cmd.libraries.empty()) { lib_list = "| "; for (auto &lib : link_cmd.libraries) { - if (lib.empty()) continue; + if (lib.empty()) + continue; lib_list += "$builddir/" + lib + " "; } @@ -141,12 +144,26 @@ ninja_build_rule_link_exe_target(const GeneratorLinkTargetCommand &link_cmd) { result += "build $builddir/" + link_cmd.output_name + ": link_cxx " + file_list + " " + lib_list + "\n"; - result += " p_linker_flags = " + link_cmd.linker_flags + GState::get().global_linker_flags + "\n"; + result += " p_linker_flags = " + link_cmd.linker_flags + + GState::get().global_linker_flags + "\n"; result += " p_cflags = " + GState::get().global_compiler_flags + "\n\n"; return result; } +std::string ninja_build_rule_task(const GeneratorTask &task) { + std::string result; + + result += "## " + task.id + " ##\n"; + result += "rule " + task.id + "_task\n"; + result += " command = " + task.shell_script + "\n"; + result += " description = " + task.description += "\n\n"; + + result += "build " + task.id + ": " + task.id + "_task\n\n"; + + return result; +} + // Ninja generator entry GeneratorResult ninja_generator() { @@ -156,7 +173,9 @@ GeneratorResult ninja_generator() { result.file_name = "build.ninja"; - result.content += "### GRBC BUILT-IN NINJA GENERATOR ###\n\n"; + result.content += "### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ###\n"; + result.content += "### GENERATED ON: " + std::to_string(std::time(nullptr)) + " ###\n\n"; + result.content += ninja_build_default_variables(); result.content += ninja_build_rule_compile_cc(); result.content += ninja_build_rule_compile_cxx(); @@ -164,6 +183,8 @@ GeneratorResult ninja_generator() { result.content += ninja_build_rule_link_cxx(); result.content += ninja_build_rule_archive_library(); + std::string targets; + for (auto &target : GState::get().targets) { for (auto &compile_cmd : target.compile_commands) { result.content += ninja_build_rule_compile_file(compile_cmd); @@ -175,8 +196,17 @@ GeneratorResult ninja_generator() { } else { result.content += ninja_build_rule_link_lib_target(link_cmd); } + + targets += "$builddir/" + link_cmd.output_name + " "; } } + for (auto &task : GState::get().tasks) { + result.content += ninja_build_rule_task(task); + } + + result.content += "build all: phony " + targets + "\n\n"; + result.content += "default all\n"; + return result; } \ No newline at end of file diff --git a/src/task.cc b/src/task.cc new file mode 100644 index 0000000..f7baf49 --- /dev/null +++ b/src/task.cc @@ -0,0 +1,12 @@ +#include "grbc/generator.h" +#include "grbc/spec.h" +#include "grbc/state.h" + +void grbc_task(const TaskConfig &config) { + GeneratorTask task{}; + task.description = "Running task: " + config.name + " (" + config.task_id + ")"; + task.id = config.task_id; + task.shell_script = config.shell_script; + + GState::get().tasks.push_back(task); +} \ No newline at end of file From 816dcbe1185234da86faa3c25ffc7c7b0bc7dfa6 Mon Sep 17 00:00:00 2001 From: Interfiber Date: Sun, 29 Sep 2024 16:35:45 -0400 Subject: [PATCH 03/10] command-line option support + switch compiler profile on command line --- .gdb_history | 4 + CMakeLists.txt | 4 +- HConfig | 5 +- build.ninja | 39 +++--- compile_commands.json | 110 +++++++++++++++++ include/grbc/spec.h | 6 +- include/grbc/state.h | 31 ++--- spec/functions.md | 8 +- src/ext_profiles.cc | 10 +- src/main.cc | 271 ++++++++++++++++++++++++------------------ src/options.cc | 22 ++++ src/target_lib.cc | 4 + 12 files changed, 359 insertions(+), 155 deletions(-) create mode 100644 compile_commands.json create mode 100644 src/options.cc diff --git a/.gdb_history b/.gdb_history index 0084caf..9db2813 100644 --- a/.gdb_history +++ b/.gdb_history @@ -48,3 +48,7 @@ up up up q +q +q +r gen -compiler_profile release +q diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e91ebc..91eb28a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,12 @@ cmake_minimum_required(VERSION 3.28) project(grbc) +message(${CMAKE_CXX_FLAGS_RELEASE}) + add_subdirectory("vendor/sol2") include_directories("include") include_directories("vendor/sol2/include") add_executable(grbc src/main.cc src/utils.cc src/file.cc src/target_exe.cc src/platform.cc src/ninja.cc src/generator.cc src/target_lib.cc src/package.cc src/ext.cc src/ext_pkg_config.cc src/task.cc src/ext_profiles.cc) -target_link_libraries(grbc sol2 lua) \ No newline at end of file +target_link_libraries(grbc sol2 lua) diff --git a/HConfig b/HConfig index 8b10ad9..c3e2330 100644 --- a/HConfig +++ b/HConfig @@ -2,8 +2,6 @@ grbc_want_version("1.0") grbc_ext("GRBC_EXT_pkg_config") grbc_ext("GRBC_EXT_profiles") -grbc_set_profile("release") - local grbc_extensions = grbc_library(LibraryConfig.new({ name = "libgrbc_extensions", language_type = LanguageType.Cpp, @@ -47,7 +45,8 @@ local grbc_lib = grbc_library(LibraryConfig.new({ grbc_file("src/target_lib.cc"), grbc_file("src/package.cc"), grbc_file("src/ext.cc"), - grbc_file("src/task.cc") + grbc_file("src/task.cc"), + grbc_file("src/options.cc") }, lib_type = LibraryType.Static, diff --git a/build.ninja b/build.ninja index dd58c6b..e3fbcec 100644 --- a/build.ninja +++ b/build.ninja @@ -1,5 +1,5 @@ ### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ### -### GENERATED ON: 1727637831 ### +### GENERATED ON: 1727642123 ### ## Default variables ## @@ -44,12 +44,12 @@ rule archive ## Compile: src/ext_pkg_config.cc ## build $builddir/src/ext_pkg_config.o: cxx src/ext_pkg_config.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/ext_profiles.cc ## build $builddir/src/ext_profiles.o: cxx src/ext_profiles.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Link: libgrbc_extensions.a ## @@ -58,67 +58,72 @@ build $builddir/libgrbc_extensions.a: archive $builddir/src/ext_pkg_config.o $bu ## Compile: src/file.cc ## build $builddir/src/file.o: cxx src/file.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/ninja.cc ## build $builddir/src/ninja.o: cxx src/ninja.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/platform.cc ## build $builddir/src/platform.o: cxx src/platform.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/target_exe.cc ## build $builddir/src/target_exe.o: cxx src/target_exe.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/utils.cc ## build $builddir/src/utils.o: cxx src/utils.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/generator.cc ## build $builddir/src/generator.o: cxx src/generator.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/target_lib.cc ## build $builddir/src/target_lib.o: cxx src/target_lib.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/package.cc ## build $builddir/src/package.o: cxx src/package.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/ext.cc ## build $builddir/src/ext.o: cxx src/ext.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Compile: src/task.cc ## build $builddir/src/task.o: cxx src/task.cc - p_cflags = -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 + +## Compile: src/options.cc ## + +build $builddir/src/options.o: cxx src/options.cc + p_cflags = -Iinclude -Ivendor/sol2/include -g -O1 ## Link: libgrbc.a ## -build $builddir/libgrbc.a: archive $builddir/src/file.o $builddir/src/ninja.o $builddir/src/platform.o $builddir/src/target_exe.o $builddir/src/utils.o $builddir/src/generator.o $builddir/src/target_lib.o $builddir/src/package.o $builddir/src/ext.o $builddir/src/task.o +build $builddir/libgrbc.a: archive $builddir/src/file.o $builddir/src/ninja.o $builddir/src/platform.o $builddir/src/target_exe.o $builddir/src/utils.o $builddir/src/generator.o $builddir/src/target_lib.o $builddir/src/package.o $builddir/src/ext.o $builddir/src/task.o $builddir/src/options.o ## Compile: src/main.cc ## build $builddir/src/main.o: cxx src/main.cc - p_cflags = -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/sol2/include + p_cflags = -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/sol2/include -g -O1 ## Link: grbc ## build $builddir/grbc: link_cxx $builddir/src/main.o | $builddir/libgrbc.a $builddir/libgrbc_extensions.a - p_linker_flags = -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a -O3 -Lbuild -Wl,-rpath,build:. - p_cflags = + p_linker_flags = -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a -Lbuild -Wl,-rpath,build:. + p_cflags = -g -O1 ## clean ## rule clean_task diff --git a/compile_commands.json b/compile_commands.json new file mode 100644 index 0000000..ec49990 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1,110 @@ +[ + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_pkg_config.o -MF build/src/ext_pkg_config.o.d -Iinclude -Ivendor/sol2/include -c src/ext_pkg_config.cc -o build/src/ext_pkg_config.o", + "file": "src/ext_pkg_config.cc", + "output": "build/src/ext_pkg_config.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_profiles.o -MF build/src/ext_profiles.o.d -Iinclude -Ivendor/sol2/include -c src/ext_profiles.cc -o build/src/ext_profiles.o", + "file": "src/ext_profiles.cc", + "output": "build/src/ext_profiles.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "rm -f build/libgrbc_extensions.a; ar crs build/libgrbc_extensions.a build/src/ext_pkg_config.o build/src/ext_profiles.o", + "file": "build/src/ext_pkg_config.o", + "output": "build/libgrbc_extensions.a" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/file.o -MF build/src/file.o.d -Iinclude -Ivendor/sol2/include -c src/file.cc -o build/src/file.o", + "file": "src/file.cc", + "output": "build/src/file.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ninja.o -MF build/src/ninja.o.d -Iinclude -Ivendor/sol2/include -c src/ninja.cc -o build/src/ninja.o", + "file": "src/ninja.cc", + "output": "build/src/ninja.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/platform.o -MF build/src/platform.o.d -Iinclude -Ivendor/sol2/include -c src/platform.cc -o build/src/platform.o", + "file": "src/platform.cc", + "output": "build/src/platform.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/target_exe.o -MF build/src/target_exe.o.d -Iinclude -Ivendor/sol2/include -c src/target_exe.cc -o build/src/target_exe.o", + "file": "src/target_exe.cc", + "output": "build/src/target_exe.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/utils.o -MF build/src/utils.o.d -Iinclude -Ivendor/sol2/include -c src/utils.cc -o build/src/utils.o", + "file": "src/utils.cc", + "output": "build/src/utils.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/generator.o -MF build/src/generator.o.d -Iinclude -Ivendor/sol2/include -c src/generator.cc -o build/src/generator.o", + "file": "src/generator.cc", + "output": "build/src/generator.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/target_lib.o -MF build/src/target_lib.o.d -Iinclude -Ivendor/sol2/include -c src/target_lib.cc -o build/src/target_lib.o", + "file": "src/target_lib.cc", + "output": "build/src/target_lib.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/package.o -MF build/src/package.o.d -Iinclude -Ivendor/sol2/include -c src/package.cc -o build/src/package.o", + "file": "src/package.cc", + "output": "build/src/package.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext.o -MF build/src/ext.o.d -Iinclude -Ivendor/sol2/include -c src/ext.cc -o build/src/ext.o", + "file": "src/ext.cc", + "output": "build/src/ext.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/task.o -MF build/src/task.o.d -Iinclude -Ivendor/sol2/include -c src/task.cc -o build/src/task.o", + "file": "src/task.cc", + "output": "build/src/task.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/options.o -MF build/src/options.o.d -Iinclude -Ivendor/sol2/include -c src/options.cc -o build/src/options.o", + "file": "src/options.cc", + "output": "build/src/options.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "rm -f build/libgrbc.a; ar crs build/libgrbc.a build/src/file.o build/src/ninja.o build/src/platform.o build/src/target_exe.o build/src/utils.o build/src/generator.o build/src/target_lib.o build/src/package.o build/src/ext.o build/src/task.o build/src/options.o", + "file": "build/src/file.o", + "output": "build/libgrbc.a" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -MMD -MT build/src/main.o -MF build/src/main.o.d -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/sol2/include -c src/main.cc -o build/src/main.o", + "file": "src/main.cc", + "output": "build/src/main.o" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "/usr/lib64/ccache/g++ -o build/grbc build/src/main.o -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a -O3 -DNDEBUG -Lbuild -Wl,-rpath,build:. ", + "file": "build/src/main.o", + "output": "build/grbc" + }, + { + "directory": "/home/interfiber/dev/grbc", + "command": "", + "file": "build/libgrbc_extensions.a", + "output": "all" + } +] diff --git a/include/grbc/spec.h b/include/grbc/spec.h index 83fc198..1cb9e17 100644 --- a/include/grbc/spec.h +++ b/include/grbc/spec.h @@ -272,4 +272,8 @@ std::string grbc_platform_file(PlatformType platform_type, bool grbc_is_ext_loaded(const std::string &extension_name); -void grbc_task(const TaskConfig &config); \ No newline at end of file +void grbc_task(const TaskConfig &config); + +bool grbc_has_option(const std::string &option_name); + +std::string grbc_get_option(const std::string &option_name); \ No newline at end of file diff --git a/include/grbc/state.h b/include/grbc/state.h index fdf06d6..19df9fe 100644 --- a/include/grbc/state.h +++ b/include/grbc/state.h @@ -2,31 +2,34 @@ #include "grbc/ext.h" #include "grbc/generator.h" #include "grbc/spec.h" +#include #include #include #include #include struct GState { - Platform current_platform{}; - sol::state lua; + Platform current_platform{}; + sol::state lua; - std::vector tasks; - std::vector targets; - std::vector generators; + std::vector tasks; + std::vector targets; + std::vector generators; - std::unordered_map packages; + std::map options; - std::vector extensions; + std::unordered_map packages; - std::string global_compiler_flags = ""; - std::string global_linker_flags = " "; + std::vector extensions; - std::string ninja_output; + std::string global_compiler_flags = ""; + std::string global_linker_flags = " "; - static GState& get() { - static GState state{}; + std::string ninja_output; - return state; - } + static GState &get() { + static GState state{}; + + return state; + } }; \ No newline at end of file diff --git a/spec/functions.md b/spec/functions.md index 49e6450..7d7bda3 100644 --- a/spec/functions.md +++ b/spec/functions.md @@ -83,4 +83,10 @@ Get the given extension for a library file on the current platform Convert a PackageConfig into a Package ## [X] grbc_task(config: TaskConfig) -> Void -Create a task and add it to the build script \ No newline at end of file +Create a task and add it to the build script + +## [X] grbc_has_option(option_name: String) -> Boolean +Check if the given option was set on the command line + +## [X] grbc_get_option(option_name: String) -> String +Get the value of an option \ No newline at end of file diff --git a/src/ext_profiles.cc b/src/ext_profiles.cc index eb9c86d..a9477bb 100644 --- a/src/ext_profiles.cc +++ b/src/ext_profiles.cc @@ -51,17 +51,21 @@ void grbc_profiles_init(sol::state &lua) { Profile release_with_debug_symbols_profile{}; release_with_debug_symbols_profile.name = "release_with_debug_symbols"; - release_with_debug_symbols_profile.compiler_flags = {"-g", "-O3"}; + release_with_debug_symbols_profile.compiler_flags = {"-g", "-O3", "-DNDEBUG"}; Profile release_profile{}; release_profile.name = "release"; - release_profile.linker_flags = {"-O3"}; + release_profile.linker_flags = {"-O3", "-DNDEBUG"}; EXT_profiles_get_profiles().push_back(debug_profile); EXT_profiles_get_profiles().push_back(release_with_debug_symbols_profile); EXT_profiles_get_profiles().push_back(release_profile); - EXT_profiles_set("debug"); // Always use debug as the default profile + if (!grbc_has_option("compiler_profile")) { + EXT_profiles_set("debug"); // Always use debug as the default profile + } else { + EXT_profiles_set(grbc_get_option("compiler_profile")); + } lua.set("grbc_set_profile", EXT_profiles_set); diff --git a/src/main.cc b/src/main.cc index 8690e95..fbf2786 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,155 +1,196 @@ #include "grbc/ext_pkg_config.h" #include "grbc/ext_profiles.h" -#include "grbc/state.h" -#include -#include -#define SOL_ALL_SAFETIES_ON 1 - #include "grbc/helpers.h" #include "grbc/spec.h" +#include "grbc/state.h" +#include +#include +#include #include +#include -int main() { - log_msg("opening lua libraries..."); +void print_help() { + printf("GRBC - Graphite Build Configurator\n"); + printf("Author: Interfiber \n"); + printf("Commands:\n"); + printf(" gen - Generate build configuration from HConfig\n"); +} - auto &lua = GState::get().lua; +int main(int argc, char **argv) { + if (argc == 1) { + print_help(); - lua.open_libraries(sol::lib::base, sol::lib::coroutine, sol::lib::string, - sol::lib::io, sol::lib::package, sol::lib::math); + std::exit(EXIT_FAILURE); + } - log_msg("setting up runtime..."); + std::map options; - // TargetInfo - lua.new_usertype("TargetInfo", "name", &TargetInfo::name); + for (int i = 0; i < argc; i++) { + std::string arg = argv[i]; - // PackageConfig - lua.new_usertype( - "PackageConfig", sol::constructors(), "name", - &PackageConfig::name, "libraries", &PackageConfig::libraries, - "include_dirs", &PackageConfig::include_dirs, "compile_flags", - &PackageConfig::compile_flags, "linker_flags", - &PackageConfig::linker_flags); + if (arg[0] == '-' && i + 1 < argc) { + if (std::string(argv[i + 1]).empty()) continue; - // GlobalConfig - lua.new_usertype("GlobalConfig", "engine_version", - &GlobalConfig::engine_version, "architecture", - &GlobalConfig::architecture, "target_config", - &GlobalConfig::platform_config); + arg.erase(arg.begin()); - // Platform - lua.new_usertype("Platform", "name", &Platform::name, - "cxx_compiler", &Platform::cxx_compiler, - "cc_compiler", &Platform::cc_compiler, - "platform_type", &Platform::platform_type, - "is_64bit", &Platform::is_64bit); + options.insert({ arg, std::string(argv[i + 1]) }); - // PlatformType - lua.new_enum("PlatformType", {{"Win32", PlatformType_Win32}, - {"Linux", PlatformType_Linux}}); + log_msg(("found option: " + arg + " = " + std::string(argv[i + 1])).c_str()); + } + } - // LanguageType - lua.new_enum( - "LanguageType", {{"Cpp", LanguageType_CPP}, {"C", LanguageType_C}}); + GState::get().options = options; - // LibraryType - lua.new_enum("LibraryType", {{"Static", LibraryType_Static}, - {"Shared", LibraryType_Shared}}); + if (std::string(argv[1]) == "gen") { + log_msg("running grbc generator..."); - // ExecutableConfig - lua.new_usertype( - "ExecutableConfig", sol::constructors(), - "name", &ExecutableConfig::name, "files", &ExecutableConfig::files, - "requirements", &ExecutableConfig::requirements, "compile_flags", - &ExecutableConfig::compile_flags, "linker_flags", - &ExecutableConfig::linker_flags, "include_dirs", - &ExecutableConfig::include_dirs, "language_type", - &ExecutableConfig::language_type); + log_msg("opening lua libraries..."); - // LibraryConfig - lua.new_usertype( - "LibraryConfig", sol::constructors(), "name", - &LibraryConfig::name, "files", &LibraryConfig::files, "requirements", - &LibraryConfig::requirements, "compile_flags", - &LibraryConfig::compile_flags, "linker_flags", - &LibraryConfig::linker_flags, "include_dirs", - &LibraryConfig::include_dirs, "language_type", - &LibraryConfig::language_type, "lib_type", &LibraryConfig::lib_type, - "package_config", &LibraryConfig::package_config); + auto &lua = GState::get().lua; - // Package - lua.new_usertype("Package", sol::constructors(), - "name", &Package::name, "compiler_flags", - &Package::compiler_flags, "linker_flags", - &Package::linker_flags); + lua.open_libraries(sol::lib::base, sol::lib::coroutine, sol::lib::string, + sol::lib::io, sol::lib::package, sol::lib::math); - // TaskConfig - lua.new_usertype( - "TaskConfig", sol::constructors(), "name", - &TaskConfig::name, "task_id", &TaskConfig::task_id, "shell_script", - &TaskConfig::shell_script); + log_msg("setting up runtime..."); - lua.set("grbc_want_version", grbc_want_version); - lua.set("grbc_exception", grbc_exception); - lua.set("grbc_get_config", grbc_get_config); - lua.set("grbc_file", grbc_file); - lua.set("grbc_executable", grbc_executable); - lua.set("grbc_library", grbc_library); - lua.set("grbc_load_platform", grbc_load_platform); - lua.set("grbc_set_platform", grbc_set_platform); - lua.set("grbc_find_compiler", grbc_find_compiler); - lua.set("grbc_build", grbc_build); - lua.set("grbc_replace_string", grbc_replace_string); - lua.set("grbc_object_file", grbc_object_file); - lua.set("grbc_include_dirs_to_clflags", grbc_include_dirs_to_cflags); - lua.set("grbc_log", grbc_log); - lua.set("grbc_is_32bit", grbc_is_32bit); - lua.set("grbc_is_64bit", grbc_is_64bit); - lua.set("grbc_is_linux", grbc_is_linux); - lua.set("grbc_is_win32", grbc_is_win32); - lua.set("grbc_get_platform", grbc_get_platform); - lua.set("grbc_compiler_define", grbc_compiler_define); - lua.set("grbc_get_lib_extension", grbc_get_lib_extension); - lua.set("grbc_bake_package_config", grbc_bake_package_config); - lua.set("grbc_pkg", grbc_pkg); - lua.set("grbc_ext", grbc_ext); - lua.set("grbc_has_ext", grbc_has_ext); - lua.set("grbc_platform_file", grbc_platform_file); - lua.set("grbc_is_ext_loaded", grbc_is_ext_loaded); - lua.set("grbc_task", grbc_task); + // TargetInfo + lua.new_usertype("TargetInfo", "name", &TargetInfo::name); - // Load generators + // PackageConfig + lua.new_usertype( + "PackageConfig", sol::constructors(), "name", + &PackageConfig::name, "libraries", &PackageConfig::libraries, + "include_dirs", &PackageConfig::include_dirs, "compile_flags", + &PackageConfig::compile_flags, "linker_flags", + &PackageConfig::linker_flags); - GState::get().generators.push_back( - {.name = "ninja", .func = ninja_generator}); + // GlobalConfig + lua.new_usertype( + "GlobalConfig", "engine_version", &GlobalConfig::engine_version, + "architecture", &GlobalConfig::architecture, "target_config", + &GlobalConfig::platform_config); - // Load default extensions + // Platform + lua.new_usertype("Platform", "name", &Platform::name, + "cxx_compiler", &Platform::cxx_compiler, + "cc_compiler", &Platform::cc_compiler, + "platform_type", &Platform::platform_type, + "is_64bit", &Platform::is_64bit); + + // PlatformType + lua.new_enum("PlatformType", {{"Win32", PlatformType_Win32}, + {"Linux", PlatformType_Linux}}); + + // LanguageType + lua.new_enum( + "LanguageType", {{"Cpp", LanguageType_CPP}, {"C", LanguageType_C}}); + + // LibraryType + lua.new_enum("LibraryType", {{"Static", LibraryType_Static}, + {"Shared", LibraryType_Shared}}); + + // ExecutableConfig + lua.new_usertype( + "ExecutableConfig", sol::constructors(), + "name", &ExecutableConfig::name, "files", &ExecutableConfig::files, + "requirements", &ExecutableConfig::requirements, "compile_flags", + &ExecutableConfig::compile_flags, "linker_flags", + &ExecutableConfig::linker_flags, "include_dirs", + &ExecutableConfig::include_dirs, "language_type", + &ExecutableConfig::language_type); + + // LibraryConfig + lua.new_usertype( + "LibraryConfig", sol::constructors(), "name", + &LibraryConfig::name, "files", &LibraryConfig::files, "requirements", + &LibraryConfig::requirements, "compile_flags", + &LibraryConfig::compile_flags, "linker_flags", + &LibraryConfig::linker_flags, "include_dirs", + &LibraryConfig::include_dirs, "language_type", + &LibraryConfig::language_type, "lib_type", &LibraryConfig::lib_type, + "package_config", &LibraryConfig::package_config); + + // Package + lua.new_usertype( + "Package", sol::constructors(), "name", + &Package::name, "compiler_flags", &Package::compiler_flags, + "linker_flags", &Package::linker_flags); + + // TaskConfig + lua.new_usertype( + "TaskConfig", sol::constructors(), "name", + &TaskConfig::name, "task_id", &TaskConfig::task_id, "shell_script", + &TaskConfig::shell_script); + + lua.set("grbc_want_version", grbc_want_version); + lua.set("grbc_exception", grbc_exception); + lua.set("grbc_get_config", grbc_get_config); + lua.set("grbc_file", grbc_file); + lua.set("grbc_executable", grbc_executable); + lua.set("grbc_library", grbc_library); + lua.set("grbc_load_platform", grbc_load_platform); + lua.set("grbc_set_platform", grbc_set_platform); + lua.set("grbc_find_compiler", grbc_find_compiler); + lua.set("grbc_build", grbc_build); + lua.set("grbc_replace_string", grbc_replace_string); + lua.set("grbc_object_file", grbc_object_file); + lua.set("grbc_include_dirs_to_clflags", grbc_include_dirs_to_cflags); + lua.set("grbc_log", grbc_log); + lua.set("grbc_is_32bit", grbc_is_32bit); + lua.set("grbc_is_64bit", grbc_is_64bit); + lua.set("grbc_is_linux", grbc_is_linux); + lua.set("grbc_is_win32", grbc_is_win32); + lua.set("grbc_get_platform", grbc_get_platform); + lua.set("grbc_compiler_define", grbc_compiler_define); + lua.set("grbc_get_lib_extension", grbc_get_lib_extension); + lua.set("grbc_bake_package_config", grbc_bake_package_config); + lua.set("grbc_pkg", grbc_pkg); + lua.set("grbc_ext", grbc_ext); + lua.set("grbc_has_ext", grbc_has_ext); + lua.set("grbc_platform_file", grbc_platform_file); + lua.set("grbc_is_ext_loaded", grbc_is_ext_loaded); + lua.set("grbc_task", grbc_task); + lua.set("grbc_has_option", grbc_has_option); + lua.set("grbc_get_option", grbc_get_option); + + // Load generators + + GState::get().generators.push_back( + {.name = "ninja", .func = ninja_generator}); + + // Load default extensions #if !defined(_WIN32) - grbc_register_ext(grbc_pkg_config()); + grbc_register_ext(grbc_pkg_config()); #endif - grbc_register_ext(grbc_profiles()); + grbc_register_ext(grbc_profiles()); - // Detect platform - log_msg("autodetecting platform..."); + // Detect platform + log_msg("autodetecting platform..."); #if defined(WIN32) - GState::get().current_platform.platform_type = PlatformType_Win32; - GState::get().current_platform.name = "Windows"; + GState::get().current_platform.platform_type = PlatformType_Win32; + GState::get().current_platform.name = "Windows"; #elif defined(__linux__) - GState::get().current_platform.platform_type = PlatformType_Linux; - GState::get().current_platform.name = "Linux"; + GState::get().current_platform.platform_type = PlatformType_Linux; + GState::get().current_platform.name = "Linux"; #endif #if defined(ENVIRONMENT32) - GState::get().current_platform.is_64bit = false; + GState::get().current_platform.is_64bit = false; #endif - // Default compiler is g++ - GState::get().current_platform.cc_compiler = grbc_find_compiler("gcc"); - GState::get().current_platform.cxx_compiler = grbc_find_compiler("g++"); + // Default compiler is g++ + GState::get().current_platform.cc_compiler = grbc_find_compiler("gcc"); + GState::get().current_platform.cxx_compiler = grbc_find_compiler("g++"); - log_msg("loading HConfig..."); + log_msg("loading HConfig..."); - lua.script_file("HConfig"); + lua.script_file("HConfig"); + } else { + printf("unknown command\n"); + + std::exit(EXIT_FAILURE); + } } \ No newline at end of file diff --git a/src/options.cc b/src/options.cc new file mode 100644 index 0000000..17351ec --- /dev/null +++ b/src/options.cc @@ -0,0 +1,22 @@ +#include "grbc/spec.h" +#include "grbc/state.h" + +bool grbc_has_option(const std::string &option_name) { + for (auto &k : GState::get().options) { + if (k.first == option_name) + return true; + } + + return false; +} + +std::string grbc_get_option(const std::string &option_name) { + for (auto &k : GState::get().options) { + if (k.first == option_name) + return k.second; + } + + grbc_exception("Failed to find option with name '" + option_name + "'"); + + return ""; +} \ No newline at end of file diff --git a/src/target_lib.cc b/src/target_lib.cc index a3fb820..adc9285 100644 --- a/src/target_lib.cc +++ b/src/target_lib.cc @@ -5,6 +5,10 @@ TargetInfo grbc_library(const LibraryConfig &library_config) { TargetInfo target_config{}; + if (library_config.name[0] != 'l' && library_config.name[1] != 'i' && library_config.name[2] != 'b') { + grbc_exception("library names are mandated to start with 'lib'"); + } + std::string lib_name = library_config.name; lib_name += grbc_get_lib_extension(library_config.lib_type); From 1036d97ec681b25223160b3248404249a1150f8b Mon Sep 17 00:00:00 2001 From: Interfiber Date: Sun, 29 Sep 2024 16:36:38 -0400 Subject: [PATCH 04/10] document compiler_profile flag support --- spec/ext/GRBC_EXT_profiles.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/ext/GRBC_EXT_profiles.md b/spec/ext/GRBC_EXT_profiles.md index 81451db..93fac6a 100644 --- a/spec/ext/GRBC_EXT_profiles.md +++ b/spec/ext/GRBC_EXT_profiles.md @@ -17,6 +17,12 @@ grbc_set_profile("debug") ``` +## Command line options +Passing ```-compiler_profile``` to grbc will allow setting of the compiler profile, for example: +```bash +grbc gen -compiler_profile release +``` + ## Profiles For more detailed information see ```src/ext_profiles.cc``` From ec26aa89e774bbec3270ace016ed3a3f8009de66 Mon Sep 17 00:00:00 2001 From: Interfiber Date: Sun, 29 Sep 2024 20:21:39 -0400 Subject: [PATCH 05/10] ext_easy impl + demo + fixes --- CMakeFiles/3.28.2/CMakeCCompiler.cmake | 74 ++ CMakeFiles/3.28.2/CMakeCXXCompiler.cmake | 85 ++ .../3.28.2/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 16672 bytes .../3.28.2/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 16688 bytes CMakeFiles/3.28.2/CMakeSystem.cmake | 15 + .../3.28.2/CompilerIdC/CMakeCCompilerId.c | 880 ++++++++++++++++++ CMakeFiles/3.28.2/CompilerIdC/a.out | Bin 0 -> 16784 bytes .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 869 +++++++++++++++++ CMakeFiles/3.28.2/CompilerIdCXX/a.out | Bin 0 -> 16800 bytes CMakeFiles/CMakeConfigureLog.yaml | 473 ++++++++++ CMakeFiles/TargetDirectories.txt | 41 + CMakeFiles/VerifyGlobs.cmake | 22 + CMakeFiles/cmake.check_cache | 1 + CMakeFiles/cmake.verify_globs | 1 + CMakeFiles/rules.ninja | 73 ++ CMakeLists.txt | 2 +- HConfig | 13 +- README.md | 11 +- build.ninja | 16 +- compile_commands.json | 38 +- demo.png | Bin 0 -> 586500 bytes example/HConfig | 46 + example/build.ninja | 75 ++ example/compile_commands.json | 32 + example/include/test.h | 3 + example/main.c | 8 + example/test.c | 6 + include/grbc/ext.h | 1 + include/grbc/ext_easy.h | 7 + include/grbc/spec.h | 1 + spec/ext.md | 4 + src/ext_easy.cc | 27 + src/main.cc | 12 +- 33 files changed, 2796 insertions(+), 40 deletions(-) create mode 100644 CMakeFiles/3.28.2/CMakeCCompiler.cmake create mode 100644 CMakeFiles/3.28.2/CMakeCXXCompiler.cmake create mode 100755 CMakeFiles/3.28.2/CMakeDetermineCompilerABI_C.bin create mode 100755 CMakeFiles/3.28.2/CMakeDetermineCompilerABI_CXX.bin create mode 100644 CMakeFiles/3.28.2/CMakeSystem.cmake create mode 100644 CMakeFiles/3.28.2/CompilerIdC/CMakeCCompilerId.c create mode 100755 CMakeFiles/3.28.2/CompilerIdC/a.out create mode 100644 CMakeFiles/3.28.2/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100755 CMakeFiles/3.28.2/CompilerIdCXX/a.out create mode 100644 CMakeFiles/CMakeConfigureLog.yaml create mode 100644 CMakeFiles/TargetDirectories.txt create mode 100644 CMakeFiles/VerifyGlobs.cmake create mode 100644 CMakeFiles/cmake.check_cache create mode 100644 CMakeFiles/cmake.verify_globs create mode 100644 CMakeFiles/rules.ninja create mode 100644 demo.png create mode 100644 example/HConfig create mode 100644 example/build.ninja create mode 100644 example/compile_commands.json create mode 100644 example/include/test.h create mode 100644 example/main.c create mode 100644 example/test.c create mode 100644 include/grbc/ext_easy.h create mode 100644 src/ext_easy.cc diff --git a/CMakeFiles/3.28.2/CMakeCCompiler.cmake b/CMakeFiles/3.28.2/CMakeCCompiler.cmake new file mode 100644 index 0000000..acbe6aa --- /dev/null +++ b/CMakeFiles/3.28.2/CMakeCCompiler.cmake @@ -0,0 +1,74 @@ +set(CMAKE_C_COMPILER "/usr/lib64/ccache/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "14.2.1") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/bin/ar") +set(CMAKE_C_COMPILER_AR "/bin/gcc-ar") +set(CMAKE_RANLIB "/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/bin/gcc-ranlib") +set(CMAKE_LINKER "/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/14/include;/usr/local/include;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/14;/usr/lib64;/lib64;/usr/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/CMakeFiles/3.28.2/CMakeCXXCompiler.cmake b/CMakeFiles/3.28.2/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..5023eb4 --- /dev/null +++ b/CMakeFiles/3.28.2/CMakeCXXCompiler.cmake @@ -0,0 +1,85 @@ +set(CMAKE_CXX_COMPILER "/usr/lib64/ccache/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "14.2.1") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/bin/gcc-ar") +set(CMAKE_RANLIB "/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/bin/gcc-ranlib") +set(CMAKE_LINKER "/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/14;/usr/include/c++/14/x86_64-redhat-linux;/usr/include/c++/14/backward;/usr/lib/gcc/x86_64-redhat-linux/14/include;/usr/local/include;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-redhat-linux/14;/usr/lib64;/lib64;/usr/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_C.bin b/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000000000000000000000000000000000000..6dd9fa903b51b3e060b8f162706057504b91011c GIT binary patch literal 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