summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-05-24 11:25:12 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-05-24 11:26:00 +0200
commitfe5915be878e5076693334b9cb5e5092149d7e12 (patch)
treef98dcee864d25bb657c2cdf8e1c106bb0f8f8a39
parent4067a61c80b90e656f129f34f4479fa0c7262b91 (diff)
downloadqtlocation-mapboxgl-upstream/fix-with-nodejs-off.tar.gz
[build] disable parts of the build that require node when WITH_NODEJS=OFF is setupstream/fix-with-nodejs-off
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/test.cmake5
-rw-r--r--test/src/mbgl/test/util.cpp6
-rw-r--r--test/src/mbgl/test/util.hpp20
4 files changed, 18 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46aea73356..c2f7134de7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,7 +166,7 @@ if(COMMAND mbgl_platform_offline)
include(cmake/offline.cmake)
endif()
-if(COMMAND mbgl_platform_node)
+if(WITH_NODEJS AND COMMAND mbgl_platform_node)
include(cmake/node.cmake)
endif()
diff --git a/cmake/test.cmake b/cmake/test.cmake
index 183263c5a9..d6a2565979 100644
--- a/cmake/test.cmake
+++ b/cmake/test.cmake
@@ -8,6 +8,11 @@ else()
)
endif()
+
+if(NOT WITH_NODEJS)
+ target_compile_definitions(mbgl-test PRIVATE "-DTEST_HAS_SERVER=0")
+endif()
+
set_source_files_properties(test/src/mbgl/test/util.cpp PROPERTIES COMPILE_FLAGS -DNODE_EXECUTABLE="${NodeJS_EXECUTABLE}")
target_include_directories(mbgl-test
diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp
index 028a0a9d51..30eea19bdf 100644
--- a/test/src/mbgl/test/util.cpp
+++ b/test/src/mbgl/test/util.cpp
@@ -11,10 +11,6 @@
#include <unistd.h>
-#ifndef NODE_EXECUTABLE
-#define NODE_EXECUTABLE node
-#endif
-
#define xstr(s) str(s)
#define str(s) #s
@@ -54,8 +50,6 @@ Server::Server(const char* script) {
const char* executable = xstr(NODE_EXECUTABLE);
- fprintf(stderr, "executable: %s\n", executable);
-
// Launch the actual server process.
int ret = execl(executable, executable, script, nullptr);
diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp
index 7a8d78897e..9f56841dcc 100644
--- a/test/src/mbgl/test/util.hpp
+++ b/test/src/mbgl/test/util.hpp
@@ -5,20 +5,24 @@
#endif
#if ANDROID
-#define TEST_READ_ONLY 0
-#define TEST_HAS_SERVER 0
+ #define TEST_READ_ONLY 0
+ #undef TEST_HAS_SERVER
+ #define TEST_HAS_SERVER 0
#elif TARGET_OS_IOS
-#define TEST_READ_ONLY 1
-#define TEST_HAS_SERVER 0
+ #define TEST_READ_ONLY 1
+ #undef TEST_HAS_SERVER
+ #define TEST_HAS_SERVER 0
#else
-#define TEST_READ_ONLY 0
-#define TEST_HAS_SERVER 1
+ #define TEST_READ_ONLY 0
+ #ifndef TEST_HAS_SERVER
+ #define TEST_HAS_SERVER 1
+ #endif
#endif
#if TARGET_OS_SIMULATOR
-#define TEST_IS_SIMULATOR 1
+ #define TEST_IS_SIMULATOR 1
#else
-#define TEST_IS_SIMULATOR 0
+ #define TEST_IS_SIMULATOR 0
#endif
#if !TEST_IS_SIMULATOR && !CI_BUILD