Skip to content

Commit

Permalink
Makefile: use minizip-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Oct 11, 2023
1 parent e679be1 commit 582b2cd
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CXXFLAGS := -std=c++17 \
-O2 -flto \
-I$(SOURCE_DIR) \
-I$(THIRDPARTY_DIR)/tinyxml2 \
$(shell $(PKG_CONFIG) --cflags minizip)
-I$(THIRDPARTY_DIR)/minizip-ng

LDFLAGS := -s $(shell $(PKG_CONFIG) --libs minizip)
LDFLAGS := -s

OBJECT_FILES = \
$(SOURCE_DIR)/main.o \
Expand All @@ -27,6 +27,14 @@ OBJECT_FILES = \
$(SOURCE_DIR)/SporeModManagerHelpers/Zip.o \
$(THIRDPARTY_DIR)/tinyxml2/tinyxml2.o

THIRDPARTY_LIBRARIES = \
$(THIRDPARTY_DIR)/minizip-ng/build/libminizip.a \
$(THIRDPARTY_DIR)/minizip-ng/build/_deps/zlib-build/libz.a


THIRDPARTY_BUILD_DIRS = \
$(THIRDPARTY_DIR)/minizip-ng/build

%.o: %.cpp
$(CXX) -c $< -o $@ $(CXXFLAGS)

Expand All @@ -35,8 +43,22 @@ all: $(BINARY_DIR)/SporeModManager
$(BINARY_DIR):
mkdir -p $@

$(BINARY_DIR)/SporeModManager: $(BINARY_DIR) $(OBJECT_FILES)
$(CXX) $(OBJECT_FILES) -o $@ $(LDFLAGS)
$(THIRDPARTY_DIR)/minizip-ng/build/libminizip.a:
cmake -S $(THIRDPARTY_DIR)/minizip-ng -B $(THIRDPARTY_DIR)/minizip-ng/build \
-DMZ_LZMA=OFF -DMZ_ZSTD=OFF \
-DMZ_BZIP2=OFF -DMZ_PKCRYPT=OFF \
-DMZ_WZAES=OFF -DMZ_SIGNING=OFF \
-DMZ_DECOMPRESS_ONLY=ON -DMZ_ICONV=OFF \
-DMZ_OPENSSL=OFF -DMZ_LIBBSD=OFF \
-DMZ_FORCE_FETCH_LIBS=ON -DMZ_FETCH_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-G "Unix Makefiles"
$(MAKE) -C $(THIRDPARTY_DIR)/minizip-ng/build

$(THIRDPARTY_DIR)/minizip-ng/build/_deps/zlib-build/libz.a: $(THIRDPARTY_DIR)/minizip-ng/build/libminizip.a

$(BINARY_DIR)/SporeModManager: $(THIRDPARTY_LIBRARIES) $(BINARY_DIR) $(OBJECT_FILES)
$(CXX) $(OBJECT_FILES) -o $@ $(THIRDPARTY_LIBRARIES) $(LDFLAGS)

clean:
rm -rf $(BINARY_DIR) $(OBJECT_FILES)
rm -rf $(BINARY_DIR) $(OBJECT_FILES) $(THIRDPARTY_BUILD_DIRS)

0 comments on commit 582b2cd

Please sign in to comment.