Some championships depend on a given car category (e.g.: "36GP") that
might have not been installed yet by the user.
Making the championship not available fixes a out-of-bounds access when
reading VecCarCategoryIds in driverselect.cpp.
Now that speed-dreams-data is available as a submodule, this allows the
build system to choose it for in-tree builds. Therefore, CMake will
perform in the following order:
1. Do not search the speed-dreams-data package if SD_ASSUME_DATADIR is
set.
2. Otherwise, do an in-tree build if the submodule has been updated.
3. Otherwise, search for the speed-dreams-data package on standard
locations and CMAKE_PREFIX_PATH and/or CMAKE_FIND_ROOT_PATH.
4. Otherwise, return an error message.
SD_HAS_DATADIR was rendered redundant, so it has been removed. However,
SD_DATADIR_INSTALL_PREFIX was introduced because it would not equal
SD_DATADIR_ABS for in-tree builds, where an installed version of the
speed-dreams-data package is not required.
In-tree builds now allow to generate NSIS installers with both code and
data.
There were several reasons behind splitting the old SVN monorepo in two
Git repositories:
- It made packaging for GNU/Linux distributions easier, since
speed-dreams-data would be often considered as a separate,
portable package, as typically done in other video games. For example,
0ad and 0ad-data, cube2 and cube2-data, and so on.
- It reduced the repository size for the engine repository as much as
possible, which is often desirable for CI/CD runs and developers with
poor connectivity and/or who only want to perform quick changes to the
source code. After all, speed-dreams-data is around 294 MiB as of the
time of this writing, whereas speed-dreams-code is around 36 MiB.
However, there are situations where having both repositories together is
desirable or even mandatory:
- In the case of Windows builds, both repositories must be configured by
the same top-level CMakeLists.txt so that files and targets from both
repositories are installed simultaneously, and therefore packaged into
the NSIS-based installers. Otherwise, it would require users to run two
separate installers, one for speed-dreams-code and another for
speed-dreams-data.
- Having a submodule makes which version from speed-dreams-data is
compatible with speed-dreams-code clearer.
- Not having a submodule required developers to both fetch the
speed-dreams-data repository and install it, which means double disk
space usage.
- Some users might still prefer to work on a monorepo and not have to
worry about installing speed-dreams-data beforehand.
- build-3rdparty.yml cross-builds all third-party dependencies for
Windows. This workflow is meant to be run only sparingly, since
it fetches source code from many repositories and takes a long time to
build.
- build-w64-mingw32.yml cross-builds the game engine and tools for
Windows. It requires a pre-existing build of the third-party libraries.
These get reflected by the web browser interface, enhancing readability.
However, splitting into different steps requires to specify the working
directory.
Even if most of the project follows the 4-space convention, 2 spaces
seems more comfortable for YAML files, specially for workflows where
deeper levels of indentations are common.
The existing scripts for Debian and NSIS packaging were too complex and
dealt unnecessarily with lower level details that should be already
handled by CMake and CPack.
- Packaging-related scripts have been moved to the new cpack/ directory.
There, CPack variables common to all generators are defined in
cpack/common.cmake, and then generator-specific variables are defined
independently (e.g.: cpack/debian.cmake and cpack/nsis.cmake).
- Packaging is now optionally done at a second stage, by running
`cpack -G <generator>` on the build directory. This removes the
requirement to branch based on the system name, and instead all CPack
variables are assigned unconditionally.
- Since now only one version of the game is packaged, there is no need
to maintain the complex scripts in packaging/ and packaging/windows that
used to deal with all variants (e.g.: "wip-cars-and-tracks",
"hq-cars-and-tracks", etc.).
- The use of CPACK_NSIS_EXTRA_INSTALL_COMMANDS,
CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS and CPACK_NSIS_CREATE_ICONS_EXTRA
should not be required, let alone modifying the HKLM registry manually,
since CPack already provides everything required to set up the
installer, the uninstaller and shortcuts.
- $INSTDIR is not required, since NSIS would already prepend the
target installation directory.
- PROJECT_VERSION_METADATA is not a standard CMake variable.
CMAKE_PROJECT_VERSION_TWEAK is instead meant for this purpose. [1]
- OPTION_PACKAGING and OPTION_ALL_IN_ONE_PACKAGING were removed since
packaging will always be available, yet optional. Packagers must then
run CPack on a second stage, as described above.
- Outdated comments were removed to avoid confusion.
TODO:
- Add shortcut to track editor on NSIS.
- dmg packaging was not revamped because of lacking compatible
hardware, but still it has been moved to cpack/dmg.cmake.
- Windows portable packaging (OPTION_PORTABLE_PACKAGING) has been left
out since it required 7z and relied on several hacks to work.
Furthermore, portable versions of the game were already not released on
the latest release, either. [2]
[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_VERSION_TWEAK.html
[2]: https://sourceforge.net/projects/speed-dreams/files/2.3.0/
rmdir_r's POSIX counterpart returns 0 on non-existing directories.
However, when SHFileOperation is called on a non-existing directory,
usually with DE_INVALIDFILES (0x7C) as its return code, although it is
considered unreliable. [1] Therefore, its existence must be checked
first.
[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationa
By default, std::ofstream objects are opened under the std::ios::out
mode, equivalent to "r" mode in fopen(3), which has non-portable
behaviour. [1]
In order to avoid non-portable behaviour, std::ios::binary must be used
instead, equivalent to "rb" mode in fopen(3).
[1]: https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream
Until version 2.4.0 is not released, it is better to keep it as 2.3.0
since `git describe --tags --dirty` would return `v2.3.0-...` until the
`v2.4.0` tag is created.
Accordingly, speed-dreams-data also reduced its version to 2.3.0. [1]
[1]: 5c58ce805d
This repository depends on the speed-dreams-data package in order to
generate a working package. However, in the context of CI/CD, it is
desirable to build this package without depending on the
speed-dreams-data, and instead assume it would be found on a standard
location.
Therefore, this would allow the generation of artifacts that install to
standard locations, such as Debian packages.
Otherwise, pressing the "arrow down" key would jump with the following
order:
Options -> Downloads -> Credits -> Quit
Instead of the expected order:
Options -> Credits -> Downloads -> Quit
When GfFileSetup is called on a fresh installation, none of the
destination directories might exist.
On the other hand, robustness has been slightly improved by adding calls
to good() and is_open().
Now that the game ships without any driver by default, it is very likely
that simplix.xml does not exist on fresh installations. In fact, the
game already did not consider this as an error, so this was a leftover.
Commit 744677c3a6f3e6c1c463fe55b7b5408355ffe89b from speed-dreams-data
replaced the definition for SD_DATADIR from an absolute path to a
relative path. This was done in order to allow a relative path to be
looked up first by GfApplication::parseOptions() (as required by Windows
and macOS builds), and then look SD_DATADIR_ABS if not found (as
required by in-tree builds).