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"]
path = external/abseil-cpp
url = https://github.com/abseil/abseil-cpp
[submodule "external/spdlog"]
path = external/spdlog
url = https://github.com/gabime/spdlog
[submodule "external/Catch2"]
path = external/Catch2
url = https://github.com/catchorg/Catch2
[submodule "external/cxxopts"]
path = external/cxxopts
url = https://github.com/jarro2783/cxxopts
[submodule "external/benchmark"]
path = external/benchmark
url = https://github.com/google/benchmark
[submodule "external/readerwriterqueue"]
path = external/readerwriterqueue
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"]
path = external/cnpy
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_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
add_subdirectory(external/abseil-cpp)
add_subdirectory(external/spdlog)
add_subdirectory(external/Catch2)
add_subdirectory(external/cxxopts)
add_subdirectory(external/gsl-lite)
add_subdirectory(external/benchmark)
add_subdirectory(external/cnpy)
@ -121,7 +118,7 @@ add_executable(sfzprint sources/ParserMain.cpp sources/Opcode.cpp sources/Parser
if(UNIX)
target_link_libraries(sfzprint stdc++fs)
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_link_libraries(sfizz stdc++fs)
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

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

View file

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