Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux build #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
*.suo
*.user
/ipch

# Compiled binaries
btsk-test
3 changes: 2 additions & 1 deletion BehaviorTreeOptimized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* Credits: Alex J. Champandard
*****************************************************************************/

#include <stdint.h>
#include <cstdint>
#include <cstddef>
#include <vector>
#include <limits>
#include "Shared.h"
Expand Down
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 $<