Skip to content

Commit bb8b315

Browse files
committed
misc: move src/ libraries into libs
1 parent 694a2c1 commit bb8b315

11 files changed

Lines changed: 46 additions & 23 deletions

File tree

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,35 @@ LDFLAGS += -L./$(BUILDDIR)/fmt -lfmt -ldl
6161
CXXFLAGS ?= -mtune=generic -march=native
6262
CXXFLAGS += -fvisibility=hidden -Iinclude -std=c++20 $(VARS) -DVERSION=\"$(VERSION)\" -DLOCALEDIR=\"$(LOCALEDIR)\"
6363

64-
all: genver fmt toml $(TARGET)
64+
all: genver fmt toml json $(TARGET)
6565

6666
fmt:
6767
ifeq ($(wildcard $(BUILDDIR)/fmt/libfmt.a),)
6868
mkdir -p $(BUILDDIR)/fmt
69-
make -C src/fmt BUILDDIR=$(BUILDDIR)/fmt
69+
make -C src/libs/fmt BUILDDIR=$(BUILDDIR)/fmt
7070
endif
7171

7272
toml:
7373
ifeq ($(wildcard $(BUILDDIR)/toml++/toml.o),)
7474
mkdir -p $(BUILDDIR)/toml++
75-
make -C src/toml++ BUILDDIR=$(BUILDDIR)/toml++
75+
make -C src/libs/toml++ BUILDDIR=$(BUILDDIR)/toml++
76+
endif
77+
78+
json:
79+
ifeq ($(wildcard $(BUILDDIR)/json/json.o),)
80+
mkdir -p $(BUILDDIR)/json
81+
make -C src/libs/json BUILDDIR=$(BUILDDIR)/json
7682
endif
7783

7884
genver: ./scripts/generateVersion.sh
7985
ifeq ($(wildcard include/version.h),)
8086
./scripts/generateVersion.sh
8187
endif
8288

83-
$(TARGET): genver fmt toml $(OBJ)
89+
$(TARGET): genver fmt toml json $(OBJ)
8490
mkdir -p $(BUILDDIR)
8591
sh ./scripts/generateVersion.sh
86-
$(CXX) $(OBJ) $(BUILDDIR)/toml++/toml.o -o $(BUILDDIR)/$(TARGET) $(LDFLAGS)
92+
$(CXX) $(OBJ) $(BUILDDIR)/toml++/toml.o $(BUILDDIR)/json/json.o -o $(BUILDDIR)/$(TARGET) $(LDFLAGS)
8793
cd $(BUILDDIR)/ && ln -sf $(TARGET) cufetch
8894

8995
locale:

src/display.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,5 +433,8 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
433433
void Display::display(const std::vector<std::string>& renderResult)
434434
{
435435
for (const std::string& str : renderResult)
436-
fmt::print("{}\n", str);
436+
{
437+
fmt::print("{}", str);
438+
fmt::print("\n");
439+
}
437440
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CXX ?= g++
66
# CXX_DEFINES = -DFMT_LIB_EXPORT -Dfmt_EXPORTS
7-
CXX_INCLUDES = -I../../include
7+
CXX_INCLUDES = -I../../../include
88
CXX_FLAGS = -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden
99

1010
all: fmt
@@ -14,10 +14,10 @@ fmt: format.cc os.cc
1414
$(CXX) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -c os.cc -o os.cc.o
1515
ar qc libfmt.a os.cc.o format.cc.o
1616
ranlib libfmt.a
17-
mv -f libfmt.a ../../$(BUILDDIR)/libfmt.a
17+
mv -f libfmt.a ../../../$(BUILDDIR)/libfmt.a
1818
# $(CXX) -fPIC -O3 -DNDEBUG -shared -Wl,-soname,libfmt.so.10 -o libfmt.so format.cc.o os.cc.o
1919

2020
clean:
21-
rm -f *.o *.so *.a ../../$(BUILDDIR)/fmt/.*a
21+
rm -f *.o *.so *.a ../../../$(BUILDDIR)/fmt/.*a
2222

2323
.PHONY: clean all fmt
File renamed without changes.

src/libs/json/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CXX ?= g++
2+
SRC = json.cpp
3+
TARGET = json.o
4+
CXXFLAGS = -I../../../include -std=c++20
5+
6+
all: $(TARGET)
7+
8+
$(TARGET):
9+
${CXX} $(SRC) $(CXXFLAGS) -c -o ../../../$(BUILDDIR)/$@
10+
11+
clean:
12+
rm -rf ../../$(BUILDDIR)/json/$(TARGET)
13+
14+
.PHONY: $(TARGET) clean all
File renamed without changes.

src/libs/toml++/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CXX ?= g++
2+
SRC = toml.cpp
3+
TARGET = toml.o
4+
CXXFLAGS = -I../../../include -std=c++20
5+
6+
all: $(TARGET)
7+
8+
$(TARGET):
9+
${CXX} $(SRC) $(CXXFLAGS) -c -o ../../../$(BUILDDIR)/$@
10+
11+
clean:
12+
rm -rf ../../../$(BUILDDIR)/toml++/$(TARGET)
13+
14+
.PHONY: $(TARGET) clean all

0 commit comments

Comments
 (0)