diff --git a/CMakeLists.txt b/CMakeLists.txt index aff2843..c13ff63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.13.4) project(WASM2BRS VERSION 1.0.0) +# Require C++11 standard for the project +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + add_subdirectory(third_party/wabt) add_subdirectory(third_party/binaryen) diff --git a/README.md b/README.md index db8575a..d50f0d3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,17 @@ git submodule update --init --recursive To run `make` without the Docker image (not recommended) be sure to install the same dependencies as listed in the `Dockerfile`. +## Build Requirements +- C++11 compatible compiler +- CMake 3.13.4 or higher +- If building manually, set the C++11 standard explicitly: + ```bash + mkdir -p build/wasm2brs + cd build/wasm2brs + cmake ../.. -DCMAKE_CXX_FLAGS="-std=c++11" + make -j + ``` + # Running the samples ```bash ./run.sh make doom diff --git a/docker/Dockerfile b/docker/Dockerfile index 6e4c1b9..9ea80d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -28,10 +28,10 @@ ENV WASMER_DIR="/home/user/.wasmer" ENV WASMER_CACHE_DIR="/home/user/.wasmer/cache" ENV PATH="/home/user/.wasmer/bin:/home/user/.wasienv/bin/:${PATH}:/home/user/.wasmer/globals/wapm_packages/.bin" -RUN curl -sSf https://sh.rustup.rs | bash -s -- -y +RUN curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain=1.81.0 ENV PATH="/home/user/.cargo/bin:${PATH}" RUN rustup target add wasm32-wasi -RUN cargo install cargo-wasi +RUN cargo install --locked cargo-wasi ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD echo "No command specified" diff --git a/src/wasm2brs.cc b/src/wasm2brs.cc index 7c268f7..9a3e680 100644 --- a/src/wasm2brs.cc +++ b/src/wasm2brs.cc @@ -124,7 +124,7 @@ int ProgramMain(int argc, char** argv) { result = ParseWatModule(lexer.get(), &module, &errors, &options); } else { location_type = Location::Type::Binary; - module = std::make_unique(); + module = MakeUnique(); const bool kStopOnFirstError = true; const bool kFailOnCustomSectionError = true; ReadBinaryOptions options(s_features, s_log_stream.get(),