set c++ version
This commit is contained in:
parent
b3a326720b
commit
29afc49c36
|
@ -1,22 +0,0 @@
|
||||||
# CMAKE generated file: DO NOT EDIT!
|
|
||||||
# Generated by CMake Version 3.28
|
|
||||||
cmake_policy(SET CMP0009 NEW)
|
|
||||||
|
|
||||||
# sol2-headers at vendor/sol2/CMakeLists.txt:83 (file)
|
|
||||||
file(GLOB_RECURSE NEW_GLOB LIST_DIRECTORIES false "/home/interfiber/dev/grbc/vendor/sol2/include/sol*.hpp")
|
|
||||||
set(OLD_GLOB
|
|
||||||
"/home/interfiber/dev/grbc/vendor/sol2/include/sol/sol.hpp"
|
|
||||||
)
|
|
||||||
if(NOT "${NEW_GLOB}" STREQUAL "${OLD_GLOB}")
|
|
||||||
message("-- GLOB mismatch!")
|
|
||||||
file(TOUCH_NOCREATE "/home/interfiber/dev/grbc/CMakeFiles/cmake.verify_globs")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# sol2-sources at vendor/sol2/CMakeLists.txt:89 (file)
|
|
||||||
file(GLOB_RECURSE NEW_GLOB LIST_DIRECTORIES false "/home/interfiber/dev/grbc/vendor/sol2/source/**")
|
|
||||||
set(OLD_GLOB
|
|
||||||
)
|
|
||||||
if(NOT "${NEW_GLOB}" STREQUAL "${OLD_GLOB}")
|
|
||||||
message("-- GLOB mismatch!")
|
|
||||||
file(TOUCH_NOCREATE "/home/interfiber/dev/grbc/CMakeFiles/cmake.verify_globs")
|
|
||||||
endif()
|
|
12
HConfig
12
HConfig
|
@ -4,6 +4,10 @@ grbc_ext("GRBC_EXT_profiles")
|
||||||
grbc_ext("GRBC_EXT_easy")
|
grbc_ext("GRBC_EXT_easy")
|
||||||
grbc_ext("GRBC_EXT_dynamic_extensions")
|
grbc_ext("GRBC_EXT_dynamic_extensions")
|
||||||
|
|
||||||
|
grbc_global_properties({
|
||||||
|
grbc_cxx_version("c++17")
|
||||||
|
})
|
||||||
|
|
||||||
local hotwire = grbc_library(LibraryConfig.new({
|
local hotwire = grbc_library(LibraryConfig.new({
|
||||||
name = "libhotwire",
|
name = "libhotwire",
|
||||||
language_type = LanguageType.C,
|
language_type = LanguageType.C,
|
||||||
|
@ -20,6 +24,9 @@ local hotwire = grbc_library(LibraryConfig.new({
|
||||||
"vendor/hotwire/src",
|
"vendor/hotwire/src",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
properties = {
|
||||||
|
},
|
||||||
|
|
||||||
package_config = PackageConfig.new({
|
package_config = PackageConfig.new({
|
||||||
name = "libhotwire",
|
name = "libhotwire",
|
||||||
libraries = {},
|
libraries = {},
|
||||||
|
@ -38,7 +45,8 @@ local grbc_extensions = grbc_library(LibraryConfig.new({
|
||||||
grbc_file("src/ext_pkg_config.cc"),
|
grbc_file("src/ext_pkg_config.cc"),
|
||||||
grbc_file("src/ext_profiles.cc"),
|
grbc_file("src/ext_profiles.cc"),
|
||||||
grbc_file("src/ext_easy.cc"),
|
grbc_file("src/ext_easy.cc"),
|
||||||
grbc_file("src/ext_dynamic.cc")
|
grbc_file("src/ext_dynamic.cc"),
|
||||||
|
grbc_file("src/ext_cmake.cc")
|
||||||
},
|
},
|
||||||
lib_type = LibraryType.Static,
|
lib_type = LibraryType.Static,
|
||||||
|
|
||||||
|
@ -123,4 +131,4 @@ local grbc_exe = grbc_executable(ExecutableConfig.new({
|
||||||
}))
|
}))
|
||||||
|
|
||||||
-- Output the final build script
|
-- Output the final build script
|
||||||
grbc_build("ninja")
|
grbc_build("ninja")
|
||||||
|
|
47
build.ninja
47
build.ninja
|
@ -1,5 +1,5 @@
|
||||||
### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ###
|
### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ###
|
||||||
### GENERATED ON: 1727740849 ###
|
### GENERATED ON: 1728779034 ###
|
||||||
|
|
||||||
## Default variables ##
|
## Default variables ##
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ rule archive
|
||||||
## Compile: vendor/hotwire/src/dlopen.c ##
|
## Compile: vendor/hotwire/src/dlopen.c ##
|
||||||
|
|
||||||
build $builddir/vendor/hotwire/src/dlopen.o: cc vendor/hotwire/src/dlopen.c
|
build $builddir/vendor/hotwire/src/dlopen.o: cc vendor/hotwire/src/dlopen.c
|
||||||
p_cflags = -Ivendor/hotwire/src -g -O1
|
p_cflags = -std=c++17 -Ivendor/hotwire/src
|
||||||
|
|
||||||
## Link: libhotwire.a ##
|
## Link: libhotwire.a ##
|
||||||
|
|
||||||
|
@ -53,81 +53,86 @@ build $builddir/libhotwire.a: archive $builddir/vendor/hotwire/src/dlopen.o
|
||||||
## Compile: src/ext_pkg_config.cc ##
|
## Compile: src/ext_pkg_config.cc ##
|
||||||
|
|
||||||
build $builddir/src/ext_pkg_config.o: cxx src/ext_pkg_config.cc
|
build $builddir/src/ext_pkg_config.o: cxx src/ext_pkg_config.cc
|
||||||
p_cflags = -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1
|
p_cflags = -std=c++17 -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/ext_profiles.cc ##
|
## Compile: src/ext_profiles.cc ##
|
||||||
|
|
||||||
build $builddir/src/ext_profiles.o: cxx src/ext_profiles.cc
|
build $builddir/src/ext_profiles.o: cxx src/ext_profiles.cc
|
||||||
p_cflags = -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1
|
p_cflags = -std=c++17 -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/ext_easy.cc ##
|
## Compile: src/ext_easy.cc ##
|
||||||
|
|
||||||
build $builddir/src/ext_easy.o: cxx src/ext_easy.cc
|
build $builddir/src/ext_easy.o: cxx src/ext_easy.cc
|
||||||
p_cflags = -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1
|
p_cflags = -std=c++17 -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/ext_dynamic.cc ##
|
## Compile: src/ext_dynamic.cc ##
|
||||||
|
|
||||||
build $builddir/src/ext_dynamic.o: cxx src/ext_dynamic.cc
|
build $builddir/src/ext_dynamic.o: cxx src/ext_dynamic.cc
|
||||||
p_cflags = -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1
|
p_cflags = -std=c++17 -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include
|
||||||
|
|
||||||
|
## Compile: src/ext_cmake.cc ##
|
||||||
|
|
||||||
|
build $builddir/src/ext_cmake.o: cxx src/ext_cmake.cc
|
||||||
|
p_cflags = -std=c++17 -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include
|
||||||
|
|
||||||
## Link: libgrbc_extensions.a ##
|
## Link: libgrbc_extensions.a ##
|
||||||
|
|
||||||
build $builddir/libgrbc_extensions.a: archive $builddir/src/ext_pkg_config.o $builddir/src/ext_profiles.o $builddir/src/ext_easy.o $builddir/src/ext_dynamic.o
|
build $builddir/libgrbc_extensions.a: archive $builddir/src/ext_pkg_config.o $builddir/src/ext_profiles.o $builddir/src/ext_easy.o $builddir/src/ext_dynamic.o $builddir/src/ext_cmake.o
|
||||||
|
|
||||||
## Compile: src/file.cc ##
|
## Compile: src/file.cc ##
|
||||||
|
|
||||||
build $builddir/src/file.o: cxx src/file.cc
|
build $builddir/src/file.o: cxx src/file.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/ninja.cc ##
|
## Compile: src/ninja.cc ##
|
||||||
|
|
||||||
build $builddir/src/ninja.o: cxx src/ninja.cc
|
build $builddir/src/ninja.o: cxx src/ninja.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/platform.cc ##
|
## Compile: src/platform.cc ##
|
||||||
|
|
||||||
build $builddir/src/platform.o: cxx src/platform.cc
|
build $builddir/src/platform.o: cxx src/platform.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/target_exe.cc ##
|
## Compile: src/target_exe.cc ##
|
||||||
|
|
||||||
build $builddir/src/target_exe.o: cxx src/target_exe.cc
|
build $builddir/src/target_exe.o: cxx src/target_exe.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/utils.cc ##
|
## Compile: src/utils.cc ##
|
||||||
|
|
||||||
build $builddir/src/utils.o: cxx src/utils.cc
|
build $builddir/src/utils.o: cxx src/utils.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/generator.cc ##
|
## Compile: src/generator.cc ##
|
||||||
|
|
||||||
build $builddir/src/generator.o: cxx src/generator.cc
|
build $builddir/src/generator.o: cxx src/generator.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/target_lib.cc ##
|
## Compile: src/target_lib.cc ##
|
||||||
|
|
||||||
build $builddir/src/target_lib.o: cxx src/target_lib.cc
|
build $builddir/src/target_lib.o: cxx src/target_lib.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/package.cc ##
|
## Compile: src/package.cc ##
|
||||||
|
|
||||||
build $builddir/src/package.o: cxx src/package.cc
|
build $builddir/src/package.o: cxx src/package.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/ext.cc ##
|
## Compile: src/ext.cc ##
|
||||||
|
|
||||||
build $builddir/src/ext.o: cxx src/ext.cc
|
build $builddir/src/ext.o: cxx src/ext.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/task.cc ##
|
## Compile: src/task.cc ##
|
||||||
|
|
||||||
build $builddir/src/task.o: cxx src/task.cc
|
build $builddir/src/task.o: cxx src/task.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Compile: src/options.cc ##
|
## Compile: src/options.cc ##
|
||||||
|
|
||||||
build $builddir/src/options.o: cxx src/options.cc
|
build $builddir/src/options.o: cxx src/options.cc
|
||||||
p_cflags = -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O1
|
p_cflags = -Ivendor/hotwire/src -std=c++17 -Iinclude -Ivendor/sol2/include
|
||||||
|
|
||||||
## Link: libgrbc.a ##
|
## Link: libgrbc.a ##
|
||||||
|
|
||||||
|
@ -136,13 +141,13 @@ build $builddir/libgrbc.a: archive $builddir/src/file.o $builddir/src/ninja.o $b
|
||||||
## Compile: src/main.cc ##
|
## Compile: src/main.cc ##
|
||||||
|
|
||||||
build $builddir/src/main.o: cxx src/main.cc
|
build $builddir/src/main.o: cxx src/main.cc
|
||||||
p_cflags = -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -Ivendor/hotwire/src -g -O1
|
p_cflags = -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -Ivendor/hotwire/src -std=c++17
|
||||||
|
|
||||||
## Link: grbc ##
|
## Link: grbc ##
|
||||||
|
|
||||||
build $builddir/grbc: link_cxx $builddir/src/main.o | $builddir/libgrbc.a $builddir/libgrbc_extensions.a $builddir/libhotwire.a
|
build $builddir/grbc: link_cxx $builddir/src/main.o | $builddir/libgrbc.a $builddir/libgrbc_extensions.a $builddir/libhotwire.a
|
||||||
p_linker_flags = -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a build/libhotwire.a -Lbuild -Wl,-rpath,build:.
|
p_linker_flags = -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a build/libhotwire.a -O3 -DNDEBUG -Lbuild -Wl,-rpath,build:.
|
||||||
p_cflags = -g -O1
|
p_cflags =
|
||||||
|
|
||||||
## clean ##
|
## clean ##
|
||||||
rule clean_task
|
rule clean_task
|
||||||
|
|
|
@ -1,132 +1,138 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/gcc -MMD -MT build/vendor/hotwire/src/dlopen.o -MF build/vendor/hotwire/src/dlopen.o.d -Ivendor/hotwire/src -g -O1 -c vendor/hotwire/src/dlopen.c -o build/vendor/hotwire/src/dlopen.o",
|
"command": "/usr/lib64/ccache/gcc -MMD -MT build/vendor/hotwire/src/dlopen.o -MF build/vendor/hotwire/src/dlopen.o.d -Ivendor/hotwire/src -g -O3 -DNDEBUG -c vendor/hotwire/src/dlopen.c -o build/vendor/hotwire/src/dlopen.o",
|
||||||
"file": "vendor/hotwire/src/dlopen.c",
|
"file": "vendor/hotwire/src/dlopen.c",
|
||||||
"output": "build/vendor/hotwire/src/dlopen.o"
|
"output": "build/vendor/hotwire/src/dlopen.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "rm -f build/libhotwire.a; ar crs build/libhotwire.a build/vendor/hotwire/src/dlopen.o",
|
"command": "rm -f build/libhotwire.a; ar crs build/libhotwire.a build/vendor/hotwire/src/dlopen.o",
|
||||||
"file": "build/vendor/hotwire/src/dlopen.o",
|
"file": "build/vendor/hotwire/src/dlopen.o",
|
||||||
"output": "build/libhotwire.a"
|
"output": "build/libhotwire.a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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/hotwire/src -Ivendor/sol2/include -g -O1 -c src/ext_pkg_config.cc -o build/src/ext_pkg_config.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_pkg_config.o -MF build/src/ext_pkg_config.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext_pkg_config.cc -o build/src/ext_pkg_config.o",
|
||||||
"file": "src/ext_pkg_config.cc",
|
"file": "src/ext_pkg_config.cc",
|
||||||
"output": "build/src/ext_pkg_config.o"
|
"output": "build/src/ext_pkg_config.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_profiles.o -MF build/src/ext_profiles.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1 -c src/ext_profiles.cc -o build/src/ext_profiles.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_profiles.o -MF build/src/ext_profiles.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext_profiles.cc -o build/src/ext_profiles.o",
|
||||||
"file": "src/ext_profiles.cc",
|
"file": "src/ext_profiles.cc",
|
||||||
"output": "build/src/ext_profiles.o"
|
"output": "build/src/ext_profiles.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_easy.o -MF build/src/ext_easy.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1 -c src/ext_easy.cc -o build/src/ext_easy.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_easy.o -MF build/src/ext_easy.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext_easy.cc -o build/src/ext_easy.o",
|
||||||
"file": "src/ext_easy.cc",
|
"file": "src/ext_easy.cc",
|
||||||
"output": "build/src/ext_easy.o"
|
"output": "build/src/ext_easy.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_dynamic.o -MF build/src/ext_dynamic.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O1 -c src/ext_dynamic.cc -o build/src/ext_dynamic.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_dynamic.o -MF build/src/ext_dynamic.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext_dynamic.cc -o build/src/ext_dynamic.o",
|
||||||
"file": "src/ext_dynamic.cc",
|
"file": "src/ext_dynamic.cc",
|
||||||
"output": "build/src/ext_dynamic.o"
|
"output": "build/src/ext_dynamic.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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 build/src/ext_easy.o build/src/ext_dynamic.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext_cmake.o -MF build/src/ext_cmake.o.d -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext_cmake.cc -o build/src/ext_cmake.o",
|
||||||
|
"file": "src/ext_cmake.cc",
|
||||||
|
"output": "build/src/ext_cmake.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"directory": "/home/hstasonis/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 build/src/ext_easy.o build/src/ext_dynamic.o build/src/ext_cmake.o",
|
||||||
"file": "build/src/ext_pkg_config.o",
|
"file": "build/src/ext_pkg_config.o",
|
||||||
"output": "build/libgrbc_extensions.a"
|
"output": "build/libgrbc_extensions.a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/file.o -MF build/src/file.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/file.cc -o build/src/file.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/file.o -MF build/src/file.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/file.cc -o build/src/file.o",
|
||||||
"file": "src/file.cc",
|
"file": "src/file.cc",
|
||||||
"output": "build/src/file.o"
|
"output": "build/src/file.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ninja.o -MF build/src/ninja.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/ninja.cc -o build/src/ninja.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ninja.o -MF build/src/ninja.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ninja.cc -o build/src/ninja.o",
|
||||||
"file": "src/ninja.cc",
|
"file": "src/ninja.cc",
|
||||||
"output": "build/src/ninja.o"
|
"output": "build/src/ninja.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/platform.o -MF build/src/platform.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/platform.cc -o build/src/platform.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/platform.o -MF build/src/platform.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/platform.cc -o build/src/platform.o",
|
||||||
"file": "src/platform.cc",
|
"file": "src/platform.cc",
|
||||||
"output": "build/src/platform.o"
|
"output": "build/src/platform.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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 -g -O1 -c src/target_exe.cc -o build/src/target_exe.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/target_exe.o -MF build/src/target_exe.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/target_exe.cc -o build/src/target_exe.o",
|
||||||
"file": "src/target_exe.cc",
|
"file": "src/target_exe.cc",
|
||||||
"output": "build/src/target_exe.o"
|
"output": "build/src/target_exe.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/utils.o -MF build/src/utils.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/utils.cc -o build/src/utils.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/utils.o -MF build/src/utils.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/utils.cc -o build/src/utils.o",
|
||||||
"file": "src/utils.cc",
|
"file": "src/utils.cc",
|
||||||
"output": "build/src/utils.o"
|
"output": "build/src/utils.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/generator.o -MF build/src/generator.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/generator.cc -o build/src/generator.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/generator.o -MF build/src/generator.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/generator.cc -o build/src/generator.o",
|
||||||
"file": "src/generator.cc",
|
"file": "src/generator.cc",
|
||||||
"output": "build/src/generator.o"
|
"output": "build/src/generator.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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 -g -O1 -c src/target_lib.cc -o build/src/target_lib.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/target_lib.o -MF build/src/target_lib.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/target_lib.cc -o build/src/target_lib.o",
|
||||||
"file": "src/target_lib.cc",
|
"file": "src/target_lib.cc",
|
||||||
"output": "build/src/target_lib.o"
|
"output": "build/src/target_lib.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/package.o -MF build/src/package.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/package.cc -o build/src/package.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/package.o -MF build/src/package.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/package.cc -o build/src/package.o",
|
||||||
"file": "src/package.cc",
|
"file": "src/package.cc",
|
||||||
"output": "build/src/package.o"
|
"output": "build/src/package.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext.o -MF build/src/ext.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/ext.cc -o build/src/ext.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/ext.o -MF build/src/ext.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/ext.cc -o build/src/ext.o",
|
||||||
"file": "src/ext.cc",
|
"file": "src/ext.cc",
|
||||||
"output": "build/src/ext.o"
|
"output": "build/src/ext.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/task.o -MF build/src/task.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/task.cc -o build/src/task.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/task.o -MF build/src/task.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/task.cc -o build/src/task.o",
|
||||||
"file": "src/task.cc",
|
"file": "src/task.cc",
|
||||||
"output": "build/src/task.o"
|
"output": "build/src/task.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/options.o -MF build/src/options.o.d -Iinclude -Ivendor/sol2/include -g -O1 -c src/options.cc -o build/src/options.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/options.o -MF build/src/options.o.d -Ivendor/hotwire/src -Iinclude -Ivendor/sol2/include -g -O3 -DNDEBUG -c src/options.cc -o build/src/options.o",
|
||||||
"file": "src/options.cc",
|
"file": "src/options.cc",
|
||||||
"output": "build/src/options.o"
|
"output": "build/src/options.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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",
|
"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",
|
"file": "build/src/file.o",
|
||||||
"output": "build/libgrbc.a"
|
"output": "build/libgrbc.a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/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/hotwire/src -Ivendor/sol2/include -Ivendor/hotwire/src -g -O1 -c src/main.cc -o build/src/main.o",
|
"command": "/usr/lib64/ccache/g++ -MMD -MT build/src/main.o -MF build/src/main.o.d -Iinclude -Ivendor/sol2/include -Iinclude -Ivendor/hotwire/src -Ivendor/sol2/include -Ivendor/hotwire/src -g -O3 -DNDEBUG -c src/main.cc -o build/src/main.o",
|
||||||
"file": "src/main.cc",
|
"file": "src/main.cc",
|
||||||
"output": "build/src/main.o"
|
"output": "build/src/main.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "/usr/lib64/ccache/g++ -g -O1 -o build/grbc build/src/main.o -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a build/libhotwire.a -Lbuild -Wl,-rpath,build:. ",
|
"command": "/usr/lib64/ccache/g++ -g -O3 -DNDEBUG -o build/grbc build/src/main.o -llua -lm -ldl build/libgrbc.a build/libgrbc_extensions.a build/libhotwire.a -Lbuild -Wl,-rpath,build:. ",
|
||||||
"file": "build/src/main.o",
|
"file": "build/src/main.o",
|
||||||
"output": "build/grbc"
|
"output": "build/grbc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "/home/interfiber/dev/grbc",
|
"directory": "/home/hstasonis/dev/grbc",
|
||||||
"command": "",
|
"command": "",
|
||||||
"file": "build/libhotwire.a",
|
"file": "build/libhotwire.a",
|
||||||
"output": "all"
|
"output": "all"
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
local grbc_extensions = grbc_library(LibraryConfig.new({
|
|
||||||
name = "libfusion",
|
|
||||||
language_type = LanguageType.Cpp,
|
|
||||||
files = {
|
|
||||||
grbc_file("src/ext_fusion.cc")
|
|
||||||
},
|
|
||||||
lib_type = LibraryType.Shared,
|
|
||||||
|
|
||||||
requirements = {},
|
|
||||||
compile_flags = {},
|
|
||||||
linker_flags = {},
|
|
||||||
|
|
||||||
include_dirs = {
|
|
||||||
"../vendor/sol2/include"
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
grbc_build("ninja")
|
|
|
@ -1,2 +0,0 @@
|
||||||
FUSION GRBC EXTENSION
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
### GENERATED BY THE GRBC BUILT-IN NINJA GENERATOR ###
|
|
||||||
### GENERATED ON: 1727735253 ###
|
|
||||||
|
|
||||||
## Default variables ##
|
|
||||||
|
|
||||||
builddir = build
|
|
||||||
|
|
||||||
## build_rule_compile_cc ##
|
|
||||||
|
|
||||||
cc_path = /usr/lib64/ccache/gcc
|
|
||||||
rule cc
|
|
||||||
command = $cc_path -MMD -MT $out -MF $out.d $p_cflags -c $in -o $out
|
|
||||||
description = Compiling C object $in
|
|
||||||
depfile = $out.d
|
|
||||||
deps = gcc
|
|
||||||
|
|
||||||
## build_rule_compile_cxx ##
|
|
||||||
|
|
||||||
cxx_path = /usr/lib64/ccache/g++
|
|
||||||
rule cxx
|
|
||||||
command = $cxx_path -MMD -MT $out -MF $out.d $p_cflags -c $in -o $out
|
|
||||||
description = Compiling C++ object $in
|
|
||||||
depfile = $out.d
|
|
||||||
deps = gcc
|
|
||||||
|
|
||||||
## build_rule_link_cc ##
|
|
||||||
|
|
||||||
rule link_cc
|
|
||||||
command = $cc_path $p_cflags -o $out $in $p_linker_flags
|
|
||||||
description = Linking C target $out
|
|
||||||
|
|
||||||
## build_rule_link_cxx ##
|
|
||||||
|
|
||||||
rule link_cxx
|
|
||||||
command = $cxx_path $p_cflags -o $out $in $p_linker_flags
|
|
||||||
description = Linking C++ target $out
|
|
||||||
|
|
||||||
## build_rule_archive_library ##
|
|
||||||
|
|
||||||
rule archive
|
|
||||||
command = rm -f $out; ar crs $out $in
|
|
||||||
description = Creating static library $out
|
|
||||||
|
|
||||||
## Compile: src/ext_fusion.cc ##
|
|
||||||
|
|
||||||
build $builddir/src/ext_fusion.o: cxx src/ext_fusion.cc
|
|
||||||
p_cflags = -fPIC -I../vendor/sol2/include
|
|
||||||
|
|
||||||
## Link: libfusion.so ##
|
|
||||||
|
|
||||||
build $builddir/libfusion.so: link_cxx $builddir/src/ext_fusion.o
|
|
||||||
p_linker_flags = -shared -Lbuild -Wl,-rpath,build:.
|
|
||||||
p_cflags =
|
|
||||||
|
|
||||||
build all: phony $builddir/libfusion.so
|
|
||||||
|
|
||||||
default all
|
|
|
@ -1,10 +0,0 @@
|
||||||
#include "grbc/spec.h"
|
|
||||||
#include <sol/state.hpp>
|
|
||||||
|
|
||||||
const char* GRBC_Get_Name() {
|
|
||||||
return "GRBC_EXT_Fusion";
|
|
||||||
}
|
|
||||||
|
|
||||||
void GRBC_Hook_Init(sol::state &lua) {
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define GRBC_EXT_profiles_NAME "GRBC_EXT_profiles"
|
#define GRBC_EXT_profiles_NAME "GRBC_EXT_profiles"
|
||||||
#define GRBC_EXT_easy_NAME "GRBC_EXT_easy"
|
#define GRBC_EXT_easy_NAME "GRBC_EXT_easy"
|
||||||
#define GRBC_EXT_dynamic_extensions_NAME "GRBC_EXT_dynamic_extensions"
|
#define GRBC_EXT_dynamic_extensions_NAME "GRBC_EXT_dynamic_extensions"
|
||||||
|
#define GRBC_EXT_cmake_NAME "GRBC_EXT_cmake"
|
||||||
|
|
||||||
/// Called when the extension is loaded
|
/// Called when the extension is loaded
|
||||||
typedef void (*EXT_HookInit)(sol::state &lua);
|
typedef void (*EXT_HookInit)(sol::state &lua);
|
||||||
|
|
22
include/grbc/ext_cmake.h
Normal file
22
include/grbc/ext_cmake.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#pragma once
|
||||||
|
#include "grbc/ext.h"
|
||||||
|
#include "sol/table.hpp"
|
||||||
|
|
||||||
|
struct CMakeConfig {
|
||||||
|
CMakeConfig(const sol::table &table) {
|
||||||
|
configure_arguments = table.get<std::vector<std::string>>("configure_arguments");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Configuration arguments
|
||||||
|
std::vector<std::string> configure_arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CMakeProject {
|
||||||
|
/// Source directory
|
||||||
|
std::string source_dir;
|
||||||
|
|
||||||
|
/// Build directory
|
||||||
|
std::string build_dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
Extension grbc_cmake();
|
|
@ -5,6 +5,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#define GRBC_PROPERTY_CXX_VERSION "CXX_VERSION"
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/1505582/determining-32-vs-64-bit-in-c
|
// https://stackoverflow.com/questions/1505582/determining-32-vs-64-bit-in-c
|
||||||
|
|
||||||
#if _WIN32 || _WIN64
|
#if _WIN32 || _WIN64
|
||||||
|
@ -26,6 +28,21 @@
|
||||||
|
|
||||||
#define GRBC_VERSION "1.0"
|
#define GRBC_VERSION "1.0"
|
||||||
|
|
||||||
|
struct Property {
|
||||||
|
Property() = default;
|
||||||
|
|
||||||
|
Property(const sol::table &table) {
|
||||||
|
name = table.get<std::string>("name");
|
||||||
|
value = table.get<std::string>("value");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Name of this property
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
/// Value of this property
|
||||||
|
std::string value;
|
||||||
|
};
|
||||||
|
|
||||||
enum LanguageType { LanguageType_CPP, LanguageType_C };
|
enum LanguageType { LanguageType_CPP, LanguageType_C };
|
||||||
enum LibraryType { LibraryType_Shared, LibraryType_Static };
|
enum LibraryType { LibraryType_Shared, LibraryType_Static };
|
||||||
|
|
||||||
|
@ -104,6 +121,10 @@ struct ExecutableConfig {
|
||||||
include_dirs = table.get<std::vector<std::string>>("include_dirs");
|
include_dirs = table.get<std::vector<std::string>>("include_dirs");
|
||||||
|
|
||||||
language_type = table.get<LanguageType>("language_type");
|
language_type = table.get<LanguageType>("language_type");
|
||||||
|
|
||||||
|
if (table["properties"].valid()) {
|
||||||
|
properties = table.get<std::vector<Property>>("properties");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Name of the executable
|
/// Name of the executable
|
||||||
|
@ -126,6 +147,9 @@ struct ExecutableConfig {
|
||||||
|
|
||||||
/// Include directories
|
/// Include directories
|
||||||
std::vector<std::string> include_dirs{};
|
std::vector<std::string> include_dirs{};
|
||||||
|
|
||||||
|
/// Optional list of properties
|
||||||
|
std::vector<Property> properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TaskConfig {
|
struct TaskConfig {
|
||||||
|
@ -162,8 +186,11 @@ struct LibraryConfig {
|
||||||
language_type = table.get<LanguageType>("language_type");
|
language_type = table.get<LanguageType>("language_type");
|
||||||
lib_type = table.get<LibraryType>("lib_type");
|
lib_type = table.get<LibraryType>("lib_type");
|
||||||
|
|
||||||
if (!table["package_config"].is<sol::nil_t>())
|
if (table["package_config"].valid())
|
||||||
package_config = table.get<PackageConfig>("package_config");
|
package_config = table.get<PackageConfig>("package_config");
|
||||||
|
|
||||||
|
if (table["properties"].valid())
|
||||||
|
properties = table.get<std::vector<Property>>("properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Name of the executable
|
/// Name of the executable
|
||||||
|
@ -192,6 +219,9 @@ struct LibraryConfig {
|
||||||
|
|
||||||
/// Include directories
|
/// Include directories
|
||||||
std::vector<std::string> include_dirs{};
|
std::vector<std::string> include_dirs{};
|
||||||
|
|
||||||
|
/// Optional list of properties
|
||||||
|
std::vector<Property> properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Platform {
|
struct Platform {
|
||||||
|
@ -277,4 +307,10 @@ void grbc_task(const TaskConfig &config);
|
||||||
|
|
||||||
bool grbc_has_option(const std::string &option_name);
|
bool grbc_has_option(const std::string &option_name);
|
||||||
|
|
||||||
std::string grbc_get_option(const std::string &option_name);
|
std::string grbc_get_option(const std::string &option_name);
|
||||||
|
|
||||||
|
Property grbc_property(const std::string &key, const std::string &value);
|
||||||
|
|
||||||
|
Property grbc_cxx_version(const std::string &version_string);
|
||||||
|
|
||||||
|
void grbc_global_properties(const sol::table &properties);
|
|
@ -18,6 +18,8 @@ struct GState {
|
||||||
|
|
||||||
std::map<std::string, std::string> options;
|
std::map<std::string, std::string> options;
|
||||||
|
|
||||||
|
std::vector<Property> global_properties;
|
||||||
|
|
||||||
std::unordered_map<std::string, Package> packages;
|
std::unordered_map<std::string, Package> packages;
|
||||||
|
|
||||||
std::vector<Extension> extensions;
|
std::vector<Extension> extensions;
|
||||||
|
|
|
@ -63,6 +63,9 @@ struct LibraryConfig {
|
||||||
|
|
||||||
/// Include directories
|
/// Include directories
|
||||||
Array<string> include_dirs;
|
Array<string> include_dirs;
|
||||||
|
|
||||||
|
/// Optional list of properties
|
||||||
|
Array<Property> properties;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -97,6 +100,9 @@ struct ExecutableConfig {
|
||||||
|
|
||||||
/// Include directories
|
/// Include directories
|
||||||
Array<string> include_dirs;
|
Array<string> include_dirs;
|
||||||
|
|
||||||
|
/// Optional list of properties
|
||||||
|
Array<Property> properties;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -176,4 +182,15 @@ struct TaskConfig {
|
||||||
/// Shell script to be executed when this task is called
|
/// Shell script to be executed when this task is called
|
||||||
string shell_script;
|
string shell_script;
|
||||||
};
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Property
|
||||||
|
```c++
|
||||||
|
struct Property {
|
||||||
|
/// Property name
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
/// Property value
|
||||||
|
std::string value;
|
||||||
|
};
|
||||||
```
|
```
|
|
@ -89,4 +89,13 @@ Create a task and add it to the build script
|
||||||
Check if the given option was set on the command line
|
Check if the given option was set on the command line
|
||||||
|
|
||||||
## [X] grbc_get_option(option_name: String) -> String
|
## [X] grbc_get_option(option_name: String) -> String
|
||||||
Get the value of an option
|
Get the value of an option
|
||||||
|
|
||||||
|
## [X] grbc_property(name: String, value: String) -> Property
|
||||||
|
Create a property
|
||||||
|
|
||||||
|
## [X] grbc_cxx_version(version_string: String) -> Property
|
||||||
|
Create a property that sets the C++ version
|
||||||
|
|
||||||
|
## [X] grbc_global_properties(properties: Array<Property>) -> Void
|
||||||
|
Set the global property list
|
76
src/ext_cmake.cc
Normal file
76
src/ext_cmake.cc
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#include "grbc/ext_cmake.h"
|
||||||
|
#include "grbc/ext.h"
|
||||||
|
#include "grbc/helpers.h"
|
||||||
|
#include "grbc/spec.h"
|
||||||
|
#include "sol/raii.hpp"
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
CMakeProject EXT_grbc_import_cmake(const std::string &cmake_path,
|
||||||
|
const CMakeConfig &cfg) {
|
||||||
|
CMakeProject project{};
|
||||||
|
|
||||||
|
log_msg(("configuring cmake project: " + cmake_path).c_str());
|
||||||
|
|
||||||
|
if (!std::filesystem::exists(cmake_path)) {
|
||||||
|
grbc_exception("CMake cannot configure in non-existant directory: " +
|
||||||
|
cmake_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::filesystem::exists(cmake_path + "/CMakeLists.txt")) {
|
||||||
|
grbc_exception("No CMakeLists.txt file in: " + cmake_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::path old_path = std::filesystem::current_path();
|
||||||
|
|
||||||
|
// Change directory into the cmake dir
|
||||||
|
std::filesystem::current_path(cmake_path);
|
||||||
|
|
||||||
|
std::filesystem::create_directory("grbc_configure");
|
||||||
|
|
||||||
|
std::filesystem::current_path("./grbc_configure");
|
||||||
|
|
||||||
|
// Create configure arg string
|
||||||
|
std::string configure_arguments;
|
||||||
|
|
||||||
|
for (const std::string &argument : cfg.configure_arguments) {
|
||||||
|
configure_arguments += argument + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run configure
|
||||||
|
int exit_code =
|
||||||
|
std::system(("cmake -S .. -B . -GNinja " + configure_arguments).c_str());
|
||||||
|
|
||||||
|
if (exit_code != EXIT_SUCCESS)
|
||||||
|
grbc_exception("Failed to configure cmake project in: " + cmake_path);
|
||||||
|
|
||||||
|
std::filesystem::current_path(old_path);
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
Package EXT_grbc_get_cmake_library(const CMakeProject &self,
|
||||||
|
const std::string &library_name) {
|
||||||
|
std::filesystem::path library_path = library_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grbc_cmake_init(sol::state &lua) {
|
||||||
|
lua.new_usertype<CMakeConfig>(
|
||||||
|
"CMakeConfig", sol::constructors<CMakeConfig(sol::table)>(),
|
||||||
|
"configure_arguments", &CMakeConfig::configure_arguments);
|
||||||
|
lua.new_usertype<CMakeProject>("CMakeProject", "source_dir",
|
||||||
|
&CMakeProject::source_dir, "build_dir",
|
||||||
|
&CMakeProject::build_dir);
|
||||||
|
|
||||||
|
lua["CMakeProject"]["get_library"] = EXT_grbc_get_cmake_library;
|
||||||
|
|
||||||
|
lua.set("grbc_import_cmake", EXT_grbc_import_cmake);
|
||||||
|
}
|
||||||
|
|
||||||
|
Extension grbc_cmake() {
|
||||||
|
Extension ext{};
|
||||||
|
ext.name = GRBC_EXT_cmake_NAME;
|
||||||
|
ext.hook_init = grbc_cmake_init;
|
||||||
|
|
||||||
|
return ext;
|
||||||
|
}
|
|
@ -12,8 +12,8 @@ extern "C" {
|
||||||
typedef const char *(*EXT_GetName)();
|
typedef const char *(*EXT_GetName)();
|
||||||
|
|
||||||
void EXT_dynamic_ext(const std::string &extension_name) {
|
void EXT_dynamic_ext(const std::string &extension_name) {
|
||||||
const std::array<std::string, 4 > extension_paths = {"./grbc_ext",
|
const std::array<std::string, 4> extension_paths = {
|
||||||
"C:\\grbc\\ext", "./", "./build"};
|
"./grbc_ext", "C:\\grbc\\ext", "./", "./build"};
|
||||||
|
|
||||||
std::filesystem::path good_extension_path;
|
std::filesystem::path good_extension_path;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "grbc/ext.h"
|
#include "grbc/ext.h"
|
||||||
|
#include "grbc/ext_cmake.h"
|
||||||
#include "grbc/ext_dynamic.h"
|
#include "grbc/ext_dynamic.h"
|
||||||
#include "grbc/ext_easy.h"
|
#include "grbc/ext_easy.h"
|
||||||
#include "grbc/ext_pkg_config.h"
|
#include "grbc/ext_pkg_config.h"
|
||||||
|
@ -144,6 +145,9 @@ int main(int argc, char **argv) {
|
||||||
&TaskConfig::name, "task_id", &TaskConfig::task_id, "shell_script",
|
&TaskConfig::name, "task_id", &TaskConfig::task_id, "shell_script",
|
||||||
&TaskConfig::shell_script);
|
&TaskConfig::shell_script);
|
||||||
|
|
||||||
|
// Property
|
||||||
|
lua.new_usertype<Property>("Property", sol::constructors<Property(sol::table)>(), "name", &Property::name, "value", &Property::value);
|
||||||
|
|
||||||
lua.set("grbc_want_version", grbc_want_version);
|
lua.set("grbc_want_version", grbc_want_version);
|
||||||
lua.set("grbc_exception", grbc_exception);
|
lua.set("grbc_exception", grbc_exception);
|
||||||
lua.set("grbc_get_config", grbc_get_config);
|
lua.set("grbc_get_config", grbc_get_config);
|
||||||
|
@ -174,6 +178,9 @@ int main(int argc, char **argv) {
|
||||||
lua.set("grbc_task", grbc_task);
|
lua.set("grbc_task", grbc_task);
|
||||||
lua.set("grbc_has_option", grbc_has_option);
|
lua.set("grbc_has_option", grbc_has_option);
|
||||||
lua.set("grbc_get_option", grbc_get_option);
|
lua.set("grbc_get_option", grbc_get_option);
|
||||||
|
lua.set("grbc_property", grbc_property);
|
||||||
|
lua.set("grbc_cxx_version", grbc_cxx_version);
|
||||||
|
lua.set("grbc_global_properties", grbc_global_properties);
|
||||||
|
|
||||||
// Load generators
|
// Load generators
|
||||||
|
|
||||||
|
@ -189,6 +196,7 @@ int main(int argc, char **argv) {
|
||||||
grbc_register_ext(grbc_profiles());
|
grbc_register_ext(grbc_profiles());
|
||||||
grbc_register_ext(grbc_easy());
|
grbc_register_ext(grbc_easy());
|
||||||
grbc_register_ext(grbc_dynamic());
|
grbc_register_ext(grbc_dynamic());
|
||||||
|
grbc_register_ext(grbc_cmake());
|
||||||
|
|
||||||
// Detect platform
|
// Detect platform
|
||||||
log_msg("autodetecting platform...");
|
log_msg("autodetecting platform...");
|
||||||
|
|
|
@ -27,6 +27,14 @@ TargetInfo grbc_executable(const ExecutableConfig &executable_config) {
|
||||||
compiler_args += compiler_arg + " ";
|
compiler_args += compiler_arg + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Property> properties = executable_config.properties; for (auto &global_property : GState::get().global_properties)
|
||||||
|
properties.push_back(global_property);
|
||||||
|
|
||||||
|
for (auto &property : properties) {
|
||||||
|
if (property.name == GRBC_PROPERTY_CXX_VERSION)
|
||||||
|
compiler_args += "-std=" + property.value + " ";
|
||||||
|
}
|
||||||
|
|
||||||
// Include directories
|
// Include directories
|
||||||
|
|
||||||
compiler_args += grbc_include_dirs_to_cflags(executable_config.include_dirs);
|
compiler_args += grbc_include_dirs_to_cflags(executable_config.include_dirs);
|
||||||
|
|
|
@ -33,6 +33,15 @@ TargetInfo grbc_library(const LibraryConfig &library_config) {
|
||||||
compiler_args += "-fPIC ";
|
compiler_args += "-fPIC ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Property> properties = library_config.properties;
|
||||||
|
for (auto &global_property : GState::get().global_properties)
|
||||||
|
properties.push_back(global_property);
|
||||||
|
|
||||||
|
for (auto &property : properties) {
|
||||||
|
if (property.name == GRBC_PROPERTY_CXX_VERSION)
|
||||||
|
compiler_args += "-std=" + property.value + " ";
|
||||||
|
}
|
||||||
|
|
||||||
// Include directories
|
// Include directories
|
||||||
|
|
||||||
compiler_args += grbc_include_dirs_to_cflags(library_config.include_dirs);
|
compiler_args += grbc_include_dirs_to_cflags(library_config.include_dirs);
|
||||||
|
|
29
src/utils.cc
29
src/utils.cc
|
@ -48,7 +48,7 @@ std::string grbc_replace_string(const std::string &string, char substring,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalConfig& grbc_get_config() {
|
GlobalConfig &grbc_get_config() {
|
||||||
static GlobalConfig cfg{};
|
static GlobalConfig cfg{};
|
||||||
|
|
||||||
return cfg;
|
return cfg;
|
||||||
|
@ -97,4 +97,31 @@ std::string grbc_get_lib_extension(LibraryType lib_type) {
|
||||||
"library combo");
|
"library combo");
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Property grbc_property(const std::string &key, const std::string &value) {
|
||||||
|
static std::vector<std::string> validPropertyNames = {
|
||||||
|
GRBC_PROPERTY_CXX_VERSION};
|
||||||
|
|
||||||
|
for (const std::string &propertyName : validPropertyNames) {
|
||||||
|
if (propertyName == key) {
|
||||||
|
Property property{};
|
||||||
|
property.name = key;
|
||||||
|
property.value = value;
|
||||||
|
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grbc_exception("Invalid property name: " + key);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
Property grbc_cxx_version(const std::string &version_string) {
|
||||||
|
return grbc_property(GRBC_PROPERTY_CXX_VERSION, version_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void grbc_global_properties(const sol::table &properties) {
|
||||||
|
GState::get().global_properties = properties.as<std::vector<Property>>();
|
||||||
}
|
}
|
Loading…
Reference in a new issue