diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4454c1898c..33a1090790 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -222,10 +222,13 @@ jobs: gettext \ create-dmg brew link gettext --force + - uses: actions/setup-python@v4 # Workaround for #2069 + with: + python-version: '3.11' - uses: lukka/run-vcpkg@v10 name: Install dependencies with: - vcpkgGitCommitId: 50fd3d9957195575849a49fa591e645f1d8e7156 + vcpkgGitCommitId: 23ceb9cbf9b6d32f485cf039547b70102a6ef9d8 - name: Build uses: lukka/run-cmake@v10 with: @@ -253,6 +256,7 @@ jobs: mkdir staging mv Freeciv21.app staging create-dmg \ + --hdiutil-verbose \ --volname "Freeciv21 Installer" \ --volicon "client.icns" \ --window-pos 200 120 \ @@ -264,11 +268,6 @@ jobs: "Freeciv21-${{steps.split.outputs.fragment}}.dmg" \ "staging/" shasum -a 256 Freeciv21-${{steps.split.outputs.fragment}}.dmg > Freeciv21-${{steps.split.outputs.fragment}}.dmg.sha256 - - name: Debug - if: failure() - run: | - cat CMakeCache.txt - echo ${{steps.split.outputs.fragment}} - name: Upload package uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 8223f973bc..7ab0ba6686 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -158,7 +158,6 @@ target_link_libraries(freeciv21-client PRIVATE tolua) target_link_libraries(freeciv21-client PRIVATE Qt5::Widgets) target_link_libraries(freeciv21-client PRIVATE Qt5::Svg) -target_link_libraries(freeciv21-client PRIVATE ${SDL2_MIXER_LIBRARIES} ${SDL2_LIBRARY}) if(NOT EMSCRIPTEN) target_sources(freeciv21-client PRIVATE servers.cpp) @@ -168,13 +167,15 @@ if (AUDIO_SDL) target_sources(freeciv21-client PRIVATE audio/audio_sdl.cpp) if (NOT EMSCRIPTEN) # SDL comes with the -s option on emscripten - target_include_directories(freeciv21-client PRIVATE ${SDL2_INCLUDE_DIR}) + # See https://github.com/microsoft/vcpkg/blob/2023.12.12/ports/sdl2/usage + target_link_libraries(freeciv21-client + PRIVATE $,SDL2::SDL2,SDL2::SDL2-static>) + target_link_libraries(freeciv21-client PRIVATE ${SDL2_MIXER_LIBRARIES}) target_include_directories(freeciv21-client PRIVATE ${SDL2_MIXER_INCLUDE_DIR}) endif() endif() -if(APPLE) - target_link_libraries(freeciv21-client PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework ForceFeedback" "-framework AudioToolbox") +if (APPLE) qt5_import_plugins(freeciv21-client INCLUDE Qt5::QCocoaIntegrationPlugin Qt5::QSvgPlugin) endif() diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake deleted file mode 100644 index aa45ac3690..0000000000 --- a/cmake/FindSDL2.cmake +++ /dev/null @@ -1,181 +0,0 @@ -# - Locate SDL library -# This module defines -# SDL_LIBRARY, the name of the library to link against -# SDL_FOUND, if false, do not try to link to SDL -# SDL_INCLUDE_DIR, where to find SDL.h -# SDL_VERSION_STRING, human-readable string containing the version of SDL -# -# This module responds to the the flag: -# SDL_BUILDING_LIBRARY -# If this is defined, then no SDL_main will be linked in because -# only applications need main(). -# Otherwise, it is assumed you are building an application and this -# module will attempt to locate and set the the proper link flags -# as part of the returned SDL_LIBRARY variable. -# -# Don't forget to include SDLmain.h and SDLmain.m your project for the -# OS X framework based version. (Other versions link to -lSDLmain which -# this module will try to find on your behalf.) Also for OS X, this -# module will automatically add the -framework Cocoa on your behalf. -# -# -# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration -# and no SDL_LIBRARY, it means CMake did not find your SDL library -# (SDL.dll, libsdl.so, SDL.framework, etc). -# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. -# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value -# as appropriate. These values are used to generate the final SDL_LIBRARY -# variable, but when these values are unset, SDL_LIBRARY does not get created. -# -# -# $SDLDIR is an environment variable that would -# correspond to the ./configure --prefix=$SDLDIR -# used in building SDL. -# l.e.galup 9-20-02 -# -# Modified by Eric Wing. -# Added code to assist with automated building by using environmental variables -# and providing a more controlled/consistent search behavior. -# Added new modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). -# Also corrected the header search path to follow "proper" SDL guidelines. -# Added a search for SDLmain which is needed by some platforms. -# Added a search for threads which is needed by some platforms. -# Added needed compile switches for MinGW. -# -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDL_LIBRARY to override this selection or set the CMake environment -# CMAKE_INCLUDE_PATH to modify the search paths. -# -# Note that the header path has changed from SDL/SDL.h to just SDL.h -# This needed to change because "proper" SDL convention -# is #include "SDL.h", not . This is done for portability -# reasons because not all systems place things in SDL/ (see FreeBSD). - -#============================================================================= -# Copyright 2003-2009 Kitware, Inc. -# Copyright 2012 Benjamin Eikel -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -find_path(SDL2_INCLUDE_DIR SDL.h - HINTS - ENV SDLDIR - PATH_SUFFIXES include/SDL2 include -) - -# On FreeBSD SDL depends on libiconv and SDL_stdinc.h includes iconv.h, which is -# located in ${LOCALBASE}/include. Append {LOCALBASE}/include to -# the SDL_INCLUDE_DIR, thus allow to build SDL apps out of box. -list(APPEND SDL2_INCLUDE_DIR /usr/local/include) - -find_library(SDL_LIBRARY_TEMP - NAMES SDL2 SDL2-2.0 - HINTS - ENV SDLDIR - PATH_SUFFIXES lib -) - -if(NOT SDL_BUILDING_LIBRARY) - if(NOT "${SDL2_INCLUDE_DIR}" MATCHES ".framework") - # Non-OS X framework versions expect you to also dynamically link to - # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms - # seem to provide SDLmain for compatibility even though they don't - # necessarily need it. - find_library(SDLMAIN2_LIBRARY - NAMES SDLmain2 SDLmain2.0 - HINTS - ENV SDLDIR - PATH_SUFFIXES lib - PATHS - /sw - /opt/local - /opt/csw - /opt - ) - endif() -endif() - -# SDL may require threads on your system. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. -# But for non-OSX systems, I will use the CMake Threads package. -if(NOT APPLE) - find_package(Threads) -endif() - -# MinGW needs an additional library, mwindows -# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows -# (Actually on second look, I think it only needs one of the m* libraries.) -if(MINGW) - set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") -endif() - -if(SDL_LIBRARY_TEMP) - # For SDLmain - if(SDLMAIN2_LIBRARY AND NOT SDL_BUILDING_LIBRARY) - list(FIND SDL_LIBRARY_TEMP "${SDLMAIN2_LIBRARY}" _SDL_MAIN_INDEX) - if(_SDL_MAIN_INDEX EQUAL -1) - set(SDL_LIBRARY_TEMP "${SDLMAIN2_LIBRARY}" ${SDL_LIBRARY_TEMP}) - endif() - unset(_SDL_MAIN_INDEX) - endif() - - # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. - # CMake doesn't display the -framework Cocoa string in the UI even - # though it actually is there if I modify a pre-used variable. - # I think it has something to do with the CACHE STRING. - # So I use a temporary variable until the end so I can set the - # "real" variable in one-shot. - if(APPLE) - set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") - endif() - - # For threads, as mentioned Apple doesn't need this. - # In fact, there seems to be a problem if I used the Threads package - # and try using this line, so I'm just skipping it entirely for OS X. - if(NOT APPLE) - set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) - endif() - - # For MinGW library - if(MINGW) - set(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP}) - endif() - - # Set the final string here so the GUI reflects the final state. - set(SDL2_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") -endif() - -if(SDL2_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h") - file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}") - set(SDL2_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH}) - unset(SDL_VERSION_MAJOR_LINE) - unset(SDL_VERSION_MINOR_LINE) - unset(SDL_VERSION_PATCH_LINE) - unset(SDL_VERSION_MAJOR) - unset(SDL_VERSION_MINOR) - unset(SDL_VERSION_PATCH) -endif() - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 - REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR - VERSION_VAR SDL2_VERSION_STRING) diff --git a/docs/Contributing/index.rst b/docs/Contributing/index.rst index 8ed635e53f..0ca9e3dc48 100644 --- a/docs/Contributing/index.rst +++ b/docs/Contributing/index.rst @@ -12,6 +12,7 @@ Freeciv21 project. pull-request.rst eval-pull-request.rst release.rst + workarounds.rst stable-branch.rst style-guide.rst :maxdepth: 1 diff --git a/docs/Contributing/release.rst b/docs/Contributing/release.rst index 77f6307ddf..c1c8dca667 100644 --- a/docs/Contributing/release.rst +++ b/docs/Contributing/release.rst @@ -53,6 +53,11 @@ These are the general steps to prepare and finalize a release: created PR's. #. While inside the ``Release Update of AutoRevision.txt`` PR, the release manager will enable an automatic rebase and merge. +#. The release manager will open an issue titled ``Review workarounds after release`` with the following text: + + We should review the workarounds in the source code and check that they are still needed. Some + workarounds are documented here: :doc:`Workarounds`. + #. When all the CI actions are complete, the release manager will make a post in the ``#news-channel`` on the Longturn.net Discord server. #. The release manager will download the Windows i686 and x86_64 installer packages and use their Microsoft diff --git a/docs/Contributing/workarounds.rst b/docs/Contributing/workarounds.rst new file mode 100644 index 0000000000..d3a4f7a2cc --- /dev/null +++ b/docs/Contributing/workarounds.rst @@ -0,0 +1,11 @@ +.. SPDX-License-Identifier: GPL-3.0-or-later +.. SPDX-FileCopyrightText: Louis Moureaux + +Workarounds +*********** + +This page lists workarounds in the code. They should be checked from time to +time and removed once they are no longer needed. + +#. The macOS CI installs a fixed Python version to work around a bug in Meson. + (``.github/workflows/build.yaml``) diff --git a/vcpkg.json b/vcpkg.json index 507b4a9b86..a1d83044c0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "name": "freeciv21", "version-string": "3.0.0", - "builtin-baseline": "50fd3d9957195575849a49fa591e645f1d8e7156", + "builtin-baseline": "23ceb9cbf9b6d32f485cf039547b70102a6ef9d8", "dependencies": [ "qt5-base", "qt5-svg",