diff --git a/Makefile b/Makefile index e3c3eb7..4b0fe08 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include Makefile.common # TEST_APP = test_emplace -TEST_APP = test_json +TEST_APP = csar .PHONY: all build-static build-shared check clean distclean test all: build-static check test @@ -15,7 +15,6 @@ check: build-static $(MAKE) -C test test: - ./build/$(TEST_APP).exe clean: $(MAKE) -C src clean diff --git a/Makefile.common b/Makefile.common index 64deb78..25d4160 100644 --- a/Makefile.common +++ b/Makefile.common @@ -17,7 +17,8 @@ BUILD_DIR := ../build RESULT_DIR := $(BUILD_DIR)/ CACHE_DIR := $(BUILD_DIR)/cache -EXEFLAGS := -m64 +EXEFLAGS := $(LDFLAGS) +EXEFLAGS += -m64 $(CACHE_DIR)/%.o : %.cpp diff --git a/src/csar.cpp b/src/csar.cpp index a191ae3..4dff3ca 100644 --- a/src/csar.cpp +++ b/src/csar.cpp @@ -1,17 +1,37 @@ #include #include -#include -#include +#include struct NotImplementedError: public std::exception { }; +namespace po = boost::program_options; int main(int argc, char const *argv[]) { - using options_description = boost::program_options::options_description; - options_description desc("Allowed options:"); - std::cout << "Hello world!" << std::endl; + po::options_description desc("Arguments: "); + desc.add_options() + ("help", "produce help messages") + ("input-file", po::value< std::string >(), "input file path") + ("output", po::value< std::string >(), "output file path") + ; + po::positional_options_description p; + p.add("input-file", -1); + + po::variables_map vm; + po::store(po::command_line_parser(argc, argv). + options(desc).positional(p).run(), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << "Usage: options_description [options]\n"; + std::cout << desc << std::endl; + return 0; + } + if (vm.count("output")) + { + // std::cout << desc["output"].as() << std::endl; + } return 0; } \ No newline at end of file diff --git a/test/Makefile b/test/Makefile index 20adbd9..1a7ed20 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,12 +5,13 @@ OBJECTS := EXEUTABLES := $(foreach f,$(SOURCES:.cpp=.exe),$(BUILD_DIR)/$(f)) -.PHONY: all build clean +.PHONY: all build clean test all: build build: $(EXEUTABLES) +test: build $(BUILD_DIR)/%.exe: %.o $(OBJECTS) - $(CXX) $(CXXFLAGS) -o $@ $^ + $(CXX) $(CXXFLAGS) $(EXEFLAGS) -o $@ $^ clean: $(RM) $(EXEUTABLES)