Skip to content
Snippets Groups Projects
Unverified Commit 6e9e5c69 authored by Bart Ribbers's avatar Bart Ribbers
Browse files

Port to CMake

parent dec247ec
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.6.0)
project(mapbox-gl-qml
VERSION 1.7.6
DESCRIPTION "Unofficial Mapbox GL Native bindings for Qt QML")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
option(USE_CURL_SSL "Use curl SSL" ON)
include(FindPkgConfig)
include(FeatureSummary)
include(GNUInstallDirs)
set(QT_MIN_VERSION "5.6.0")
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS Gui Quick Positioning Sql REQUIRED)
find_package(QMapboxGL REQUIRED)
if(USE_CURL_SSL)
find_package(PkgConfig)
pkg_check_modules(CURL libcurl IMPORTED_TARGET)
pkg_check_modules(OPENSSL openssl IMPORTED_TARGET)
set_property(GLOBAL APPEND PROPERTY _CMAKE_libcurl_TYPE REQUIRED)
set_property(GLOBAL APPEND PROPERTY _CMAKE_openssl_TYPE REQUIRED)
if(CURL_FOUND)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libcurl)
else()
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND libcurl)
endif()
if(OPENSSL_FOUND)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND openssl)
else()
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND openssl)
endif()
endif()
add_subdirectory(src)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
### Sets QT_INSTALL_QML to the directory where QML Plugins should be installed
function(FindQtInstallQml)
find_program(QMAKE NAMES qmake-qt5 qmake)
if(NOT QMAKE)
message(FATAL_ERROR "qmake not found")
endif()
execute_process(
COMMAND ${QMAKE} -query QT_INSTALL_QML
OUTPUT_VARIABLE PROC_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(QT_INSTALL_QML ${PROC_RESULT} PARENT_SCOPE)
endfunction()
set(SRC
qquickitemmapboxgl.cpp
qsgmapboxglnode.cpp
qsgtextureplain.cpp
qmapboxsync.cpp
plugin/mapboxglextensionplugin.cpp)
set(HEADERS
qmapboxsync_p.h
include/qsgmapboxglnode.h
include/qquickitemmapboxgl.h
include/qsgtextureplain.h
plugin/mapboxglextensionplugin.h)
add_library(qmlmapboxglplugin SHARED ${SRC} ${HEADERS})
target_include_directories(qmlmapboxglplugin PRIVATE include src)
target_link_libraries(qmlmapboxglplugin PRIVATE
Qt5::Gui
Qt5::Qml
Qt5::Quick
Qt5::Positioning
Qt5::Sql
qmapboxgl)
if(USE_CURL_SSL)
add_definitions(-DUSE_CURL_SSL=1)
target_link_libraries(qmlmapboxglplugin PRIVATE
PkgConfig::CURL
PkgConfig::OPENSSL)
endif()
FindQtInstallQml()
install(FILES
plugin/MapboxMapGestureArea.qml
plugin/qmldir
DESTINATION ${QT_INSTALL_QML}/MapboxMap/)
install(TARGETS qmlmapboxglplugin DESTINATION ${QT_INSTALL_QML}/MapboxMap/)
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment