This macro had already been removed by the commit below. Moreover,
in-tree builds are discouraged by CMake.
commit cf18241a16
Author: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
Date: Sat Dec 28 14:13:38 2024 +0100
cmake: Get SD_DATADIR from speed-dreams-data package
CPack does not install to CMAKE_INSTALL_PREFIX, but
CPACK_PACKAGING_INSTALL_PREFIX. However, the executables' rpath
would still be configured for ${CMAKE_INSTALL_PREFIX}/${SD_LIBDIR}/lib
instead of ${CPACK_PACKAGING_INSTALL_PREFIX}/${SD_LIBDIR}/lib,
making executables to fail to find their respective shared libraries.
Unfortunately, CPACK_PACKAGING_INSTALL_PREFIX is not defined by CMake,
but CPack, so it is not available from this context, so this commit
assumes its default value. [1]
[1]: https://cmake.org/cmake/help/latest/variable/CPACK_PACKAGING_INSTALL_PREFIX.html
Having an uninstall target is unjustified extra maintenance burden for
no benefit.
Instead, it is recommended to install to a CMAKE_INSTALL_PREFIX that the
user can easily remove e.g.: by deleting a directory as a
non-privileged user.
According to the documentation [1], EXISTS only has well-defined
behaviour when an absolute path is given. This fixes a bug where
re-configuring the project would fail because CMake would inadverently
jump to the invalid branch.
[1]: https://cmake.org/cmake/help/latest/command/if.html#exists
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.
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/
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.
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.
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
These properties are not transmitted with git-svn(1) [1], which might
then cause failed patches when modifying lines close to these
properties.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9554 30fe4595-0a0c-4342-8851-515496e4dcbd
Former-commit-id: 6ed21e1fe12d01a370842418c35722c75117a30a
Former-commit-id: 8ecd21b7c0211cd000b10b3f0032980f63c06398
The following shell script was used:
while read f
do
sed -Ei 's/[[:space:]]+$//g' "$f"
done <<EOF
$(svn ls -R | grep \
-e '.\cpp$' \
-e '\.cmake$' \
-e '\.txt$' \
-e '\.cppcheck$' \
-e '\.frag$' \
-e '\.h$' \
-e '\.hpp$' \
-e '\.vert$' \
-e '\.xml$' \
-e '\.java$' \
-e '\.c$')
EOF
As a side effect, this has also converted some files from CRLF line
endings to LF.
File extensions such as .ac or .osg were intentionally left out because
those usually are very large files generated by tools.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9507 30fe4595-0a0c-4342-8851-515496e4dcbd
Former-commit-id: 6c1e5ab34415982ec77fc92a77e1b1c149518eca
Former-commit-id: c6cf9480ae7c1d2f9a999eb6c6b976eef8bae3ba