-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CMake packaging and test with examples
- Loading branch information
Showing
30 changed files
with
704 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
project(QMapLibreExampleQuick VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED) | ||
qt_standard_project_setup() | ||
|
||
find_package(QMapLibre COMPONENTS Location REQUIRED) | ||
|
||
qt_add_executable(QMapLibreExampleQuick | ||
main.cpp | ||
) | ||
|
||
qt_add_qml_module(QMapLibreExampleQuick | ||
URI Example | ||
VERSION 1.0 | ||
RESOURCE_PREFIX "/" | ||
QML_FILES | ||
main.qml | ||
) | ||
|
||
set_target_properties(QMapLibreExampleQuick PROPERTIES | ||
WIN32_EXECUTABLE ON | ||
MACOSX_BUNDLE ON | ||
) | ||
|
||
target_link_libraries(QMapLibreExampleQuick | ||
PRIVATE | ||
Qt::Quick | ||
QMapLibre::Location | ||
) | ||
|
||
qmaplibre_location_copy_plugin(QMapLibreExampleQuick) | ||
|
||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
add_custom_target(deploy | ||
COMMAND macdeployqt QMapLibreExampleQuick.app -qmldir=${CMAKE_SOURCE_DIR} | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
) | ||
add_dependencies(deploy QMapLibreExampleQuick) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
project(QMapLibreExampleWidgets VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
if(APPLE) # suppress some warnings in Qt6 | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
endif() | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
find_package(Qt6 REQUIRED COMPONENTS Widgets REQUIRED) | ||
qt_standard_project_setup() | ||
|
||
find_package(QMapLibre COMPONENTS Widgets REQUIRED) | ||
|
||
qt_add_executable(QMapLibreExampleWidgets | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.hpp | ||
window.cpp | ||
window.hpp | ||
) | ||
|
||
set_target_properties(QMapLibreExampleWidgets PROPERTIES | ||
WIN32_EXECUTABLE ON | ||
MACOSX_BUNDLE ON | ||
) | ||
|
||
target_link_libraries(QMapLibreExampleWidgets | ||
PRIVATE | ||
QMapLibre::Widgets | ||
) | ||
|
||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
add_custom_target(deploy | ||
COMMAND macdeployqt QMapLibreExampleWidgets.app | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
) | ||
add_dependencies(deploy QMapLibreExampleWidgets) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: MIT | ||
|
||
#include "mainwindow.hpp" | ||
|
||
#include <QApplication> | ||
|
||
int main(int argc, char **argv) { | ||
QApplication app(argc, argv); | ||
|
||
MainWindow window; | ||
|
||
window.resize(800, 600); | ||
window.show(); | ||
|
||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: MIT | ||
|
||
#include "mainwindow.hpp" | ||
|
||
#include "window.hpp" | ||
|
||
#include <QMenu> | ||
#include <QMenuBar> | ||
#include <QMessageBox> | ||
|
||
MainWindow::MainWindow() { | ||
auto *menuBar = new QMenuBar(this); | ||
QMenu *menuWindow = menuBar->addMenu(tr("&Window")); | ||
auto *actionAddNew = new QAction(menuWindow); | ||
actionAddNew->setText(tr("Add new")); | ||
menuWindow->addAction(actionAddNew); | ||
connect(actionAddNew, &QAction::triggered, this, &MainWindow::onAddNew); | ||
setMenuBar(menuBar); | ||
|
||
onAddNew(); | ||
} | ||
|
||
void MainWindow::onAddNew() { | ||
if (!centralWidget()) | ||
setCentralWidget(new Window(this)); | ||
else | ||
QMessageBox::information(nullptr, tr("Cannot add new window"), tr("Already occupied. Undock first.")); | ||
} |
Oops, something went wrong.