diff --git a/.gitignore b/.gitignore index d62f1eb7..e9bc5de1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,14 @@ build-reldeb build-debug .vscode perf.data -perf.data.old \ No newline at end of file +perf.data.old + +Makefile +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +compile_commands.json +*.a + +clients/sfizz_jack +clients/sfzprint diff --git a/CMakeLists.txt b/CMakeLists.txt index ae9e4769..d42c1a5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID) add_compile_options(-stdlib=libc++) # Presumably need the above for linking too, maybe other options missing as well add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release +else() + add_link_options(-lstdc++fs) endif() if (UNIX) diff --git a/clients/sfzprint.cpp b/clients/sfzprint.cpp index 3e07f383..41e87b06 100644 --- a/clients/sfzprint.cpp +++ b/clients/sfzprint.cpp @@ -23,8 +23,8 @@ #include "Parser.h" #include "StringViewHelpers.h" +#include "filesystem.h" #include -#include #include #include #include @@ -92,4 +92,4 @@ int main(int argc, char** argv) std::cout << '\t' << define.first << '=' << define.second << '\n'; // spdlog::info("Done!"); return 0; -} \ No newline at end of file +} diff --git a/sfizz/FilePool.h b/sfizz/FilePool.h index 77d650d7..2da54176 100644 --- a/sfizz/FilePool.h +++ b/sfizz/FilePool.h @@ -27,9 +27,9 @@ #include "LeakDetector.h" #include "AudioBuffer.h" #include "Voice.h" +#include "filesystem.h" #include "readerwriterqueue.h" #include -#include #include #include #include @@ -76,4 +76,4 @@ private: absl::flat_hash_map>> preloadedData; LEAK_DETECTOR(FilePool); }; -} \ No newline at end of file +} diff --git a/sfizz/Parser.h b/sfizz/Parser.h index 3015d9a2..c7927d13 100644 --- a/sfizz/Parser.h +++ b/sfizz/Parser.h @@ -23,7 +23,7 @@ #pragma once #include "Opcode.h" -#include +#include "filesystem.h" #include #include #include @@ -57,4 +57,4 @@ private: void readSfzFile(const std::filesystem::path& fileName, std::vector& lines) noexcept; }; -} // namespace sfz \ No newline at end of file +} // namespace sfz diff --git a/sfizz/filesystem.h b/sfizz/filesystem.h new file mode 100644 index 00000000..3ad22a65 --- /dev/null +++ b/sfizz/filesystem.h @@ -0,0 +1,35 @@ +// Copyright (c) 2019, Paul Ferrand +// All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: + +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#pragma once + +#if defined(__cpp_lib_filesystem) || (defined(__has_include) && __has_include()) +#include +#elif defined(__cpp_lib_experimental_filesystem) || (defined(__has_include) && __has_include()) +#include +namespace std { + namespace filesystem = std::experimental::filesystem; +} +#else +#error no filesystem support +#endif