summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--CMakeLists.txt44
-rw-r--r--Makefile6
-rw-r--r--cmake/mason.cmake117
-rw-r--r--cmake/mbgl.cmake18
-rw-r--r--cmake/node.cmake2
-rw-r--r--platform/android/config.cmake16
-rw-r--r--platform/linux/config.cmake17
-rw-r--r--platform/macos/config.cmake5
-rw-r--r--platform/qt/config.cmake9
-rw-r--r--platform/qt/qt.cmake2
11 files changed, 64 insertions, 173 deletions
diff --git a/.travis.yml b/.travis.yml
index b36c9eefa7..0f92d58feb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,6 +46,7 @@ before_script:
script:
- make linux
- make test
+ - make run-test
after_script:
- ccache --show-stats
- ./platform/linux/scripts/after_script.sh ${TRAVIS_JOB_NUMBER} ${TRAVIS_TAG:-}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7e4e1ca59..0421ad52c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,32 +1,38 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.1)
project(mbgl LANGUAGES CXX C)
-include(cmake/npm.cmake)
-include(cmake/mason.cmake)
+
include(cmake/mbgl.cmake)
-mason_use(geometry 0.8.0)
-mason_use(variant 1.1.0)
-mason_use(unique_resource dev)
-mason_use(rapidjson 1.0.2)
-mason_use(boost 1.60.0)
-mason_use(geojsonvt 6.1.2)
-mason_use(supercluster 0.2.0)
-mason_use(kdbush 0.1.1)
-mason_use(earcut 0.11)
-mason_use(protozero 1.3.0)
-mason_use(pixelmatch 0.9.0)
+if(NOT EXISTS ".mason/mason.cmake")
+ execute_process(
+ COMMAND git submodule update --init .mason
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+endif()
+
+include(.mason/mason.cmake)
+
+include(cmake/npm.cmake)
option(WITH_CXX11ABI "Use cxx11abi mason packages" OFF)
option(WITH_COVERAGE "Enable coverage reports" OFF)
if(WITH_CXX11ABI)
- mason_use(geojson 0.1.4-cxx11abi)
- mason_use(gtest 1.7.0-cxx11abi)
-else()
- mason_use(geojson 0.1.4)
- mason_use(gtest 1.7.0)
+ set(MASON_CXXABI_SUFFIX -cxx11abi)
endif()
+mason_use(geometry VERSION 0.8.0 HEADER_ONLY)
+mason_use(variant VERSION 1.1.0 HEADER_ONLY)
+mason_use(unique_resource VERSION dev HEADER_ONLY)
+mason_use(rapidjson VERSION 1.0.2 HEADER_ONLY)
+mason_use(boost VERSION 1.60.0 HEADER_ONLY)
+mason_use(geojsonvt VERSION 6.1.2 HEADER_ONLY)
+mason_use(supercluster VERSION 0.2.0 HEADER_ONLY)
+mason_use(kdbush VERSION 0.1.1 HEADER_ONLY)
+mason_use(earcut VERSION 0.11 HEADER_ONLY)
+mason_use(protozero VERSION 1.3.0 HEADER_ONLY)
+mason_use(pixelmatch VERSION 0.9.0 HEADER_ONLY)
+mason_use(geojson VERSION 0.1.4${MASON_CXXABI_SUFFIX})
+
if(WITH_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
diff --git a/Makefile b/Makefile
index 62197bf624..d58f14ea11 100644
--- a/Makefile
+++ b/Makefile
@@ -337,8 +337,9 @@ $(QT_BUILD): $(BUILD_DEPS)
(cd $(QT_OUTPUT_PATH) && cmake -G Ninja ../../.. \
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
- -DBUILD_PLATFORM=$(BUILD_PLATFORM) \
-DMBGL_PLATFORM=qt \
+ -DMASON_PLATFORM=$(BUILD_PLATFORM) \
+ -DMASON_PLATFORM_VERSION=$(BUILD_PLATFORM_VERSION) \
-DWITH_QT_DECODERS=${WITH_QT_DECODERS} \
-DWITH_QT_4=${WITH_QT_4} \
-DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh) \
@@ -350,8 +351,9 @@ MACOS_QT_PROJ_PATH = $(QT_ROOT_PATH)/xcode/mbgl.xcodeproj
$(MACOS_QT_PROJ_PATH): $(BUILD_DEPS)
mkdir -p $(QT_ROOT_PATH)/xcode
(cd $(QT_ROOT_PATH)/xcode && cmake -G Xcode ../../.. \
- -DBUILD_PLATFORM=$(BUILD_PLATFORM) \
-DMBGL_PLATFORM=qt \
+ -DMASON_PLATFORM=$(BUILD_PLATFORM) \
+ -DMASON_PLATFORM_VERSION=$(BUILD_PLATFORM_VERSION) \
-DWITH_QT_DECODERS=${WITH_QT_DECODERS} \
-DWITH_QT_4=${WITH_QT_4} \
-DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh) \
diff --git a/cmake/mason.cmake b/cmake/mason.cmake
deleted file mode 100644
index 7954b53522..0000000000
--- a/cmake/mason.cmake
+++ /dev/null
@@ -1,117 +0,0 @@
-set(_mason_command ${CMAKE_SOURCE_DIR}/.mason/mason)
-string(RANDOM LENGTH 16 _mason_invocation)
-
-if(EXISTS "${_mason_command}")
-else()
- execute_process(
- COMMAND git submodule update --init .mason
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-function(_mason_valid_args package version)
- if(NOT package OR NOT version)
- message(FATAL_ERROR "No package name or version given")
- endif()
-endfunction()
-
-function(_mason_install package version)
- set(_mason_failed)
- execute_process(
- COMMAND ${_mason_command} install ${package} ${version}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- RESULT_VARIABLE _mason_failed)
- if(_mason_failed)
- message(FATAL_ERROR "[Mason] Could not install Mason package")
- endif()
-endfunction()
-
-function(_mason_get_flags package version)
- set(_mason_flags)
- set(_mason_failed)
- execute_process(
- COMMAND ${_mason_command} cflags ${package} ${version}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE _mason_flags
- RESULT_VARIABLE _mason_failed
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(_mason_failed)
- message(FATAL_ERROR "[Mason] Could not get flags for package ${package} ${version}")
- endif()
-
- # Extract -I and -isystem to {package}_INCLUDE_DIRS
- string(REGEX MATCHALL "(^| +)-(I|isystem) *([^ ]+)" _mason_include_dirs "${_mason_flags}")
- string(REGEX REPLACE "(^| +)-(I|isystem) *" "" _mason_include_dirs "${_mason_include_dirs}")
- string(STRIP "${_mason_include_dirs}" _mason_include_dirs)
- list(REMOVE_DUPLICATES _mason_include_dirs)
- set(_mason_include_dirs "${_mason_include_dirs}" PARENT_SCOPE)
-
- # Extract -D definitions to {package}_DEFINITIONS
- string(REGEX MATCHALL "(^| +)-D *([^ ]+)" _mason_definitions "${_mason_flags}")
- string(REGEX REPLACE "(^| +)-D *" "\\1" _mason_definitions "${_mason_definitions}")
- string(STRIP "${_mason_definitions}" _mason_definitions)
- set(_mason_definitions "${_mason_definitions}" PARENT_SCOPE)
-
- # Store all other flags in {package}_OPTIONS
- string(REGEX REPLACE "(^| +)-(D|I|isystem) *([^ ]+)" "" _mason_options "${_mason_flags}")
- string(STRIP "${_mason_options}" _mason_options)
- set(_mason_options "${_mason_options}" PARENT_SCOPE)
-endfunction()
-
-function(_mason_get_libs package version)
- set(_mason_failed)
- set(_mason_static_libs)
- execute_process(
- COMMAND ${_mason_command} static_libs ${package} ${version}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE _mason_static_libs
- RESULT_VARIABLE _mason_failed
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(_mason_failed)
- message(FATAL_ERROR "[Mason] Could not get static libraries for package ${package} ${version}")
- endif()
-
- set(_mason_failed)
- set(_mason_ldflags)
- execute_process(
- COMMAND ${_mason_command} ldflags ${package} ${version}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE _mason_ldflags
- RESULT_VARIABLE _mason_failed
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(_mason_failed)
- message(FATAL_ERROR "[Mason] Could not get linker flags for package ${package} ${version}")
- endif()
-
- set(_mason_libraries)
- list(APPEND _mason_libraries ${_mason_static_libs} ${_mason_ldflags})
- set(_mason_libraries ${_mason_libraries} PARENT_SCOPE)
-endfunction()
-
-macro(mason_use package version)
- _mason_valid_args("${package}" "${version}")
-
- if(MASON_${package}_INVOCATION STREQUAL ${_mason_invocation})
- # Check that the previous invocation of mason_use didn't select another version of this package
- if(NOT MASON_${package}_VERSION STREQUAL ${version})
- message(FATAL_ERROR "[Mason] Already using ${package} ${MASON_${package}_VERSION}. Cannot select version ${version}.")
- endif()
- else()
- _mason_install("${package}" "${version}")
- _mason_get_flags("${package}" "${version}")
- _mason_get_libs("${package}" "${version}")
- set(MASON_${package}_INCLUDE_DIRS "${_mason_include_dirs}" CACHE STRING "${package} include directories" FORCE)
- set(MASON_${package}_DEFINITIONS "${_mason_definitions}" CACHE STRING "${package} definitions" FORCE)
- set(MASON_${package}_OPTIONS "${_mason_options}" CACHE STRING "${package} compiler options" FORCE)
- set(MASON_${package}_LIBRARIES "${_mason_libraries}" CACHE STRING "${package} libraries" FORCE)
- set(MASON_${package}_VERSION "${version}" CACHE INTERNAL "${package} version" FORCE)
- set(MASON_${package}_INVOCATION "${_mason_invocation}" CACHE INTERNAL "${package} invocation ID" FORCE)
- endif()
-endmacro()
-
-macro(target_add_mason_package target visibility package)
- mason_use("${package}" "${MASON_${package}_VERSION}")
- target_include_directories(${target} ${visibility} "${MASON_${package}_INCLUDE_DIRS}")
- target_compile_definitions(${target} ${visibility} "${MASON_${package}_DEFINITIONS}")
- target_compile_options(${target} ${visibility} "${MASON_${package}_OPTIONS}")
- target_link_libraries(${target} ${visibility} "${MASON_${package}_LIBRARIES}")
-endmacro()
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake
index 317057a406..752f05619c 100644
--- a/cmake/mbgl.cmake
+++ b/cmake/mbgl.cmake
@@ -1,4 +1,4 @@
-if (NOT DEFINED MBGL_PLATFORM)
+if (NOT MBGL_PLATFORM)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(MBGL_PLATFORM "macos")
else()
@@ -6,16 +6,8 @@ if (NOT DEFINED MBGL_PLATFORM)
endif()
endif()
-if (NOT DEFINED ENV{MASON_PLATFORM})
- if(MBGL_PLATFORM STREQUAL "qt")
- set(ENV{MASON_PLATFORM} ${BUILD_PLATFORM})
- else()
- set(ENV{MASON_PLATFORM} ${MBGL_PLATFORM})
- endif()
-endif()
-
-if ("$ENV{MASON_PLATFORM}" STREQUAL "macos")
- set(ENV{MASON_PLATFORM} "osx")
+if (NOT MASON_PLATFORM)
+ set(MASON_PLATFORM "${MBGL_PLATFORM}")
endif()
set(MBGL_GENERATED ${CMAKE_BINARY_DIR}/generated/${CMAKE_CFG_INTDIR})
@@ -54,3 +46,7 @@ endfunction()
file(WRITE "${CMAKE_BINARY_DIR}/config.xcconfig" "// Do not edit -- generated by CMake\n")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
+
+# CMake 3.1 does not have this yet.
+set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
diff --git a/cmake/node.cmake b/cmake/node.cmake
index 9c8c6b074b..081b158d41 100644
--- a/cmake/node.cmake
+++ b/cmake/node.cmake
@@ -43,6 +43,8 @@ target_link_libraries(mbgl-node
PRIVATE mbgl-core
)
+target_add_mason_package(mbgl-node PRIVATE geojson)
+
add_custom_command(
TARGET mbgl-node
POST_BUILD
diff --git a/platform/android/config.cmake b/platform/android/config.cmake
index b5924b110e..aa1cec2072 100644
--- a/platform/android/config.cmake
+++ b/platform/android/config.cmake
@@ -1,14 +1,12 @@
#Include to use build specific variables
include(${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake)
-mason_use(geojson 0.1.4)
-mason_use(jni.hpp 2.0.0)
-mason_use(libjpeg-turbo 1.4.2)
-mason_use(libpng 1.6.20)
-mason_use(libzip 0.11.2)
-mason_use(nunicode 1.6)
-mason_use(sqlite 3.9.1)
-mason_use(zlib system)
+mason_use(jni.hpp VERSION 2.0.0 HEADER_ONLY)
+mason_use(libjpeg-turbo VERSION 1.4.2)
+mason_use(libpng VERSION 1.6.20)
+mason_use(libzip VERSION 0.11.2)
+mason_use(nunicode VERSION 1.6)
+mason_use(sqlite VERSION 3.9.1)
macro(mbgl_platform_core)
@@ -57,7 +55,6 @@ macro(mbgl_platform_core)
target_add_mason_package(mbgl-core PUBLIC nunicode)
target_add_mason_package(mbgl-core PUBLIC libpng)
target_add_mason_package(mbgl-core PUBLIC libjpeg-turbo)
- target_add_mason_package(mbgl-core PUBLIC zlib)
target_add_mason_package(mbgl-core PUBLIC libzip)
target_add_mason_package(mbgl-core PUBLIC geojson)
target_add_mason_package(mbgl-core PUBLIC jni.hpp)
@@ -69,6 +66,7 @@ macro(mbgl_platform_core)
PUBLIC -lGLESv2
PUBLIC -lstdc++
PUBLIC -latomic
+ PUBLIC -lz
)
endmacro()
diff --git a/platform/linux/config.cmake b/platform/linux/config.cmake
index 814a249849..038719d66f 100644
--- a/platform/linux/config.cmake
+++ b/platform/linux/config.cmake
@@ -1,11 +1,12 @@
-mason_use(glfw 3.1.2)
-mason_use(boost_libprogram_options 1.60.0)
-mason_use(sqlite 3.9.1)
-mason_use(libuv 1.7.5)
-mason_use(nunicode 1.6)
-mason_use(libpng 1.6.20)
-mason_use(libjpeg-turbo 1.4.2)
-mason_use(webp 0.5.0)
+mason_use(glfw VERSION 3.1.2)
+mason_use(boost_libprogram_options VERSION 1.60.0)
+mason_use(sqlite VERSION 3.9.1)
+mason_use(libuv VERSION 1.7.5)
+mason_use(nunicode VERSION 1.6)
+mason_use(libpng VERSION 1.6.20)
+mason_use(libjpeg-turbo VERSION 1.4.2)
+mason_use(webp VERSION 0.5.0)
+mason_use(gtest VERSION 1.7.0${MASON_CXXABI_SUFFIX})
include(cmake/loop-uv.cmake)
diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake
index fcb2c9a3e3..b9f18635c1 100644
--- a/platform/macos/config.cmake
+++ b/platform/macos/config.cmake
@@ -1,5 +1,6 @@
-mason_use(glfw 3.1.2)
-mason_use(boost_libprogram_options 1.60.0)
+mason_use(glfw VERSION 3.1.2)
+mason_use(boost_libprogram_options VERSION 1.60.0)
+mason_use(gtest VERSION 1.7.0${MASON_CXXABI_SUFFIX})
include(cmake/loop-darwin.cmake)
diff --git a/platform/qt/config.cmake b/platform/qt/config.cmake
index 5e3b0bd92a..46cc98eb81 100644
--- a/platform/qt/config.cmake
+++ b/platform/qt/config.cmake
@@ -1,11 +1,12 @@
include(platform/qt/qt.cmake)
-mason_use(sqlite 3.9.1)
+mason_use(sqlite VERSION 3.9.1)
+mason_use(gtest VERSION 1.7.0${MASON_CXXABI_SUFFIX})
if(NOT WITH_QT_DECODERS)
- mason_use(libjpeg-turbo 1.4.2)
- mason_use(libpng 1.6.20)
- mason_use(webp 0.5.0)
+ mason_use(libjpeg-turbo VERSION 1.4.2)
+ mason_use(libpng VERSION 1.6.20)
+ mason_use(webp VERSION 0.5.0)
endif()
macro(mbgl_platform_core)
diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake
index 9d8ae10f9e..2d3ec58ad9 100644
--- a/platform/qt/qt.cmake
+++ b/platform/qt/qt.cmake
@@ -82,7 +82,7 @@ else()
endif()
# OS specific configurations
-if (BUILD_PLATFORM STREQUAL "macos")
+if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND MBGL_QT_FILES
PRIVATE platform/darwin/src/nsthread.mm
PRIVATE platform/darwin/src/headless_view_cgl.cpp