Use per-folder build files + fix some compilation errors
This commit is contained in:
parent
bdeb91bc89
commit
3d6f46be6e
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@ build*/
|
||||
.vscode/
|
||||
_test*/
|
||||
docs/refs
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
.cache/
|
@ -1,11 +1,10 @@
|
||||
# Compiling jujube
|
||||
|
||||
jujube uses the meson build system.
|
||||
Only time will tell if this turned out to be a wise choice, I wanted to try something other than CMake.
|
||||
|
||||
Regardless of the target platform the build steps are pretty much the same :
|
||||
|
||||
0. Get an up-to-date C++ compiler (compatible with C++17 at least)
|
||||
0. Get an up-to-date C++ compiler
|
||||
0. Install (or build) the dependencies :
|
||||
- **meson** : the build system, installation explained [here](https://mesonbuild.com/Quick-guide.html)
|
||||
- **SFML 2.5.1** : the game framework
|
||||
@ -28,9 +27,15 @@ If you managed to compile jujube with another toolchain I did not mention here y
|
||||
|
||||
You need at least gcc `9.0.0`
|
||||
|
||||
The meson install is pretty straightforward.
|
||||
Install meson either from system packages, or alternatively with pip if you want a more recent meson version
|
||||
|
||||
For SFML, If you want to use another compiler than the one shipped with your system you may need to re-build SFML yourself using the compiler you chose. [Here's](https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php) their docs. Don't forget to manually specify the compiler (and maybe the library install path) at the configuration step (when you run `meson build`).
|
||||
Install dependencies, for instance on Debian :
|
||||
|
||||
```console
|
||||
$ git submodule init
|
||||
$ git submodule update
|
||||
$ sudo apt install libsfml-dev libdw-dev
|
||||
```
|
||||
|
||||
## Windows
|
||||
|
||||
|
5
imgui.ini
Normal file
5
imgui.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
@ -11,6 +11,7 @@ https://github.com/Stepland/memon
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
11
include/meson.build
Normal file
11
include/meson.build
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
inc = include_directories('.', 'imgui', 'imgui-sfml')
|
||||
|
||||
sources += files(
|
||||
'imgui/imgui.cpp',
|
||||
'imgui/imgui_draw.cpp',
|
||||
'imgui/imgui_widgets.cpp',
|
||||
'imgui-sfml/imgui-SFML.cpp',
|
||||
'whereami/whereami.c',
|
||||
'whereami/whereami++.cpp'
|
||||
)
|
142
meson.build
142
meson.build
@ -1,130 +1,33 @@
|
||||
project(
|
||||
'jujube',
|
||||
['cpp', 'c'],
|
||||
default_options : ['cpp_std=c++17'],
|
||||
version : '0.1.0'
|
||||
version : '0.1.0',
|
||||
default_options : ['cpp_std=c++20'],
|
||||
)
|
||||
|
||||
sources = [
|
||||
'include/imgui/imgui.cpp',
|
||||
'include/imgui/imgui_draw.cpp',
|
||||
'include/imgui/imgui_widgets.cpp',
|
||||
'include/imgui-sfml/imgui-SFML.cpp',
|
||||
'include/whereami/whereami.c',
|
||||
'include/whereami/whereami++.cpp',
|
||||
'src/Data/Chart.cpp',
|
||||
'src/Data/Chart.hpp',
|
||||
'src/Data/GradedNote.cpp',
|
||||
'src/Data/GradedNote.hpp',
|
||||
'src/Data/Note.hpp',
|
||||
'src/Data/Preferences.hpp',
|
||||
'src/Data/Preferences.cpp',
|
||||
'src/Data/Score.hpp',
|
||||
'src/Data/Score.cpp',
|
||||
'src/Data/Song.hpp',
|
||||
'src/Data/Song.cpp',
|
||||
'src/Data/TimeBounds.hpp',
|
||||
'src/Drawables/BlackFrame.hpp',
|
||||
'src/Drawables/BlackFrame.cpp',
|
||||
'src/Drawables/ButtonHighlight.hpp',
|
||||
'src/Drawables/ButtonHighlight.cpp',
|
||||
'src/Drawables/DensityGraph.hpp',
|
||||
'src/Drawables/DensityGraph.cpp',
|
||||
'src/Drawables/GradedDensityGraph.hpp',
|
||||
'src/Drawables/GradedDensityGraph.cpp',
|
||||
'src/Input/Buttons.hpp',
|
||||
'src/Input/Buttons.cpp',
|
||||
'src/Input/KeyMapping.hpp',
|
||||
'src/Input/KeyMapping.cpp',
|
||||
'src/Input/Events.hpp',
|
||||
'src/Input/Events.cpp',
|
||||
'src/Resources/TextureCache.cpp',
|
||||
'src/Resources/TextureCache.hpp',
|
||||
'src/Resources/LNMarker.cpp',
|
||||
'src/Resources/LNMarker.hpp',
|
||||
'src/Resources/Marker.cpp',
|
||||
'src/Resources/Marker.hpp',
|
||||
'src/Resources/SharedResources.hpp',
|
||||
'src/Resources/SharedResources.cpp',
|
||||
'src/Resources/SpriteSheet.cpp',
|
||||
'src/Resources/SpriteSheet.hpp',
|
||||
'src/Resources/SplitSpriteSheet.cpp',
|
||||
'src/Resources/SplitSpriteSheet.hpp',
|
||||
# 'src/Resources/CoverAtlas.hpp',
|
||||
# 'src/Resources/CoverAtlas.cpp',
|
||||
'src/Screens/MusicSelect/Drawables/ControlPanels.hpp',
|
||||
'src/Screens/MusicSelect/Drawables/ControlPanels.cpp',
|
||||
'src/Screens/MusicSelect/Options/OptionPage.hpp',
|
||||
'src/Screens/MusicSelect/Options/OptionPage.cpp',
|
||||
'src/Screens/MusicSelect/Options/AudioOffset.hpp',
|
||||
'src/Screens/MusicSelect/Options/AudioOffset.cpp',
|
||||
'src/Screens/MusicSelect/Options/InputRemap.hpp',
|
||||
'src/Screens/MusicSelect/Options/InputRemap.cpp',
|
||||
'src/Screens/MusicSelect/Panels/MarkerPanel.hpp',
|
||||
'src/Screens/MusicSelect/Panels/MarkerPanel.cpp',
|
||||
'src/Screens/MusicSelect/Panels/Panel.hpp',
|
||||
'src/Screens/MusicSelect/Panels/Panel.cpp',
|
||||
'src/Screens/MusicSelect/Panels/SubpagePanel.hpp',
|
||||
'src/Screens/MusicSelect/Panels/SubpagePanel.cpp',
|
||||
'src/Screens/MusicSelect/MusicPreview.hpp',
|
||||
'src/Screens/MusicSelect/MusicPreview.cpp',
|
||||
'src/Screens/MusicSelect/MusicSelect.hpp',
|
||||
'src/Screens/MusicSelect/MusicSelect.cpp',
|
||||
'src/Screens/MusicSelect/PanelLayout.hpp',
|
||||
'src/Screens/MusicSelect/PanelLayout.cpp',
|
||||
'src/Screens/MusicSelect/Ribbon.hpp',
|
||||
'src/Screens/MusicSelect/Ribbon.cpp',
|
||||
'src/Screens/MusicSelect/Resources.hpp',
|
||||
'src/Screens/MusicSelect/Resources.cpp',
|
||||
'src/Screens/MusicSelect/SongInfo.hpp',
|
||||
'src/Screens/MusicSelect/SongInfo.cpp',
|
||||
'src/Screens/Gameplay/Drawables/Cursor.hpp',
|
||||
'src/Screens/Gameplay/Drawables/Cursor.cpp',
|
||||
'src/Screens/Gameplay/Drawables/Shutter.hpp',
|
||||
'src/Screens/Gameplay/Drawables/Shutter.cpp',
|
||||
'src/Screens/Gameplay/Gameplay.hpp',
|
||||
'src/Screens/Gameplay/Gameplay.cpp',
|
||||
'src/Screens/Gameplay/PreciseMusic.hpp',
|
||||
'src/Screens/Gameplay/PreciseMusic.cpp',
|
||||
'src/Screens/Gameplay/Silence.hpp',
|
||||
'src/Screens/Gameplay/Silence.cpp',
|
||||
'src/Screens/Gameplay/TimedEventsQueue.hpp',
|
||||
'src/Screens/Gameplay/TimedEventsQueue.cpp',
|
||||
'src/Screens/Results/Resources.hpp',
|
||||
'src/Screens/Results/Results.hpp',
|
||||
'src/Screens/Results/Results.cpp',
|
||||
'src/Toolkit/AffineTransform.hpp',
|
||||
'src/Toolkit/Cache.hpp',
|
||||
'src/Toolkit/Debuggable.hpp',
|
||||
'src/Toolkit/DurationInFrames.hpp',
|
||||
'src/Toolkit/EasingFunctions.hpp',
|
||||
'src/Toolkit/EasingFunctions.cpp',
|
||||
'src/Toolkit/GHCFilesystemPathHash.hpp',
|
||||
'src/Toolkit/HSL.hpp',
|
||||
'src/Toolkit/HSL.cpp',
|
||||
'src/Toolkit/SFMLHelpers.hpp',
|
||||
'src/Toolkit/SFMLHelpers.cpp',
|
||||
'src/Toolkit/QuickRNG.hpp',
|
||||
'src/Toolkit/QuickRNG.cpp',
|
||||
'src/Main.cpp',
|
||||
]
|
||||
sources = []
|
||||
subdir('include') # Defines `inc` and adds stuff in `sources`
|
||||
|
||||
subdir('src') # Adds stuff in the `sources` list and defines configuration_inc
|
||||
|
||||
cc = meson.get_compiler('cpp')
|
||||
|
||||
dependencies = []
|
||||
|
||||
foreach module : ['system', 'window', 'graphics', 'audio']
|
||||
dependencies += [dependency('sfml-'+module, version : '>=2.5.1')]
|
||||
endforeach
|
||||
|
||||
dependencies += dependency('threads')
|
||||
dependencies += dependency('gl')
|
||||
dependencies += cc.find_library('atomic')
|
||||
dependencies = [
|
||||
dependency('sfml-system', version : '>=2.5.1'),
|
||||
dependency('sfml-window', version : '>=2.5.1'),
|
||||
dependency('sfml-graphics', version : '>=2.5.1'),
|
||||
dependency('sfml-audio', version : '>=2.5.1'),
|
||||
dependency('threads'),
|
||||
dependency('gl'),
|
||||
cc.find_library('atomic')
|
||||
]
|
||||
|
||||
if host_machine.system() == 'linux'
|
||||
dependencies += cc.find_library('m')
|
||||
dependencies += cc.find_library('X11')
|
||||
dependencies += cc.find_library('dw')
|
||||
dependencies += [
|
||||
cc.find_library('m'),
|
||||
cc.find_library('X11'),
|
||||
cc.find_library('dw')
|
||||
]
|
||||
sources += ['include/backward-cpp/backward.cpp']
|
||||
add_project_arguments('-DBACKWARD_HAS_DW=1', language : 'cpp')
|
||||
add_project_link_arguments('-lstdc++', language : 'cpp')
|
||||
@ -136,7 +39,7 @@ subdir('test')
|
||||
|
||||
executable(
|
||||
'jujube',
|
||||
sources,
|
||||
sources: sources,
|
||||
dependencies: dependencies,
|
||||
include_directories : inc,
|
||||
cpp_args : [
|
||||
@ -145,5 +48,6 @@ executable(
|
||||
'-Wshadow',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-pedantic'
|
||||
]
|
||||
],
|
||||
win_subsystem: 'windows' # mark as GUI app when compiling for windows, hides the console amongst other things
|
||||
)
|
@ -1,9 +1,6 @@
|
||||
rm -rf build
|
||||
mkdir build
|
||||
meson build
|
||||
meson configure build -Ddebug=false -Doptimization=2
|
||||
cd build
|
||||
ninja
|
||||
rm -rf build_release
|
||||
meson setup build_release --buildtype=release
|
||||
meson compile -C build_release
|
||||
cp ../assets assets -r
|
||||
../utils/copy_dependencies.py -f jujube.exe
|
||||
|
7
src/Data/meson.build
Normal file
7
src/Data/meson.build
Normal file
@ -0,0 +1,7 @@
|
||||
sources += files(
|
||||
'Chart.cpp',
|
||||
'GradedNote.cpp',
|
||||
'Preferences.cpp',
|
||||
'Score.cpp',
|
||||
'Song.cpp',
|
||||
)
|
6
src/Drawables/meson.build
Normal file
6
src/Drawables/meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
sources += files(
|
||||
'BlackFrame.cpp',
|
||||
'ButtonHighlight.cpp',
|
||||
'DensityGraph.cpp',
|
||||
'GradedDensityGraph.cpp'
|
||||
)
|
5
src/Input/meson.build
Normal file
5
src/Input/meson.build
Normal file
@ -0,0 +1,5 @@
|
||||
sources += files(
|
||||
'Buttons.cpp',
|
||||
'KeyMapping.cpp',
|
||||
'Events.cpp'
|
||||
)
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
#include <ghc/filesystem.hpp>
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
#include <ghc/filesystem.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <ghc/filesystem.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <ghc/filesystem.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
|
9
src/Resources/meson.build
Normal file
9
src/Resources/meson.build
Normal file
@ -0,0 +1,9 @@
|
||||
sources += files(
|
||||
'TextureCache.cpp',
|
||||
'LNMarker.cpp',
|
||||
'Marker.cpp',
|
||||
'SharedResources.cpp',
|
||||
'SpriteSheet.cpp',
|
||||
'SplitSpriteSheet.cpp',
|
||||
# 'CoverAtlas.cpp',
|
||||
)
|
4
src/Screens/Gameplay/Drawables/meson.build
Normal file
4
src/Screens/Gameplay/Drawables/meson.build
Normal file
@ -0,0 +1,4 @@
|
||||
sources += files(
|
||||
'Cursor.cpp',
|
||||
'Shutter.cpp',
|
||||
)
|
8
src/Screens/Gameplay/meson.build
Normal file
8
src/Screens/Gameplay/meson.build
Normal file
@ -0,0 +1,8 @@
|
||||
subdir('Drawables')
|
||||
|
||||
sources += files(
|
||||
'Gameplay.cpp',
|
||||
'PreciseMusic.cpp',
|
||||
'Silence.cpp',
|
||||
'TimedEventsQueue.cpp',
|
||||
)
|
1
src/Screens/MusicSelect/Drawables/meson.build
Normal file
1
src/Screens/MusicSelect/Drawables/meson.build
Normal file
@ -0,0 +1 @@
|
||||
sources += files('ControlPanels.cpp')
|
5
src/Screens/MusicSelect/Options/meson.build
Normal file
5
src/Screens/MusicSelect/Options/meson.build
Normal file
@ -0,0 +1,5 @@
|
||||
sources += files(
|
||||
'OptionPage.cpp',
|
||||
'AudioOffset.cpp',
|
||||
'InputRemap.cpp'
|
||||
)
|
5
src/Screens/MusicSelect/Panels/meson.build
Normal file
5
src/Screens/MusicSelect/Panels/meson.build
Normal file
@ -0,0 +1,5 @@
|
||||
sources += files(
|
||||
'MarkerPanel.cpp',
|
||||
'Panel.cpp',
|
||||
'SubpagePanel.cpp'
|
||||
)
|
12
src/Screens/MusicSelect/meson.build
Normal file
12
src/Screens/MusicSelect/meson.build
Normal file
@ -0,0 +1,12 @@
|
||||
subdir('Drawables')
|
||||
subdir('Options')
|
||||
subdir('Panels')
|
||||
|
||||
sources += files(
|
||||
'MusicPreview.cpp',
|
||||
'MusicSelect.cpp',
|
||||
'PanelLayout.cpp',
|
||||
'Ribbon.cpp',
|
||||
'Resources.cpp',
|
||||
'SongInfo.cpp'
|
||||
)
|
1
src/Screens/Results/meson.build
Normal file
1
src/Screens/Results/meson.build
Normal file
@ -0,0 +1 @@
|
||||
sources += files('Results.cpp')
|
3
src/Screens/meson.build
Normal file
3
src/Screens/meson.build
Normal file
@ -0,0 +1,3 @@
|
||||
subdir('MusicSelect')
|
||||
subdir('Gameplay')
|
||||
subdir('Results')
|
6
src/Toolkit/meson.build
Normal file
6
src/Toolkit/meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
sources += files(
|
||||
'EasingFunctions.cpp',
|
||||
'HSL.cpp',
|
||||
'SFMLHelpers.cpp',
|
||||
'QuickRNG.cpp'
|
||||
)
|
8
src/meson.build
Normal file
8
src/meson.build
Normal file
@ -0,0 +1,8 @@
|
||||
sources += files('Main.cpp')
|
||||
|
||||
subdir('Data')
|
||||
subdir('Drawables')
|
||||
subdir('Input')
|
||||
subdir('Resources')
|
||||
subdir('Screens')
|
||||
subdir('Toolkit')
|
Loading…
Reference in New Issue
Block a user