diff options
author | Evan Nemerson <evan@nemerson.com> | 2016-07-29 11:52:15 -0700 |
---|---|---|
committer | Evan Nemerson <evan@nemerson.com> | 2016-07-29 13:24:17 -0700 |
commit | c1ec7ba29287d3c6a0fb359bbf653aaef66e6581 (patch) | |
tree | 028f98ff5c586afe7947442f37f9253c12c19132 | |
parent | 01f9cf94a0732b3eafafc1c4b506cdb9b31b765a (diff) | |
download | brotli-c1ec7ba29287d3c6a0fb359bbf653aaef66e6581.zip brotli-c1ec7ba29287d3c6a0fb359bbf653aaef66e6581.tar.gz brotli-c1ec7ba29287d3c6a0fb359bbf653aaef66e6581.tar.bz2 |
appveyor: add Visual Studio builds (based on CMake)
This only goes back to VS 12 (2013) because MSVC didn't support log2
until then.
-rw-r--r-- | CMakeLists.txt | 31 | ||||
-rw-r--r-- | appveyor.yml | 82 |
2 files changed, 83 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0004461..082b1d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,27 @@ if (ENABLE_SANITIZER) endif() endif () +include(CheckFunctionExists) +set(LIBM_LIBRARY) +CHECK_FUNCTION_EXISTS(log2 LOG2_RES) +if(NOT LOG2_RES) + unset(LOG2_RES) + set(orig_req_libs "${CMAKE_REQUIRED_LIBRARIES}") + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m") + CHECK_FUNCTION_EXISTS(log2 LOG2_RES) + if(LOG2_RES) + set(LIBM_LIBRARY "m") + else() + message(FATAL_ERROR "log2() not found") + endif() + + set(CMAKE_REQUIRED_LIBRARIES "${orig_req_libs}") + unset(orig_req_libs) +endif() +unset(LOG2_RES) + set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") -set(BROTLI_LIBRARIES brotli_enc brotli_dec brotli_common m) +set(BROTLI_LIBRARIES brotli_enc brotli_dec brotli_common ${LIBM_LIBRARY}) mark_as_advanced(BROTLI_INCLUDE_DIRS BROTLI_LIBRARIES) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -81,7 +100,7 @@ add_library(brotli_enc STATIC enc/utf8_util.c) foreach(lib brotli_common brotli_dec brotli_enc) - target_link_libraries(${lib} m) + target_link_libraries(${lib} ${LIBM_LIBRARY}) set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS}) set_target_properties(${lib} PROPERTIES VERSION ${BROTLI_VERSION_MAJOR}.${BROTLI_VERSION_MINOR}.${BROTLI_VERSION_REVISION} @@ -119,11 +138,11 @@ endif() if(NOT BROTLI_DISABLE_TESTS) if(WIN32 AND NOT CMAKE_HOST_WIN32) find_program(BROTLI_WINE NAMES wine) - endif() - if(NOT BROTLI_WINE AND NOT BROTLI_WINEPATH) - message("wine not found, disabling tests") - set(BROTLI_DISABLE_TESTS TRUE) + if(NOT BROTLI_WINE) + message(STATUS "wine not found, disabling tests") + set(BROTLI_DISABLE_TESTS TRUE) + endif() endif() endif() diff --git a/appveyor.yml b/appveyor.yml index 0b60e82..9b37ad8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,59 +7,93 @@ environment: WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
matrix:
- - PYTHON: "C:\\Python27"
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 14 2015 Win64
+
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 14 2015
+
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 12 2013 Win64
+
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 12 2013
+
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python34"
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python34"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python35"
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.0"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python27-x64"
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
- - PYTHON: "C:\\Python34-x64"
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"
- - PYTHON: "C:\\Python35-x64"
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.0"
PYTHON_ARCH: "64"
-init:
- - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
+# init:
+# - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
install:
- # install Python and pip when not already installed
- - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }
+ - ps: |
+ if ($env:BUILD_SYSTEM -eq "Python") {
+ # install Python and pip when not already installed
+ if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }
+
+ # prepend newly installed Python to the PATH
+ $env:Path = $env:PYTHON + ';' + $env:PYTHON + '\\Scripts;' + $env:PATH
- # prepend newly installed Python to the PATH
- - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+ # upgrade pip to avoid out-of-date warnings
+ pip install --disable-pip-version-check --user --upgrade pip
- # check that we have the expected version and architecture for Python
- - "python --version"
- - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
+ # install/upgrade setuptools and wheel to build packages
+ pip install --upgrade setuptools wheel
+ }
- # upgrade pip to avoid out-of-date warnings
- - "pip install --disable-pip-version-check --user --upgrade pip"
+before_build:
+ - ps: |
+ if ($env:BUILD_SYSTEM -eq "CMake") {
+ mkdir builddir
+ cd builddir
- # install/upgrade setuptools and wheel to build packages
- - "pip install --upgrade setuptools wheel"
+ cmake -G "$env:GENERATOR" ..
+ }
-build: false
+build_script:
+ - ps: |
+ if ($env:BUILD_SYSTEM -eq "CMake") {
+ cmake --build . --config Debug
+ }
test_script:
- - "%WITH_COMPILER% python setup.py build_ext test"
+ - ps: |
+ if ($env:BUILD_SYSTEM -eq "CMake") {
+ ctest --output-on-failure --interactive-debug-mode 0 -C Debug
+ } else {
+ python setup.py build_ext test
+ }
after_test:
- # if tests are successful, create binary and source packages for the project
- - "%WITH_COMPILER% pip wheel -w dist ."
- - "%WITH_COMPILER% python setup.py sdist --formats=gztar,zip"
+ - if "%BUILD_SYSTEM%" == "Python" ( pip wheel -w dist .)
+ - if "%BUILD_SYSTEM%" == "Python" ( python setup.py sdist --formats=gztar,zip )
artifacts:
# archive the generated packages in the ci.appveyor.com build report
|