From 47fb555f26962f81d2c6671e3bca19f3c4b95a69 Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Wed, 18 Sep 2024 01:19:25 +0200 Subject: [PATCH 1/2] Changed lib build from shared object to archive for linux --- cpp/Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cpp/Makefile b/cpp/Makefile index 52423a4..95c77d7 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -7,12 +7,12 @@ INCS = -I$(NEGENTROPY_ROOT) -I/opt/homebrew/include/ -I$(NEGENTROPY_ROOT)/vendor ifeq ($(OS),Windows_NT) TARGET = libnegentropy.dll else - TARGET = libnegentropy.so + TARGET = libnegentropy.a endif -.PHONY: all clean install-deps precompiled-header shared-lib +.PHONY: all clean install-deps precompiled-header build-lib -all: precompiled-header shared-lib +all: precompiled-header build-lib #TODO: Need to add compilation flags based on OS install-deps: @@ -22,8 +22,13 @@ install-deps: precompiled-header: g++ -O0 --std=c++20 -Wall -fexceptions -g $(NEGENTROPY_ROOT)negentropy.h $(INCS) -shared-lib: +build-lib: +ifeq ($(OS),Windows_NT) g++ -O0 -g -std=c++20 $(INCS) -shared -fPIC -o $(TARGET) $(NEGENTROPY_ROOT)negentropy_wrapper.cpp -lcrypto -lssl -L/opt/homebrew/lib/ +else + g++ -O0 -g -std=c++20 $(INCS) -c negentropy_wrapper.cpp + ar rcs $(TARGET) negentropy_wrapper.o +endif clean: - rm -f $(TARGET) negentropy.h.gch libnegentropy.so + rm -f $(TARGET) negentropy.h.gch *.o From 8e08aa246bb2dbd4e208d5800076c48ea788baa4 Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:55:59 +0200 Subject: [PATCH 2/2] Add back -fPIC --- cpp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/Makefile b/cpp/Makefile index 95c77d7..66c1c5d 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -26,7 +26,7 @@ build-lib: ifeq ($(OS),Windows_NT) g++ -O0 -g -std=c++20 $(INCS) -shared -fPIC -o $(TARGET) $(NEGENTROPY_ROOT)negentropy_wrapper.cpp -lcrypto -lssl -L/opt/homebrew/lib/ else - g++ -O0 -g -std=c++20 $(INCS) -c negentropy_wrapper.cpp + g++ -O0 -g -std=c++20 $(INCS) -fPIC -c negentropy_wrapper.cpp ar rcs $(TARGET) negentropy_wrapper.o endif