Skip to content

Commit 2a26a5e

Browse files
swagtoyMatusGuy
andauthored
CMake Refactor (#3093)
* Fix install guide for Ubuntu and Arch * Refactor add_package to a macro, do aliases, move to separate file * Fix incorrect terminology * Better ProvideDiscord warning * Refactor tests a bit Probably incomplete commit * MD5 unit test * 5am code * make_unit_test; fix AATriangleTest * Use SDL_rect.h instead of SDL.h for math/rect methods Too much overhead for a single function usage * Custom assert function (broken) * GLM_ENABLE_EXPERIMENTAL * Make tests/assert more verbose * Add broken DynamicScopeTest for now * Fix title screen release check * Move SavePNG * Fix SDL_SavePNG * Packages using provides code wot i dont think compiles anyway lole just push it lel im tired its 2am lol heh dont feel like finishing this lol and this thing in vcpkg is taking forever to build lole #lol #lole #lel #kek #jej #rofl #roflcoper I need to add a nice argument for these too * btich mingw * Fix indention * Workaround tinygettext wanting iconv Not sure if this is the best solution long-term. I would personally not be against allowing for external Iconv (even though SDL2 provides iconv, i think). For now though it's fine. Goodnight. * Add more external links NOTE: pkg-config case for Ogg and Vorbis isn't working. Look into it! * remove gprof thingy and wip mingw fix error handler * mingw works!!! Create dbghelp.a using a predefined dbghelp.def * Add ALL_TESTS target; add FileSystemTest just to remove it anyway * Would help if I actually committed the tests * add this file that i forgot to add for mingw * fix msvc, add option to disable testing, use console when in debug build * Allow for different package names when using pkg-config Because sometimes different distros like doing that. Thanks. * Update sexp-cpp * Better window title and git version detection * Better window title and git version detection * Fix git message Sorry marty im dumb idk what youre doing here this makes 0 sense to me * Git run improvements * Modules thing (complete me) * Correctly use pkg-config and add option to prefer it * Fix git revision checking * Fix _FOUND if statement * Move Emscripten.cmake to correct path * Fix install target for portable package I think there was an issue with the msi version and components? Weird. Maybe l8er. * Exclude submodules from all target and better release checking * Improve git version checking * FreeBSD (and others?) error handling FreeBSD and NetBSD require that execinfo needs to be linked. I didn't see anything regarding this in OpenBSD's (and dragonfly's??) but we can wait for someone to complain or an OpenBSD user sends/creates a patch. I was reading the manpages and all I tested on was FreeBSD. It works here for now. * Fix random weird components in WIX cpack generation * Fix simplesquirrel merge conflict * Update tinygettext * Update simplesquirrel * Mark CTest porting for later * Use simpler opengl check without GLEW * Try gnulinux.yml * Fix comment * install fmt * install physfs * strenghten addpackage * Fix glm on Fedora * Only check target in add_package * Use cmake target features for cxx standard * cmake policy for cxx standard * hack * Change add_subdirectory order * try this and if it doesnt work i will die probably * Ok it didnt work but updating sexp-cpp might work * Update compilers * update sexp * Update sexp again * Update sexp * Fix a bunch of things and fmt * go my discord-rpc * Update discord sdk * Fix fix fix discord update fmt fix fix * Update ubuntu version * ugghhhh fix * fix gcc.version * no more coverage * go back to fmt addpackage * fix 32bit * Don't package when debug * fix clang warning * remove arch args * Prefer find package in physfs ci 32bit * Disable a clang warning * Remove CI werror * idk what to do here * vcpkg toolchain file in linux ci * change vcpkg root in ci * fix package.sh * 32bit vcpkg triplet * specify vcpkg root as env var * add fuse * switch to pwsh aleluja * try fix * test * chg name * test again * finally fix * fix fix fix fix fix fix fix fix * AAHHHHHH HOW COULD I FORGET * test 2 * this should fix EVERYTHING * turn to string * fix docs * try * fix indent * revert docs * doc fix aaha * normal boolean please??? * AAAAAAAAAA DOCS YOU BT * im desperate please work stop trolling me * REport opengl * update desktop file install location * add glu * Fix...? * fix everythign???? * change quotes * update windows ci * add physfs and wait another 2 years * Update windows.yml * Fix ubuntu touch * fix ut fmt maybe?? lol * fix macos?? * remove macos glbinding * add ppa * update fmt * get newer fmt * forgot to commit script this always happens * set pwd * dont change pwd * no way this work * give up * try this * omfg leave me alone * remove sudo please work now * i have been trolled into oblivion * use the force * uuuuhhhh.. wakey wakey? * DON'T CARE * ok NEVERMIND * Fix sdl version * build fmt from source * try again * aauu * gicve up * fix link * use zip * fix cmake command fmt * add deps to pkgconfig path * add to env * no more tests * update tinygettext and fix macos * remove macos tests * wasm vcpkg * run emsdk env * emscripten glew * rm glew * chainload emscripten * fix fix fix * use emscripten ports * move * install libpng * disable sq install * disable sq installer but better * opengl emscripten but better * update tinygettext * sdl savepng wasm * add wasm vorbis * link openal but better * put opengl in link flags instead * update sexp * oops * add back raqm and sdl ttf fork * use raqm 32bit package * Fix addpackage required flag * update sexp * CMake 3.5 compat * str * raqm vcpkg * RAQM try fix * darn logic * do this do that * try try try * Fix arabic text FOREVER * fix savepng emscripten * add sdl2ttf to emscripten * Add gles * gl in use flags * opengl es * add opengles compile def * move option * uoooaaah add define manually * what is even going on anymore * if this doesnt work im gonna DIE * WAKE UP * testy * set as cachevars auguh * try fix github actions cache * Print opengl src * Foda-se! * final fix and im OUTTA HERE * Remove all unneeded files * add IPH and PCH * try fix windows dlls * we dont need these lets be honest * try fux * OOPS * Dude who tf is u * wtf... * this is so unbearable * Fix windows packaging???? Dear god * dont package on debug workflow * Add vcpkg manifest file * Manually specify supertux release * Fix linux install * Update compilation docs * disable vcpkg manifest mode * fix manifest mode 1 (i can already predict the amount of times i have to do this) * try fix * try fix wasm * oops that is NOT powershell * fix manifest file * add description * Fix simplesquirrel install target * Excuse me my dear good wonderous sir I seem to have forgottentten to Install The Data Directoryry * fix git branch * fix pwsh parsing * Dude why is it like that * stringify * you IDIOT * try fix windows * disable windows manifest mode * Improve testing * Improve mingw support * Fix BUILD_TESTING option * Cleanup + Fix windows issues * Fix windows x86 * Try remove testing on linux * Use option instead of set cache * Fix windowed mode * Fix cmake compat issue --------- Co-authored-by: Swagtoy <[email protected]> Co-authored-by: MatusGuy <[email protected]> Co-authored-by: Marty <[email protected]>
1 parent 25753a1 commit 2a26a5e

File tree

97 files changed

+1322
-2793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1322
-2793
lines changed

.ci_scripts/package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if [ "$SOURCE" = "ON" ]; then
2121
cpack --config CPackSourceConfig.cmake -G TGZ;
2222
fi
2323

24-
if ([ "$OS_NAME" = "ubuntu-22.04" ] || [ "$OS_NAME" = "ubuntu-20.04" ] || [ "$OS_NAME" = "ubuntu-18.04" ]) && [ "$PACKAGE" = "ON" ]; then
24+
if ([ "$OS_NAME" = "ubuntu-latest" ]) && [ "$PACKAGE" = "ON" ]; then
2525
../.ci_scripts/build_appimage.sh
2626
# extract built appimages for uploading
2727
mv ~/out/* .

.github/workflows/gnulinux.yml

Lines changed: 86 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,24 @@ on:
2727

2828
jobs:
2929
gnulinux:
30-
3130
strategy:
3231
fail-fast: false
3332
matrix:
33+
# TODO Working Linux 32-bit packaging
34+
# TODO CTest & coverage workflow implement
3435
arch: [32, 64]
35-
os: [ubuntu-22.04]
36+
os: [ubuntu-latest]
3637
compiler: [gcc, clang]
3738
build_type: [Debug, Release]
38-
glbinding: [ON, OFF]
39-
exclude:
40-
- arch: 32
41-
glbinding: ON
4239
include:
43-
- os: ubuntu-22.04
40+
- os: ubuntu-latest
4441
build_type: Release
4542
compiler: gcc
4643
arch: 64
47-
glbinding: OFF
4844
release: ON
4945
source: ON
50-
documentation: ON
51-
- os: ubuntu-22.04
52-
build_type: Debug
53-
compiler: gcc
54-
arch: 64
55-
glbinding: OFF
46+
documentation: true
5647
coverage: ON
57-
# TODO: Working Linux 32-bit packaging
5848

5949
runs-on: ${{ matrix.os }}
6050
steps:
@@ -70,69 +60,77 @@ jobs:
7060
sudo apt-get update
7161
sudo apt-get install -y \
7262
cmake \
63+
ninja-build \
7364
build-essential \
7465
automake \
7566
gtk-doc-tools \
67+
fuse \
7668
rpm \
7769
rename \
7870
sshpass \
79-
clang-14 \
80-
g++-9 \
81-
gcc-multilib \
82-
g++-multilib \
71+
clang \
72+
g++ \
73+
libglu1-mesa-dev \
8374
libgtest-dev \
8475
libc++-dev \
8576
libogg-dev \
8677
libvorbis-dev \
8778
libopenal-dev \
8879
libsdl2-dev \
8980
libsdl2-image-dev \
90-
libfreetype6-dev \
91-
libharfbuzz-dev \
92-
libfribidi-dev \
9381
libglib2.0-dev \
82+
libfreetype6-dev \
9483
libraqm-dev \
9584
libglew-dev \
9685
libglbinding-dev \
9786
libcurl4-openssl-dev \
9887
libglm-dev \
88+
libfmt-dev \
89+
libphysfs-dev \
9990
zlib1g-dev \
10091
lcov \
101-
doxygen \
102-
libfuse2
92+
doxygen
10393
10494
- name: Install 32-bit dependencies
10595
if: ${{ matrix.arch == 32 }}
10696
run: |
10797
sudo dpkg --add-architecture i386
10898
sudo apt-get update
99+
109100
sudo apt-get install -y \
110101
cmake \
102+
ninja-build \
111103
build-essential \
112104
automake \
113105
gtk-doc-tools \
106+
fuse \
114107
rpm \
115108
rename \
116109
sshpass \
110+
clang \
117111
gcc-multilib \
118112
g++-multilib \
119-
libgtest-dev:i386 \
113+
libglu1-mesa-dev:i386 \
120114
libogg-dev:i386 \
121115
libvorbis-dev:i386 \
122116
libopenal-dev:i386 \
123117
libsdl2-dev:i386 \
124118
libsdl2-image-dev:i386 \
125119
libfreetype6-dev:i386 \
126120
libcurl4-openssl-dev:i386 \
127-
libharfbuzz-dev:i386 \
128-
libfribidi-dev:i386 \
129-
libglm-dev \
130-
zlib1g-dev \
131-
libfuse2
121+
zlib1g-dev:i386 \
122+
libfmt-dev:i386 \
123+
libglm-dev
124+
125+
# Let's get out of this directory to disable vcpkg manifest mode.
126+
# Manifest mode is not adequate here because most dependencies can
127+
# be used via the system package manager.
128+
pushd /
132129
133-
# Nethier GLEW nor glbinding exist in 32-bit for Ubuntu 22.04, so snatch the debs from 16.04 instead
134-
wget archive.ubuntu.com/ubuntu/pool/main/g/glew/libglew1.13_1.13.0-2_i386.deb && sudo dpkg -i libglew1.13_1.13.0-2_i386.deb
135-
wget archive.ubuntu.com/ubuntu/pool/main/g/glew/libglew-dev_1.13.0-2_i386.deb && sudo dpkg -i libglew-dev_1.13.0-2_i386.deb
130+
# These libraries don't exist for 32-bit in Ubuntu repositories.
131+
vcpkg install --triplet x86-linux physfs glew libraqm
132+
133+
popd
136134
137135
- name: Set compiler (gcc)
138136
if: ${{ matrix.compiler == 'gcc' }}
@@ -146,51 +144,74 @@ jobs:
146144
echo "CXX=clang++" >> $GITHUB_ENV
147145
echo "CC=clang" >> $GITHUB_ENV
148146
147+
- name: Run slugify
148+
id: slugify
149+
uses: eltimn/[email protected]
150+
149151
- name: Configure build
152+
shell: pwsh
150153
env:
154+
# Using git rev-parse gives incorrect values when querying the branch
155+
# so, use slugify instead
156+
GIT_HASH: ${{ steps.slugify.outputs.sha }}
157+
GIT_BRANCH: ${{ steps.slugify.outputs.branch }}
151158
BUILD_TYPE: ${{ matrix.build_type }}
152-
ARCH: ${{ matrix.arch == 32 && '-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32' || '' }}
159+
32BIT: ${{ matrix.arch == 32 }}
153160
MAKE_DOCS: ${{ matrix.documentation }}
154161
GLBINDING: ${{ matrix.glbinding }}
155-
# FIXME: GoogleTest isn't detected by CMake on Ubuntu 18.04
156-
# (also check the step that invokes the tests with ./test_supertux2)
157-
TESTS: ${{ matrix.os == 'ubuntu-22.04' }}
158-
CMAKE_POLICY_VERSION_MINIMUM: 3.5
162+
#TESTS: ${{ matrix.os == 'ubuntu-20.04' }}
159163
run: |
160-
cmake --version
161-
$CXX --version
164+
$Env:GIT_TAG = (& git describe --tags --abbrev=0)
165+
166+
echo "Git information:"
167+
echo "- GIT_TAG: $Env:GIT_TAG"
168+
echo "- GIT_HASH: $Env:GIT_HASH"
169+
echo "- GIT_BRANCH: $Env:GIT_BRANCH"
170+
171+
& cmake --version
172+
& $Env:CXX --version
173+
162174
mkdir "build"
163175
cd "build"
164-
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ARCH -DBUILD_TESTS=$TESTS \
165-
-DWARNINGS=ON -DWERROR=ON -DGLBINDING_ENABLED=$GLBINDING \
166-
-DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_INSTALL_PREFIX=/usr \
167-
-DBUILD_DOCUMENTATION=$MAKE_DOCS -DINSTALL_SUBDIR_BIN=bin \
168-
-DINSTALL_SUBDIR_SHARE=share/supertux2 -DENABLE_DISCORD=ON.
176+
177+
# Pass -DPhysFS_PREFER_FIND_PACKAGE=ON because we use
178+
# vcpkg for physfs on 32bit
179+
& cmake .. -DCMAKE_BUILD_TYPE="$Env:BUILD_TYPE" -DENABLE_DISCORD=ON `
180+
-DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_INSTALL_PREFIX=/usr `
181+
-DCMAKE_POLICY_VERSION_MINIMUM="3.5" `
182+
-DSUPERTUX_PACKAGE_VERSION="$Env:GIT_TAG dev - $Env:GIT_HASH ($Env:GIT_BRANCH) (CI ARTIFACT)" `
183+
-DSUPERTUX_VERSION_STRING="$Env:GIT_BRANCH-$Env:GIT_HASH" `
184+
$(if ($Env:32BIT -eq "true") {
185+
"-DCMAKE_TOOLCHAIN_FILE=$Env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake "
186+
"-DVCPKG_TARGET_TRIPLET=x86-linux "
187+
"-DVCPKG_MANIFEST_MODE=OFF "
188+
"-DPhysFS_PREFER_FIND_PACKAGE=ON"
189+
}) `
190+
-DBUILD_DOCUMENTATION="$(if ($Env:MAKE_DOCS -eq "true") {"ON"} else {"OFF"})" `
191+
-DCMAKE_CXX_FLAGS="$(if ($Env:32BIT -eq "true") {"-m32"})" `
192+
-DCMAKE_C_FLAGS="$(if ($Env:32BIT -eq "true") {"-m32"})" `
193+
-DBUILD_TESTING=OFF
169194
170195
- name: Build and install
171196
working-directory: build
172-
env:
173-
CMAKE_POLICY_VERSION_MINIMUM: 3.5
174197
run: |
175198
make -j3 VERBOSE=1
176199
make install DESTDIR="/tmp/supertux" VERBOSE=1
177200
178-
- name: Run tests
179-
# FIXME: GoogleTest isn't detected by CMake on Ubuntu 18.04
180-
# (also check the step that invokes CMake with -DBUILD_TESTS)
181-
if: ${{ matrix.os == 'ubuntu-22.04' }}
182-
working-directory: build
183-
run: ./test_supertux2
201+
# - name: Run tests
202+
# if: ${{ matrix.os == 'ubuntu-20.04' }}
203+
# working-directory: build
204+
# run: ./test_supertux2
184205

185-
- name: Make coverage
186-
if: ${{ matrix.coverage }}
187-
working-directory: build
188-
run: |
189-
lcov --capture --directory . --exclude '/usr/*' --exclude '*/tests/*'\
190-
--exclude '*/external/*' --output-file coverage.info
191-
mkdir coverage
192-
cd coverage
193-
genhtml ../coverage.info
206+
# - name: Make coverage
207+
# if: ${{ matrix.coverage }}
208+
# working-directory: build
209+
# run: |
210+
# lcov --capture --directory . --exclude '/usr/*' --exclude '*/tests/*'\
211+
# --exclude '*/external/*' --output-file coverage.info
212+
# mkdir coverage
213+
# cd coverage
214+
# genhtml ../coverage.info
194215

195216
- name: Make documentation
196217
if: ${{ matrix.documentation }}
@@ -199,7 +220,7 @@ jobs:
199220
doxygen docs/Doxyfile
200221
201222
- name: Package
202-
if: matrix.arch != '32'
223+
if: matrix.arch != '32' && matrix.build_type != 'Debug'
203224
env:
204225
OS_NAME: ${{ matrix.os }}
205226
ARCH: ${{ matrix.arch }} # TODO: Working Linux 32-bit packaging
@@ -211,10 +232,10 @@ jobs:
211232
run: ../.ci_scripts/package.sh
212233

213234
- name: Upload AppImage
214-
if: matrix.build_type != 'Debug' && matrix.glbinding == 'OFF'
235+
if: matrix.build_type != 'Debug'
215236
uses: actions/upload-artifact@v4
216237
with:
217-
name: "${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-appimage"
238+
name: "${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-${{ steps.slugify.outputs.branch }}-${{ steps.slugify.outputs.sha }}-${{ matrix.build_type }}-appimage"
218239
path: build/upload/*.AppImage
219240
if-no-files-found: ignore
220241

.github/workflows/macos.yml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ jobs:
3333
matrix:
3434
os: [macos-13]
3535
build_type: [Debug, Release]
36-
glbinding: [ON, OFF]
3736
include:
3837
- os: macos-13
3938
build_type: Release
40-
glbinding: OFF
4139
release: ON
4240

4341
runs-on: ${{ matrix.os }}
@@ -53,10 +51,9 @@ jobs:
5351
run: |
5452
# Use GLM 1.0.0 as later versions don't build with clang
5553
HOMEBREW_NO_AUTO_UPDATE=1 brew install --formula ./mk/brew/glm.rb --build-from-source
56-
brew install cmake googletest bash rename libogg libvorbis glew \
57-
openal-soft sdl2 sdl2_image sdl2_ttf freetype harfbuzz \
58-
fribidi glib gtk-doc glbinding@2 libraqm zlib
59-
brew link glbinding@2
54+
brew install cmake bash rename libogg libvorbis glew \
55+
openal-soft sdl2 sdl2_image libraqm freetype \
56+
glib gtk-doc zlib physfs fmt
6057
6158
install_name_tool -change \
6259
'@rpath/libsharpyuv.0.dylib' \
@@ -80,37 +77,49 @@ jobs:
8077
echo "CXX=clang++" >> $GITHUB_ENV
8178
echo "CC=clang" >> $GITHUB_ENV
8279
80+
- name: Run slugify
81+
id: slugify
82+
uses: eltimn/[email protected]
83+
8384
- name: Configure build
8485
env:
86+
# Using git rev-parse gives incorrect values when querying the branch
87+
# so, use slugify instead
88+
GIT_HASH: ${{ steps.slugify.outputs.sha }}
89+
GIT_BRANCH: ${{ steps.slugify.outputs.branch }}
8590
BUILD_TYPE: ${{ matrix.build_type }}
86-
GLBINDING: ${{ matrix.glbinding }}
87-
CMAKE_POLICY_VERSION_MINIMUM: 3.5
91+
PKG_CONFIG_PATH: /usr/local/opt/openal-soft/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
8892
run: |
93+
GIT_TAG="$(git describe --tags --abbrev=0)"
94+
95+
echo "Git information:"
96+
echo "- GIT_TAG: $GIT_TAG"
97+
echo "- GIT_HASH: $GIT_HASH"
98+
echo "- GIT_BRANCH: $GIT_BRANCH"
99+
89100
cmake --version
90101
$CXX --version
102+
91103
mkdir "build"
92104
cd "build"
93-
# TODO add -DGLBINDING_ENABLED=$USE_GLBINDING
94-
# NOTE: The `WERROR` flag is set to OFF in order to work around issues
95-
# where said flag applied to system includes as well, causing the
96-
# builds to fail. This issue requires further investigation!
97-
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ARCH -DBUILD_TESTS=ON \
98-
-DWARNINGS=ON -DWERROR=OFF -DGLBINDING_ENABLED=$GLBINDING \
105+
106+
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ARCH \
99107
-DENABLE_DISCORD=ON -DCMAKE_INSTALL_MESSAGE=NEVER \
108+
-DSUPERTUX_PACKAGE_VERSION="$GIT_TAG dev - $GIT_HASH ($GIT_BRANCH) (CI ARTIFACT)" \
109+
-DSUPERTUX_VERSION_STRING="$GIT_BRANCH-$GIT_HASH" \
100110
-DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SUBDIR_BIN=bin \
101-
-DINSTALL_SUBDIR_SHARE=share/supertux2
111+
-DINSTALL_SUBDIR_SHARE=share/supertux2 \
112+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
102113
103114
- name: Build and install
104-
env:
105-
CMAKE_POLICY_VERSION_MINIMUM: 3.5
106115
working-directory: build
107116
run: |
108117
make -j3 VERBOSE=1
109118
make install DESTDIR="/tmp/supertux" VERBOSE=1
110119
111-
- name: Run tests
112-
working-directory: build
113-
run: ./test_supertux2
120+
#- name: Run tests
121+
# working-directory: build
122+
# run: ./test_supertux2
114123

115124
- name: Package
116125
env:
@@ -123,9 +132,9 @@ jobs:
123132
run: ../.ci_scripts/package.sh
124133

125134
- uses: actions/upload-artifact@v4
126-
if: matrix.build_type != 'Debug' && matrix.glbinding == 'OFF'
135+
if: matrix.build_type != 'Debug'
127136
with:
128-
name: "${{ matrix.os }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-dmg"
137+
name: "${{ matrix.os }}-${{ matrix.build_type }}-${{ steps.slugify.outputs.branch }}-${{ steps.slugify.outputs.sha }}-dmg"
129138
path: build/upload/*.dmg
130139
if-no-files-found: ignore
131140

0 commit comments

Comments
 (0)