From 4b52bcea11228b3a23f2ce09f9e40c9eda669c8c Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Fri, 6 Sep 2024 16:03:52 +0530 Subject: [PATCH 1/2] chore: update makefile to give support major os --- cpp/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/Makefile b/cpp/Makefile index 44bf143..fd56ed5 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -1,7 +1,8 @@ # Build a shared library of negentropy -#TODO: Need to add compilation flags based on OS -INCS = -I./ -I/opt/homebrew/include/ -I./vendor/lmdbxx/include/ +# Define the root directory of the negentropy project; this absolute path mechanism works across all major os +NEGENTROPY_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +INCS = -I$(NEGENTROPY_ROOT) -I/opt/homebrew/include/ -I$(NEGENTROPY_ROOT)/vendor/lmdbxx/include/ TARGET = libnegentropy.so .PHONY: all clean install-deps precompiled-header shared-lib @@ -14,10 +15,10 @@ install-deps: # Generate 'negentropy.h.gch' precompiled-header: - g++ -O0 --std=c++20 -Wall -fexceptions -g negentropy.h $(INCS) + g++ -O0 --std=c++20 -Wall -fexceptions -g $(NEGENTROPY_ROOT)negentropy.h $(INCS) shared-lib: - g++ -O0 -g -std=c++20 $(INCS) -shared -fPIC -o $(TARGET) negentropy_wrapper.cpp -lcrypto -lssl -L/opt/homebrew/lib/ + g++ -O0 -g -std=c++20 $(INCS) -shared -fPIC -o $(TARGET) $(NEGENTROPY_ROOT)negentropy_wrapper.cpp -lcrypto -lssl -L/opt/homebrew/lib/ clean: rm -f $(TARGET) negentropy.h.gch libnegentropy.so From a07aeb9f2175c18f1496b950306b1ab032efa36c Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Tue, 10 Sep 2024 23:26:41 +0530 Subject: [PATCH 2/2] chore: update target according to OS, rn install-deps not required --- cpp/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/Makefile b/cpp/Makefile index fd56ed5..c54d79a 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -3,7 +3,12 @@ # Define the root directory of the negentropy project; this absolute path mechanism works across all major os NEGENTROPY_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) INCS = -I$(NEGENTROPY_ROOT) -I/opt/homebrew/include/ -I$(NEGENTROPY_ROOT)/vendor/lmdbxx/include/ -TARGET = libnegentropy.so + +ifeq ($(OS),Windows_NT) + TARGET = negentropy.dll +else + TARGET = libnegentropy.so +endif .PHONY: all clean install-deps precompiled-header shared-lib