diff options
Diffstat (limited to 'svg-flatten')
-rw-r--r-- | svg-flatten/Makefile | 7 | ||||
-rw-r--r-- | svg-flatten/src/main.cpp | 10 |
2 files changed, 9 insertions, 8 deletions
diff --git a/svg-flatten/Makefile b/svg-flatten/Makefile index 88619fc..25c8048 100644 --- a/svg-flatten/Makefile +++ b/svg-flatten/Makefile @@ -1,6 +1,6 @@ CXX := clang++ -LD := ld +LD ?= ld INSTALL := install PKG_CONFIG ?= pkg-config @@ -46,7 +46,8 @@ CXXFLAGS += $(shell $(PKG_CONFIG) --cflags opencv4 2> /dev/null || $(PKG_CONFIG) LDFLAGS := -lm -lc -lstdc++ LDFLAGS += $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_DEPS)) # debian hack. see above. -LDFLAGS += $(shell $(PKG_CONFIG) --libs opencv4 2> /dev/null || $(PKG_CONFIG) --libs opencv 2>/dev/null) +OPENCV_LDFLAGS := $(shell $(PKG_CONFIG) --libs opencv4 2> /dev/null || $(PKG_CONFIG) --libs opencv 2>/dev/null) +LDFLAGS += $(shell echo $(OPENCV_LDFLAGS) | sed 's/-l\S\+ //g') -lopencv_core -lopencv_imgproc -lopencv_imgcodecs TARGET := svg-flatten @@ -65,7 +66,7 @@ $(BUILDDIR)/%.o: %.cpp $(BUILDDIR)/$(TARGET): $(SOURCES:%.cpp=$(BUILDDIR)/%.o) @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -lstdc++fs + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $^ -lstdc++fs -Wl,--end-group .PHONY: install install: diff --git a/svg-flatten/src/main.cpp b/svg-flatten/src/main.cpp index e120a9c..3427373 100644 --- a/svg-flatten/src/main.cpp +++ b/svg-flatten/src/main.cpp @@ -168,7 +168,7 @@ int main(int argc, char **argv) { precision = atoi(args["precision"]); } - string fmt = args["ofmt"] ? args["ofmt"] : "gerber"; + string fmt = args["ofmt"] ? args["ofmt"].as<string>() : "gerber"; transform(fmt.begin(), fmt.end(), fmt.begin(), [](unsigned char c){ return std::tolower(c); }); /* c++ yeah */ string sexp_layer = args["sexp_layer"] ? args["sexp_layer"].as<string>() : "auto"; @@ -179,8 +179,8 @@ int main(int argc, char **argv) { PolygonSink *flattener = nullptr; PolygonSink *dilater = nullptr; if (fmt == "svg") { - string dark_color = args["svg_dark_color"] ? args["svg_dark_color"] : "#000000"; - string clear_color = args["svg_clear_color"] ? args["svg_clear_color"] : "#ffffff"; + string dark_color = args["svg_dark_color"] ? args["svg_dark_color"].as<string>() : "#000000"; + string clear_color = args["svg_clear_color"] ? args["svg_clear_color"].as<string>() : "#ffffff"; sink = new SimpleSVGOutput(*out_f, only_polys, precision, dark_color, clear_color); } else if (fmt == "gbr" || fmt == "grb" || fmt == "gerber") { @@ -232,7 +232,7 @@ int main(int argc, char **argv) { sel.layers = &gerbolyze::kicad_default_layers; } - string vectorizer = args["vectorizer"] ? args["vectorizer"] : "poisson-disc"; + string vectorizer = args["vectorizer"] ? args["vectorizer"].as<string>() : "poisson-disc"; /* Check argument */ ImageVectorizer *vec = makeVectorizer(vectorizer); if (!vec) { @@ -408,7 +408,7 @@ int main(int argc, char **argv) { } } - VectorizerSelectorizer vec_sel(vectorizer, args["vectorizer_map"] ? args["vectorizer_map"] : ""); + VectorizerSelectorizer vec_sel(vectorizer, args["vectorizer_map"] ? args["vectorizer_map"].as<string>() : ""); RenderSettings rset { min_feature_size, vec_sel, |