Removed some dependencies and use abseil's flags

This commit is contained in:
paul 2019-08-22 21:11:59 +02:00
parent b88a1c3e00
commit 81469d25a4
7 changed files with 19 additions and 42 deletions

9
.gitmodules vendored
View file

@ -1,24 +1,15 @@
[submodule "external/abseil-cpp"] [submodule "external/abseil-cpp"]
path = external/abseil-cpp path = external/abseil-cpp
url = https://github.com/abseil/abseil-cpp url = https://github.com/abseil/abseil-cpp
[submodule "external/spdlog"]
path = external/spdlog
url = https://github.com/gabime/spdlog
[submodule "external/Catch2"] [submodule "external/Catch2"]
path = external/Catch2 path = external/Catch2
url = https://github.com/catchorg/Catch2 url = https://github.com/catchorg/Catch2
[submodule "external/cxxopts"]
path = external/cxxopts
url = https://github.com/jarro2783/cxxopts
[submodule "external/benchmark"] [submodule "external/benchmark"]
path = external/benchmark path = external/benchmark
url = https://github.com/google/benchmark url = https://github.com/google/benchmark
[submodule "external/readerwriterqueue"] [submodule "external/readerwriterqueue"]
path = external/readerwriterqueue path = external/readerwriterqueue
url = https://github.com/cameron314/readerwriterqueue.git url = https://github.com/cameron314/readerwriterqueue.git
[submodule "external/gsl-lite"]
path = external/gsl-lite
url = https://github.com/martinmoene/gsl-lite.git
[submodule "external/cnpy"] [submodule "external/cnpy"]
path = external/cnpy path = external/cnpy
url = https://github.com/rogersce/cnpy.git url = https://github.com/rogersce/cnpy.git

View file

@ -42,10 +42,7 @@ set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests")
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests") set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests")
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install") set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
add_subdirectory(external/abseil-cpp) add_subdirectory(external/abseil-cpp)
add_subdirectory(external/spdlog)
add_subdirectory(external/Catch2) add_subdirectory(external/Catch2)
add_subdirectory(external/cxxopts)
add_subdirectory(external/gsl-lite)
add_subdirectory(external/benchmark) add_subdirectory(external/benchmark)
add_subdirectory(external/cnpy) add_subdirectory(external/cnpy)
@ -121,7 +118,7 @@ add_executable(sfzprint sources/ParserMain.cpp sources/Opcode.cpp sources/Parser
if(UNIX) if(UNIX)
target_link_libraries(sfzprint stdc++fs) target_link_libraries(sfzprint stdc++fs)
endif(UNIX) endif(UNIX)
target_link_libraries(sfzprint absl::strings cxxopts) target_link_libraries(sfzprint absl::strings absl::flags_parse)
############################### ###############################
@ -132,7 +129,7 @@ if(UNIX)
target_compile_options(sfizz PRIVATE -fno-rtti) target_compile_options(sfizz PRIVATE -fno-rtti)
target_link_libraries(sfizz stdc++fs) target_link_libraries(sfizz stdc++fs)
endif(UNIX) endif(UNIX)
target_link_libraries(sfizz absl::strings cxxopts sndfile absl::flat_hash_map readerwriterqueue) target_link_libraries(sfizz absl::strings sndfile absl::flat_hash_map readerwriterqueue absl::flags_parse)
############################### ###############################
# Test application # Test application

1
external/cxxopts vendored

@ -1 +0,0 @@
Subproject commit cb60381e84df99a4829e3d3c657c06380f916d0f

1
external/gsl-lite vendored

@ -1 +0,0 @@
Subproject commit 89987ffc3b6940ad7b7b9c61c5d5beea0bf2f2c0

1
external/spdlog vendored

@ -1 +0,0 @@
Subproject commit 139c0d135f303946bd542a9bc2d6b18d6a7415bb

View file

@ -1,20 +1,17 @@
#include "Synth.h" #include "Synth.h"
#include <iostream> #include <iostream>
#include "cxxopts.hpp" #include <absl/flags/parse.h>
#include <absl/types/span.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
std::ios::sync_with_stdio(false); std::ios::sync_with_stdio(false);
std::vector<std::string> filesToParse; auto arguments = absl::ParseCommandLine(argc, argv);
cxxopts::Options options("sfzparser", "Parses an sfz file and prints the output"); auto filesToParse = absl::MakeConstSpan(arguments).subspan(1);
options.add_options()("positional", "SFZ files to parse", cxxopts::value<std::vector<std::string>>(filesToParse)); std::cout << "Positional arguments:";
options.parse_positional({"positional"}); for (auto& file: filesToParse)
auto result = options.parse(argc, argv); std::cout << " " << file << ',';
if (filesToParse.size() == 0) std::cout << '\n';
{
std::cout << options.help() << '\n';
return -1;
}
sfz::Synth synth; sfz::Synth synth;
std::filesystem::path filename { filesToParse[0] }; std::filesystem::path filename { filesToParse[0] };

View file

@ -1,10 +1,9 @@
#include "Parser.h" #include "Parser.h"
#include "cxxopts.hpp"
// #include "spdlog/spdlog.h"
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include <string_view> #include <string_view>
#include <absl/flags/parse.h>
#include <absl/types/span.h>
class PrintingParser: public sfz::Parser class PrintingParser: public sfz::Parser
{ {
@ -44,17 +43,13 @@ private:
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
std::ios::sync_with_stdio(false); std::ios::sync_with_stdio(false);
std::vector<std::string> filesToParse; auto arguments = absl::ParseCommandLine(argc, argv);
cxxopts::Options options("sfzparser", "Parses an sfz file and prints the output"); auto filesToParse = absl::MakeConstSpan(arguments).subspan(1);
options.add_options()("positional", "SFZ files to parse", cxxopts::value<std::vector<std::string>>(filesToParse)); std::cout << "Positional arguments:";
options.parse_positional({"positional"}); for (auto& file: filesToParse)
auto result = options.parse(argc, argv); std::cout << " " << file << ',';
if (filesToParse.size() == 0) std::cout << '\n';
{
std::cout << options.help() << '\n';
return -1;
}
PrintingParser parser; PrintingParser parser;
std::filesystem::path filename { filesToParse[0] }; std::filesystem::path filename { filesToParse[0] };
parser.loadSfzFile(filename); parser.loadSfzFile(filename);