Skip to content

Commit

Permalink
Allow building only core
Browse files Browse the repository at this point in the history
  • Loading branch information
ntadej committed Oct 14, 2023
1 parent c2eaef1 commit a01c39d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ set(MLN_QT_WIDGETS_LIB QMapLibreWidgets)
set(MLN_QT_GEOSERVICES_PLUGIN qtgeoservices_maplibre)
set(MLN_QT_QML_PLUGIN declarative_locationplugin_maplibre)

# Options
set(MLN_QT_WITH_LOCATION ON CACHE BOOL "Build QMapLibreLocation")
set(MLN_QT_WITH_WIDGETS ON CACHE BOOL "Build QMapLibreWidgets")

# Find Qt
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Network REQUIRED) # main dependencies
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Location REQUIRED) # location
if (Qt6_FOUND)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED)
if (MLN_QT_WITH_LOCATION)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Location REQUIRED) # location
endif()
if (MLN_QT_WITH_WIDGETS)
if (Qt6_FOUND)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGLWidgets REQUIRED)
else()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED)
endif()
endif()
message(STATUS "Using Qt${QT_VERSION_MAJOR}")

Expand Down
10 changes: 8 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
add_subdirectory(core)
add_subdirectory(location)
add_subdirectory(widgets)
if (MLN_QT_WITH_LOCATION)
add_subdirectory(location)
message(STATUS "Building location module")
endif()
if (MLN_QT_WITH_WIDGETS)
add_subdirectory(widgets)
message(STATUS "Building widgets module")
endif()
8 changes: 6 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
endif()

add_subdirectory(core)
add_subdirectory(qml)
add_subdirectory(widgets)
if (MLN_QT_WITH_LOCATION)
add_subdirectory(qml)
endif()
if (MLN_QT_WITH_WIDGETS)
add_subdirectory(widgets)
endif()

0 comments on commit a01c39d

Please sign in to comment.