diff --git a/.changelog b/.changelog index 2f7e6941c2..56cb66cc4d 100644 --- a/.changelog +++ b/.changelog @@ -1,3 +1,91 @@ +1.11.0-RC1 (2021-03-14) +------------------------------------------------------------------------ +Feature: Option to (dis-)allow hardware accelerated video drivers (#8819) +Feature: Option to set display refresh rate (#8813) +Feature: Allow custom width/height of screenshot and making heightmap screenshots via console (#8804) +Feature: Allow filtering on name in rail station window (#8706) +Feature: Setting for highest resolution of sprites to use (#8604) +Add: Make NewGRF Scanner / World Generation update smoother and make aborting it react faster (#8830) +Add: Malaysia Ringgit as Currency (#8783) +Add: "Engines only" filter in build train window (#8733) +Change: De-limit framerate window's framerate (#8772) +Change: Clarify what effect town interactions have (#8744) +Change: Don't show global goals in company goal windows (#8709) +Change: Recolour graph windows to brown (#8700) +Fix #8855: Bootstrap could result in an empty screen when bootstrap fails (#8856) +Fix #8851: Don't allow infinite "exec" depth in script, but limit to 10 deep (#8852) +Fix #8647: Incorrect drawing order of tram catenary sprites (#8843) +Fix #8711: Having gui_zoom lower than zoom_min causes a crash (#8835) +Fix #8810: "aircraft out of fuel" news shows the wrong place (#8832) +Fix #8833: Don't reload NewGRFs when we are shutting down (#8830) +Fix: Scale padding between elements the same as other padding (#8829) +Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer (#8822) +Fix #8784: Using Alt+Enter doesn't update the fullscreen toggle visibly (#8820) +Fix #8817: Keep NewGRF order for object class sorting (#8818) +Fix #8809: Crash when removing airport when hangar window open (#8815) +Fix #8799: Crash when Search Internet in Multiplayer (#8801) +Fix #8775: [Win32] Don't create the main window when Alt-Tabbing back into fullscreen (#8792) +Fix #8774: Black screenshots when using 40bpp-blitter (#8791) +Fix: [OSX] Hide dock when entering fullscreen (#8789) +Fix: Bootstrap fails to start on clean install (#8788) +Fix: Terraform limit acts random when maxing out per_64k_frames setting (#8782) +Fix: Max-value of fast-forward-speed-limit can be outside its storage size (#8769) + + +1.11.0-beta2 (2021-02-28) +------------------------------------------------------------------------ +Feature: Add setting to limit fast-forward speed (#8766) +Feature: Significant performance improvements to all video drivers (#8605, #8652, #8660, #8685, #8702, #8703, #8707, #8726, #8740) +Feature: Configurable display refresh-rate, default to 60fps (#8680) +Feature: Automatically upload releases to Steam (#8644) +Feature: Generic Linux builds (#8641) +Feature: [GS] Allow non-question type windows to have no buttons (#8638) +Feature: [macOS] ZIP build (#8614) +Feature: Object class selection string filtering (#8603) +Feature: 'Remove all industries' button in scenario editor (#8550) +Feature: Automatic UI and font zoom levels when supported by the OS (#8537) +Feature: [macOS] Render screen at native resolution by default for HiDPI screens (#8519) +Feature: OpenGL video driver (#7744) +Add: Indonesia Rupiah currency (#8616) +Change: Improve graph period markings (#8732) +Change: Make pathfinder account for maximum order speed, if set (#8722) +Change: Darken graph grid lines for legibility (#8690) +Change: Make order window hotkeys toggle for load & unload variants (#8669) +Change: Use a more specific error message when attempting to bulldoze your own HQ (#8667) +Change: Convert .md to .rtf for Windows/Mac packages (#8617) +Change: Move the 'tree placer algorithm' & 'road drive side' settings to the Settings window (#8566) +Change: Move town name generator selection to mapgen GUI (#8566) +Change: [macOS] Native font rendering (#8518) +Fix: Display of network lobby windows for different GUI sizes (#8765) +Fix: Don't desync if client leaves before you finish downloading map (#8755) +Fix: Allow estimating vehicle clone cost even if short on money (#8748) +Fix: Don't notify twice that a client left because of a timeout (#8746) +Fix: Vehicle cursor size did not account for the interface zoom level (#8739) +Fix #8123: Trams on half-tiles couldn't find depots (#8738) +Fix #8276: [NewGRF] Crash when an object's size was not set (#8719) +Fix #8349: Close depot vehicle list windows when closing the depot window (#8717) +Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits or lengths of tunnels/bridges (#8710) +Fix: Whole status bar instead of money widget refreshed on money change (#8692) +Fix: Unnecessary status bar redraws when there is no news to show (#8691) +Fix: New orders are non-stop by default (#8689) +Fix: Framerate window showed a slightly higher rate than actually measured (#8682) +Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681) +Fix #8625: Wrong ending year was displayed in highscore table (#8672) +Fix #8620: Scale spacing between date & news in history window according to font scaling (#8671) +Fix: [Win32] Set minimum resolution for timers to 1ms (#8660) +Fix: Mention our websites with https:// (instead of http://) (#8657) +Fix: [Emscripten] Open links in browser (#8655) +Fix: Don't crash when towns upgrade road tiles during expansion (#8651) +Fix #8029: [SDL2] Blank display when under Wayland (#8648) +Fix: Default Network Server List sorter put compatible servers in wrong order (#8626) +Fix: Use non-pulsating red highlight for coverage (#8622) +Fix: Center text and image in vehicle statusbar vertically (#8602) +Fix: Don't walk out of the map when trying to build tunnels (#8600) +Fix: Off-by-one error in desert/rainforest positioning at world gen (#8588) +Fix #8037: Crash when restarting AI that is controlling the same company as the player (#8587) +Fix: Stopped ships shouldn't block depots (#8578) + + 1.11.0-beta1 (2021-01-22) ------------------------------------------------------------------------ Feature: [GS] Ability to set some extra text in the industry window (#8576) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 8b9a160d96..1aa7e17ccb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -39,7 +39,7 @@ jobs: echo "::group::Build" echo "Running on $(nproc) cores" - make -j$(nproc) tools + cmake --build . -j $(nproc) --target tools echo "::endgroup::" - name: Install GCC problem matcher @@ -56,7 +56,7 @@ jobs: echo "::group::Build" echo "Running on $(nproc) cores" - emmake make -j$(nproc) + cmake --build . -j $(nproc) echo "::endgroup::" linux: @@ -66,10 +66,18 @@ jobs: fail-fast: false matrix: include: - - compiler: clang - cxxcompiler: clang++ - - compiler: gcc - cxxcompiler: g++ + - compiler: clang + cxxcompiler: clang++ + libsdl: libsdl2-dev + - compiler: gcc + cxxcompiler: g++ + libsdl: libsdl2-dev + - compiler: gcc + cxxcompiler: g++ + libsdl: libsdl1.2-dev + - compiler: gcc + cxxcompiler: g++ + extra-cmake-parameters: -DOPTION_DEDICATED=ON runs-on: ubuntu-20.04 env: @@ -88,12 +96,12 @@ jobs: echo "::group::Install dependencies" sudo apt-get install -y --no-install-recommends \ + liballegro4-dev \ libfontconfig-dev \ libicu-dev \ liblzma-dev \ liblzo2-dev \ - libsdl1.2-dev \ - libsdl2-dev \ + ${{ matrix.libsdl }} \ zlib1g-dev \ # EOF echo "::endgroup::" @@ -124,18 +132,18 @@ jobs: cd build echo "::group::CMake" - cmake .. + cmake .. ${{ matrix.extra-cmake-parameters }} echo "::endgroup::" echo "::group::Build" echo "Running on $(nproc) cores" - make -j$(nproc) + cmake --build . -j $(nproc) echo "::endgroup::" - name: Test run: | cd build - make -j$(nproc) test + ctest -j $(nproc) macos: name: Mac OS @@ -155,13 +163,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Prepare vcpkg (with cache) - uses: lukka/run-vcpkg@v6 + - name: Prepare cache key + id: key + run: | + echo "::set-output name=image::$ImageOS-$ImageVersion" + + - name: Enable vcpkg cache + uses: actions/cache@v2 with: - vcpkgDirectory: '/usr/local/share/vcpkg' - doNotUpdateVcpkg: true - vcpkgArguments: 'freetype liblzma lzo' - vcpkgTriplet: '${{ matrix.arch }}-osx' + path: /usr/local/share/vcpkg/installed + key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified + restore-keys: | + ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }} + + - name: Prepare vcpkg + run: | + vcpkg install --triplet=${{ matrix.arch }}-osx \ + liblzma \ + libpng \ + lzo \ + zlib \ + # EOF - name: Install OpenGFX run: | @@ -196,13 +218,13 @@ jobs: echo "::group::Build" echo "Running on $(sysctl -n hw.logicalcpu) cores" - make -j$(sysctl -n hw.logicalcpu) + cmake --build . -j $(sysctl -n hw.logicalcpu) echo "::endgroup::" - name: Test run: | cd build - make -j$(sysctl -n hw.logicalcpu) test + ctest -j $(sysctl -n hw.logicalcpu) windows: name: Windows @@ -210,35 +232,41 @@ jobs: strategy: fail-fast: false matrix: - include: - - arch: x86 - - arch: x64 + os: [windows-latest, windows-2016] + arch: [x86, x64] - runs-on: windows-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - # "restore-cache" which is done by "run-vcpkg" uses Windows tar. - # A git clone on windows marks a few files as read-only; when Windows tar - # tries to extract the cache over this folder, it fails, despite the files - # being identical. This failure shows up as an warning in the logs. We - # avoid this by simply removing the read-only mark from the git folder. - # In other words: this is a hack! - # See: https://github.com/lukka/run-vcpkg/issues/61 - - name: Remove read-only flag from vcpkg git folder + - name: Prepare cache key + id: key shell: powershell run: | - attrib -r "c:\vcpkg\.git\*.*" /s + # Work around caching failure with GNU tar + New-Item -Type Junction -Path vcpkg -Target c:\vcpkg - - name: Prepare vcpkg (with cache) - uses: lukka/run-vcpkg@v6 + Write-Output "::set-output name=image::$env:ImageOS-$env:ImageVersion" + + - name: Enable vcpkg cache + uses: actions/cache@v2 with: - vcpkgDirectory: 'c:/vcpkg' - doNotUpdateVcpkg: true - vcpkgArguments: 'liblzma libpng lzo zlib' - vcpkgTriplet: '${{ matrix.arch }}-windows-static' + path: vcpkg/installed + key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified + restore-keys: | + ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }} + + - name: Prepare vcpkg + shell: bash + run: | + vcpkg install --triplet=${{ matrix.arch }}-windows-static \ + liblzma \ + libpng \ + lzo \ + zlib \ + # EOF - name: Install OpenGFX shell: bash @@ -259,16 +287,31 @@ jobs: - name: Install MSVC problem matcher uses: ammaraskar/msvc-problem-matcher@master - - name: Build - uses: lukka/run-cmake@v3 + - name: Configure developer command prompt for ${{ matrix.arch }} + uses: ilammy/msvc-dev-cmd@v1 with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - useVcpkgToolchainFile: true - buildDirectory: '${{ github.workspace }}/build' - cmakeAppendedArgs: ' -GNinja' + arch: ${{ matrix.arch }} + + - name: Build + shell: bash + run: | + mkdir build + cd build + + echo "::group::CMake" + cmake .. \ + -GNinja \ + -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ + -DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \ + # EOF + echo "::endgroup::" + + echo "::group::Build" + cmake --build . + echo "::endgroup::" - name: Test shell: bash run: | cd ${GITHUB_WORKSPACE}/build - ctest -C Debug + ctest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81d3cd5b91..62f5498a2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -230,7 +230,7 @@ jobs: echo "::endgroup::" echo "::group::Build" - make docs + cmake --build . --target docs echo "::endgroup::" - name: Create bundles @@ -265,7 +265,104 @@ jobs: retention-days: 5 linux: - name: Linux + name: Linux (Generic) + needs: source + + runs-on: ubuntu-20.04 + container: + # manylinux2014 is based on CentOS 7, but already has a lot of things + # installed and preconfigured. It makes it easier to build OpenTTD. + image: quay.io/pypa/manylinux2014_x86_64 + + steps: + - name: Download source + uses: actions/download-artifact@v2 + with: + name: internal-source + + - name: Unpack source + run: | + tar -xf source.tar.gz --strip-components=1 + + - name: Install dependencies + run: | + echo "::group::Install dependencies" + yum install -y \ + fontconfig-devel \ + freetype-devel \ + libicu-devel \ + libpng-devel \ + libpng-devel \ + lzo-devel \ + SDL2-devel \ + wget \ + xz-devel \ + zlib-devel \ + # EOF + echo "::endgroup::" + + # The yum variant of fluidsynth depends on all possible audio drivers, + # like jack, ALSA, pulseaudio, etc. This is not really useful for us, + # as we route the output of fluidsynth back via our sound driver, and + # as such do not use these audio driver outputs at all. So instead, + # we compile fluidsynth ourselves, with as little dependencies as + # possible. This currently means it picks up SDL2, but this is fine, + # as we need SDL2 anyway. + echo "::group::Install fluidsynth" + wget https://github.com/FluidSynth/fluidsynth/archive/v2.1.6.tar.gz + tar xf v2.1.6.tar.gz + ( + cd fluidsynth-2.1.6 + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr + cmake --build . -j $(nproc) + cmake --install . + ) + echo "::endgroup::" + + - name: Install GCC problem matcher + uses: ammaraskar/gcc-problem-matcher@master + + - name: Build + run: | + mkdir -p build + cd build + + echo "::group::CMake" + cmake ${GITHUB_WORKSPACE} \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DOPTION_PACKAGE_DEPENDENCIES=ON \ + # EOF + echo "::endgroup::" + + echo "::group::Build" + echo "Running on $(nproc) cores" + cmake --build . -j $(nproc) + echo "::endgroup::" + + - name: Create bundles + run: | + cd ${GITHUB_WORKSPACE}/build + echo "::group::Run CPack" + cpack + echo "::endgroup::" + + echo "::group::Cleanup" + # Remove the sha256 files CPack generates; we will do this ourself at + # the end of this workflow. + rm -f bundles/*.sha256 + echo "::endgroup::" + + - name: Store bundles + uses: actions/upload-artifact@v2 + with: + name: openttd-linux-generic + path: build/bundles + retention-days: 5 + + linux-distro: + name: Linux (Distros) needs: source if: needs.source.outputs.is_tag == 'true' @@ -317,7 +414,6 @@ jobs: liblzma-dev \ liblzo2-dev \ libsdl2-dev \ - libxdg-basedir-dev \ lsb-release \ zlib1g-dev \ # EOF @@ -342,12 +438,22 @@ jobs: echo "::group::Build" echo "Running on $(nproc) cores" - make -j$(nproc) package + # Ubuntu 18.04 cmake does not support -j so we pass the option to the native tool + cmake --build . -- -j $(nproc) echo "::endgroup::" + - name: Create bundles + run: | + cd ${GITHUB_WORKSPACE}/build + echo "::group::Run CPack" + cpack + echo "::endgroup::" + + echo "::group::Cleanup" # Remove the sha256 files CPack generates; we will do this ourself at # the end of this workflow. rm -f bundles/*.sha256 + echo "::endgroup::" - name: Store bundles uses: actions/upload-artifact@v2 @@ -374,21 +480,42 @@ jobs: run: | tar -xf source.tar.gz --strip-components=1 - # The following step can be removed when the build VM is updated with a revision of - # vcpkg dating from roughly 01/01/2021 or later. At that point, `doNotUpdateVcpkg` - # can be set to `true` and the `vcpkgGitCommitId` can be removed. - - name: Update vcpkg + - name: Install dependencies + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 run: | - cd /usr/local/share/vcpkg - git fetch --unshallow + brew install pandoc - - name: Prepare vcpkg (with cache) - uses: lukka/run-vcpkg@v6 + - name: Prepare cache key + id: key + run: | + echo "::set-output name=image::$ImageOS-$ImageVersion" + + - name: Enable vcpkg cache + uses: actions/cache@v2 with: - vcpkgDirectory: '/usr/local/share/vcpkg' - doNotUpdateVcpkg: false - vcpkgGitCommitId: 2a42024b53ebb512fb5dd63c523338bf26c8489c - vcpkgArguments: 'freetype:x64-osx liblzma:x64-osx lzo:x64-osx freetype:arm64-osx liblzma:arm64-osx lzo:arm64-osx' + path: /usr/local/share/vcpkg/installed + key: ${{ steps.key.outputs.image }}-vcpkg-release-0 # Increase the number whenever dependencies are modified + restore-keys: | + ${{ steps.key.outputs.image }}-vcpkg-release + ${{ steps.key.outputs.image }}-vcpkg-x64 + + - name: Prepare vcpkg + run: | + vcpkg install \ + liblzma:x64-osx \ + liblzma:arm64-osx \ + libpng:x64-osx \ + libpng:arm64-osx \ + lzo:x64-osx \ + lzo:arm64-osx \ + zlib:x64-osx \ + zlib:arm64-osx \ + # EOF + + - name: Install GCC problem matcher + uses: ammaraskar/gcc-problem-matcher@master - name: Build tools run: | @@ -404,12 +531,9 @@ jobs: echo "::group::Build tools" echo "Running on $(sysctl -n hw.logicalcpu) cores" - make -j$(sysctl -n hw.logicalcpu) tools + cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools echo "::endgroup::" - - name: Install GCC problem matcher - uses: ammaraskar/gcc-problem-matcher@master - - name: Import code signing certificates uses: Apple-Actions/import-codesign-certs@v1 with: @@ -437,7 +561,7 @@ jobs: echo "::group::Build" echo "Running on $(sysctl -n hw.logicalcpu) cores" - make -j$(sysctl -n hw.logicalcpu) + cmake --build . -j $(sysctl -n hw.logicalcpu) echo "::endgroup::" - name: Build x64 @@ -460,25 +584,28 @@ jobs: echo "::group::Build" echo "Running on $(sysctl -n hw.logicalcpu) cores" - make -j$(sysctl -n hw.logicalcpu) + cmake --build . -j $(sysctl -n hw.logicalcpu) echo "::endgroup::" - - name: Build package + - name: Create bundles run: | cd build-x64 + echo "::group::Create universal binary" # Combine the `openttd` binaries from each build into a single file lipo -create -output openttd-universal ../build-*/openttd mv openttd-universal openttd - - echo "::group::Build" - echo "Running on $(sysctl -n hw.logicalcpu) cores" - make -j$(sysctl -n hw.logicalcpu) package echo "::endgroup::" + echo "::group::Run CPack" + cpack + echo "::endgroup::" + + echo "::group::Cleanup" # Remove the sha256 files CPack generates; we will do this ourself at # the end of this workflow. rm -f bundles/*.sha256 + echo "::endgroup::" - name: Install gon env: @@ -496,6 +623,29 @@ jobs: cd build-x64 ../os/macosx/notarize.sh + - name: Build zip + run: | + cd build-x64 + + pushd _CPack_Packages/*/Bundle/openttd-*/ + + # Remove the Applications symlink from the staging folder + rm -f Applications + + # Remove the original dmg built by CPack to avoid a conflict when resolving + # the zip_filename variable below + rm -f ../*.dmg + + zip_filename=(../openttd-*) + + # Package up the existing, notarised .app into a zip file + zip -r -9 ${zip_filename}.zip OpenTTD.app + + popd + + # Now move it into place to be uploaded + mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/ + - name: Store bundles uses: actions/upload-artifact@v2 with: @@ -512,8 +662,11 @@ jobs: matrix: include: - arch: x86 + host: x86 - arch: x64 + host: x64 - arch: arm64 + host: x64_arm64 runs-on: windows-latest @@ -528,55 +681,111 @@ jobs: run: | tar -xf source.tar.gz --strip-components=1 - # "restore-cache" which is done by "run-vcpkg" uses Windows tar. - # A git clone on windows marks a few files as read-only; when Windows tar - # tries to extract the cache over this folder, it fails, despite the files - # being identical. This failure shows up as an warning in the logs. We - # avoid this by simply removing the read-only mark from the git folder. - # In other words: this is a hack! - # See: https://github.com/lukka/run-vcpkg/issues/61 - - name: Remove read-only flag from vcpkg git folder + - name: Install dependencies + shell: bash + run: | + choco install pandoc + + - name: Prepare cache key + id: key shell: powershell run: | - attrib -r "c:\vcpkg\.git\*.*" /s + # Work around caching failure with GNU tar + New-Item -Type Junction -Path vcpkg -Target c:\vcpkg - - name: Prepare vcpkg (with cache) - uses: lukka/run-vcpkg@v6 - with: - vcpkgDirectory: 'c:/vcpkg' - doNotUpdateVcpkg: true - vcpkgArguments: 'liblzma libpng lzo zlib' - vcpkgTriplet: '${{ matrix.arch }}-windows-static' + Write-Output "::set-output name=image::$env:ImageOS-$env:ImageVersion" - - name: Build tools - uses: lukka/run-cmake@v3 + - name: Enable vcpkg cache + uses: actions/cache@v2 with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - useVcpkgToolchainFile: false - buildDirectory: '${{ github.workspace }}/build-host' - buildWithCMakeArgs: '--target tools' - cmakeAppendedArgs: ' -GNinja -DOPTION_TOOLS_ONLY=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo' + path: vcpkg/installed + key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified + restore-keys: | + ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }} + + - name: Prepare vcpkg + shell: bash + run: | + vcpkg install --triplet=${{ matrix.arch }}-windows-static \ + liblzma \ + libpng \ + lzo \ + zlib \ + # EOF - name: Install MSVC problem matcher uses: ammaraskar/msvc-problem-matcher@master + - name: Configure developer command prompt for tools + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Build tools + shell: bash + run: | + mkdir build-host + cd build-host + + echo "::group::CMake" + cmake ${GITHUB_WORKSPACE} \ + -GNinja \ + -DOPTION_TOOLS_ONLY=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + # EOF + echo "::endgroup::" + + echo "::group::Build" + cmake --build . --target tools + echo "::endgroup::" + + - name: Configure developer command prompt for ${{ matrix.arch }} + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.host }} + - name: Build (with installer) if: needs.source.outputs.is_tag == 'true' - uses: lukka/run-cmake@v3 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - useVcpkgToolchainFile: true - buildDirectory: '${{ github.workspace }}/build' - cmakeAppendedArgs: ' -GNinja -DOPTION_USE_NSIS=ON -DHOST_BINARY_DIR=${{ github.workspace }}/build-host -DCMAKE_BUILD_TYPE=RelWithDebInfo' + shell: bash + run: | + mkdir build + cd build + + echo "::group::CMake" + cmake ${GITHUB_WORKSPACE} \ + -GNinja \ + -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ + -DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \ + -DOPTION_USE_NSIS=ON \ + -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + # EOF + echo "::endgroup::" + + echo "::group::Build" + cmake --build . + echo "::endgroup::" - name: Build (without installer) if: needs.source.outputs.is_tag != 'true' - uses: lukka/run-cmake@v3 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - useVcpkgToolchainFile: true - buildDirectory: '${{ github.workspace }}/build' - cmakeAppendedArgs: ' -GNinja -DHOST_BINARY_DIR=${{ github.workspace }}/build-host -DCMAKE_BUILD_TYPE=RelWithDebInfo' + shell: bash + run: | + mkdir build + cd build + + echo "::group::CMake" + cmake ${GITHUB_WORKSPACE} \ + -GNinja \ + -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ + -DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \ + -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + # EOF + echo "::endgroup::" + + echo "::group::Build" + cmake --build . + echo "::endgroup::" - name: Create bundles shell: bash @@ -606,11 +815,12 @@ jobs: retention-days: 5 upload: - name: Upload + name: Upload (AWS) needs: - source - docs - linux + - linux-distro - macos - windows @@ -619,7 +829,7 @@ jobs: # "always()" is important here, it is the keyword to use to stop skipping # this job if any dependency is skipped. It looks a bit silly, but it is # how GitHub Actions work ;) - if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && (needs.linux.result == 'success' || needs.linux.result == 'skipped') && needs.macos.result == 'success' && needs.windows.result == 'success' + if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && needs.linux.result == 'success' && (needs.linux-distro.result == 'success' || needs.linux-distro.result == 'skipped') && needs.macos.result == 'success' && needs.windows.result == 'success' runs-on: ubuntu-20.04 @@ -654,7 +864,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - name: Trigger 'New OpenTTD release' uses: peter-evans/repository-dispatch@v1 @@ -663,3 +873,80 @@ jobs: repository: OpenTTD/workflows event-type: ${{ needs.source.outputs.trigger_type }} client-payload: '{"version": "${{ needs.source.outputs.version }}", "folder": "${{ needs.source.outputs.folder }}"}' + + upload-steam: + name: Upload (Steam) + needs: + - source + - linux + - macos + - windows + + if: needs.source.outputs.trigger_type == 'new-master' || needs.source.outputs.trigger_type == 'new-tag' + + runs-on: ubuntu-20.04 + + steps: + - name: Download all bundles + uses: actions/download-artifact@v2 + + - name: Setup steamcmd + uses: CyberAndrii/setup-steamcmd@v1 + + - name: Generate Steam auth code + id: steam-totp + uses: CyberAndrii/steam-totp@v1 + with: + shared_secret: ${{ secrets.STEAM_SHARED_SECRET }} + + - name: Upload to Steam + run: | + echo "::group::Extracting source" + mkdir source + ( + cd source + tar -xf ../internal-source/source.tar.gz --strip-components=1 + ) + echo "::endgroup::" + + mkdir steam + ( + cd steam + + echo "::group::Prepare Win32" + unzip ../openttd-windows-x86/openttd-*-windows-win32.zip + mv openttd-*-windows-win32 steam-win32 + echo "::endgroup::" + + echo "::group::Prepare Win64" + unzip ../openttd-windows-x64/openttd-*-windows-win64.zip + mv openttd-*-windows-win64 steam-win64 + echo "::endgroup::" + + echo "::group::Prepare macOS" + mkdir steam-macos + ( + cd steam-macos + unzip ../../openttd-macos-universal/openttd-*-macos-universal.zip + ) + echo "::endgroup::" + + echo "::group::Prepare Linux" + tar xvf ../openttd-linux-generic/openttd-*-linux-generic-amd64.tar.xz + mv openttd-*-linux-generic-amd64 steam-linux + echo "::endgroup::" + + echo "::group::Preparing build file" + if [ "${{ needs.source.outputs.trigger_type }}" = "new-tag" ]; then + BRANCH="testing" + else + BRANCH="nightly" + fi + cat ../source/os/steam/release.vdf | sed 's/@@DESCRIPTION@@/openttd-${{ needs.source.outputs.version }}/;s/@@BRANCH@@/'${BRANCH}'/' > release.vdf + cat release.vdf + echo "::endgroup::" + + echo "::group::Upload to Steam" + steamcmd +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} ${{ steps.steam-totp.outputs.code }} +run_app_build $(pwd)/release.vdf +quit + echo "::endgroup::" + ) diff --git a/.ottdrev b/.ottdrev index 5ae0733bbb..89d91767f4 100644 --- a/.ottdrev +++ b/.ottdrev @@ -1 +1 @@ -1.11.0-beta1 20210122 0 a252679a121a3e989ba76fae29007151fdac26a1 1 1 2021 +1.11.0-RC1 20210314 0 ad256b5c1d50838beaeaf73a952aab257dab90b3 1 1 2021 diff --git a/.release_date b/.release_date index bfa3fff97b..3e4a60e0b9 100644 --- a/.release_date +++ b/.release_date @@ -1 +1 @@ -2021-01-22 10:21 UTC +2021-03-14 20:54 UTC diff --git a/.version b/.version index 5caf72196c..45d6eb9e15 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.11.0-beta1 +1.11.0-RC1 diff --git a/CMakeLists.txt b/CMakeLists.txt index d273937a31..c5f1d11b50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.9) if(NOT BINARY_NAME) set(BINARY_NAME openttd) @@ -23,10 +23,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) # Use GNUInstallDirs to allow customisation -# but set our own default data dir +# but set our own default data and bin dir if(NOT CMAKE_INSTALL_DATADIR) set(CMAKE_INSTALL_DATADIR "share/games") endif() +if(NOT CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "games") +endif() include(GNUInstallDirs) include(Options) @@ -101,6 +104,11 @@ if(OPTION_TOOLS_ONLY) return() endif() +if(APPLE) + # Avoid searching for headers in Frameworks, and libraries in LIBDIR. + set(CMAKE_FIND_FRAMEWORK LAST) +endif() + # Prefer -pthread over -lpthread, which is often the better option of the two. set(CMAKE_THREAD_PREFER_PTHREAD YES) # Make sure we have Threads available. @@ -111,25 +119,33 @@ find_package(LibLZMA) find_package(LZO) find_package(PNG) -if(NOT WIN32) - find_package(Allegro) - find_package(Freetype) - if(NOT APPLE) - find_package(SDL2) - if(NOT SDL2_FOUND) - find_package(SDL) +if(NOT OPTION_DEDICATED) + if(NOT WIN32) + find_package(Allegro) + if(NOT APPLE) + find_package(Freetype) + find_package(SDL2) + if(NOT SDL2_FOUND) + find_package(SDL) + endif() + find_package(Fluidsynth) + find_package(Fontconfig) + find_package(ICU OPTIONAL_COMPONENTS i18n lx) endif() - find_package(Fluidsynth) - find_package(Fontconfig) - find_package(ICU OPTIONAL_COMPONENTS i18n lx) - else() - find_package(Iconv) - - find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox) - find_library(AUDIOUNIT_LIBRARY AudioUnit) - find_library(COCOA_LIBRARY Cocoa) endif() endif() +if(APPLE) + find_package(Iconv) + + find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox) + find_library(AUDIOUNIT_LIBRARY AudioUnit) + find_library(COCOA_LIBRARY Cocoa) + find_library(QUARTZCORE_LIBRARY QuartzCore) +endif() + +if(NOT EMSCRIPTEN AND NOT OPTION_DEDICATED) + find_package(OpenGL COMPONENTS OpenGL) +endif() if(MSVC) find_package(Editbin REQUIRED) @@ -140,19 +156,14 @@ find_package(Xaudio2) find_package(Grfcodec) -# IPO is only properly supported from CMake 3.9. Despite the fact we are -# CMake 3.5, still enable IPO if we detect we are 3.9+. -if(POLICY CMP0069) - cmake_policy(SET CMP0069 NEW) - include(CheckIPOSupported) - check_ipo_supported(RESULT IPO_FOUND) -endif() +include(CheckIPOSupported) +check_ipo_supported(RESULT IPO_FOUND) show_options() if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED) - if(NOT SDL_FOUND AND NOT SDL2_FOUND) - message(FATAL_ERROR "SDL or SDL2 is required for this platform") + if(NOT SDL_FOUND AND NOT SDL2_FOUND AND NOT ALLEGRO_FOUND) + message(FATAL_ERROR "SDL, SDL2 or Allegro is required for this platform") endif() endif() if(APPLE) @@ -165,6 +176,30 @@ if(APPLE) if(NOT COCOA_LIBRARY) message(FATAL_ERROR "Cocoa is required for this platform") endif() + if(NOT QUARTZCORE_LIBRARY) + message(FATAL_ERROR "QuartzCore is required for this platform") + endif() +endif() + +if(OPTION_PACKAGE_DEPENDENCIES) + if(NOT UNIX) + message(FATAL_ERROR "Can only package dependencies on Linux") + endif() + if(OPTION_INSTALL_FHS) + message(FATAL_ERROR "Cannot install in FHS folders when we are packaging dependencies") + endif() + if(${CMAKE_VERSION} VERSION_LESS "3.16.0") + message(FATAL_ERROR "OPTION_PACKAGE_DEPENDENCIES can only work with CMake 3.16+; you are using ${CMAKE_VERSION}") + endif() + + # If we are packaging dependencies, we do two things: + # 1) set the RPATH to include $ORIGIN/lib; $ORIGIN (that literal string) + # is a Linux indicator for "path where application is". In CMake, we + # have to do this before add_executable() is executed. + # 2) copy the libraries that we compile against to the "lib" folder. + # This is done in InstallAndPackage.cmake. + set(CMAKE_INSTALL_RPATH "\$ORIGIN/lib") + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) endif() include(SourceList) @@ -180,8 +215,13 @@ add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES}) set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}") # All other files are added via target_sources() +if(MSVC) + # Add DPI manifest to project; other WIN32 targets get this via ottdres.rc + target_sources(openttd PRIVATE "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest") +endif() + add_subdirectory(${CMAKE_SOURCE_DIR}/src) -add_subdirectory(${CMAKE_SOURCE_DIR}/media/baseset) +add_subdirectory(${CMAKE_SOURCE_DIR}/media) add_dependencies(openttd find_version) @@ -189,6 +229,7 @@ add_dependencies(openttd target_link_libraries(openttd openttd::languages openttd::settings + openttd::media openttd::basesets openttd::script_api Threads::Threads @@ -217,6 +258,16 @@ if(NOT OPTION_DEDICATED) link_package(Fontconfig TARGET Fontconfig::Fontconfig) link_package(ICU_lx) link_package(ICU_i18n) + + if(SDL2_FOUND AND OPENGL_FOUND AND UNIX) + # SDL2 dynamically loads OpenGL if needed, so do not link to OpenGL when + # on Linux. For Windows, we need to link to OpenGL as we also have a win32 + # driver using it. + add_definitions(-DWITH_OPENGL) + message(STATUS "OpenGL found -- -DWITH_OPENGL -- (via SDL2)") + else() + link_package(OpenGL TARGET OpenGL::GL) + endif() endif() if(APPLE) @@ -226,6 +277,7 @@ if(APPLE) ${AUDIOTOOLBOX_LIBRARY} ${AUDIOUNIT_LIBRARY} ${COCOA_LIBRARY} + ${QUARTZCORE_LIBRARY} ) add_definitions( @@ -313,4 +365,8 @@ endif() include(CreateRegression) create_regression() +if(APPLE OR WIN32) + find_package(Pandoc) +endif() + include(InstallAndPackage) diff --git a/COMPILING.md b/COMPILING.md index 145b244753..5e642dc874 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -57,6 +57,9 @@ To install both the x64 (64bit) and x86 (32bit) variants (though only one is nec ``` You can open the folder (as a CMake project). CMake will be detected, and you can compile from there. +If libraries are installed but not found, you need to set VCPKG_TARGET_TRIPLET in CMake parameters. +For Visual Studio 2017 you also need to set CMAKE_TOOLCHAIN_FILE. +(Typical values are shown in the MSVC project file command line example) Alternatively, you can create a MSVC project file via CMake. For this either download CMake from https://cmake.org/download/ or use the version @@ -73,6 +76,7 @@ in the build folder are MSVC project files. MSVC can rebuild the project files himself via the `ZERO_CHECK` project. ## All other platforms +Minimum required version of CMake is 3.9. ```bash mkdir build diff --git a/changelog.txt b/changelog.txt index 068dad577f..58cba6132f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,91 @@ +1.11.0-RC1 (2021-03-14) +------------------------------------------------------------------------ +Feature: Option to (dis-)allow hardware accelerated video drivers (#8819) +Feature: Option to set display refresh rate (#8813) +Feature: Allow custom width/height of screenshot and making heightmap screenshots via console (#8804) +Feature: Allow filtering on name in rail station window (#8706) +Feature: Setting for highest resolution of sprites to use (#8604) +Add: Make NewGRF Scanner / World Generation update smoother and make aborting it react faster (#8830) +Add: Malaysia Ringgit as Currency (#8783) +Add: "Engines only" filter in build train window (#8733) +Change: De-limit framerate window's framerate (#8772) +Change: Clarify what effect town interactions have (#8744) +Change: Don't show global goals in company goal windows (#8709) +Change: Recolour graph windows to brown (#8700) +Fix #8855: Bootstrap could result in an empty screen when bootstrap fails (#8856) +Fix #8851: Don't allow infinite "exec" depth in script, but limit to 10 deep (#8852) +Fix #8647: Incorrect drawing order of tram catenary sprites (#8843) +Fix #8711: Having gui_zoom lower than zoom_min causes a crash (#8835) +Fix #8810: "aircraft out of fuel" news shows the wrong place (#8832) +Fix #8833: Don't reload NewGRFs when we are shutting down (#8830) +Fix: Scale padding between elements the same as other padding (#8829) +Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer (#8822) +Fix #8784: Using Alt+Enter doesn't update the fullscreen toggle visibly (#8820) +Fix #8817: Keep NewGRF order for object class sorting (#8818) +Fix #8809: Crash when removing airport when hangar window open (#8815) +Fix #8799: Crash when Search Internet in Multiplayer (#8801) +Fix #8775: [Win32] Don't create the main window when Alt-Tabbing back into fullscreen (#8792) +Fix #8774: Black screenshots when using 40bpp-blitter (#8791) +Fix: [OSX] Hide dock when entering fullscreen (#8789) +Fix: Bootstrap fails to start on clean install (#8788) +Fix: Terraform limit acts random when maxing out per_64k_frames setting (#8782) +Fix: Max-value of fast-forward-speed-limit can be outside its storage size (#8769) + + +1.11.0-beta2 (2021-02-28) +------------------------------------------------------------------------ +Feature: Add setting to limit fast-forward speed (#8766) +Feature: Significant performance improvements to all video drivers (#8605, #8652, #8660, #8685, #8702, #8703, #8707, #8726, #8740) +Feature: Configurable display refresh-rate, default to 60fps (#8680) +Feature: Automatically upload releases to Steam (#8644) +Feature: Generic Linux builds (#8641) +Feature: [GS] Allow non-question type windows to have no buttons (#8638) +Feature: [macOS] ZIP build (#8614) +Feature: Object class selection string filtering (#8603) +Feature: 'Remove all industries' button in scenario editor (#8550) +Feature: Automatic UI and font zoom levels when supported by the OS (#8537) +Feature: [macOS] Render screen at native resolution by default for HiDPI screens (#8519) +Feature: OpenGL video driver (#7744) +Add: Indonesia Rupiah currency (#8616) +Change: Improve graph period markings (#8732) +Change: Make pathfinder account for maximum order speed, if set (#8722) +Change: Darken graph grid lines for legibility (#8690) +Change: Make order window hotkeys toggle for load & unload variants (#8669) +Change: Use a more specific error message when attempting to bulldoze your own HQ (#8667) +Change: Convert .md to .rtf for Windows/Mac packages (#8617) +Change: Move the 'tree placer algorithm' & 'road drive side' settings to the Settings window (#8566) +Change: Move town name generator selection to mapgen GUI (#8566) +Change: [macOS] Native font rendering (#8518) +Fix: Display of network lobby windows for different GUI sizes (#8765) +Fix: Don't desync if client leaves before you finish downloading map (#8755) +Fix: Allow estimating vehicle clone cost even if short on money (#8748) +Fix: Don't notify twice that a client left because of a timeout (#8746) +Fix: Vehicle cursor size did not account for the interface zoom level (#8739) +Fix #8123: Trams on half-tiles couldn't find depots (#8738) +Fix #8276: [NewGRF] Crash when an object's size was not set (#8719) +Fix #8349: Close depot vehicle list windows when closing the depot window (#8717) +Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits or lengths of tunnels/bridges (#8710) +Fix: Whole status bar instead of money widget refreshed on money change (#8692) +Fix: Unnecessary status bar redraws when there is no news to show (#8691) +Fix: New orders are non-stop by default (#8689) +Fix: Framerate window showed a slightly higher rate than actually measured (#8682) +Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681) +Fix #8625: Wrong ending year was displayed in highscore table (#8672) +Fix #8620: Scale spacing between date & news in history window according to font scaling (#8671) +Fix: [Win32] Set minimum resolution for timers to 1ms (#8660) +Fix: Mention our websites with https:// (instead of http://) (#8657) +Fix: [Emscripten] Open links in browser (#8655) +Fix: Don't crash when towns upgrade road tiles during expansion (#8651) +Fix #8029: [SDL2] Blank display when under Wayland (#8648) +Fix: Default Network Server List sorter put compatible servers in wrong order (#8626) +Fix: Use non-pulsating red highlight for coverage (#8622) +Fix: Center text and image in vehicle statusbar vertically (#8602) +Fix: Don't walk out of the map when trying to build tunnels (#8600) +Fix: Off-by-one error in desert/rainforest positioning at world gen (#8588) +Fix #8037: Crash when restarting AI that is controlling the same company as the player (#8587) +Fix: Stopped ships shouldn't block depots (#8578) + + 1.11.0-beta1 (2021-01-22) ------------------------------------------------------------------------ Feature: [GS] Ability to set some extra text in the industry window (#8576) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index 772041a42c..f4047b8396 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -27,9 +27,6 @@ macro(compile_flags) # Enable multi-threaded compilation. add_compile_options(/MP) endif() - - # Add DPI manifest to project; other WIN32 targets get this via ottdres.rc - list(APPEND GENERATED_SOURCE_FILES "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest") endif() # Add some -D flags for Debug builds. We cannot use add_definitions(), because diff --git a/cmake/CreateRegression.cmake b/cmake/CreateRegression.cmake index 3da3438b43..8e3865bc55 100644 --- a/cmake/CreateRegression.cmake +++ b/cmake/CreateRegression.cmake @@ -10,8 +10,8 @@ macro(create_regression) # build folder before we can run the regression file(GLOB_RECURSE REGRESSION_SOURCE_FILES ${CMAKE_SOURCE_DIR}/regression/*) foreach(REGRESSION_SOURCE_FILE IN LISTS REGRESSION_SOURCE_FILES) - string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "${CMAKE_BINARY_DIR}/ai/" REGRESSION_BINARY_FILE "${REGRESSION_SOURCE_FILE}") - string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}") + string(REPLACE "${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}") + string(CONCAT REGRESSION_BINARY_FILE "${CMAKE_BINARY_DIR}/ai/" "${REGRESSION_SOURCE_FILE_NAME}") if("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg") continue() diff --git a/cmake/FindAllegro.cmake b/cmake/FindAllegro.cmake index 3c90d2c4e7..5d873dd3e1 100644 --- a/cmake/FindAllegro.cmake +++ b/cmake/FindAllegro.cmake @@ -31,7 +31,7 @@ The following cache variables may also be set: #]=======================================================================] find_package(PkgConfig QUIET) -pkg_check_modules(PC_Allegro QUIET allegro) +pkg_check_modules(PC_Allegro QUIET allegro<5) find_path(Allegro_INCLUDE_DIR NAMES allegro.h diff --git a/cmake/FindICU.cmake b/cmake/FindICU.cmake index b110dbf404..d12f36b0ad 100644 --- a/cmake/FindICU.cmake +++ b/cmake/FindICU.cmake @@ -1,3 +1,8 @@ +# CMake provides a FindICU module since version 3.7. +# But it doesn't use pkgconfig, doesn't set expected variables, +# And it returns incomplete dependencies if only some modules are searched. + + #[=======================================================================[.rst: FindICU ------- diff --git a/cmake/FindPandoc.cmake b/cmake/FindPandoc.cmake new file mode 100644 index 0000000000..3a42851dd7 --- /dev/null +++ b/cmake/FindPandoc.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${PANDOC_EXECUTABLE}) + find_program(PANDOC_EXECUTABLE pandoc) +endif() diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake index b54c8131ac..0b1dc14933 100644 --- a/cmake/InstallAndPackage.cmake +++ b/cmake/InstallAndPackage.cmake @@ -58,8 +58,18 @@ if(OPTION_INSTALL_FHS) COMPONENT manual) endif() -# TODO -- Media files -# TODO -- Menu files +if(UNIX AND NOT APPLE) + install(DIRECTORY + ${CMAKE_BINARY_DIR}/media/icons + ${CMAKE_BINARY_DIR}/media/pixmaps + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} + COMPONENT media) + + install(FILES + ${CMAKE_BINARY_DIR}/media/${BINARY_NAME}.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications + COMPONENT menu) +endif() if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") set(ARCHITECTURE "amd64") @@ -95,7 +105,14 @@ set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.openttd.org/") set(CPACK_PACKAGE_CONTACT "OpenTTD ") set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenTTD") set(CPACK_PACKAGE_CHECKSUM "SHA256") -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md") + +if((APPLE OR WIN32) AND EXISTS ${PANDOC_EXECUTABLE}) + execute_process(COMMAND ${PANDOC_EXECUTABLE} "${CMAKE_SOURCE_DIR}/COPYING.md" -s -o "${CMAKE_BINARY_DIR}/COPYING.rtf") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.rtf") +else() + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md") +endif() + set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") set(CPACK_MONOLITHIC_INSTALL YES) set(CPACK_PACKAGE_EXECUTABLES "openttd;OpenTTD") @@ -123,8 +140,12 @@ elseif(UNIX) # With FHS, we can create deb/rpm/... Without it, they would be horribly broken # and not work. The other way around is also true; with FHS they are not # usable, and only flat formats work. - if(NOT OPTION_INSTALL_FHS) + if(OPTION_PACKAGE_DEPENDENCIES) set(CPACK_GENERATOR "TXZ") + set(PLATFORM "generic") + elseif(NOT OPTION_INSTALL_FHS) + set(CPACK_GENERATOR "TXZ") + set(PLATFORM "unknown") else() find_program(LSB_RELEASE_EXEC lsb_release) execute_process(COMMAND ${LSB_RELEASE_EXEC} -is @@ -149,7 +170,7 @@ elseif(UNIX) string(REGEX MATCH "ID=(.*)" _ ${OS_RELEASE_CONTENTS}) set(DISTRO_ID ${CMAKE_MATCH_1}) if(DISTRO_ID STREQUAL "arch") - set(PLATFORM "generic") + set(PLATFORM "arch") set(CPACK_GENERATOR "TXZ") else() set(UNSUPPORTED_PLATFORM_NAME "Linux distribution '${DISTRO_ID}' from /etc/os-release") @@ -163,12 +184,39 @@ elseif(UNIX) set(CPACK_GENERATOR "TXZ") message(WARNING "Unknown ${UNSUPPORTED_PLATFORM_NAME} found for packaging; can only pack to a txz. Please consider creating a Pull Request to add support for this distribution.") endif() - - set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}") endif() + set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}") + else() message(FATAL_ERROR "Unknown OS found for packaging; please consider creating a Pull Request to add support for this OS.") endif() include(CPack) + +if(OPTION_PACKAGE_DEPENDENCIES) + # Install all dependencies we can resolve, with the exception of ones that + # every Linux machine should have. This should make this build as generic + # as possible, where it runs on any machine with the same or newer libc + # than the one this is compiled with. + # We copy these libraries into lib/ folder, so they can be found on game + # startup. See comment in root CMakeLists.txt for how this works exactly. + install(CODE [[ + file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR DEPENDENCIES + UNRESOLVED_DEPENDENCIES_VAR UNRESOLVED_DEPENDENCIES + EXECUTABLES openttd + POST_EXCLUDE_REGEXES "ld-linux|libc.so|libdl.so|libm.so|libgcc_s.so|libpthread.so|librt.so|libstdc...so") + file(INSTALL + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" + FILES ${DEPENDENCIES} + FOLLOW_SYMLINK_CHAIN) + + # This should not be possible, but error out when a dependency cannot + # be resolved. + list(LENGTH UNRESOLVED_DEPENDENCIES UNRESOLVED_LENGTH) + if(${UNRESOLVED_LENGTH} GREATER 0) + message(FATAL_ERROR "Unresolved dependencies: ${UNRESOLVED_DEPENDENCIES}") + endif() + ]]) +endif() diff --git a/cmake/MSVCFilters.cmake b/cmake/MSVCFilters.cmake index df576a98a9..e8026eee3c 100644 --- a/cmake/MSVCFilters.cmake +++ b/cmake/MSVCFilters.cmake @@ -16,6 +16,7 @@ source_group("Sprite loaders" REGULAR_EXPRESSION "src/spriteloader/") source_group("Squirrel" REGULAR_EXPRESSION "src/3rdparty/squirrel/squirrel/") source_group("Tables" REGULAR_EXPRESSION "src/table/") source_group("Video" REGULAR_EXPRESSION "src/video/") +source_group("Video/GL" REGULAR_EXPRESSION "src/3rdparty/opengl/") source_group("Widgets" REGULAR_EXPRESSION "src/widgets/") source_group("Windows files" REGULAR_EXPRESSION "src/os/windows/|\.rc$") diff --git a/cmake/Options.cmake b/cmake/Options.cmake index c94a193b32..42d1127906 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -44,7 +44,9 @@ endfunction() # set_options() # function(set_options) - if(UNIX AND NOT APPLE) + option(OPTION_PACKAGE_DEPENDENCIES "Copy dependencies into lib/ for easy packaging (Linux only)" OFF) + + if(UNIX AND NOT APPLE AND NOT OPTION_PACKAGE_DEPENDENCIES) set(DEFAULT_OPTION_INSTALL_FHS ON) else() set(DEFAULT_OPTION_INSTALL_FHS OFF) @@ -76,6 +78,7 @@ endfunction() # show_options() # function(show_options) + message(STATUS "Option Package Dependencies - ${OPTION_PACKAGE_DEPENDENCIES}") message(STATUS "Option Dedicated - ${OPTION_DEDICATED}") message(STATUS "Option Install FHS - ${OPTION_INSTALL_FHS}") message(STATUS "Option Use assert - ${OPTION_USE_ASSERTS}") diff --git a/cmake/scripts/Baseset.cmake b/cmake/scripts/Baseset.cmake index 7cf60629d9..cb5fb5704d 100644 --- a/cmake/scripts/Baseset.cmake +++ b/cmake/scripts/Baseset.cmake @@ -4,6 +4,16 @@ cmake_minimum_required(VERSION 3.5) # Create a single baseset meta file with the correct translations. # +if(NOT BASESET_SOURCE_FILE) + message(FATAL_ERROR "Script needs BASESET_SOURCE_FILE defined") +endif() +if(NOT BASESET_BINARY_FILE) + message(FATAL_ERROR "Script needs BASESET_BINARY_FILE defined") +endif() +if(NOT BASESET_EXTRAGRF_FILE) + message(FATAL_ERROR "Script needs BASESET_EXTRAGRF_FILE defined") +endif() + set(ARGC 1) set(ARG_READ NO) diff --git a/cmake/scripts/Desktop.cmake b/cmake/scripts/Desktop.cmake new file mode 100644 index 0000000000..7cec0b9afe --- /dev/null +++ b/cmake/scripts/Desktop.cmake @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.5) + +# +# Create a desktop file with the correct translations. +# + +if(NOT DESKTOP_SOURCE_FILE) + message(FATAL_ERROR "Script needs DESKTOP_SOURCE_FILE defined") +endif() +if(NOT DESKTOP_BINARY_FILE) + message(FATAL_ERROR "Script needs DESKTOP_BINARY_FILE defined") +endif() +if(NOT BINARY_NAME) + message(FATAL_ERROR "Script needs BINARY_NAME defined") +endif() + +set(ARGC 1) +set(ARG_READ NO) + +# Read all the arguments given to CMake; we are looking for -- and everything +# that follows. Those are our language files. +while(ARGC LESS CMAKE_ARGC) + set(ARG ${CMAKE_ARGV${ARGC}}) + + if(ARG_READ) + list(APPEND LANG_SOURCE_FILES "${ARG}") + endif() + + if(ARG STREQUAL "--") + set(ARG_READ YES) + endif() + + math(EXPR ARGC "${ARGC} + 1") +endwhile() + +# Place holder format is @_@ +file(STRINGS "${DESKTOP_SOURCE_FILE}" PLACE_HOLDER REGEX "^@") +string(REGEX REPLACE "@([^_]+).*@" "\\1" INI_KEY "${PLACE_HOLDER}") +string(REGEX REPLACE "@[^_]+_(.*)@" "\\1" STR_ID "${PLACE_HOLDER}") +string(REGEX REPLACE "@(.*)@" "\\1" PLACE_HOLDER "${PLACE_HOLDER}") + +# Get the translations +foreach(LANGFILE IN LISTS LANG_SOURCE_FILES) + file(STRINGS "${LANGFILE}" LANGLINES REGEX "^(##isocode|${STR_ID})" ENCODING UTF-8) + string(FIND "${LANGLINES}" "${STR_ID}" HAS_STR_ID) + if(HAS_STR_ID LESS 0) + continue() + endif() + string(REGEX REPLACE "##isocode ([^;]+).*" "\\1" ISOCODE "${LANGLINES}") + if("${ISOCODE}" STREQUAL "en_GB") + string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}=\\1" LANGLINES "${LANGLINES}") + else() + string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}[${ISOCODE}]=\\1" LANGLINES "${LANGLINES}") + endif() + list(APPEND ${PLACE_HOLDER} ${LANGLINES}) +endforeach() +list(SORT ${PLACE_HOLDER}) +string(REPLACE ";" "\n" ${PLACE_HOLDER} "${${PLACE_HOLDER}}") + +configure_file(${DESKTOP_SOURCE_FILE} ${DESKTOP_BINARY_FILE}) diff --git a/cmake/scripts/Regression.cmake b/cmake/scripts/Regression.cmake index 620ed2c2ca..e21a86d292 100644 --- a/cmake/scripts/Regression.cmake +++ b/cmake/scripts/Regression.cmake @@ -53,6 +53,9 @@ string(REPLACE "0x(nil)" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}") string(REPLACE "0x0000000000000000" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}") string(REPLACE "0x0x0" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}") +# Remove timestamps if any +string(REGEX REPLACE "\[[0-9-]+ [0-9:]+\] " "" REGRESSION_RESULT "${REGRESSION_RESULT}") + # Convert the output to a format that is expected (and more readable) by result.txt string(REPLACE "\ndbg: [script]" "\n" REGRESSION_RESULT "${REGRESSION_RESULT}") string(REPLACE "\n " "\nERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}") diff --git a/cmake/scripts/SquirrelIncludes.cmake b/cmake/scripts/SquirrelIncludes.cmake index e64e2d25af..672ad09531 100644 --- a/cmake/scripts/SquirrelIncludes.cmake +++ b/cmake/scripts/SquirrelIncludes.cmake @@ -16,11 +16,18 @@ endif() set(ARGC 1) set(ARG_READ NO) +# For MSVC CMake runs this script from a batch file using || to detect errors, +# depending on source path it may quote args, and cause cmd to not understand || +# and pass it as argument to ourself. # Read all the arguments given to CMake; we are looking for -- and everything -# that follows. Those are our api files. +# that follows, until ||. Those are our api files. while(ARGC LESS CMAKE_ARGC) set(ARG ${CMAKE_ARGV${ARGC}}) + if(ARG STREQUAL "||") + set(ARG_READ NO) + endif() + if(ARG_READ) list(APPEND SCRIPT_API_BINARY_FILES "${ARG}") endif() diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index d4a88d0bb5..7eac768591 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -5,10 +5,14 @@ OpenTTD Landscape Internals - #2