aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit/makefile
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-11-17 11:11:45 +1100
committerNeil <nyamatongwe@gmail.com>2013-11-17 11:11:45 +1100
commit3ef31230a61ce74e2ae8bb116f7b4e338dd69ae6 (patch)
tree5b2b36dbf80a6aeb4027e15e886e3844135052e4 /test/unit/makefile
parentf7b5bf30ba118fcd86f6acec132e9a372e7f2af2 (diff)
downloadscintilla-mirror-3ef31230a61ce74e2ae8bb116f7b4e338dd69ae6.tar.gz
Switch unit tests to Catch framework.
Diffstat (limited to 'test/unit/makefile')
-rw-r--r--test/unit/makefile81
1 files changed, 35 insertions, 46 deletions
diff --git a/test/unit/makefile b/test/unit/makefile
index 220952c6f..71e4add7c 100644
--- a/test/unit/makefile
+++ b/test/unit/makefile
@@ -1,68 +1,57 @@
-# Build all the unit tests
-# Should be run using mingw32-make on Windows
+# Build all the unit tests using GNU make and either g++ or clang
+# Should be run using mingw32-make on Windows, not nmake
+# On Windows g++ is used, on OS X clang, and on Linux G++ is used by default
+# but clang can be used by defining CLANG when invoking make
+# clang works only with libc++, not libstdc++
+# Tested with clang 3.3 and g++ 4.8
+
+ifndef windir
+ifeq ($(shell uname),Darwin)
+# On OS X always use clang as g++ is old version
+CLANG = 1
+endif
+endif
-.SUFFIXES: .cxx
+CXXFLAGS += --std=c++11
-GTEST_DIR = ../../../../gtest-1.5.0
+ifdef CLANG
+CXX = clang
+CXXFLAGS += --stdlib=libc++
+LINKFLAGS = -lc++
+else
+CXX = g++
+endif
ifdef windir
-
DEL = del /q
-# Find Google Test headers.
-CPPFLAGS += -I$(GTEST_DIR)/include
-GTEST_ALL = gtest-all.o
-LINKFLAGS = $(CPPFLAGS) $(CXXFLAGS)
EXE = unitTest.exe
-
else
-
DEL = rm -f
-CPPFLAGS = $(shell gtest-config --cppflags)
-CXXFLAGS = $(shell gtest-config --cxxflags)
-LINKFLAGS = $(shell gtest-config --ldflags --libs)
EXE = unitTest
-
-# For coverage testing with gcov
-#CPPFLAGS += -fprofile-arcs -ftest-coverage
-#LINKFLAGS += -fprofile-arcs -ftest-coverage
-
endif
-#vpath %.cxx ../src ../lexlib ../lexers
-vpath %.cxx ../../src
-
-
INCLUDEDIRS = -I ../../include -I ../../src -I../../lexlib
-
-# Find headers of test code.
CPPFLAGS += $(INCLUDEDIRS)
+CXXFLAGS += -Wall -Wextra
-CXXFLAGS += -g -Wall -Wextra -Wno-unused-function
-#~ CXXFLAGS += -g -Wall
-
-CASES:=$(addsuffix .o,$(basename $(notdir $(wildcard test*.cxx))))
-TESTEDOBJS=ContractionState.o RunStyles.o CharClassify.o
+# Files in this directory containing tests
+TESTSRC=test*.cxx
+# Files being tested from scintilla/src directory
+TESTEDSRC=\
+ ../../src/CharClassify.cxx \
+ ../../src/ContractionState.cxx \
+ ../../src/RunStyles.cxx
TESTS=$(EXE)
-GTEST_HEADERS=$(GTEST_DIR)/include/gtest/*.h $(GTEST_DIR)/include/gtest/internal/*.h
-
all: $(TESTS)
-clean:
- $(DEL) $(TESTS) *.a *.o *.exe *.gcov *.gcda *.gcno
-
-# Usually you shouldn't tweak such internal variables, indicated by a
-# trailing _.
-GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
+test: $(TESTS)
+ ./$(EXE)
-gtest-all.o: $(GTEST_SRCS_)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -I$(GTEST_DIR) -c \
- $(GTEST_DIR)/src/gtest-all.cc
-
-.cxx.o:
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
+clean:
+ $(DEL) $(TESTS) *.o *.obj *.exe
-$(EXE): $(CASES) $(TESTEDOBJS) unitTest.o $(GTEST_ALL)
- $(CXX) $(LINKFLAGS) $^ -o $@
+$(EXE): $(TESTSRC) $(TESTEDSRC) unitTest.cxx
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LINKFLAGS) $^ -o $@