diff --git a/.github/workflows/fatman.yml b/.github/workflows/fatman.yml new file mode 100644 index 0000000000..b7c7a0723d --- /dev/null +++ b/.github/workflows/fatman.yml @@ -0,0 +1,72 @@ +# The fat man: clones every external module into modules/ and builds ONE daslang host +# with all of them statically linked (the superbuild half of the externals' both-worlds +# CMakeLists — the half no other CI exercises; each module's own CI covers the +# standalone .shared_module half). Runs examples/fatman/main.das, which requires every +# external module: registration + boost-path resolution + the static link, no window, +# no GPU. Also the compile-time ABI canary for daslang-vs-externals drift. +name: fatman + +on: + pull_request: + paths: + - 'CMakeLists.txt' + - 'web/CMakeLists.txt' + - 'examples/fatman/**' + - '.github/workflows/fatman.yml' + - 'include/**' + - 'src/**' + workflow_dispatch: + +concurrency: + group: fatman-${{ github.ref }} + cancel-in-progress: true + +jobs: + fatman: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: "Install CMake and Ninja" + uses: lukka/get-cmake@latest + + - name: "Install: Required Dev Packages" + run: | + set -eux + sudo apt-get update -y + sudo apt-get install --no-install-recommends -y \ + libatomic-ops-dev \ + libglu1-mesa-dev \ + mesa-common-dev \ + libx11-dev \ + libxrandr-dev \ + libxcursor-dev \ + libxinerama-dev \ + libxi-dev + + - name: "Clone external modules into modules/ (master; no .daspkg_standalone marker => the modules glob includes their both-worlds CMakeLists)" + run: | + set -eux + git clone --depth 1 --recurse-submodules https://github.com/borisbat/dasImgui.git modules/dasImgui + git clone --depth 1 --recurse-submodules https://github.com/borisbat/dasImguiImplot.git modules/dasImguiImplot + git clone --depth 1 --recurse-submodules https://github.com/borisbat/dasImguiNodeEditor.git modules/dasImguiNodeEditor + git clone --depth 1 --recurse-submodules https://github.com/borisbat/dasVulkan.git modules/dasVulkan + + - name: "Configure (externals absorbed by the modules glob)" + run: | + set -eux + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DDAS_GLFW_DISABLED=OFF + + - name: "Build the fat host (daslang_static — the flavor that links the static module halves; the DLL-flavor daslang gets externals via .shared_module at runtime instead)" + run: | + set -eux + cmake --build build --target daslang_static -j $(nproc) + + - name: "Run the fat man" + run: | + set -eux + ./bin/daslang_static examples/fatman/main.das diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d22efbbb..e010f74d0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -612,9 +612,12 @@ IF(EMSCRIPTEN AND DAS_WEB_IMGUI_DIR) ADD_MODULE_DAS(imgui imgui ${_n}) ENDIF() ENDFOREACH() - # imgui_boost_v2: module name differs from its file (widgets/imgui_boost.das). The - # web embed mounts that file as imgui_boost_v2.das so this resolves. - ADD_MODULE_DAS(imgui imgui imgui_boost_v2) + # Pre-rename dasImgui kept module imgui_boost_v2 in widgets/imgui_boost.das (the web + # embed mounts it under the module name); post-rename (dasImgui #218) the glob above + # already registered it. Tolerate both layouts. + IF(NOT EXISTS "${DAS_WEB_IMGUI_DIR}/widgets/imgui_boost_v2.das") + ADD_MODULE_DAS(imgui imgui imgui_boost_v2) + ENDIF() UNSET(_module) # C++ binding modules: register_Module_dasIMGUI / _imgui_app / _imgui_app_headless, # pulled from the prebuilt wasm32 archives linked in web/CMakeLists.txt. diff --git a/examples/fatman/main.das b/examples/fatman/main.das new file mode 100644 index 0000000000..d52d8459f0 --- /dev/null +++ b/examples/fatman/main.das @@ -0,0 +1,31 @@ +options gen2 +options indenting = 4 + +// The fat man: statically links every external module into one host and requires them +// all. Exists purely to CI-gate the superbuild (static-embed) half of the external +// modules' both-worlds CMakeLists — the standalone .shared_module half each module's +// own CI covers. Build recipe: clone the externals into modules/ of a daslang checkout +// (no .daspkg_standalone marker), configure + build the daslang target, run this file. +// A `require` proves registration + boost-path resolution + the static link; nothing +// here opens a window or touches a GPU, so it runs on any CI runner. + +// C++ binding modules (require-to-link is the whole test, hence the nolints) +require imgui // nolint:STYLE030 +require imgui_app // nolint:STYLE030 +require imgui_app_headless // nolint:STYLE030 +require implot // nolint:STYLE030 +require imgui_node_editor // nolint:STYLE030 +require vulkan // nolint:STYLE030 + +// one boost path per external — proves the ADD_MODULE_DAS registrations resolve +require imgui/imgui_boost_v2 +require imgui/imgui_theme_daslang // nolint:STYLE030 +require imgui/imgui_implot_boost_v2 +require imgui/imgui_node_editor_boost_v2 +require vulkan/vulkan_boost // nolint:STYLE030 +require vulkan/spirv_vulkan_shader + +[export] +def main { + print("the fat man stands: imgui + imgui_app(+headless) + implot + node_editor + vulkan all statically linked\n") +} diff --git a/include/daScript/simulate/aot.h b/include/daScript/simulate/aot.h index ce2624e32d..c55357c17c 100644 --- a/include/daScript/simulate/aot.h +++ b/include/daScript/simulate/aot.h @@ -3079,7 +3079,7 @@ namespace das { template __forceinline void das_vector_push ( TT & vec, const QQ & value, int32_t at, Context * context ) { - if ( uint32_t(at)>vec.size() ) { + if ( uint32_t(at)>uint32_t(vec.size()) ) { // both sides cast: ImVector::size() is int, std::vector's is size_t context->throw_error_ex("insert index out of range, %i of %u", at, uint32_t(vec.size())); } (void)value; @@ -3089,7 +3089,7 @@ namespace das { template __forceinline void das_vector_push_value ( TT & vec, QQ value, int32_t at, Context * context ) { - if ( uint32_t(at)>vec.size() ) { + if ( uint32_t(at)>uint32_t(vec.size()) ) { // both sides cast: ImVector::size() is int, std::vector's is size_t context->throw_error_ex("insert index out of range, %i of %u", at, uint32_t(vec.size())); } (void)value; @@ -3099,7 +3099,7 @@ namespace das { template __forceinline void das_vector_push_empty ( TT & vec, int32_t at, Context * context ) { - if ( uint32_t(at)>vec.size() ) { + if ( uint32_t(at)>uint32_t(vec.size()) ) { // both sides cast: ImVector::size() is int, std::vector's is size_t context->throw_error_ex("insert index out of range, %i of %u", at, uint32_t(vec.size())); } if constexpr (das::is_stub_type::value) { DAS_ASSERTF(false, "STUB!"); } @@ -3159,7 +3159,7 @@ namespace das { template __forceinline void das_vector_erase ( TT & vec, int32_t index, Context * context ) { - if ( uint32_t(index)>vec.size() ) { + if ( uint32_t(index)>uint32_t(vec.size()) ) { // both sides cast: ImVector::size() is int, std::vector's is size_t context->throw_error_ex("erasing vector index out of range %i of %i", index, int32_t(vec.size())); } if constexpr (das::is_stub_type::value) { DAS_ASSERTF(false, "STUB!"); } diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index 7c9bbfd9e6..5d0e230241 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -165,9 +165,12 @@ add_link_options("SHELL:--embed-file ${CMAKE_CURRENT_SOURCE_DIR}/../modules/dasA IF(DAS_WEB_IMGUI_DIR) MESSAGE(STATUS "web: embedding dasImgui (${DAS_WEB_IMGUI_DIR}) into daslang_static") add_link_options("SHELL:--embed-file ${DAS_WEB_IMGUI_DIR}/widgets@modules/dasImgui/imgui") - # module imgui_boost_v2 lives in the file widgets/imgui_boost.das; the NATIVE_MODULE - # resolver maps require imgui/imgui_boost_v2 -> imgui_boost_v2.das, so mount it there too. - add_link_options("SHELL:--embed-file ${DAS_WEB_IMGUI_DIR}/widgets/imgui_boost.das@modules/dasImgui/imgui/imgui_boost_v2.das") + # Pre-rename dasImgui kept module imgui_boost_v2 in the file widgets/imgui_boost.das; + # post-rename (dasImgui #218) the file carries the module's own name and the widgets/ + # embed above already covers it. Tolerate both layouts. + IF(NOT EXISTS "${DAS_WEB_IMGUI_DIR}/widgets/imgui_boost_v2.das") + add_link_options("SHELL:--embed-file ${DAS_WEB_IMGUI_DIR}/widgets/imgui_boost.das@modules/dasImgui/imgui/imgui_boost_v2.das") + ENDIF() add_link_options("SHELL:--embed-file ${DAS_WEB_IMGUI_DIR}/font/JetBrainsMono-Regular.ttf@modules/dasImgui/font/JetBrainsMono-Regular.ttf") add_link_options("SHELL:--embed-file ${CMAKE_CURRENT_SOURCE_DIR}/../modules/dasLiveHost/live@modules/dasLiveHost/live") ENDIF()