aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kliuchnikov <eustas@google.com>2016-08-10 13:30:59 +0200
committerGitHub <noreply@github.com>2016-08-10 13:30:59 +0200
commit5d8b0f3a0ccfb8c26d8598964ccb98202043455d (patch)
treefc4eaedc356548ae0a931151d807b0814ab290f0
parente0a87638d89c5de72f48004c3ecbce20b97dbf3a (diff)
parentfe0e153cb8273febfa6a6105e6d1598cc3f7069c (diff)
downloadbrotli-5d8b0f3a0ccfb8c26d8598964ccb98202043455d.zip
brotli-5d8b0f3a0ccfb8c26d8598964ccb98202043455d.tar.gz
brotli-5d8b0f3a0ccfb8c26d8598964ccb98202043455d.tar.bz2
Merge pull request #400 from nemequ/master
appveyor: add Visual Studio builds (based on CMake)
-rw-r--r--CMakeLists.txt31
-rw-r--r--appveyor.yml82
2 files changed, 83 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0004461..0cba0f0 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)
+ set(orig_req_libs "${CMAKE_REQUIRED_LIBRARIES}")
+ set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
+ CHECK_FUNCTION_EXISTS(log2 LOG2_LIBM_RES)
+ if(LOG2_LIBM_RES)
+ set(LIBM_LIBRARY "m")
+ else()
+ message(FATAL_ERROR "log2() not found")
+ endif()
+
+ set(CMAKE_REQUIRED_LIBRARIES "${orig_req_libs}")
+ unset(LOG2_LIBM_RES)
+ 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