diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-10-24 01:53:22 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-10-31 18:19:28 +0200 |
commit | 69960afb8db0444ec11cb46b47e877cc34f61fc7 (patch) | |
tree | 37bcc19f033aadd8c3c158fad02b8c5e4a9437ed /CMakeLists.txt | |
parent | 3a3c05bd8aeabf179084bd9a0137edd2abf41e4c (diff) | |
download | qtlocation-mapboxgl-69960afb8db0444ec11cb46b47e877cc34f61fc7.tar.gz |
[build] Add build system for submodules
Vendorize the submodules and a simple CMake build
system for all them. The dependencies will inherit
compilation options for core.
The goal is to make Mapbox GL Core completely self
contained with a simple offline build.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bb315916b4..91b0aa5c1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,24 @@ cmake_minimum_required(VERSION 3.4) project(mbgl LANGUAGES CXX C) +set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo Sanitize) + +# Compiler configuration +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Required to avoid warnings when setting visibility +cmake_policy(SET CMP0063 NEW) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_C_VISIBILITY_PRESET hidden) + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + option(WITH_CXX11ABI "Use the C++11 ABI" OFF) option(WITH_COVERAGE "Enable coverage reports" OFF) option(WITH_OSMESA "Use OSMesa headless backend" OFF) @@ -8,6 +26,12 @@ option(WITH_EGL "Use EGL backend" OFF) option(WITH_NODEJS "Download test dependencies like NPM and Node.js" ON) option(WITH_ERROR "Add -Werror flag to build (turns warnings into errors)" ON) +if (WITH_ERROR) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") +endif() + +include(cmake/vendor.cmake) include(cmake/mbgl.cmake) include(cmake/mason.cmake) include(cmake/xcode.cmake) @@ -47,31 +71,11 @@ set_source_files_properties(src/mbgl/util/version.cpp PROPERTIES COMPILE_DEFINIT include(cmake/mason-dependencies.cmake) -add_definitions(-DRAPIDJSON_HAS_STDSTRING=1) - if(WITH_COVERAGE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") endif(WITH_COVERAGE) -set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo Sanitize) - -# Compiler configuration -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_C_EXTENSIONS OFF) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) - -# Required to avoid warnings when setting visibility -cmake_policy(SET CMP0063 NEW) -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_C_VISIBILITY_PRESET hidden) - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-backtrace-limit=0 -w") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") @@ -80,11 +84,6 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wno-variadic-macros -Wno-unknown-pragmas") endif() -if (WITH_ERROR) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") -endif() - if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # -Wno-error=unused-command-line-argument is required due to https://llvm.org/bugs/show_bug.cgi?id=7798 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-command-line-argument") |