diff options
author | David Athay <ko2fan@gmail.com> | 2024-04-14 23:00:57 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2024-04-14 23:00:57 +0100 |
commit | e235ab70bd1a41df8da06bf8e8913f04d2bb6465 (patch) | |
tree | d4257f774c4b76e0725d2e9a8d831547886f44f0 | |
parent | 4e227366facd1c05abf51d552372e4721a31ff46 (diff) | |
parent | 4a730fa0b08c68fc01f35b79a43fdd72411f2b83 (diff) | |
download | mana-e235ab70bd1a41df8da06bf8e8913f04d2bb6465.tar.gz mana-e235ab70bd1a41df8da06bf8e8913f04d2bb6465.tar.bz2 mana-e235ab70bd1a41df8da06bf8e8913f04d2bb6465.tar.xz mana-e235ab70bd1a41df8da06bf8e8913f04d2bb6465.zip |
Merge remote-tracking branch 'origin/master' into online-player-list
-rw-r--r-- | .github/workflows/snap.yml | 18 | ||||
-rw-r--r-- | .gitlab-ci.yml | 12 | ||||
-rw-r--r-- | CMakeLists.txt | 16 | ||||
-rw-r--r-- | po/CMakeLists.txt | 2 | ||||
-rw-r--r-- | snap/snapcraft.yaml | 59 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/client.cpp | 3 | ||||
-rw-r--r-- | src/gui/gui.cpp | 11 |
8 files changed, 112 insertions, 19 deletions
diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml new file mode 100644 index 00000000..8ce2750b --- /dev/null +++ b/.github/workflows/snap.yml @@ -0,0 +1,18 @@ +on: push + +jobs: + snap: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: snapcore/action-build@v1 + id: snapcraft + - uses: actions/upload-artifact@v4 + if: always() + with: + name: snapcraft.log + path: '/home/runner/.local/state/snapcraft/log/*.log' + - uses: actions/upload-artifact@v4 + with: + name: mana_amd64.snap + path: ${{ steps.snapcraft.outputs.snap }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0cbe67e0..b2fae39e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,11 +8,19 @@ ubuntu-build: - UBUNTU_VERSION: "20.04" - UBUNTU_VERSION: "22.04" image: ubuntu:$UBUNTU_VERSION + cache: + paths: + - ccache + before_script: + - export CCACHE_BASEDIR="$PWD" + - export CCACHE_DIR="$PWD/ccache" + - export CCACHE_COMPILERCHECK=content script: - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y build-essential + ccache cmake gettext libcurl4-openssl-dev @@ -26,8 +34,10 @@ ubuntu-build: libsdl2-ttf-dev libxml2-dev ninja-build - - cmake -G Ninja -B build . + - ccache --zero-stats || true + - cmake -G Ninja -B build . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - cmake --build build + - ccache --show-stats macos-build: stage: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 9da0ca6b..f6782168 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) # where to look for cmake modules SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) +include(GNUInstallDirs) + FIND_PACKAGE(Gettext) OPTION(WITH_OPENGL "Enable OpenGL support" ON) @@ -31,12 +33,10 @@ OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON) IF (WIN32) SET(PKG_DATADIR ".") - SET(LOCALEDIR "share/locale") SET(PKG_BINDIR ".") ELSE (WIN32) - SET(PKG_DATADIR ${CMAKE_INSTALL_PREFIX}/share/mana CACHE PATH "Mana datadir") - SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) - SET(PKG_BINDIR ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "Mana bindir") + SET(PKG_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana CACHE PATH "Mana datadir") + SET(PKG_BINDIR ${CMAKE_INSTALL_BINDIR}) ENDIF (WIN32) ADD_SUBDIRECTORY(data) @@ -66,10 +66,10 @@ IF (GETTEXT_FOUND AND ENABLE_NLS) ENDIF() If(UNIX) - INSTALL(FILES org.manasource.Mana.desktop DESTINATION share/applications) - INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION share/metainfo) - INSTALL(FILES data/icons/mana.png DESTINATION share/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png) - INSTALL(FILES data/icons/mana.svg DESTINATION share/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg) + INSTALL(FILES org.manasource.Mana.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) + INSTALL(FILES data/icons/mana.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png) + INSTALL(FILES data/icons/mana.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg) ENDIF() SET(CPACK_PACKAGE_VENDOR "Mana Development Team") diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 08abb6bf..f2ae4b93 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -30,7 +30,7 @@ MACRO(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) DEPENDS ${_absPotFile} ${_absFile} ) - INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) ENDFOREACH (_currentPoFile) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..49ae3e0b --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,59 @@ +name: mana +version: git +adopt-info: mana +base: core22 + +grade: stable +confinement: strict + +assumes: + - command-chain + +apps: + mana: + command: usr/bin/mana + command-chain: + - snap/command-chain/desktop-launch + desktop: usr/share/applications/org.manasource.Mana.desktop + extensions: [gnome] + plugs: + - audio-playback + - home + - network + - opengl + +layout: + /usr/share/mana: + symlink: $SNAP/usr/share/mana + +parts: + mana: + plugin: cmake + cmake-parameters: + - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_INSTALL_PREFIX=/usr + parse-info: + - usr/share/metainfo/org.manasource.Mana.metainfo.xml + source: . + build-packages: + - build-essential + - gettext + - libcurl4-openssl-dev + - libguichan-dev + - libphysfs-dev + - libpng-dev + - libsdl2-dev + - libsdl2-image-dev + - libsdl2-mixer-dev + - libsdl2-net-dev + - libsdl2-ttf-dev + - libxml2-dev + stage-packages: + - libcurl4 + - libguichan-0.8.1-1v5 + - libphysfs1 + - libsdl2-2.0-0 + - libsdl2-image-2.0-0 + - libsdl2-mixer-2.0-0 + - libsdl2-net-2.0-0 + - libsdl2-ttf-2.0-0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc2b6ee3..5e5b4078 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,14 @@ IF (CMAKE_COMPILER_IS_GNUCXX) ENDIF() SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"") -SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") -SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") + +IF (WIN32) + SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") + SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_LOCALEDIR}/\\\"") +ELSE() + SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_FULL_DATAROOTDIR}/mana/\\\"") + SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_FULL_LOCALEDIR}/\\\"") +ENDIF() IF (ENABLE_MANASERV) INCLUDE_DIRECTORIES("../libs/enet/include") diff --git a/src/client.cpp b/src/client.cpp index 6fd73d4f..6e12a579 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -274,12 +274,11 @@ Client::Client(const Options &options): } CFRelease(resourcesURL); strncat(path, "/data", PATH_MAX - 1); - resman->addToSearchPath(path, false); mPackageDir = path; #else - resman->addToSearchPath(PKG_DATADIR "data", false); mPackageDir = PKG_DATADIR "data"; #endif + resman->addToSearchPath(mPackageDir, false); resman->addToSearchPath("data", false); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 93037db2..92dab954 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -56,7 +56,7 @@ gcn::Font *monoFont = nullptr; bool Gui::debugDraw; Gui::Gui(Graphics *graphics) - : mCustomCursorScale(graphics->getScale()) + : mCustomCursorScale(Client::getVideo().settings().scale()) { logger->log("Initializing GUI..."); // Set graphics @@ -186,13 +186,14 @@ void Gui::event(Event::Channel channel, const Event &event) bool Gui::videoResized(int width, int height) { - const float scale = static_cast<Graphics*>(mGraphics)->getScale(); + const float graphicsScale = static_cast<Graphics*>(mGraphics)->getScale(); + const float userScale = Client::getVideo().settings().scale(); - TrueTypeFont::updateFontScale(scale); + TrueTypeFont::updateFontScale(graphicsScale); - if (mCustomCursorScale != scale) + if (mCustomCursorScale != userScale) { - mCustomCursorScale = scale; + mCustomCursorScale = userScale; loadCustomCursors(); updateCursor(); } |