Skip to content

Commit

Permalink
Restored C scripts functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
checkroom committed Nov 22, 2024
1 parent ed28d6b commit 456eaeb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
15 changes: 14 additions & 1 deletion scripts/gen-commons.sh
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
cp -r ../commons ./
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/
11 changes: 7 additions & 4 deletions src/pipelines/tcc-c.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "globals.hpp"
#include "ui-frame.hpp"
#include "ui.hpp"
#include "utils/paths.hpp"
#include <cstddef>

#include <iostream>
Expand Down Expand Up @@ -45,8 +47,9 @@ std::shared_ptr<tcc> 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");
Expand Down Expand Up @@ -118,14 +121,14 @@ std::shared_ptr<tcc> tcc_c_pipeline(bool is_runtime, vs::ui_base* obj, const cha

if(compact){
script->compile_str_embedded(
"#include <vs.h>\n#include <stub.h>\n#file embedded \nint callback(){\n#line 0\n", //TODO: Add custom header if linked with an external thing
"#include <vs.h>\n#include <stub.h>\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 <vs.h>\n#include <stub.h>\n#file embedded \n#line 0\n", //TODO: Add custom header if linked with an external thing
"#include <vs.h>\n#include <stub.h>\n//#file embedded \n#line 0\n", //TODO: Add custom header if linked with an external thing
src,
""
);
Expand Down

0 comments on commit 456eaeb

Please sign in to comment.