diff --git a/docs/Compiling.md b/docs/Compiling.md new file mode 100644 index 0000000..31d3de9 --- /dev/null +++ b/docs/Compiling.md @@ -0,0 +1,24 @@ +# Compiling jujube + +jujube uses the meson build system. +Only time will tell if this turned out to be a wise choice, I just can't stand CMake. + +jujube needs a *very* up to date C++ compiler for I'm using stuff like `std::filesystem` which is, at the time of writing, easily availble only on the very last version of your favorite compiler + +## Linux + +### Dependencies + +- **SFML 2.5.1** : You will most likely need to build SFML yourself, and with the same compiler as the one you will use for jujube because if you just get precompiled binaries for SFML from your package manager you *will* have compatibility problems. [Here's](https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php) their docs. +- **meson** : Installation explained [here](https://mesonbuild.com/Quick-guide.html) + +### Building + +let's say you downloaded the source code in `jujube` and you decided to compile with `gcc-9` + +```bash +$ cd jujube +$ CXX=gcc-9 meson build +$ cd build +$ ninja +``` \ No newline at end of file diff --git a/meson.build b/meson.build index 8043150..8d68d76 100644 --- a/meson.build +++ b/meson.build @@ -10,8 +10,7 @@ foreach module : ['system', 'window', 'graphics', 'audio'] sfml += [dependency('sfml-'+module, version : '>=2.5.1')] endforeach -cpp = meson.get_compiler('cpp') -filesystem = cpp.find_library('stdc++fs') +add_project_link_arguments(['-lstdc++', '-lstdc++fs'], language : 'cpp') sources = [ 'src/Main.cpp', @@ -40,7 +39,7 @@ sources = [ executable( 'jujube', sources, - dependencies: [sfml, filesystem], + dependencies: [sfml], include_directories : include_directories('include'), cpp_args : [ '-Wall', diff --git a/src/Data/SongList.cpp b/src/Data/SongList.cpp index 4ed3f71..eb609ba 100644 --- a/src/Data/SongList.cpp +++ b/src/Data/SongList.cpp @@ -28,17 +28,20 @@ namespace Data { const std::vector getSongFolders() { - std::vector song_folders; + std::vector potential_song_folders; + fs::path song_folder = "songs/"; - for (const auto& dir_item : fs::directory_iterator("songs/")) { - if (dir_item.is_directory()) { - for (auto& path : recursiveSongSearch(dir_item.path())) { - song_folders.push_back(path); + if (fs::exists(song_folder) and fs::is_directory(song_folder)) { + for (const auto& dir_item : fs::directory_iterator("songs/")) { + if (dir_item.is_directory()) { + for (auto& path : recursiveSongSearch(dir_item.path())) { + potential_song_folders.push_back(path); + } } } } - return song_folders; + return potential_song_folders; } std::list recursiveSongSearch(fs::path song_or_pack) {