From 456eaeb39c0cc754611faf2496dd853c8798284d Mon Sep 17 00:00:00 2001 From: checkroom Date: Fri, 22 Nov 2024 17:33:08 +0000 Subject: [PATCH] Restored C scripts functionality --- meson.build | 4 ++-- package.json | 2 +- scripts/gen-commons.sh | 15 ++++++++++++++- src/pipelines/tcc-c.cpp | 11 +++++++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index b9f3dfcc..c8b20d88 100644 --- a/meson.build +++ b/meson.build @@ -267,8 +267,8 @@ install_headers(['./include/cbindings/vs.h','./include/cbindings/components.auto install_subdir('commons', exclude_files:['.gitignore'], install_dir:'share/vs-fltk',strip_directory:true) install_subdir('docs',install_dir:'share/vs-fltk') -install_subdir('examples',install_dir:'share/vs-fltk') -install_subdir('bindings',install_dir:'share/vs-fltk') +#install_subdir('examples',install_dir:'share/vs-fltk') +#nstall_subdir('bindings',install_dir:'share/vs-fltk') install_data(['./LICENCE.md','./README.md', './RELEASE.md'],install_dir:'share/vs-fltk/') #install_man() diff --git a/package.json b/package.json index 0f2fa94e..e2825914 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "meson-setup.clang-release": "meson setup --reconfigure build/ --buildtype=release --native-file toolchains/clang.ini", "meson-setup.clang-debug": "meson setup --reconfigure build/ --buildtype=debug --native-file toolchains/clang.ini", "meson-setup.zig-release": "meson setup --reconfigure build/ --buildtype=release --native-file toolchains/zig.ini", - "vs.example": "meson compile -C build/ vs:executable && ./build/vs run ./examples/example-0.xml", + "vs.example": "meson compile -C build/ vs:executable && VS_COMMONS_DIR=$(pwd)/build/commons/ ./build/vs run vs://examples/example-0.xml", "test": "meson test -C build/ --suite=vs-fltk", "benchmark": "meson test --benchmark -C build/ --suite=vs-fltk", "meson-install": "DESTDIR=./dist/ meson install -C build/", diff --git a/scripts/gen-commons.sh b/scripts/gen-commons.sh index 23d3612b..83aa02b5 100755 --- a/scripts/gen-commons.sh +++ b/scripts/gen-commons.sh @@ -1 +1,14 @@ -cp -r ../commons ./ \ No newline at end of file +rm -rf ./commons +cp -r ../commons ./ + +mkdir -p ./commons/bindings/native/tcc +cp -r ../subprojects/libtcc/include/ ./commons/bindings/native/tcc + +mkdir -p ./commons/bindings/ +cp -r ../bindings/ ./commons/ + +mkdir -p ./commons/docs/ +cp -r ../docs/ ./commons/ + +mkdir -p ./commons/examples/ +cp -r ../examples/ ./commons/ \ No newline at end of file diff --git a/src/pipelines/tcc-c.cpp b/src/pipelines/tcc-c.cpp index 0968f207..244d2fe6 100644 --- a/src/pipelines/tcc-c.cpp +++ b/src/pipelines/tcc-c.cpp @@ -1,5 +1,7 @@ +#include "globals.hpp" #include "ui-frame.hpp" #include "ui.hpp" +#include "utils/paths.hpp" #include #include @@ -45,8 +47,9 @@ std::shared_ptr tcc_c_pipeline(bool is_runtime, vs::ui_base* obj, const cha script->add_lib_path("./subprojects/libtcc"); script->set_out_type(tcc::memory); - //script->add_sysinclude_path("./subprojects/libtcc/include/"); - script->add_include_path("./bindings/native/include"); + script->add_sysinclude_path((globals::path_env.root.location+"./bindings/native/tcc/include").c_str()); + + script->add_include_path((globals::path_env.root.location+"./bindings/native/include").c_str()); //script->add_lib("ld"); //script->add_lib("tcc1"); @@ -118,14 +121,14 @@ std::shared_ptr tcc_c_pipeline(bool is_runtime, vs::ui_base* obj, const cha if(compact){ script->compile_str_embedded( - "#include \n#include \n#file embedded \nint callback(){\n#line 0\n", //TODO: Add custom header if linked with an external thing + "#include \n#include \n//#file embedded \nint callback(){\n#line 0\n", //TODO: Add custom header if linked with an external thing src, "\n}" ); } else{ script->compile_str_embedded( - "#include \n#include \n#file embedded \n#line 0\n", //TODO: Add custom header if linked with an external thing + "#include \n#include \n//#file embedded \n#line 0\n", //TODO: Add custom header if linked with an external thing src, "" );