summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--CMakeLists.txt9
-rw-r--r--README.md4
-rwxr-xr-xcheck.py13
4 files changed, 21 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9bb9cb9f..240598c6e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@ full changeset diff at the end of each section.
Current Trunk
-------------
+- Add BUILD_TESTS CMake option to make gtest dependency optional.
+
v106
----
@@ -63,7 +65,7 @@ v102
- Replace `BinaryenExpressionGetSideEffects`'s features parameter with a module
parameter.
-
+
- OptimizeInstructions now lifts identical code in `select`/`if` arms (#3828). This may cause direct `BinaryenTupleExtract(BinaryenTupleMake(...))` to [use multivalue types](https://github.com/grain-lang/grain/pull/1158).
v101
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7eae4d3c6..36d68ec6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,9 @@ endif()
# more useful error reports from users.
option(BYN_ENABLE_ASSERTIONS "Enable assertions" ON)
+# Turn this off to avoid the dependency on gtest.
+option(BUILD_TESTS "Build GTest-based tests" ON)
+
# For git users, attempt to generate a more useful version string
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
find_package(Git QUIET REQUIRED)
@@ -320,8 +323,10 @@ add_subdirectory(third_party)
# Configure lit tests
add_subdirectory(test/lit)
-# Configure GTest unit tests
-add_subdirectory(test/gtest)
+if(BUILD_TESTS)
+ # Configure GTest unit tests
+ add_subdirectory(test/gtest)
+endif()
# Object files
set(binaryen_objs
diff --git a/README.md b/README.md
index a0fdeabfc..4390283c7 100644
--- a/README.md
+++ b/README.md
@@ -318,7 +318,9 @@ After that you can build with CMake:
cmake . && make
```
-A C++14 compiler is required. Note that you can also use `ninja` as your generator: `cmake -G Ninja . && ninja`.
+A C++17 compiler is required. Note that you can also use `ninja` as your generator: `cmake -G Ninja . && ninja`.
+
+To avoid the gtest dependency, you can pass `-DBUILD_TESTS=OFF` to cmake.
Binaryen.js can be built using Emscripten, which can be installed via [the SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)).
diff --git a/check.py b/check.py
index c3233b8f7..9ec638f10 100755
--- a/check.py
+++ b/check.py
@@ -343,11 +343,14 @@ def run_lit():
def run_gtest():
def run():
gtest = os.path.join(shared.options.binaryen_bin, 'binaryen-unittests')
- result = subprocess.run(gtest)
- if result.returncode != 0:
- shared.num_failures += 1
- if shared.options.abort_on_first_failure and shared.num_failures:
- raise Exception("gtest test failed")
+ if not os.path.isfile(gtest):
+ shared.warn('gtest binary not found - skipping tests')
+ else:
+ result = subprocess.run(gtest)
+ if result.returncode != 0:
+ shared.num_failures += 1
+ if shared.options.abort_on_first_failure and shared.num_failures:
+ raise Exception("gtest test failed")
shared.with_pass_debug(run)