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).
Now that the project has been migrated from SVN to Git,
the complex logic to determine the project version is now no longer
needed, since Git can achieve the same effect with git-describe(1). [1]
TODO: CPack-related code should be also updated accordingly.
[1]: https://git-scm.com/docs/git-describe
CMake 3.0.2 was released over ten years ago. [1] It is therefore assumed
that more modern CMake versions are already widely available.
[1]: https://cmake.org/files/v3.0/
Since the migration from SVN to Git, the data/ directory was put into a
separate repository, so that the engine repository should never install
anything there.
Otherwise, if the speed-dreams-data package is not found, SD_DATADIR
would expand to "/", which is a valid directory that the game would
attempt to look up.
Otherwise, even if srcPath is empty, a trailing '/' would be appended to
tgtPath, and therefore it would not be possible to get an empty data
directory if SD_DATADIR is undefined or empty.
This command line tool was meant to generate a XML file (typically,
version.xml) containing the version numbers for a list of files defined
by the SD_INSTALL_FILES CMake macro. Then, the game would read this XML
file and copy files around if an update was needed.
Unfortunately, this introduced a circular dependency between the engine
and data repositories, as the engine repository would rely on the data
directory to know the file list, and the data repository would rely on
the xmlversion executable to be available, and therefore the engine
repository.
Ultimately, none of this was needed: it is much simpler to define a
static, line-separated list of files in the data repository, and then
let the game figure out the versioning by itself. This renders
xmlversion entirely redundant, and therefore breaks the circular
dependency. As a bonus, some overly complex CMake stuff could be
removed.
So far, the game assets were located in the same repository as the game
engine. Since data and engine are split into different repositories, now
this project requires users to assign the CMAKE_PREFIX_PATH variable [1]
to indicate the location, only in the case of non-standard locations.
[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
Even if urbanski is a good example of a minimalistic implementation that
can be used for learning, it is far from a competitive driver and is
highly prone to crash in race, which would affect user experience
negatively.
Therefore, it is better to leave the source code available for reference
purposes, but do not include it into the build so that urbanski-drivers
cannot be selected.
Former-commit-id: 277281ef785291f0e7deb262e2c2c3b8f9cffc3b
Former-commit-id: efde653b918a8a4df65ac23b15025e4aeefc9275
These drivers are considered obsolete and were not even built any more.
Former-commit-id: 951cff0a690a7fe9320ed767863495266bac5159
Former-commit-id: 923e07a5ee892d5dab22593934c98958fdd63ed7
Having statically allocated buffers in this context was not only
unnecessary, but also dangerous because these strings would be shared
among all TDriver instances, even if they really should not, since every
TDriver instance belongs to a different driver, and therefore different
parameters.
Also, since racing lines are now dumped into JSON files, it makes sense
to reflect this into the file extension, too, so that text editors can
easily recognise the syntax.
Former-commit-id: 3421b724bfc040f288fe61ffc0fc78fe5a25cd4f
Former-commit-id: 0844542eecaa950c1f96a860e2fcd21d6807059a
Since oPathPoints is defined as a std::vector, dumping TPathPt instances
as Plain Old Data is not valid any more. In fact, C++ compilers would
already warn that offsetof(3) could not be safely used with TPathPt
members since it never was Plain Old Data, but this warning was
suppressed only because raw pointer manipulation had been used instead
of offsetof(3).
On the other hand, dumping binary data is inherently non-portable and
not human-readable, so this commit suggests to dump such data in JSON
format, as cJSON is already used by the project and XML is bad, among
many other things, to store arbitrarily large arrays.
Former-commit-id: 4a447adb452dd9ae85ca4cce9993cbe9ad0487f6
Former-commit-id: b462a614ed53f1938eadb4680a10ef57576b29d9