diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aa318d75..330142b5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,16 +1,25 @@ FROM ubuntu:24.10 +RUN userdel -f -r ubuntu + RUN apt-get update && apt-get install -y \ bash-completion \ build-essential \ clang-format \ clangd \ cmake \ + lldb \ ninja-build \ + pipx \ python3-pip \ python3-venv \ + valgrind \ wget RUN wget -nd -P /tmp/ https://github.com/watchexec/watchexec/releases/download/v2.2.0/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb \ && dpkg -i /tmp/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb \ && rm -f /tmp/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb + +RUN wget -nd -P /tmp/ https://github.com/bytecodealliance/wasmtime/releases/download/v25.0.2/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz \ + && tar -C /usr/local/bin -xvf /tmp/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz --strip-components=1 --wildcards 'wasmtime-*-linux/wasmtime' \ + && rm -f /tmp/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5df0c2dc..1792cf60 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,31 +7,40 @@ "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], - "hostRequirements": { - "cpus": 4 - }, - - "remoteUser": "vscode", + "postCreateCommand": "./scripts/devcontainer-post-create.sh", - "postCreateCommand": "npm ci", + "containerUser": "vscode", "features": { - "ghcr.io/devcontainers/features/common-utils": {}, - "ghcr.io/devcontainers/features/github-cli": "latest", - "ghcr.io/devcontainers/features/node": "latest" + "ghcr.io/devcontainers/features/common-utils:2": { + "configureZshAsDefaultShell": false, + "installOhMyZsh": false, + "installOhMyZshConfig": false, + "installZsh": false, + "nonFreePackages": false, + "upgradePackages": true, + "userUid": "1000", + "userGid": "1000" + }, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/node:1": { + "version": "latest" + }, + "./features/emscripten": {}, + "./features/wasi-sdk": {} }, "customizations": { "vscode": { "extensions": [ "llvm-vs-code-extensions.vscode-clangd", - "llvm-vs-code-extensions.lldb-dap" + "llvm-vs-code-extensions.lldb-dap", + "twxs.cmake", + "ms-vscode.cmake-tools", + "esbenp.prettier-vscode" ], "settings": { - "clangd.arguments": [ - "--compile-commands-dir=build", - "--completion-style=bundled" - ] + "clangd.arguments": ["--completion-style=bundled"] } } } diff --git a/.devcontainer/emscripten_dev/Dockerfile b/.devcontainer/emscripten_dev/Dockerfile deleted file mode 100644 index a2d07cee..00000000 --- a/.devcontainer/emscripten_dev/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM emscripten/emsdk:3.1.69 - -RUN wget -nd -P /tmp/ https://github.com/watchexec/watchexec/releases/download/v1.23.0/watchexec-1.23.0-x86_64-unknown-linux-gnu.deb \ - && dpkg -i /tmp/watchexec-1.23.0-x86_64-unknown-linux-gnu.deb \ - && rm -f /tmp/watchexec-1.23.0-x86_64-unknown-linux-gnu.deb - -RUN apt-get update && apt-get install -y \ - bash-completion \ - ninja-build \ - wget \ - unzip - -RUN echo emscripten ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/emscripten && \ - chmod 0440 /etc/sudoers.d/emscripten - -RUN wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-10.zip && \ - unzip Linux.flatc.binary.g++-10.zip && \ - mv flatc /usr/bin/flatc && \ - rm Linux.flatc.binary.g++-10.zip - -USER emscripten - -RUN wget -q -O - https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash && \ - . /home/emscripten/.nvm/nvm.sh && \ - nvm install node && \ - nvm use node diff --git a/.devcontainer/emscripten_dev/devcontainer.json b/.devcontainer/emscripten_dev/devcontainer.json deleted file mode 100644 index aad1267d..00000000 --- a/.devcontainer/emscripten_dev/devcontainer.json +++ /dev/null @@ -1,45 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -{ - "name": "Emscripten", - - "build": { - "dockerfile": "Dockerfile" - }, - - "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], - - "remoteUser": "emscripten", - - "postCreateCommand": "sudo g++ tools/kwgen/kwgen.cc -o /usr/bin/kwgen -std=c++20", - - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", - "esbenp.prettier-vscode", - "dbaeumer.vscode-eslint" - ], - "settings": { - "cmake.configureArgs": [ - "-DCMAKE_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake", - "-DFLATBUFFERS_FLATC_EXECUTABLE=/usr/bin/flatc", - "-DCMAKE_BUILD_TYPE=MinSizeRel", - "-DKWGEN_EXECUTABLE=/usr/bin/kwgen" - ], - "cmake.buildDirectory": "${workspaceFolder}/build.em", - "C_Cpp.default.compilerPath": "/emsdk/upstream/emscripten/emcc", - "C_Cpp.default.cStandard": "c17", - "C_Cpp.default.cppStandard": "c++20", - "C_Cpp.default.defines": ["__EMSCRIPTEN__=1"], - "C_Cpp.default.systemIncludePath": [ - "/emsdk/upstream/emscripten/cache/sysroot/include/fakesdl", - "/emsdk/upstream/emscripten/cache/sysroot/include/compat", - "/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1", - "/emsdk/upstream/lib/clang/17/include", - "/emsdk/upstream/emscripten/cache/sysroot/include" - ] - } - } - } -} diff --git a/.devcontainer/features/emscripten/devcontainer-feature.json b/.devcontainer/features/emscripten/devcontainer-feature.json new file mode 100644 index 00000000..cfecb378 --- /dev/null +++ b/.devcontainer/features/emscripten/devcontainer-feature.json @@ -0,0 +1,11 @@ +{ + "id": "emscripten", + "version": "1.0.0", + "name": "Emscripten", + "dependsOn": { + "ghcr.io/devcontainers/features/common-utils": {} + }, + "containerEnv": { + "EMSCRIPTEN_ROOT": "/opt/emsdk/upstream/emscripten" + } +} diff --git a/.devcontainer/features/emscripten/install.sh b/.devcontainer/features/emscripten/install.sh new file mode 100755 index 00000000..b0eaf004 --- /dev/null +++ b/.devcontainer/features/emscripten/install.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +git clone --depth 1 http://github.com/emscripten-core/emsdk.git /opt/emsdk +cd /opt/emsdk +./emsdk install latest +./emsdk activate latest diff --git a/.devcontainer/features/wasi-sdk/devcontainer-feature.json b/.devcontainer/features/wasi-sdk/devcontainer-feature.json new file mode 100644 index 00000000..07977b1e --- /dev/null +++ b/.devcontainer/features/wasi-sdk/devcontainer-feature.json @@ -0,0 +1,11 @@ +{ + "id": "wasi-sdk", + "version": "1.0.0", + "name": "Wasi SDK", + "dependsOn": { + "ghcr.io/devcontainers/features/common-utils": {} + }, + "containerEnv": { + "WASI_SDK_ROOT": "/opt/wasi-sdk" + } +} diff --git a/.devcontainer/features/wasi-sdk/install.sh b/.devcontainer/features/wasi-sdk/install.sh new file mode 100755 index 00000000..9e8ac303 --- /dev/null +++ b/.devcontainer/features/wasi-sdk/install.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +arch=$(uname -m) + +if [ "$arch" == "aarch64" ]; then + arch="arm64" +fi + +wget -nd -P /tmp/ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-${arch}-linux.deb + +dpkg -i /tmp/wasi-sdk-24.0-${arch}-linux.deb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d67baa09..52906266 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: runs-on: ubuntu-24.04 env: - WASMTIME_VERSION: 20.0.2 + WASMTIME_VERSION: 25.0.2 steps: - uses: actions/checkout@v4 @@ -181,12 +181,12 @@ jobs: - name: Install wasmtime run: | - wget https://github.com/bytecodealliance/wasmtime/releases/download/v${{ env.WASMTIME_VERSION }}/wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux.tar.xz - tar Jxvf wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux.tar.xz -C ~/ + wget -nd -P /tmp/ https://github.com/bytecodealliance/wasmtime/releases/download/v${{ env.WASMTIME_VERSION }}/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz + tar -C /usr/local/bin -xvf /tmp/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz --strip-components=1 --wildcards 'wasmtime-*-linux/wasmtime' - name: Test run: | - ~/wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux/wasmtime \ + wasmtime \ --dir ${{github.workspace}}/build.wasi/install::/ \ --dir tests::tests \ ${{github.workspace}}/build.wasi/install/usr/bin/cxx.wasm -v tests/manual/source.cc diff --git a/.gitignore b/.gitignore index 9ecc3f4d..35ea4ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ node_modules *.tgz .vscode/launch.json .cache +.clangd +*.pch diff --git a/CMakeLists.txt b/CMakeLists.txt index f8134969..b8ad9a7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ endif() include(FetchContent) include(GNUInstallDirs) include(CMakePackageConfigHelpers) +include(ExternalProject) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/package.json" package_json) @@ -54,17 +55,13 @@ endif() FetchContent_Declare( utfcpp - GIT_REPOSITORY https://github.com/nemtrif/utfcpp - GIT_TAG v4.0.5 - GIT_SHALLOW 1 + URL https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.5.tar.gz + PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patches/utfcpp.patch ) -FetchContent_Populate(utfcpp) +FetchContent_MakeAvailable(utfcpp) FetchContent_GetProperties(utfcpp) -add_library(utf8cpp::utf8cpp INTERFACE IMPORTED) -set_target_properties(utf8cpp::utf8cpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${utfcpp_SOURCE_DIR}/source") - FetchContent_Declare( wasi_sysroot URL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sysroot-22.0.tar.gz @@ -96,7 +93,26 @@ if (CXX_ENABLE_FLATBUFFERS) set_target_properties(flatbuffers::header-only PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${flatbuffers_SOURCE_DIR}/include") endif() -add_subdirectory(tools/kwgen) +if (NOT KWGEN_EXECUTABLE AND CMAKE_SYSTEM_NAME STREQUAL "WASI") + + ExternalProject_Add( + kwgen_host + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/kwgen + INSTALL_COMMAND "" + ) + + ExternalProject_Get_property(kwgen_host BINARY_DIR) + + add_executable(kwgen IMPORTED) + set_target_properties(kwgen PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/kwgen") + add_dependencies(kwgen kwgen_host) + +else() + + add_subdirectory(tools/kwgen) + +endif() + add_subdirectory(src) if (CXX_BUILD_TESTS) @@ -128,3 +144,15 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cxxConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cxx ) + +set(CLANGD_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/clangd.in") + +if (EMSCRIPTEN) + set(CLANGD_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/clangd_emscripten.in") +endif() + +configure_file( + ${CLANGD_CONFIG_FILE} + ${CMAKE_CURRENT_SOURCE_DIR}/.clangd + @ONLY +) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..f4de3fe0 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,171 @@ +{ + "version": 9, + "configurePresets": [ + { + "name": "default", + "displayName": "default", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install", + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "YES", + "CXX_INSTALL_WASI_SYSROOT": "YES" + } + }, + { + "inherits": "default", + "name": "debug", + "displayName": "debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "NO" + } + }, + { + "name": "emscripten", + "displayName": "emscripten", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build.em", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", + "CMAKE_TOOLCHAIN_FILE": "$env{EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake", + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build.em/install/usr", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "YES", + "CXX_ENABLE_FLATBUFFERS": "NO", + "CXX_INSTALL_WASI_SYSROOT": "YES" + }, + "condition": { + "type": "notEquals", + "lhs": "$env{EMSCRIPTEN_ROOT}", + "rhs": "" + } + }, + { + "name": "wasi", + "displayName": "wasi", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build.wasi", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", + "CMAKE_TOOLCHAIN_FILE": "$env{WASI_SDK_ROOT}/share/cmake/wasi-sdk.cmake", + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build.wasi/install/usr", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "YES", + "CXX_ENABLE_FLATBUFFERS": "NO", + "CXX_INSTALL_WASI_SYSROOT": "YES" + }, + "condition": { + "type": "notEquals", + "lhs": "$env{WASI_SDK_ROOT}", + "rhs": "" + } + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "debug", + "configurePreset": "default" + }, + { + "name": "install", + "configurePreset": "default", + "targets": ["install"] + }, + { + "name": "build-emscripten", + "configurePreset": "emscripten" + }, + { + "name": "install-emscripten", + "configurePreset": "emscripten", + "targets": ["install"] + }, + { + "name": "build-wasi", + "configurePreset": "wasi" + }, + { + "name": "install-wasi", + "configurePreset": "wasi", + "targets": ["install"] + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "debug", + "configurePreset": "debug" + }, + { + "name": "emscripten", + "configurePreset": "emscripten" + }, + { + "name": "wasi", + "configurePreset": "wasi" + } + ], + "workflowPresets": [ + { + "name": "default", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + }, + { + "type": "test", + "name": "default" + }, + { + "type": "build", + "name": "install" + } + ] + }, + { + "name": "emscripten", + "steps": [ + { + "type": "configure", + "name": "emscripten" + }, + { + "type": "build", + "name": "build-emscripten" + }, + { + "type": "build", + "name": "install-emscripten" + } + ] + }, + { + "name": "wasi", + "steps": [ + { + "type": "configure", + "name": "wasi" + }, + { + "type": "build", + "name": "install-wasi" + } + ] + } + ] +} diff --git a/Dockerfile.wasi b/Dockerfile.wasi index 011416d1..a4ce21cf 100644 --- a/Dockerfile.wasi +++ b/Dockerfile.wasi @@ -1,14 +1,16 @@ -FROM ghcr.io/webassembly/wasi-sdk:wasi-sdk-22 as wasi +FROM ghcr.io/webassembly/wasi-sdk:wasi-sdk-24 as wasi RUN apt-get update && apt-get install -y \ + g++ \ git \ binaryen \ wget \ - unzip + unzip \ + ninja-build COPY tools/kwgen/kwgen.cc /tmp/kwgen.cc -RUN $CXX -std=c++20 /tmp/kwgen.cc -o /usr/bin/kwgen +RUN g++ -std=c++20 /tmp/kwgen.cc -o /usr/bin/kwgen RUN wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.clang++-15.zip && \ unzip Linux.flatc.binary.clang++-15.zip && \ diff --git a/clangd.in b/clangd.in new file mode 100644 index 00000000..e95990a8 --- /dev/null +++ b/clangd.in @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: build/ diff --git a/clangd_emscripten.in b/clangd_emscripten.in new file mode 100644 index 00000000..265c182c --- /dev/null +++ b/clangd_emscripten.in @@ -0,0 +1,14 @@ +CompileFlags: + CompilationDatabase: build.em/ + Add: + [ + -target, + wasm32-unknown-emscripten, + -fvisibility=default, + -isysroot, + @EMSCRIPTEN_ROOT_PATH@/cache/sysroot, + -iwithsysroot/include/fakesdl, + -iwithsysroot/include/compat, + -iwithsysroot/include/c++/v1, + -iwithsysroot/include, + ] diff --git a/packages/cxx-frontend/scripts/build.js b/packages/cxx-frontend/scripts/build.js index 25cb297d..20cdc9fe 100644 --- a/packages/cxx-frontend/scripts/build.js +++ b/packages/cxx-frontend/scripts/build.js @@ -42,8 +42,12 @@ build().catch(console.error); async function build() { const sdk = await detectEmsdk(); - if (argv.docker === true || !sdk) { + if ($.env.EMSCRIPTEN_ROOT) { + await emsdkBuildPresets(); + } else if (argv.docker === true || !sdk) { await dockerBuild(); + } else if ($.env.EMSCRIPTEN_ROOT) { + await emsdkBuildPresets(); } else { await emsdkBuild(sdk); } @@ -139,6 +143,14 @@ async function emsdkBuild({ cmake, emcmake, flatc, kwgen }) { await $`${cmake} --build ${projectRootSourcePath}/build.em --target install`; } +async function emsdkBuildPresets() { + const cmake = await which("cmake", { nothrow: true }); + + await $`${cmake} -S ${projectRootSourcePath} --preset emscripten`; + + await $`${cmake} --build ${projectRootSourcePath}/build.em --target install`; +} + async function detectEmsdk() { const cmake = await which("cmake", { nothrow: true }); if (!cmake) return null; diff --git a/patches/utfcpp.patch b/patches/utfcpp.patch new file mode 100644 index 00000000..11be0868 --- /dev/null +++ b/patches/utfcpp.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f24f9b6..0ad6e6f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,15 +7,19 @@ project (utf8cpp + LANGUAGES CXX + DESCRIPTION "C++ portable library for working with utf-8 encoding") + +-add_library(${PROJECT_NAME} INTERFACE) ++option(UTFCPP_INSTALL "Generate the install target" OFF) + +-include(GNUInstallDirs) ++add_library(${PROJECT_NAME} INTERFACE) + + target_include_directories(utf8cpp INTERFACE + "$" + $ + ) + ++if (UTFCPP_INSTALL) ++ ++include(GNUInstallDirs) ++ + include(CMakePackageConfigHelpers) + write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" +@@ -51,3 +55,6 @@ install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + install(FILES ${PROJECT_SOURCE_DIR}/source/utf8.h DESTINATION include/utf8cpp) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/source/utf8 DESTINATION + include/utf8cpp) ++ ++endif() ++ diff --git a/scripts/ast-dump.mjs b/scripts/ast-dump.mjs index afdf3da8..3a1815ef 100755 --- a/scripts/ast-dump.mjs +++ b/scripts/ast-dump.mjs @@ -45,13 +45,13 @@ const astFile = path.join(astOutputDir, path.basename(sourceFile) + ".ast"); // Path to the AST dump baseline file const baselineAstFile = path.join( astOutputDir, - path.basename(sourceFile) + ".ast.base" + path.basename(sourceFile) + ".ast.base", ); async function main() { // Create the ast output directory if it doesn't exist await spinner("Setting up...", () => - fs.mkdir(astOutputDir, { recursive: true }) + fs.mkdir(astOutputDir, { recursive: true }), ); // Build the project @@ -63,7 +63,7 @@ async function main() { // Run the AST dump await spinner( "Create AST", - () => $`${cxx} -ast-dump ${sourceFile} > ${astFile}` + () => $`${cxx} -ast-dump ${sourceFile} > ${astFile}`, ); const hasBaseline = await fs.exists(baselineAstFile); diff --git a/scripts/build-wasi.mjs b/scripts/build-wasi.mjs index 9f5b60ab..829a9b6d 100755 --- a/scripts/build-wasi.mjs +++ b/scripts/build-wasi.mjs @@ -58,7 +58,7 @@ const cmakeConfigureOpts = [ "-B", "build.wasi", "-DCMAKE_INSTALL_PREFIX=build.wasi/install/usr", - "-DCMAKE_TOOLCHAIN_FILE=/usr/share/cmake/wasi-sdk.cmake", + "-DCMAKE_TOOLCHAIN_FILE=/opt/wasi-sdk/share/cmake/wasi-sdk.cmake", `-DCMAKE_BUILD_TYPE=${argv.debug ? "Debug" : "Release"}`, `-DCXX_INTERPROCEDURAL_OPTIMIZATION=${argv.debug ? "OFF" : "ON"}`, "-DKWGEN_EXECUTABLE=/usr/bin/kwgen", diff --git a/scripts/cxx-wasmtime.mjs b/scripts/cxx-wasmtime.mjs index fb119e82..306e4e2c 100755 --- a/scripts/cxx-wasmtime.mjs +++ b/scripts/cxx-wasmtime.mjs @@ -35,7 +35,7 @@ const cxxArgs = [ try { const result = await $`${wasmtime} ${cxxArgs} ${process.argv.slice( - 3 + 3, )}`.quiet(); echo`${result}`; diff --git a/scripts/devcontainer-post-create.sh b/scripts/devcontainer-post-create.sh new file mode 100755 index 00000000..922d4586 --- /dev/null +++ b/scripts/devcontainer-post-create.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +npm ci + +pipx install lit==18.1.8 +pipx install filecheck==0.0.24 diff --git a/scripts/setup-venv.mjs b/scripts/setup-venv.mjs index 46eac98b..f6892c34 100755 --- a/scripts/setup-venv.mjs +++ b/scripts/setup-venv.mjs @@ -30,7 +30,7 @@ const pip = path.join(venvPath, "bin/pip"); const requirements = path.join( workspacePath, - "tests/unit_tests/requirements.txt" + "tests/unit_tests/requirements.txt", ); await spinner("Setting up virtual environment", async () => { diff --git a/scripts/update-predefined-macros.mjs b/scripts/update-predefined-macros.mjs index 4facc31e..a501900d 100755 --- a/scripts/update-predefined-macros.mjs +++ b/scripts/update-predefined-macros.mjs @@ -29,7 +29,7 @@ async function main() { const std = argv.std ?? "c++20"; const predefinedMacros = String( - await $`${gcc} -E -dM -x c++ -std=${std} - < /dev/null`.quiet() + await $`${gcc} -E -dM -x c++ -std=${std} - < /dev/null`.quiet(), ); const out = []; diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index f3b12f50..7921b24a 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -41,7 +41,7 @@ if (EMSCRIPTEN) endif() target_link_libraries(cxx-parser - PUBLIC $ + PUBLIC $ ) add_custom_command(OUTPUT keywords-priv.h diff --git a/tests/api_tests/CMakeLists.txt b/tests/api_tests/CMakeLists.txt index 84d956f0..39d003c6 100644 --- a/tests/api_tests/CMakeLists.txt +++ b/tests/api_tests/CMakeLists.txt @@ -9,7 +9,7 @@ set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) FetchContent_Declare( googletest - URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz + URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz ) FetchContent_MakeAvailable(googletest) diff --git a/tests/unit_tests/requirements.txt b/tests/unit_tests/requirements.txt index 04aecd5e..36cfdee1 100644 --- a/tests/unit_tests/requirements.txt +++ b/tests/unit_tests/requirements.txt @@ -1,2 +1,2 @@ -lit==17.0.6 +lit==18.1.8 filecheck==0.0.24