From df4c523eb8ecd259f163747b3db5c6a1282cbe68 Mon Sep 17 00:00:00 2001 From: Emmanuel Deloget Date: Sat, 3 Oct 2015 14:48:00 +0200 Subject: [PATCH 1/4] headers: is C, use C++ standard header instead Not that stdint.h is going to be dangerous, but cstdint put the right things in the rights place (i.e. it put all newly defined types into namespace std). --- BehaviorTreeOptimized.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BehaviorTreeOptimized.cpp b/BehaviorTreeOptimized.cpp index 1e33d8c..9c8ecbd 100644 --- a/BehaviorTreeOptimized.cpp +++ b/BehaviorTreeOptimized.cpp @@ -6,7 +6,7 @@ * Credits: Alex J. Champandard *****************************************************************************/ -#include +#include #include #include #include "Shared.h" From b5026aefb8c976b0880eefa9a0695579d02bc125 Mon Sep 17 00:00:00 2001 From: Emmanuel Deloget Date: Sat, 3 Oct 2015 14:49:06 +0200 Subject: [PATCH 2/4] headers: std::ptrdiff_t is defined in It seems that MSVC is not impacted by this change but gcc (and clang) are, so add the correct include to fix "undefined symbol" errors when using these compilers. --- BehaviorTreeOptimized.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/BehaviorTreeOptimized.cpp b/BehaviorTreeOptimized.cpp index 9c8ecbd..52f0cc8 100644 --- a/BehaviorTreeOptimized.cpp +++ b/BehaviorTreeOptimized.cpp @@ -7,6 +7,7 @@ *****************************************************************************/ #include +#include #include #include #include "Shared.h" From b7f69b52957831e56eb16972d123211fabdf6d28 Mon Sep 17 00:00:00 2001 From: Emmanuel Deloget Date: Sat, 3 Oct 2015 14:52:38 +0200 Subject: [PATCH 3/4] build system: adds a Makefile for linux The Makefile has been tested with GNU make. --- Makefile | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fd150ea --- /dev/null +++ b/Makefile @@ -0,0 +1,65 @@ +btsk_TARGET := libbtsk.so +btsk_SOURCE := \ + BehaviorTree.cpp \ + BehaviorTreeEvent.cpp \ + BehaviorTreeOptimized.cpp \ + BehaviorTreeShared.cpp +btsk_OBJS := $(btsk_SOURCE:%.cpp=%.fpic.o) +btsk_LDFLAGS := -fPIC -shared + +test_TARGET := btsk-test +test_SOURCE := Test.cpp +test_OBJS := $(test_SOURCE:%.cpp=%.o) +test_LDFLAGS := -L. +test_LIBS += -lbtsk + +CXXFLAGS_local += -std=c++11 +CXXFLAGS_shared += -DPIC -fPIC + +ifeq ($(strip $(V)),) + SILENT=@ + P=@ echo +else + SILENT= + P=@ true +endif + +.PHONY: all +all: $(btsk_TARGET) $(test_TARGET) + +.PHONY: clean +clean: + $(P) " RM $(btsk_TARGET)" + $(SILENT) rm -f $(btsk_TARGET) + $(P) " RM $(btsk_OBJS)" + $(SILENT) rm -f $(btsk_OBJS) + $(P) " RM $(test_TARGET)" + $(SILENT) rm -f $(test_TARGET) + $(P) " RM $(test_OBJS)" + $(SILENT) rm -f $(test_OBJS) + +.PHONY: check +check: $(test_TARGET) + $(SILENT) LD_LIBRARY_PATH=$(PWD) ./$(test_TARGET) + +.PHONY: install +install: + @ echo "really, thou shall not do that" + +$(btsk_TARGET): $(btsk_OBJS) + $(P) "* LD.C++.shared $<" + $(SILENT) $(CXX) $(LDFLAGS) $(LDFLAGS_local) $(btsk_LDFLAGS) -o $@ $^ $(LIBS) $(LIBS_local) $(btsk_LIBS) + +$(test_TARGET): $(btsk_TARGET) +$(test_TARGET): $(test_OBJS) + $(P) "* LD.C++ $<" + $(SILENT) $(CXX) $(LDFLAGS) $(LDFLAGS_local) $(test_LDFLAGS) -o $@ $^ $(LIBS) $(LIBS_local) $(test_LIBS) + +%.fpic.o: %.cpp + $(P) " C++.shared $<" + $(SILENT) $(CXX) $(CXXFLAGS) $(CXXFLAGS_local) $(CXXFLAGS_shared) -o $@ -c $< + +%.o: %.cpp + $(P) " C++ $<" + $(SILENT) $(CXX) $(CXXFLAGS) $(CXXFLAGS_local) -o $@ -c $< + From 097eb8640c46b65a40788a9f591a051fcae7cfdb Mon Sep 17 00:00:00 2001 From: Emmanuel Deloget Date: Sat, 3 Oct 2015 14:54:08 +0200 Subject: [PATCH 4/4] add the generated btsk-test to the ignore list --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d38d46b..cca43da 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ *.suo *.user /ipch + +# Compiled binaries +btsk-test