test: Build with MinGW on AppVeyor

This commit is contained in:
David Drysdale 2016-03-03 13:57:45 +00:00
parent 23b9ad9ede
commit 3b1ff9da74
2 changed files with 52 additions and 2 deletions

View File

@ -1,11 +1,13 @@
platform:
- x64
- x86
- mingw
build_script:
- if "%platform%" == "x86" call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
- if "%platform%" == "x64" "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- if "%platform%" == "x64" call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
- if "%platform%" == "mingw" set PATH=%PATH%;C:\MinGW\bin;C:\MinGW\MSYS\1.0\local\bin;C:\MinGW\MSYS\1.0\bin
- copy ares_build.h.dist ares_build.h
- nmake /f Makefile.msvc
- if "%platform%" == "mingw" ( make -f Makefile.m32 demos ) else ( nmake /f Makefile.msvc )
- cd test
- nmake /f Makefile.msvc vtest
- if "%platform%" == "mingw" ( make -f Makefile.m32 vtest ) else ( nmake /f Makefile.msvc vtest )

48
test/Makefile.m32 Normal file
View File

@ -0,0 +1,48 @@
#############################################################
#
## Makefile for building arestest.exe with MingW32 (GCC-3.2)
## Use: make -f Makefile.m32
#
########################################################
CXX = g++
LD = g++
# Where to find the c-ares source code; needed because the tests use library-internal headers
ARES_SRC_DIR = ..
# Where to find the built c-ares static library
ARES_BLD_DIR = ..
ARESLIB = $(ARES_BLD_DIR)/libcares.a
GMOCK_DIR = gmock-1.7.0
GTEST_DIR = $(GMOCK_DIR)/gtest
CPPFLAGS = -I$(ARES_SRC_DIR) -I$(GTEST_DIR)/include -I$(GMOCK_DIR)/include -DCARES_STATICLIB
CXXFLAGS = -Wall $(PTHREAD_CFLAGS) -std=gnu++11
LDFLAGS =
LDLIBS = -lwsock32
# Makefile.inc provides the TESTSOURCES and TESTHEADERS defines
include Makefile.inc
OBJS := $(patsubst %.cc,%.o,$(strip $(TESTSOURCES)))
all: arestest.exe
arestest.exe: $(OBJS) gmock-all.o gtest-all.o
$(LD) $(LDFLAGS) -o $@ $^ -L$(ARES_BLD_DIR) -lcares $(LDLIBS)
$(OBJS): $(TESTHEADERS)
.cc.o:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
gmock-all.o: $(GMOCK_DIR)/src/gmock-all.cc
$(CXX) -I$(GTEST_DIR) -I$(GMOCK_DIR) $(CPPFLAGS) $(CXXFLAGS) -c $<
gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
$(CXX) -I$(GTEST_DIR) -I$(GMOCK_DIR) $(CPPFLAGS) $(CXXFLAGS) -c $<
test: arestest.exe
./arestest.exe
vtest: arestest.exe
./arestest.exe -v
clean:
$(RM) $(OBJS) gmock-all.o gtest-all.o arestest.exe