added standard tests dir
This commit is contained in:
parent
0d65c4e726
commit
9a87e8f939
51
tests/Makefile
Normal file
51
tests/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
include ../premake.make
|
||||
LDLIBS += -lboost_unit_test_framework
|
||||
|
||||
BIN := $(shell basename $$(pwd))
|
||||
|
||||
SRCS := $(notdir $(wildcard src/*.cpp))
|
||||
SRCS += $(notdir $(filter-out ../src/main.cpp,$(wildcard ../src/*.cpp)))
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
DEPS := $(SRCS:.cpp=.d)
|
||||
|
||||
BUILDDIR := build/intermediates/
|
||||
|
||||
CXX ?= g++
|
||||
RM := /bin/rm -rf
|
||||
INSTALL := /usr/bin/install -c
|
||||
|
||||
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -I../src
|
||||
ifeq ($(DEBUG),1)
|
||||
CXXFLAGS += -D DEBUG -O0
|
||||
CONFIG := debug
|
||||
else
|
||||
CXXFLAGS += -D NDEBUG -O3
|
||||
CONFIG := release
|
||||
endif
|
||||
OUTDIR := build/$(CONFIG)/
|
||||
|
||||
vpath %.cpp src ../src
|
||||
vpath %.d $(BUILDDIR)
|
||||
vpath %.o $(BUILDDIR)
|
||||
|
||||
.PHONY: all clean prebuild
|
||||
|
||||
all: prebuild $(OUTDIR)$(BIN)
|
||||
|
||||
prebuild:
|
||||
@mkdir -p $(BUILDDIR) $(OUTDIR)
|
||||
|
||||
$(OUTDIR)$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(addprefix $(BUILDDIR),$(OBJS)) $(LDFLAGS) $(LDLIBS) -o $(OUTDIR)$(BIN)
|
||||
@ln -sf $(OUTDIR)$(BIN) $(BIN)
|
||||
|
||||
%.o: %.cpp %.d
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||||
@mv $@ $*.d $(BUILDDIR)
|
||||
|
||||
-include $(BUILDDIR)*.d
|
||||
|
||||
%.d: ;
|
||||
|
||||
clean:
|
||||
$(RM) build $(BIN)
|
8
tests/src/main.cpp
Normal file
8
tests/src/main.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#define BOOST_TEST_MODULE My Test
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(first_test)
|
||||
{
|
||||
BOOST_TEST(1 == 1);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user