Skip to content

Commit

Permalink
Merge master into release
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Mar 11, 2021
2 parents ac4b084 + 3745618 commit 5fc6056
Show file tree
Hide file tree
Showing 253 changed files with 58,041 additions and 39,597 deletions.
4 changes: 2 additions & 2 deletions 3rd-party/cove/libvectorizer/Concurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Concurrency {
* is const in order to ensure thread safety also in accessing this object
* (cf. std::shared_ptr documentation).
*/
class Progress : public ProgressObserver
class Progress final : public ProgressObserver
{
private:
struct Data
Expand All @@ -62,7 +62,7 @@ class Progress : public ProgressObserver
Progress(Progress&& p) = delete;
Progress& operator=(const Progress&) = delete;
Progress& operator=(Progress&& p) = delete;
~Progress() final = default;
~Progress() override = default;

int getPercentage() const noexcept;
void setPercentage(int percentage) final;
Expand Down
7 changes: 7 additions & 0 deletions 3rd-party/cove/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ find_package(Qt5Test ${Qt5Core_VERSION} REQUIRED)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)

configure_file(test_config.h.in test_config.h)
add_library(cove-test-config INTERFACE)
target_include_directories(cove-test-config INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")

add_executable(cove-ParallelImageProcessingTest
ParallelImageProcessingTest.cpp
)
Expand All @@ -23,6 +27,9 @@ endif()
add_executable(cove-PolygonTest
PolygonTest.cpp
)
target_link_libraries(cove-PolygonTest
PRIVATE cove-test-config
)
add_test(
NAME cove-PolygonTest
COMMAND cove-PolygonTest
Expand Down
18 changes: 13 additions & 5 deletions 3rd-party/cove/tests/PolygonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@
#include <QtTest>
#include <QByteArray>
#include <QDataStream>
#include <QDir>
#include <QFile>
#include <QIODevice>
#include <QImage>
#include <QPointF>

#include "libvectorizer/Polygons.h"

#include "test_config.h"

// Benchmarking adds significant overhead when enabled.
// With the focus on (CI) testing, we default to disabling benchmarking
// by defining COVE_BENCHMARK as an empty macro here, and let CMake set
Expand All @@ -46,6 +49,11 @@
# define COVE_BENCHMARK
#endif

void PolygonTest::initTestCase()
{
QDir::addSearchPath(QStringLiteral("testdata"), QDir(QString::fromUtf8(COVE_TEST_SOURCE_DIR)).absoluteFilePath(QStringLiteral("data")));
}

void PolygonTest::testJoins_data()
{
QTest::addColumn<bool>("simpleOnly");
Expand All @@ -56,8 +64,8 @@ void PolygonTest::testJoins_data()
QTest::addColumn<QString>("resultFile");

QTest::newRow("simple joins")
<< true << 5.0 << 9 << 0.0 << "data/PolygonTest1-sample.png"
<< "data/PolygonTest1-simple-joins-result.dat";
<< true << 5.0 << 9 << 0.0 << "testdata:PolygonTest1-sample.png"
<< "testdata:PolygonTest1-simple-joins-result.dat";
}

void PolygonTest::testJoins()
Expand All @@ -72,7 +80,7 @@ void PolygonTest::testJoins()
QFETCH(QString, imageFile);
QFETCH(QString, resultFile);

QVERIFY(sampleImage.load(QFINDTESTDATA(imageFile)));
QVERIFY(sampleImage.load(imageFile));

polyTracer.setSimpleOnly(simpleOnly);
polyTracer.setMaxDistance(maxDistance);
Expand All @@ -85,8 +93,8 @@ void PolygonTest::testJoins()
polys = polyTracer.createPolygonsFromImage(sampleImage);
}

// saveResults(polys, QFINDTESTDATA(resultFile));
compareResults(polys, QFINDTESTDATA(resultFile));
// saveResults(polys, resultFile);
compareResults(polys, resultFile);
}

void PolygonTest::saveResults(const cove::PolygonList& polys,
Expand Down
2 changes: 2 additions & 0 deletions 3rd-party/cove/tests/PolygonTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class PolygonTest : public QObject
{
Q_OBJECT
private slots:
void initTestCase();

void testJoins_data();
void testJoins();

Expand Down
25 changes: 25 additions & 0 deletions 3rd-party/cove/tests/test_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2020 Kai Pastor
*
* This file is part of OpenOrienteering.
*
* OpenOrienteering is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenOrienteering is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenOrienteering. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef COVE_TEST_CONFIG_H
#define COVE_TEST_CONFIG_H

#define COVE_TEST_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@"

#endif
58 changes: 37 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright 2012, 2013, 2014 Thomas Schöps
# Copyright 2012-2020 Kai Pastor
# Copyright 2012-2021 Kai Pastor
#
# This file is part of OpenOrienteering.
#
Expand All @@ -27,10 +27,12 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

option(CMAKE_FIND_PACKAGE_PREFER_CONFIG "Lookup package config files before using find modules" ON)

# Project declaration

project(Mapper VERSION 0.9.4 LANGUAGES CXX C)
set(Mapper_COPYRIGHT "(C) 2020 The OpenOrienteering developers")
project(Mapper VERSION 0.9.5 LANGUAGES CXX C)
set(Mapper_COPYRIGHT "(C) 2021 The OpenOrienteering developers")

math(EXPR Mapper_VERSION_CODE "${Mapper_VERSION_MAJOR} * 10000 + ${Mapper_VERSION_MINOR} * 100 + ${Mapper_VERSION_PATCH} * 2 + ${CMAKE_SIZEOF_VOID_P} / 4 - 1")

Expand Down Expand Up @@ -63,8 +65,10 @@ endif()

option(Mapper_DEBUG_TRANSLATIONS "Debug missing translations" OFF)

# Used for some Linux distributions which do not provide the polyclipping lib.
option(Mapper_BUILD_CLIPPER "Build the Clipper package from source" OFF)
# To improve developer experience, build clipper if it is not found
set(Mapper_BUILD_CLIPPER "auto" CACHE STRING
"Build the Clipper package from source, alternatives: ON, OFF"
)

option(Mapper_USE_GDAL "Use the GDAL library" ON)

Expand Down Expand Up @@ -138,10 +142,12 @@ elseif(ANDROID)
set(MAPPER_DATA_DESTINATION "assets")
set(MAPPER_ABOUT_DESTINATION "assets/doc")
else() # LINUX and alike
set(MAPPER_RUNTIME_DESTINATION "bin")
set(MAPPER_LIBRARY_DESTINATION "lib/${Mapper_PACKAGE_NAME}")
set(MAPPER_DATA_DESTINATION "share/${Mapper_PACKAGE_NAME}")
set(MAPPER_ABOUT_DESTINATION "share/doc/${Mapper_PACKAGE_NAME}")
include(GNUInstallDirs)
set(MAPPER_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}")
set(MAPPER_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}/${Mapper_PACKAGE_NAME}")
set(MAPPER_DATA_DESTINATION "${CMAKE_INSTALL_DATADIR}/${Mapper_PACKAGE_NAME}")
string(REPLACE "/${PROJECT_NAME}" "/${Mapper_PACKAGE_NAME}"
MAPPER_ABOUT_DESTINATION "${CMAKE_INSTALL_DOCDIR}")
endif()

if(CMAKE_CROSSCOMPILING)
Expand Down Expand Up @@ -174,6 +180,19 @@ add_custom_target(Mapper_prerequisites
)
set(Mapper_prerequisites_FOUND TRUE)

if(Mapper_BUILD_CLIPPER STREQUAL "auto")
find_package(Polyclipping 6.1.3 MODULE)
if(NOT Polyclipping_FOUND)
message(WARNING
"System polyclipping is missing. Enabling embedded build.\n"
"Set Mapper_BUILD_CLIPPER=OFF to disable embedded build."
)
set_property(CACHE Mapper_BUILD_CLIPPER PROPERTY VALUE "ON")
else()
set_property(CACHE Mapper_BUILD_CLIPPER PROPERTY VALUE "OFF")
endif()
set_property(CACHE Mapper_BUILD_CLIPPER PROPERTY TYPE "BOOL")
endif()
if(Mapper_BUILD_CLIPPER)
add_subdirectory(3rd-party/clipper)
add_feature_info(Mapper_BUILD_CLIPPER 1 "version: ${CLIPPER_VERSION}")
Expand All @@ -182,18 +201,20 @@ else()
find_package(Polyclipping 6.1.3 MODULE REQUIRED)
endif()

find_package(PROJ4 CONFIG QUIET)
# We must not require a minimum version of PROJ via find_package
# because PROJ config requires the major version to match exactly.
find_package(PROJ4 REQUIRED)
if(NOT TARGET PROJ4::proj)
set(PROJ4_FOUND false)
find_package(PROJ4 MODULE REQUIRED)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindPROJ.cmake")
endif()
if(NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 6.1)
if(NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "At least PROJ 4.9 is required")
elseif(PROJ4_VERSION VERSION_LESS 6.1)
# New PROJ API missing or incomplete.
# (proj_normalize_for_visualization() came in 6.1.)
set_property(TARGET PROJ4::proj APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS ACCEPT_USE_OF_DEPRECATED_PROJ_API_H)
endif()
if(NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 6.2.1)
elseif(PROJ4_VERSION VERSION_LESS 6.2.1)
# Datum Potsdam issue, https://github.com/OSGeo/PROJ/pull/1573
set_property(TARGET PROJ4::proj APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS PROJ_ISSUE_1573)
Expand All @@ -218,11 +239,6 @@ if(big_endian)
endif()


if(UNIX AND NOT APPLE)
# set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib/${Mapper_PACKAGE_NAME}/lib")
set(CMAKE_INSTALL_RPATH "${MAPPER_LIBRARY_DESTINATION}/lib")
endif()

add_definitions(-D_USE_MATH_DEFINES -DUNICODE)

if(Mapper_DEVELOPMENT_BUILD)
Expand Down Expand Up @@ -274,7 +290,6 @@ endif()
if (Mapper_USE_GDAL)
add_subdirectory("src/gdal")
endif()
add_subdirectory("src/libocad")
if(NOT ANDROID)
add_subdirectory("src/printsupport")
endif()
Expand Down Expand Up @@ -304,6 +319,7 @@ set(ci
ci/filter-stderr.sed
ci/publish.yml
ci/publish-coverage.yml
ci/release-notes.yml
ci/setup-common.yml
ci/setup-macos.yml
ci/setup-msys2.yml
Expand Down
33 changes: 33 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,39 @@ make
```


## Compiling for Windows (without OpenOrienteering superbuild)

A development environment on 64-bit Windows can be set up and maintained easily
with the MSYS2 distribution. It provides up-to-date Windows packages of bash,
gcc, mingw-w64, CMake, Ninja, Qt, PROJ, GDAL and Doxygen.

First of all, you need to install (and update) MSYS2, https://www.msys2.org/.
The next step is to install all dependencies used by Mapper at build time
and at run time. This will download more than 1.3 GB and take more than 9 GB
of disk spaced after installation. In an msys2 terminal window, type:

```
pacman -S git mingw-w64-x86_64-qt-creator mingw-w64-x86_64-proj mingw-w64-x86_64-gdal mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-doxygen mingw-w64-x86_64-gdb
```

For development you will start with an mingw64 terminal. Clone the
OpenOrienteering Mapper repository (or use a source archive), as
written above.

```
git clone https://github.com/OpenOrienteering/mapper.git
```

Run Qt Creator:

```
qtcreator.exe &
```

Adjust the Qt Kit settings and set the CMake generator to Ninja.
Then open CMakeList.txt from the source directory.


## Compiling with OpenOrienteering superbuild

The OpenOrienteering superbuild project
Expand Down
1 change: 0 additions & 1 deletion ci/filter-stderr.sed
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Cf. https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
/:.*[0-9]: [Ww]arning:/ {
/libocad/ b
s,^\([a-zA-Z]:\)?/.*/1/s/,,
s,^\([a-zA-Z]:\)?/.*/build/,,
s,^,##vso[task.LogIssue type=warning;],
Expand Down
1 change: 1 addition & 0 deletions ci/openorienteering-mapper-ci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ superbuild_package(
"${CMAKE_COMMAND}" --build . --target package$<IF:$<STREQUAL:@CMAKE_GENERATOR@,Ninja>,,/fast>
$<$<NOT:$<BOOL:@CMAKE_CROSSCOMPILING@>>:
TEST_COMMAND
"${CMAKE_COMMAND}" -E env "LD_LIBRARY_PATH=${CMAKE_STAGING_PREFIX}/lib"
"${CMAKE_CTEST_COMMAND}" -T Test --no-compress-output
$<$<BOOL:@Mapper_CI_ENABLE_COVERAGE@>:
--exclude-regex symbol_set_t
Expand Down
4 changes: 3 additions & 1 deletion ci/setup-common.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of OpenOrienteering.

# Copyright 2019 Kai Pastor
# Copyright 2019-2021 Kai Pastor
#
# Redistribution and use is allowed according to the terms of the BSD license:
#
Expand Down Expand Up @@ -51,6 +51,8 @@ steps:
if [ -z "${APP_ID_SUFFIX}" -a -n "${VERSION_DISPLAY}" ] ; then
echo "##vso[task.setVariable variable=APP_ID_SUFFIX].${BUILD_SOURCEBRANCHNAME}"
fi
# Fix Superbuild sdk_host quirk
echo "##vso[task.setVariable variable=ANDROID_NDK_ROOT]"
env | sort
displayName: 'Update environment'

Expand Down
8 changes: 8 additions & 0 deletions code-check-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ PATTERN=
for I in \
action_grid_bar.cpp \
boolean_tool.cpp \
color_wheel_widget.cpp \
combined_symbol.cpp \
configure_grid_dialog.cpp \
course_file_format.cpp \
crs_param_widgets.cpp \
crs_template.cpp \
crs_template_implementation.cpp \
Expand All @@ -63,13 +65,17 @@ for I in \
georeferencing_dialog.cpp \
georeferencing_t.cpp \
icon_engine \
iof_course_export \
key_button_bar.cpp \
key_value_container \
kml_course_export \
line_symbol.cpp \
main.cpp \
/map.cpp \
map_coord.cpp \
map_editor.cpp \
map_find_feature.cpp \
map_printer \
map_widget.cpp \
mapper_proxystyle.cpp \
/object.cpp \
Expand All @@ -85,6 +91,8 @@ for I in \
renderable_implementation.cpp \
rotate_map_dialog.cpp \
settings_dialog.cpp \
simple_course_dialog.cpp \
simple_course_export.cpp \
stretch_map_dialog.cpp \
style_t.cpp \
/symbol.cpp \
Expand Down
1 change: 0 additions & 1 deletion codespell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ while read WORD; do SKIP_LIST="${SKIP_LIST:+$SKIP_LIST,}$WORD"; done \
3rd-party/cove/potrace
packaging/linux/Mapper.desktop
src/gdal/mapper-osmconf.ini
src/libocad
src/printsupport/qt-5.5.1
src/printsupport/qt-5.12.4
END_SKIP_LIST
Expand Down
Loading

0 comments on commit 5fc6056

Please sign in to comment.