diff --git a/.gitignore b/.gitignore index 5a21492..8405ed5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build*/ .vscode/ _test*/ docs/refs -.DS_Store \ No newline at end of file +.DS_Store +.cache/ \ No newline at end of file diff --git a/docs/Compiling.md b/docs/Compiling.md index 3610f93..085b23f 100644 --- a/docs/Compiling.md +++ b/docs/Compiling.md @@ -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 diff --git a/imgui.ini b/imgui.ini new file mode 100644 index 0000000..4a5c201 --- /dev/null +++ b/imgui.ini @@ -0,0 +1,5 @@ +[Window][Debug##Default] +Pos=60,60 +Size=400,400 +Collapsed=0 + diff --git a/include/memon/memon.hpp b/include/memon/memon.hpp index 241de56..239cd09 100644 --- a/include/memon/memon.hpp +++ b/include/memon/memon.hpp @@ -11,6 +11,7 @@ https://github.com/Stepland/memon #include #include #include +#include #include "json.hpp" diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..3dd759d --- /dev/null +++ b/include/meson.build @@ -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' +) \ No newline at end of file diff --git a/meson.build b/meson.build index 714b5c2..be4ecf1 100644 --- a/meson.build +++ b/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 ) \ No newline at end of file diff --git a/build_linux.sh b/packaging/debian/build_linux.sh similarity index 100% rename from build_linux.sh rename to packaging/debian/build_linux.sh diff --git a/make_release.sh b/packaging/windows/make_release.sh similarity index 64% rename from make_release.sh rename to packaging/windows/make_release.sh index 0a9dc9d..280f5a1 100644 --- a/make_release.sh +++ b/packaging/windows/make_release.sh @@ -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 diff --git a/src/Data/meson.build b/src/Data/meson.build new file mode 100644 index 0000000..ec47c88 --- /dev/null +++ b/src/Data/meson.build @@ -0,0 +1,7 @@ +sources += files( + 'Chart.cpp', + 'GradedNote.cpp', + 'Preferences.cpp', + 'Score.cpp', + 'Song.cpp', +) \ No newline at end of file diff --git a/src/Drawables/meson.build b/src/Drawables/meson.build new file mode 100644 index 0000000..3394445 --- /dev/null +++ b/src/Drawables/meson.build @@ -0,0 +1,6 @@ +sources += files( + 'BlackFrame.cpp', + 'ButtonHighlight.cpp', + 'DensityGraph.cpp', + 'GradedDensityGraph.cpp' +) \ No newline at end of file diff --git a/src/Input/meson.build b/src/Input/meson.build new file mode 100644 index 0000000..d25c2eb --- /dev/null +++ b/src/Input/meson.build @@ -0,0 +1,5 @@ +sources += files( + 'Buttons.cpp', + 'KeyMapping.cpp', + 'Events.cpp' +) \ No newline at end of file diff --git a/src/Resources/LNMarker.hpp b/src/Resources/LNMarker.hpp index 163b815..312b391 100644 --- a/src/Resources/LNMarker.hpp +++ b/src/Resources/LNMarker.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/src/Resources/Marker.hpp b/src/Resources/Marker.hpp index 28b574a..9d4ed82 100644 --- a/src/Resources/Marker.hpp +++ b/src/Resources/Marker.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/src/Resources/SplitSpriteSheet.hpp b/src/Resources/SplitSpriteSheet.hpp index 7fd7e3e..b1f4c17 100644 --- a/src/Resources/SplitSpriteSheet.hpp +++ b/src/Resources/SplitSpriteSheet.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include diff --git a/src/Resources/SpriteSheet.hpp b/src/Resources/SpriteSheet.hpp index 02daa35..3182cd5 100644 --- a/src/Resources/SpriteSheet.hpp +++ b/src/Resources/SpriteSheet.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include diff --git a/src/Resources/meson.build b/src/Resources/meson.build new file mode 100644 index 0000000..9f408f2 --- /dev/null +++ b/src/Resources/meson.build @@ -0,0 +1,9 @@ +sources += files( + 'TextureCache.cpp', + 'LNMarker.cpp', + 'Marker.cpp', + 'SharedResources.cpp', + 'SpriteSheet.cpp', + 'SplitSpriteSheet.cpp', + # 'CoverAtlas.cpp', +) \ No newline at end of file diff --git a/src/Screens/Gameplay/Drawables/meson.build b/src/Screens/Gameplay/Drawables/meson.build new file mode 100644 index 0000000..617a706 --- /dev/null +++ b/src/Screens/Gameplay/Drawables/meson.build @@ -0,0 +1,4 @@ +sources += files( + 'Cursor.cpp', + 'Shutter.cpp', +) \ No newline at end of file diff --git a/src/Screens/Gameplay/meson.build b/src/Screens/Gameplay/meson.build new file mode 100644 index 0000000..28138df --- /dev/null +++ b/src/Screens/Gameplay/meson.build @@ -0,0 +1,8 @@ +subdir('Drawables') + +sources += files( + 'Gameplay.cpp', + 'PreciseMusic.cpp', + 'Silence.cpp', + 'TimedEventsQueue.cpp', +) \ No newline at end of file diff --git a/src/Screens/MusicSelect/Drawables/meson.build b/src/Screens/MusicSelect/Drawables/meson.build new file mode 100644 index 0000000..3790857 --- /dev/null +++ b/src/Screens/MusicSelect/Drawables/meson.build @@ -0,0 +1 @@ +sources += files('ControlPanels.cpp') \ No newline at end of file diff --git a/src/Screens/MusicSelect/Options/meson.build b/src/Screens/MusicSelect/Options/meson.build new file mode 100644 index 0000000..9aebe50 --- /dev/null +++ b/src/Screens/MusicSelect/Options/meson.build @@ -0,0 +1,5 @@ +sources += files( + 'OptionPage.cpp', + 'AudioOffset.cpp', + 'InputRemap.cpp' +) \ No newline at end of file diff --git a/src/Screens/MusicSelect/Panels/meson.build b/src/Screens/MusicSelect/Panels/meson.build new file mode 100644 index 0000000..d7142f4 --- /dev/null +++ b/src/Screens/MusicSelect/Panels/meson.build @@ -0,0 +1,5 @@ +sources += files( + 'MarkerPanel.cpp', + 'Panel.cpp', + 'SubpagePanel.cpp' +) \ No newline at end of file diff --git a/src/Screens/MusicSelect/meson.build b/src/Screens/MusicSelect/meson.build new file mode 100644 index 0000000..4c0820c --- /dev/null +++ b/src/Screens/MusicSelect/meson.build @@ -0,0 +1,12 @@ +subdir('Drawables') +subdir('Options') +subdir('Panels') + +sources += files( + 'MusicPreview.cpp', + 'MusicSelect.cpp', + 'PanelLayout.cpp', + 'Ribbon.cpp', + 'Resources.cpp', + 'SongInfo.cpp' +) \ No newline at end of file diff --git a/src/Screens/Results/meson.build b/src/Screens/Results/meson.build new file mode 100644 index 0000000..628aee6 --- /dev/null +++ b/src/Screens/Results/meson.build @@ -0,0 +1 @@ +sources += files('Results.cpp') \ No newline at end of file diff --git a/src/Screens/meson.build b/src/Screens/meson.build new file mode 100644 index 0000000..37a8fad --- /dev/null +++ b/src/Screens/meson.build @@ -0,0 +1,3 @@ +subdir('MusicSelect') +subdir('Gameplay') +subdir('Results') \ No newline at end of file diff --git a/src/Toolkit/meson.build b/src/Toolkit/meson.build new file mode 100644 index 0000000..20ed632 --- /dev/null +++ b/src/Toolkit/meson.build @@ -0,0 +1,6 @@ +sources += files( + 'EasingFunctions.cpp', + 'HSL.cpp', + 'SFMLHelpers.cpp', + 'QuickRNG.cpp' +) \ No newline at end of file diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..d8f3bb8 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,8 @@ +sources += files('Main.cpp') + +subdir('Data') +subdir('Drawables') +subdir('Input') +subdir('Resources') +subdir('Screens') +subdir('Toolkit') \ No newline at end of file