Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[build] Run cmake-format on all the CMake files
Browse files Browse the repository at this point in the history
Unify and enforce a CMake coding style.
  • Loading branch information
tmpsantos committed Feb 7, 2020
1 parent 47f2b20 commit 021e48f
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 94 deletions.
6 changes: 5 additions & 1 deletion expression-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ set_property(TARGET mbgl-expression-test PROPERTY FOLDER Executables)

string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_EXPRESSION_TEST_SEED)

add_test(NAME mbgl-expression-test COMMAND mbgl-expression-test -s --seed=${MBGL_EXPRESSION_TEST_SEED} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test(
NAME mbgl-expression-test
COMMAND mbgl-expression-test -s --seed=${MBGL_EXPRESSION_TEST_SEED}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
3 changes: 2 additions & 1 deletion platform/ios/ios.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ if(MBGL_IOS_RENDER_TEST)
execute_process(COMMAND ${PREPARE_CMD} RESULT_VARIABLE CMD_ERROR WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
message(STATUS "CMD_ERROR:" ${CMD_ERROR})

set(RESOURCES ${PROJECT_SOURCE_DIR}/render-test/ios/Main.storyboard ${PROJECT_SOURCE_DIR}/render-test/ios/LaunchScreen.storyboard ${PROJECT_SOURCE_DIR}/test-data)
set(RESOURCES ${PROJECT_SOURCE_DIR}/render-test/ios/Main.storyboard ${PROJECT_SOURCE_DIR}/render-test/ios/LaunchScreen.storyboard
${PROJECT_SOURCE_DIR}/test-data)

add_executable(
RenderTestApp
Expand Down
3 changes: 2 additions & 1 deletion platform/macos/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ target_include_directories(

target_include_directories(
mbgl-core
PRIVATE ${PROJECT_SOURCE_DIR}/platform/darwin/include ${PROJECT_SOURCE_DIR}/platform/darwin/src ${PROJECT_SOURCE_DIR}/platform/macos/src
PRIVATE
${PROJECT_SOURCE_DIR}/platform/darwin/include ${PROJECT_SOURCE_DIR}/platform/darwin/src ${PROJECT_SOURCE_DIR}/platform/macos/src
)

include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
Expand Down
27 changes: 15 additions & 12 deletions vendor/benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@ if(TARGET mbgl-vendor-benchmark)
return()
endif()

add_library(mbgl-vendor-benchmark STATIC EXCLUDE_FROM_ALL
add_library(
mbgl-vendor-benchmark STATIC EXCLUDE_FROM_ALL
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/benchmark.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/benchmark_register.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/colorprint.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/commandlineflags.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/console_reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/complexity.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/csv_reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/colorprint.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/sleep.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/benchmark.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/console_reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/counter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/benchmark_register.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/statistics.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/csv_reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/json_reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/reporter.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/sleep.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/statistics.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/string_util.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/sysinfo.cc
${CMAKE_CURRENT_LIST_DIR}/benchmark/src/timers.cc
)

target_compile_definitions(mbgl-vendor-benchmark PRIVATE
HAVE_STEADY_CLOCK
target_compile_definitions(
mbgl-vendor-benchmark
PRIVATE HAVE_STEADY_CLOCK
)

target_include_directories(mbgl-vendor-benchmark SYSTEM PUBLIC
${CMAKE_CURRENT_LIST_DIR}/benchmark/include
target_include_directories(
mbgl-vendor-benchmark SYSTEM
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/benchmark/include
)

set_property(TARGET mbgl-vendor-benchmark PROPERTY FOLDER Core)
9 changes: 6 additions & 3 deletions vendor/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-boost)
return()
endif()

add_library(mbgl-vendor-boost INTERFACE)
add_library(
mbgl-vendor-boost INTERFACE
)

target_include_directories(mbgl-vendor-boost SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/boost/include
target_include_directories(
mbgl-vendor-boost SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/boost/include
)
10 changes: 6 additions & 4 deletions vendor/cheap-ruler-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ if(TARGET mbgl-vendor-cheap-ruler-cpp)
return()
endif()

add_library(mbgl-vendor-cheap-ruler-cpp INTERFACE)

target_include_directories(mbgl-vendor-cheap-ruler-cpp SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/cheap-ruler-cpp/include
add_library(
mbgl-vendor-cheap-ruler-cpp INTERFACE
)

target_include_directories(
mbgl-vendor-cheap-ruler-cpp SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/cheap-ruler-cpp/include
)
9 changes: 6 additions & 3 deletions vendor/earcut.hpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-earcut.hpp)
return()
endif()

add_library(mbgl-vendor-earcut.hpp INTERFACE)
add_library(
mbgl-vendor-earcut.hpp INTERFACE
)

target_include_directories(mbgl-vendor-earcut.hpp SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/earcut.hpp/include
target_include_directories(
mbgl-vendor-earcut.hpp SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/earcut.hpp/include
)
9 changes: 6 additions & 3 deletions vendor/eternal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-eternal)
return()
endif()

add_library(mbgl-vendor-eternal INTERFACE)
add_library(
mbgl-vendor-eternal INTERFACE
)

target_include_directories(mbgl-vendor-eternal SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/eternal/include
target_include_directories(
mbgl-vendor-eternal SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/eternal/include
)
9 changes: 6 additions & 3 deletions vendor/geojson-vt-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-geojson-vt-cpp)
return()
endif()

add_library(mbgl-vendor-geojson-vt-cpp INTERFACE)
add_library(
mbgl-vendor-geojson-vt-cpp INTERFACE
)

target_include_directories(mbgl-vendor-geojson-vt-cpp SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/geojson-vt-cpp/include
target_include_directories(
mbgl-vendor-geojson-vt-cpp SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/geojson-vt-cpp/include
)
12 changes: 9 additions & 3 deletions vendor/glfw.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ unset(CMAKE_C_VISIBILITY_PRESET)
add_subdirectory(vendor/glfw)
set(CMAKE_C_VISIBILITY_PRESET hidden)

target_compile_options(glfw PRIVATE -Wno-shadow -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers)
target_compile_options(
glfw
PRIVATE
-Wno-shadow
-Wno-unused-parameter
-Wno-sign-compare
-Wno-missing-field-initializers
)

if(APPLE)
# Don't show OpenGL deprecation warnings.
target_compile_options(glfw PRIVATE -Wno-deprecated-declarations -Wno-unguarded-availability-new)

# get_target_property(DEPLOYMENT_TARGET_VERSION glfw MACOSX_DEPLOYMENT_TARGET)
# message(STATUS "target: ${DEPLOYMENT_TARGET_VERSION}")
# get_target_property(DEPLOYMENT_TARGET_VERSION glfw MACOSX_DEPLOYMENT_TARGET) message(STATUS "target: ${DEPLOYMENT_TARGET_VERSION}")
set_target_properties(glfw PROPERTIES OSX_DEPLOYMENT_TARGET 10.11)
endif()

Expand Down
24 changes: 13 additions & 11 deletions vendor/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ if(TARGET mbgl-vendor-googletest)
return()
endif()

add_library(mbgl-vendor-googletest STATIC EXCLUDE_FROM_ALL
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/src/gtest-all.cc
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/src/gmock-all.cc
add_library(
mbgl-vendor-googletest STATIC EXCLUDE_FROM_ALL
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/src/gmock-all.cc ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/src/gtest-all.cc
)

target_include_directories(mbgl-vendor-googletest PRIVATE
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include
target_include_directories(
mbgl-vendor-googletest
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include
)

target_include_directories(mbgl-vendor-googletest SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include
${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include
target_include_directories(
mbgl-vendor-googletest SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include ${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include
)

set_property(TARGET mbgl-vendor-googletest PROPERTY FOLDER Core)
31 changes: 16 additions & 15 deletions vendor/icu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ if(TARGET mbgl-vendor-icu)
return()
endif()

add_library(mbgl-vendor-icu STATIC
add_library(
mbgl-vendor-icu STATIC
${CMAKE_CURRENT_LIST_DIR}/icu/src/cmemory.cpp
${CMAKE_CURRENT_LIST_DIR}/icu/src/cstring.cpp
${CMAKE_CURRENT_LIST_DIR}/icu/src/ubidi.cpp
Expand All @@ -20,23 +21,23 @@ add_library(mbgl-vendor-icu STATIC
${CMAKE_CURRENT_LIST_DIR}/icu/src/utypes.cpp
)

target_compile_definitions(mbgl-vendor-icu PRIVATE
UCONFIG_NO_BREAK_ITERATION=1
UCONFIG_NO_LEGACY_CONVERSION=1
U_CHARSET_IS_UTF8=1
U_CHAR_TYPE=uint_least16_t
U_HAVE_ATOMIC=1
U_HAVE_STRTOD_L=0
_REENTRANT
target_compile_definitions(
mbgl-vendor-icu
PRIVATE
UCONFIG_NO_BREAK_ITERATION=1
UCONFIG_NO_LEGACY_CONVERSION=1
U_CHARSET_IS_UTF8=1
U_CHAR_TYPE=uint_least16_t
U_HAVE_ATOMIC=1
U_HAVE_STRTOD_L=0
_REENTRANT
)

target_compile_options(mbgl-vendor-icu PRIVATE
-Wno-error
-Wno-shorten-64-to-32
)
target_compile_options(mbgl-vendor-icu PRIVATE -Wno-error -Wno-shorten-64-to-32)

target_include_directories(mbgl-vendor-icu SYSTEM PUBLIC
${CMAKE_CURRENT_LIST_DIR}/icu/include
target_include_directories(
mbgl-vendor-icu SYSTEM
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/icu/include
)

set_property(TARGET mbgl-vendor-icu PROPERTY FOLDER Core)
17 changes: 9 additions & 8 deletions vendor/nunicode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ if(TARGET mbgl-vendor-nunicode)
return()
endif()

add_library(mbgl-vendor-nunicode STATIC
add_library(
mbgl-vendor-nunicode STATIC
${CMAKE_CURRENT_LIST_DIR}/nunicode/src/libnu/ducet.c
${CMAKE_CURRENT_LIST_DIR}/nunicode/src/libnu/strcoll.c
${CMAKE_CURRENT_LIST_DIR}/nunicode/src/libnu/strings.c
Expand All @@ -12,14 +13,14 @@ add_library(mbgl-vendor-nunicode STATIC
${CMAKE_CURRENT_LIST_DIR}/nunicode/src/libnu/utf8.c
)

target_compile_definitions(mbgl-vendor-nunicode PRIVATE
NU_BUILD_STATIC
target_compile_definitions(
mbgl-vendor-nunicode
PRIVATE NU_BUILD_STATIC
)

target_compile_options(mbgl-vendor-nunicode PRIVATE
-Wno-error
)
target_compile_options(mbgl-vendor-nunicode PRIVATE -Wno-error)

target_include_directories(mbgl-vendor-nunicode SYSTEM PUBLIC
${CMAKE_CURRENT_LIST_DIR}/nunicode/include
target_include_directories(
mbgl-vendor-nunicode SYSTEM
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/nunicode/include
)
9 changes: 6 additions & 3 deletions vendor/polylabel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-polylabel)
return()
endif()

add_library(mbgl-vendor-polylabel INTERFACE)
add_library(
mbgl-vendor-polylabel INTERFACE
)

target_include_directories(mbgl-vendor-polylabel SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/polylabel/include
target_include_directories(
mbgl-vendor-polylabel SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/polylabel/include
)
9 changes: 6 additions & 3 deletions vendor/protozero.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-protozero)
return()
endif()

add_library(mbgl-vendor-protozero INTERFACE)
add_library(
mbgl-vendor-protozero INTERFACE
)

target_include_directories(mbgl-vendor-protozero SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/protozero/include
target_include_directories(
mbgl-vendor-protozero SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/protozero/include
)
9 changes: 6 additions & 3 deletions vendor/shelf-pack-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-shelf-pack-cpp)
return()
endif()

add_library(mbgl-vendor-shelf-pack-cpp INTERFACE)
add_library(
mbgl-vendor-shelf-pack-cpp INTERFACE
)

target_include_directories(mbgl-vendor-shelf-pack-cpp SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/shelf-pack-cpp/include
target_include_directories(
mbgl-vendor-shelf-pack-cpp SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/shelf-pack-cpp/include
)
19 changes: 11 additions & 8 deletions vendor/sqlite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@ if(TARGET mbgl-vendor-sqlite)
return()
endif()

add_library(mbgl-vendor-sqlite STATIC
add_library(
mbgl-vendor-sqlite STATIC
${CMAKE_CURRENT_LIST_DIR}/sqlite/src/sqlite3.c
)

include(CheckSymbolExists)
check_symbol_exists("strerror_r" "string.h" MBGL_SQLITE3_HAVE_STRERROR_R)

if(MBGL_SQLITE3_HAVE_STRERROR_R)
target_compile_definitions(mbgl-vendor-sqlite PRIVATE
HAVE_STRERROR_R
target_compile_definitions(
mbgl-vendor-sqlite
PRIVATE HAVE_STRERROR_R
)
endif()

# So we don't need to link with -ldl
target_compile_definitions(mbgl-vendor-sqlite PRIVATE
SQLITE_OMIT_LOAD_EXTENSION
SQLITE_THREADSAFE
target_compile_definitions(
mbgl-vendor-sqlite
PRIVATE SQLITE_OMIT_LOAD_EXTENSION SQLITE_THREADSAFE
)

target_include_directories(mbgl-vendor-sqlite SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/sqlite/include
target_include_directories(
mbgl-vendor-sqlite SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/sqlite/include
)
9 changes: 6 additions & 3 deletions vendor/unique_resource.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ if(TARGET mbgl-vendor-unique_resource)
return()
endif()

add_library(mbgl-vendor-unique_resource INTERFACE)
add_library(
mbgl-vendor-unique_resource INTERFACE
)

target_include_directories(mbgl-vendor-unique_resource SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/unique_resource
target_include_directories(
mbgl-vendor-unique_resource SYSTEM
INTERFACE ${CMAKE_CURRENT_LIST_DIR}/unique_resource
)
Loading

0 comments on commit 021e48f

Please sign in to comment.