2015-06-07 21:19:26 +00:00
|
|
|
# Build all the unit tests using GNU make and either g++ or clang
|
|
|
|
# Should be run using mingw32-make on Windows, not nmake
|
2022-01-04 23:07:50 +00:00
|
|
|
# On Windows g++ is used, on macOS clang, and on Linux G++ is used by default
|
2015-06-07 21:19:26 +00:00
|
|
|
# but clang can be used by defining CLANG when invoking make
|
|
|
|
# clang works only with libc++, not libstdc++
|
2021-02-21 04:53:09 +00:00
|
|
|
# Tested with clang 9 and g++ 9
|
2015-06-07 21:19:26 +00:00
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
CXXSTD=c++17
|
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
ifndef windir
|
|
|
|
ifeq ($(shell uname),Darwin)
|
2022-01-04 23:07:50 +00:00
|
|
|
# On macOS (detected with Darwin uname) always use clang as g++ is old version
|
2015-06-07 21:19:26 +00:00
|
|
|
CLANG = 1
|
|
|
|
USELIBCPP = 1
|
|
|
|
endif
|
|
|
|
endif
|
2013-01-25 00:46:29 +00:00
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
CXXFLAGS += $(OPTIMIZATION)
|
2019-05-04 18:14:48 +00:00
|
|
|
CXXFLAGS += --std=$(CXXSTD)
|
2013-01-25 00:46:29 +00:00
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
ifdef CLANG
|
|
|
|
CXX = clang++
|
2022-01-04 23:07:50 +00:00
|
|
|
CXXFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
2015-06-07 21:19:26 +00:00
|
|
|
ifdef USELIBCPP
|
2022-01-04 23:07:50 +00:00
|
|
|
# macOS, use libc++ but don't have sanitizers
|
2015-06-07 21:19:26 +00:00
|
|
|
CXXFLAGS += --stdlib=libc++
|
|
|
|
LINKFLAGS = -lc++
|
|
|
|
else
|
2022-01-04 23:07:50 +00:00
|
|
|
ifndef windir
|
2015-06-07 21:19:26 +00:00
|
|
|
# Linux, have sanitizers
|
|
|
|
SANITIZE = -fsanitize=address,undefined
|
|
|
|
CXXFLAGS += $(SANITIZE)
|
|
|
|
endif
|
2022-01-04 23:07:50 +00:00
|
|
|
endif
|
2015-06-07 21:19:26 +00:00
|
|
|
else
|
|
|
|
CXX = g++
|
|
|
|
endif
|
2013-01-25 00:46:29 +00:00
|
|
|
|
|
|
|
ifdef windir
|
|
|
|
DEL = del /q
|
|
|
|
EXE = unitTest.exe
|
|
|
|
else
|
|
|
|
DEL = rm -f
|
|
|
|
EXE = unitTest
|
|
|
|
endif
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
INCLUDEDIRS = -I ../../include -I ../../src
|
2013-01-25 00:46:29 +00:00
|
|
|
|
|
|
|
CPPFLAGS += $(INCLUDEDIRS)
|
2015-06-07 21:19:26 +00:00
|
|
|
CXXFLAGS += -Wall -Wextra
|
|
|
|
|
|
|
|
# Files in this directory containing tests
|
|
|
|
TESTSRC=test*.cxx
|
|
|
|
# Files being tested from scintilla/src directory
|
|
|
|
TESTEDSRC=\
|
2022-01-04 23:07:50 +00:00
|
|
|
../../src/CaseConvert.cxx \
|
|
|
|
../../src/CaseFolder.cxx \
|
2015-06-07 21:19:26 +00:00
|
|
|
../../src/CellBuffer.cxx \
|
2022-01-04 23:07:50 +00:00
|
|
|
../../src/CharacterCategoryMap.cxx \
|
2015-06-07 21:19:26 +00:00
|
|
|
../../src/CharClassify.cxx \
|
|
|
|
../../src/ContractionState.cxx \
|
|
|
|
../../src/Decoration.cxx \
|
2022-01-04 23:07:50 +00:00
|
|
|
../../src/Document.cxx \
|
|
|
|
../../src/Geometry.cxx \
|
2021-02-21 04:53:09 +00:00
|
|
|
../../src/PerLine.cxx \
|
2022-01-04 23:07:50 +00:00
|
|
|
../../src/RESearch.cxx \
|
2019-05-04 18:14:48 +00:00
|
|
|
../../src/RunStyles.cxx \
|
2019-07-21 13:26:02 +00:00
|
|
|
../../src/UniConversion.cxx \
|
|
|
|
../../src/UniqueString.cxx
|
2013-01-25 00:46:29 +00:00
|
|
|
|
|
|
|
TESTS=$(EXE)
|
|
|
|
|
|
|
|
all: $(TESTS)
|
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
test: $(TESTS)
|
|
|
|
./$(EXE)
|
2013-01-25 00:46:29 +00:00
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
clean:
|
|
|
|
$(DEL) $(TESTS) *.o *.obj *.exe
|
2013-01-25 00:46:29 +00:00
|
|
|
|
2015-06-07 21:19:26 +00:00
|
|
|
$(EXE): $(TESTSRC) $(TESTEDSRC) unitTest.cxx
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LINKFLAGS) $^ -o $@
|