mirror of
https://github.com/google/brotli.git
synced 2024-11-22 11:40:06 +00:00
Merge pull request #400 from nemequ/master
appveyor: add Visual Studio builds (based on CMake)
This commit is contained in:
commit
5d8b0f3a0c
@ -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()
|
||||
|
||||
|
82
appveyor.yml
82
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
|
||||
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
|
||||
# prepend newly installed Python to the PATH
|
||||
$env:Path = $env:PYTHON + ';' + $env:PYTHON + '\\Scripts;' + $env:PATH
|
||||
|
||||
# check that we have the expected version and architecture for Python
|
||||
- "python --version"
|
||||
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
|
||||
# upgrade pip to avoid out-of-date warnings
|
||||
pip install --disable-pip-version-check --user --upgrade pip
|
||||
|
||||
# upgrade pip to avoid out-of-date warnings
|
||||
- "pip install --disable-pip-version-check --user --upgrade pip"
|
||||
# install/upgrade setuptools and wheel to build packages
|
||||
pip install --upgrade setuptools wheel
|
||||
}
|
||||
|
||||
# install/upgrade setuptools and wheel to build packages
|
||||
- "pip install --upgrade setuptools wheel"
|
||||
before_build:
|
||||
- ps: |
|
||||
if ($env:BUILD_SYSTEM -eq "CMake") {
|
||||
mkdir builddir
|
||||
cd builddir
|
||||
|
||||
build: false
|
||||
cmake -G "$env:GENERATOR" ..
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user