CMake: Generate WinPDB files during build (#311)

Build and Install PDB (Windows Debug Symbol) files if supported by underlying system.

Also update AppVeyor to test cmake builds.

Fixes #245
Fix By: Piotr Pietraszkiewicz (@ppietrasa) and Brad House (@bradh352)
pull/312/head
Brad House 5 years ago committed by GitHub
parent 65d0878870
commit ea12ea6338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      CMakeLists.txt
  2. 8
      Makefile.msvc
  3. 130
      appveyor.yml

@ -412,10 +412,17 @@ ELSE ()
SET (GETNAMEINFO_TYPE_ARG46 int)
ENDIF ()
IF (WIN32)
SET (RECV_TYPE_ARG2 "char *")
ELSE ()
SET (RECV_TYPE_ARG2 "void *")
ENDIF ()
# Functions are typically consistent so the equivalent fields map ... equivalently
SET (RECV_TYPE_RETV ${RECVFROM_TYPE_RETV})
SET (SEND_TYPE_RETV ${RECVFROM_TYPE_RETV})
SET (RECV_TYPE_ARG1 ${RECVFROM_TYPE_ARG1})
SET (RECVFROM_TYPE_ARG2 ${RECV_TYPE_ARG2})
SET (SEND_TYPE_ARG1 ${RECVFROM_TYPE_ARG1})
SET (RECV_TYPE_ARG3 ${RECVFROM_TYPE_ARG3})
SET (SEND_TYPE_ARG3 ${RECVFROM_TYPE_ARG3})
@ -423,10 +430,8 @@ SET (GETHOSTNAME_TYPE_ARG2 ${RECVFROM_TYPE_ARG3})
# These should always be "sane" values to use always
SET (RECVFROM_QUAL_ARG5 )
SET (RECVFROM_TYPE_ARG2 "void *")
SET (RECVFROM_TYPE_ARG4 int)
SET (RECVFROM_TYPE_ARG5 "struct sockaddr *")
SET (RECV_TYPE_ARG2 "void *")
SET (RECV_TYPE_ARG4 int)
SET (GETNAMEINFO_TYPE_ARG1 "struct sockaddr *")
SET (GETNAMEINFO_TYPE_ARG7 int)
@ -595,10 +600,12 @@ IF (CARES_SHARED)
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}")
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES
EXPORT_NAME cares
OUTPUT_NAME cares
SOVERSION ${CARES_LIB_VERSION_MAJOR}
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}"
EXPORT_NAME cares
OUTPUT_NAME cares
COMPILE_PDB_NAME cares
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
SOVERSION ${CARES_LIB_VERSION_MAJOR}
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}"
)
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>")
@ -609,9 +616,16 @@ IF (CARES_SHARED)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Library
INSTALL (TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
COMPONENT Library
${TARGETS_INST_DEST}
)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF ()
SET (STATIC_SUFFIX "_static")

@ -364,10 +364,10 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
!IF "$(VALID_CFGSET)" == "FALSE"
ALL:
$(MAKE) /f .\Makefile.msvc CFG=lib-release ALL
$(MAKE) /f .\Makefile.msvc CFG=lib-debug ALL
$(MAKE) /f .\Makefile.msvc CFG=dll-release ALL
$(MAKE) /f .\Makefile.msvc CFG=dll-debug ALL
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-release ALL
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-debug ALL
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-release ALL
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-debug ALL
clean:
@-RMDIR /S /Q $(BASE_DIR) >NUL 2>&1

@ -1,15 +1,117 @@
platform:
- x64
- x86
- mingw
image: Visual Studio 2015
# Github/Bitbucket only: get source code for one particular commit as zip archive, instead of git clone'ing.
shallow_clone: true
# Github/Bitbucket only: per-file commit filtering
skip_commits:
files:
- .gitignore
- '**/*.md'
- .travis.yml
# List of build configurations to test.
configuration:
- RelWithDebInfo
# Note: You can set extra cmake args for a particular matrix entry with CMAKE_EXTRA_OPTIONS. For example:
# CMAKE_EXTRA_OPTIONS: -DOPENSSL_ROOT_DIR=C:/OpenSSL-Win32
environment:
matrix:
# MSVC 2015, 32-bit x86 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
# MSVC 2015, 64-bit x86 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
# MinGW, 32-bit x86 (cmake)
- COMPILER: MINGW
BUILDTOOL: CMAKE
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
# MSVC 2015, 32-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
# MSVC 2015, 64-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
# MinGW, 32-bit x86 (makefiles)
- COMPILER: MINGW
BUILDTOOL: MAKE
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
install:
- if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
before_build:
# Setup build environment for the selected compiler (not all compilers need to do anything here).
# -- Visual Studio --
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
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-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin
- copy ares_build.h.dist ares_build.h
- if "%platform%" == "mingw" ( mingw32-make.exe -f Makefile.m32 demos ) else ( nmake /f Makefile.msvc )
- cd test
- if "%platform%" == "mingw" ( mingw32-make.exe -f Makefile.m32 ) else ( nmake /f Makefile.msvc vtest )
- if "%platform%" == "mingw" ( mingw32-make.exe -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe ) else ( nmake /f Makefile.msvc aresfuzz aresfuzzname dnsdump )
- if "%platform%" == "mingw" ( .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa ) else ( .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa )
- if "%BUILDTOOL%" == "NMAKE" copy ares_build.h.dist ares_build.h
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
- if "%BUILDTOOL%" == "CMAKE" mkdir C:\projects\build-cares
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares
- if "%BUILDTOOL%" == "CMAKE" cmake -GNinja -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install %CMAKE_EXTRA_OPTIONS% %APPVEYOR_BUILD_FOLDER%
# -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON
# Note: Tests currently fail to compile due to ares-test-internal.cc needing access to :
# _aresx_sltosi
# _aresx_sztoui
# _ares_inet_net_pton
# _ares_malloc_data
# _ares_strdup
# _ares_writev
# _ares__is_onion_domain
# _ares__get_hostent
# _ares__read_line
# _ares__readaddrinfo
# _ares__bitncmp
# _ares_malloc
# _ares_free
- if "%BUILDTOOL%" == "CMAKE" ninja install
- if "%BUILDTOOL%" == "MAKE" copy ares_build.h.dist ares_build.h
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos
test_script:
# We can't use powershell for tests due to treating stderr as an error
- if "%BUILDTOOL%" == "NMAKE" cd test
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc vtest
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump
- if "%BUILDTOOL%" == "NMAKE" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%BUILDTOOL%" == "MAKE" cd test
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe
- if "%BUILDTOOL%" == "MAKE" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares\bin
- if "%BUILDTOOL%" == "CMAKE" .\adig.exe www.google.com
- if "%BUILDTOOL%" == "CMAKE" .\acountry.exe www.google.com
- if "%BUILDTOOL%" == "CMAKE" .\ahost.exe www.google.com
# - if "%BUILDTOOL%" == "CMAKE" .\arestest.exe -4 -v
# - if "%BUILDTOOL%" == "CMAKE" .\aresfuzz.exe "$env:APPVEYOR_BUILD_FOLDER\test\fuzzinput\*"
# - if "%BUILDTOOL%" == "CMAKE" .\aresfuzzname.exe "$env:APPVEYOR_BUILD_FOLDER\test\fuzznames\*"
# - if "%BUILDTOOL%" == "CMAKE" .\dnsdump.exe "$env:APPVEYOR_BUILD_FOLDER\test\fuzzinput\answer_a" "$env:APPVEYOR_BUILD_FOLDER\test\fuzzinput\answer_aaaa"
#on_finish:
# - cd C:\projects\build-cares\test
# - dir /B *.log > list.txt
# - cmake -E tar cfv all_tests.zip --format=zip --files-from=list.txt
# - appveyor PushArtifact all_tests.zip
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Force build worker to stay open after build is done, so we can RDP into it.
# Enable RDP connections into build worker.
#init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

Loading…
Cancel
Save