Skip to content

Commit

Permalink
Merge pull request #93 from adam-ce/main
Browse files Browse the repository at this point in the history
reduce wasm size
  • Loading branch information
adam-ce authored Feb 11, 2024
2 parents 99085f8 + 355e077 commit 8e8cdc0
Show file tree
Hide file tree
Showing 30 changed files with 960 additions and 170 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
include:
- qtarch: wasm_singlethread
qttarget: 'desktop'
qtmodules: 'qtcharts'
qtmodules: ''
additional_build_flags: '--target install'
- qtarch: wasm_multithread
qttarget: 'desktop'
qtmodules: 'qtcharts'
qtmodules: ''
additional_cmake_flags: '-DALP_ENABLE_THREADING=ON'
additional_build_flags: '--target install'
- qtarch: android_arm64_v8a
Expand Down Expand Up @@ -103,6 +103,10 @@ jobs:
echo "ANDROID_BUILD_DIR=$BUILD_DIR/$APK_TARGET/android-build/" >> $GITHUB_ENV
echo "DEPLOYMENT_SETTINGS=$BUILD_DIR/$APK_TARGET/android-alpineapp-deployment-settings.json" >> $GITHUB_ENV
- name: Remove StatsWindow, otherwise the webassembly will link against qtwidgets and charts.
if: matrix.qttarget == 'desktop'
run: rm ./app/StatsWindow.qml

- name: Configure CMake
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake
Expand Down
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ endif()
if (EMSCRIPTEN)
set(ALP_WWW_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "path to the install directory (for webassembly files, i.e., www directory)")
option(ALP_ENABLE_THREADING "Puts the scheduler into an extra thread." OFF)
option(ALP_ENABLE_DEBUG_GUI "Show debug GUI (increases binary size)" OFF)
elseif(ANDROID)
option(ALP_ENABLE_THREADING "Puts the scheduler into an extra thread." ON)
option(ALP_ENABLE_DEBUG_GUI "Show debug GUI (increases binary size)" OFF)
option(ALP_ENABLE_POSITIONING "enable qt positioning (gnss / gps)" ON)
else()
option(ALP_ENABLE_THREADING "Puts the scheduler into an extra thread." ON)
endif()

if (NOT EMSCRIPTEN)
option(ALP_ENABLE_DEBUG_GUI "Show debug GUI (increases binary size)" ON)
option(ALP_ENABLE_POSITIONING "enable qt positioning (gnss / gps)" ON)
endif()


if (UNIX AND NOT EMSCRIPTEN AND NOT ANDROID)
option(ALP_USE_LLVM_LINKER "use lld (llvm) for linking. it's parallel and much faster, but not installed by default.
if it's not installed, you'll get errors, that openmp or other stuff is not installed (hard to track down)" OFF)
Expand Down Expand Up @@ -71,7 +75,10 @@ if (ALP_USE_LLVM_LINKER)
endif()

########################################### dependencies #################################################
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Network Quick QuickControls2 LinguistTools Svg Charts)
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Network Quick QuickControls2 LinguistTools Svg)
if (ALP_ENABLE_DEBUG_GUI)
find_package(Qt6 REQUIRED COMPONENTS Widgets Charts)
endif()
qt_policy(
SET QTP0002 NEW
)
Expand Down
32 changes: 31 additions & 1 deletion COPYRIGHT_NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ This software includes code from:
- https://github.com/adobe-fonts/source-sans
- https://github.com/nocnokneo/cmake-git-versioning-example
- https://github.com/mourner/suncalc
- https://github.com/frankencode/FluxColor

Following are the corresponding licenses:

Expand Down Expand Up @@ -167,4 +168,33 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

###############################################################################
###############################################################################
###############################################################################


https://github.com/frankencode/FluxColor

###############################################################################

Copyright (C) 2020-2021 Frank Mertens

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Frank Mertens
[email protected]

###############################################################################
49 changes: 9 additions & 40 deletions app/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,53 +40,21 @@ Rectangle {
color: "#00FFFFFF"
height: about_text.implicitHeight + logo.height + 20
Image { id: logo; width: 120; height: 120; source: "icons/mascot.jpg" }
Text {
id: alpine_text
Image {
anchors {
left: logo.right
top: logo.top
leftMargin: 10
topMargin: 0
bottomMargin: 0
}
text: "Alpine"
color: Material.primaryTextColor
font {
weight: 800
pixelSize: 50
}
}
Text {
id: maps_text
anchors {
left: logo.right
top: alpine_text.baseline
leftMargin: 10
topMargin: 10
bottomMargin: 0
}
text: "Maps"
color: Material.primaryTextColor
font {
weight: 400
pixelSize: 50
}
}
Text {
id: dotorg_text
anchors {
left: maps_text.right
baseline: maps_text.baseline
leftMargin: 0
}
text: ".org"
color: Material.primaryTextColor
font {
weight: 100
pixelSize: 30
}
fillMode: Image.PreserveAspectFit
width: 180
height: 120
source: "icons/logo_type_vertical.svg"
}


Label {
id: about_text
anchors {
Expand All @@ -98,11 +66,12 @@ Rectangle {
wrapMode: Text.Wrap
onLinkActivated: Qt.openUrlExternally(link)

text: qsTr("<p>AlpineMaps.org is an open source application. It is released under the GNU General Public License (version 3 or any later version). "
text: qsTr("<p>This is an open source application. It is released under the GNU General Public License (version 3 or any later version). "
+ "The source code is available on <a href=\"https://github.com/AlpineMapsOrg/renderer\">github.com/AlpineMapsOrg/renderer</a>.</p>"
+ "<p>The source of elevation and orthographic photo data is <a href=\"https://basemap.at\">basemap.at</a>, "
+ "it is licensed under the Open Government Data Austria license (CC-BY 4.0).</p>"
+ "<h3>Authors:</h3><p>Adam Celarek, Lucas Dworschak, Gerald Kimmersdorfer, Jakob Lindner<p>")
+ "<h3>Authors:</h3><p>Adam Celarek, Lucas Dworschak, Gerald Kimmersdorfer, Jakob Lindner</p>"
+ "<h3>Impressum:</h3><p>Adam Celarek<br />Hartmanngasse 12/22<br />1050 Wien<br />Österreich / Austria</p>")
}
}
}
Expand Down
44 changes: 30 additions & 14 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ qt_add_executable(alpineapp
timing/TimerFrontendObject.h timing/TimerFrontendObject.cpp
)



qt_add_qml_module(alpineapp
URI app
VERSION 1.0
Expand All @@ -44,7 +46,6 @@ qt_add_qml_module(alpineapp
SearchResults.qml
Settings.qml
Coordinates.qml
StatsWindow.qml
GeneralSettings.qml
GlSettings.qml
FloatingActionButtonGroup.qml
Expand All @@ -62,6 +63,11 @@ qt_add_qml_module(alpineapp
components/DatePicker.qml
components/DateMonthTablePicker.qml
components/FloatingActionButton.qml
components/FluxColor/AngleWheel.qml
components/FluxColor/ColorChooser.qml
components/FluxColor/HueRing.qml
components/FluxColor/HueWheel.qml
components/FluxColor/WheelArea.qml
RESOURCES
icons/mascot.jpg
icons/menu.svg
Expand All @@ -85,6 +91,10 @@ qt_add_qml_module(alpineapp
icons/presets/basic.png
icons/presets/shaded.png
icons/presets/snow.png
icons/needle_head_down.svg
icons/logo_type_horizontal.svg
icons/logo_type_vertical.svg
icons/logo_type_horizontal_short.svg

)

Expand All @@ -103,27 +113,33 @@ qt_add_resources(alpineapp "fonts"
BASE ${alpineapp_fonts_SOURCE_DIR}/SourceSans/
PREFIX "/fonts"
FILES
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-BlackIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-BoldIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-ExtraLightIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-It.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Light.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Medium.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-SemiboldIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Black.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-BlackIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-BoldIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-ExtraLightIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-It.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Light.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Medium.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-SemiboldIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Black.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Bold.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-ExtraLight.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-LightIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-MediumIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-ExtraLight.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-LightIt.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-MediumIt.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Regular.ttf
${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Semibold.ttf
# ${alpineapp_fonts_SOURCE_DIR}/SourceSans/SourceSans3-Semibold.ttf
)


set_target_properties(alpineapp PROPERTIES
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
)
target_link_libraries(alpineapp PUBLIC nucleus gl_engine Qt::Quick Qt::QuickControls2 Qt::Charts)
target_link_libraries(alpineapp PUBLIC gl_engine Qt::Quick Qt::QuickControls2)
if (ALP_ENABLE_DEBUG_GUI)
message(WARNING building alpine app with debug gui)
qt_target_qml_sources(alpineapp QML_FILES StatsWindow.qml)
target_link_libraries(alpineapp PUBLIC Qt::Charts Qt::Widgets)
target_compile_definitions(alpineapp PUBLIC ALP_ENABLE_DEBUG_GUI)
endif()
if (ALP_ENABLE_POSITIONING)
target_link_libraries(alpineapp PUBLIC Qt::Positioning)
target_compile_definitions(alpineapp PUBLIC "ALP_ENABLE_GNSS")
Expand Down
12 changes: 6 additions & 6 deletions app/GlSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ SettingsPanel {
normal_mode.currentIndex = conf.normal_mode;
height_lines_enabled.checked = conf.height_lines_enabled;
phong_enabled.checked = conf.phong_enabled;
sun_light_color.color = Qt.rgba(conf.sun_light.x, conf.sun_light.y, conf.sun_light.z, conf.sun_light.w);
amb_light_color.color = Qt.rgba(conf.amb_light.x, conf.amb_light.y, conf.amb_light.z, conf.amb_light.w);
material_color.color = Qt.rgba(conf.material_color.x, conf.material_color.y, conf.material_color.z, conf.material_color.w);
sun_light_color.selectedColour = Qt.rgba(conf.sun_light.x, conf.sun_light.y, conf.sun_light.z, conf.sun_light.w);
amb_light_color.selectedColour = Qt.rgba(conf.amb_light.x, conf.amb_light.y, conf.amb_light.z, conf.amb_light.w);
material_color.selectedColour = Qt.rgba(conf.material_color.x, conf.material_color.y, conf.material_color.z, conf.material_color.w);
material_light_response.vector = conf.material_light_response;
ssao_enabled.checked = conf.ssao_enabled;
ssao_kernel.value = conf.ssao_kernel;
Expand Down Expand Up @@ -203,13 +203,13 @@ SettingsPanel {
Label { text: "Dir.-Light:" }
ColorPicker {
id: sun_light_color;
onColorChanged: map.shared_config.sun_light = Qt.vector4d(color.r, color.g, color.b, color.a);
onSelectedColourChanged: map.shared_config.sun_light = Qt.vector4d(selectedColour.r, selectedColour.g, selectedColour.b, selectedColour.a);
}

Label { text: "Amb.-Light:" }
ColorPicker {
id: amb_light_color;
onColorChanged: map.shared_config.amb_light = Qt.vector4d(color.r, color.g, color.b, color.a);
onSelectedColourChanged: map.shared_config.amb_light = Qt.vector4d(selectedColour.r, selectedColour.g, selectedColour.b, selectedColour.a);
}

Label { text: "Light-Direction:" }
Expand All @@ -227,7 +227,7 @@ SettingsPanel {
Label { text: "Mat.-Color:" }
ColorPicker {
id: material_color;
onColorChanged: map.shared_config.material_color = Qt.vector4d(color.r, color.g, color.b, color.a);
onSelectedColourChanged: map.shared_config.material_color = Qt.vector4d(selectedColour.r, selectedColour.g, selectedColour.b, selectedColour.a);
}

Label { text: "Light-Response:" }
Expand Down
11 changes: 9 additions & 2 deletions app/HotReloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "HotReloader.h"

#include <QDirIterator>
#include <QFileSystemWatcher>
#include <QQmlApplicationEngine>

Expand All @@ -29,9 +30,15 @@ HotReloader::HotReloader(QQmlApplicationEngine* engine, QString directory, QObje
directory.replace("file:/", "");
m_watcher->addPath(directory);
qDebug("watching %s", directory.toStdString().c_str());
QDirIterator it(directory, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
while (it.hasNext()) {
const auto current_dir = it.next();
m_watcher->addPath(current_dir);
qDebug("watching %s", current_dir.toStdString().c_str());
}

connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString&) {
qDebug("watched_source_changed");
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString& path) {
qDebug("path updated: %s", path.toStdString().c_str());
emit watched_source_changed();
});
}
Expand Down
Loading

0 comments on commit 8e8cdc0

Please sign in to comment.