[go: nahoru, domu]

Skip to content

Commit

Permalink
Appveyor -- first stab (AcademySoftwareFoundation#1399)
Browse files Browse the repository at this point in the history
* First stab at using Appveyor (like TravisCI, but for Windows).

Doesn't run tests yet, but it builds!

This includes many minor fixes to make the Microsoft compiler happy,
addressing a few compile errors and many warnings.

Also includes steps to speed up OpenEXR build: supply our own
b44ExpLogTable.h and dwaLookups.h.  Also try not to build OpenEXR tests
and binaries.
  • Loading branch information
lgritz committed Apr 16, 2016
1 parent 7169b05 commit 2e2f742
Show file tree
Hide file tree
Showing 25 changed files with 818 additions and 107 deletions.
60 changes: 36 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,6 @@ if (CCACHE_FOUND AND USE_CCACHE)
endif ()
endif ()

if (BUILDSTATIC AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# On Linux, the lack of -fPIC when building static libraries seems
# incompatible with the dynamic library needed for the Python bindings.
set (USE_PYTHON OFF)
set (USE_PYTHON3 OFF)
endif()

if (NOTHREADS)
message (STATUS "NO THREADS!")
add_definitions ("-DNOTHREADS=1")
Expand All @@ -238,20 +231,22 @@ if (EXTRA_CPP_ARGS)
add_definitions ("${EXTRA_CPP_ARGS}")
endif()

if (USE_CPP11 OR USE_CPP14)
if (USE_CPP14)
message (STATUS "Building for C++14")
add_definitions ("-std=c++14")
elseif (USE_CPP11)
message (STATUS "Building for C++11")
add_definitions ("-std=c++11")
endif ()
if (CMAKE_COMPILER_IS_CLANG)
# C++ >= 11 doesn't like 'register' keyword, which is in Qt headers
add_definitions ("-Wno-deprecated-register")
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_INTEL)
if (USE_CPP11 OR USE_CPP14)
if (USE_CPP14)
message (STATUS "Building for C++14")
add_definitions ("-std=c++14")
elseif (USE_CPP11)
message (STATUS "Building for C++11")
add_definitions ("-std=c++11")
endif ()
if (CMAKE_COMPILER_IS_CLANG)
# C++ >= 11 doesn't like 'register' keyword, which is in Qt headers
add_definitions ("-Wno-deprecated-register")
endif ()
else ()
message (STATUS "Building for C++03!")
endif ()
else ()
message (STATUS "Building for C++03!")
endif ()

if (USE_LIBCPLUSPLUS AND CMAKE_COMPILER_IS_CLANG)
Expand Down Expand Up @@ -311,6 +306,21 @@ if (NOT OIIO_NAMESPACE)
endif ()
message(STATUS "Setting Namespace to: ${OIIO_NAMESPACE}")

if (BUILDSTATIC)
message (STATUS "Building static libraries")
add_definitions(-DOIIO_STATIC_BUILD=1)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# On Linux, the lack of -fPIC when building static libraries seems
# incompatible with the dynamic library needed for the Python bindings.
set (USE_PYTHON OFF)
set (USE_PYTHON3 OFF)
endif ()
if (WIN32)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif ()
endif()

# Use .a files if LINKSTATIC is enabled
if (LINKSTATIC)
set (_orig_link_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
Expand All @@ -321,6 +331,8 @@ if (LINKSTATIC)
# set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
set (CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ()
add_definitions (-DBoost_USE_STATIC_LIBS=1)
set (Boost_USE_STATIC_LIBS 1)
endif ()

set (CMAKE_MODULE_PATH
Expand Down Expand Up @@ -418,18 +430,18 @@ endif ()


if (MSVC)
add_definitions (/W1)
add_definitions (-D_CRT_SECURE_NO_DEPRECATE)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)
if(NOT LINKSTATIC)
if (LINKSTATIC)
add_definitions (-DBoost_USE_STATIC_LIBS=1)
else ()
add_definitions (-DBOOST_ALL_DYN_LINK)
add_definitions (-DOPENEXR_DLL)
endif ()
if (BUILDSTATIC)
add_definitions(-DOIIO_STATIC_BUILD=1)
endif ()
endif (MSVC)


Expand Down
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ README for OpenImageIO
:target: https://github.com/OpenImageIO/oiio/blob/master/LICENSE
.. image:: https://travis-ci.org/OpenImageIO/oiio.svg?branch=master
:target: https://travis-ci.org/OpenImageIO/oiio

.. image:: https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master?svg=true
:target: https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master


Introduction
------------
Expand Down
160 changes: 160 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
version: '{branch}-{build}'
os: Visual Studio 2015
clone_folder: C:\projects\oiio
test: off
configuration:
- Release
# - Debug
platform:
- x64
# branches:
# only:
# - master
environment:
matrix:
# - CMAKE_PLATFORM: "Visual Studio 14 2015"
# PYTHON_DIR: "C:\\Python27"
- CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
PYTHON_DIR: "C:\\Python27-x64"
tbs_arch: "x64"
tbs_tools: "msvc14"
tbs_static_runtime: 0
# BUILD_STATIC: 1

install:
- cinstall: python
# - ps: if($env:build_platform -eq 'x64') {
# $env:vcvar_arg = 'x86_amd64';
# }
# else {
# $env:vcvar_arg = 'x86';
# }
# - call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat"
- set CMAKE_PREFIX_PATH=C:/Sys;%APPVEYOR_BUILD_FOLDER%/deps
- set CMAKE_LIBRARY_PATH=C:/Sys/lib;%APPVEYOR_BUILD_FOLDER%/deps/lib
- set CMAKE_INCLUDE_PATH=C:/Sys/include;%APPVEYOR_BUILD_FOLDER%/deps/include
- mkdir c:\sys
- mkdir deps
- cd deps
- mkdir lib
- mkdir include

# ZLIB
- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz
- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar
- cd zlib-1.2.8
- cmake -G "%CMAKE_PLATFORM%" . -DCMAKE_INSTALL_PREFIX=C:/Sys
- cmake --build . --config Release
- cmake --build . --config Release --target install
- cd ..

# TIFF
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/tiff
# - set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/tiff
# FYI, alternate way to get TIFF:
- nuget install libtiff-%tbs_tools%-%tbs_arch%-master -Version 4.0.6.85 -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b &&
powershell -Command "move libtiff*\* . -force"

# PNG
- nuget install libpng-%tbs_tools%-%tbs_arch%-master -Version 1.6.18.44 -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/png
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/libpng-msvc14-x64-master.1.6.18.44

# OpenEXR FIXME - this is 2.0?
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/openexr
# - set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/openexr
# - copy openexr\lib\Iex-2_2.lib openexr\lib\Iex.lib
# - copy openexr\lib\Iex-2_2_d.lib openexr\lib\Iex_d.lib
# - copy openexr\lib\IexMath-2_2.lib openexr\lib\IexMath.lib
# - copy openexr\lib\IexMath-2_2_d.lib openexr\lib\IexMath_d.lib
# - copy openexr\lib\IlmImf-2_2.lib openexr\lib\IlmImf.lib
# - copy openexr\lib\IlmImf-2_2_d_d.lib openexr\lib\IlmImf_d_d.lib
# - copy openexr\lib\IlmImfUtil-2_2.lib openexr\lib\IlmImfUtil.lib
# - copy openexr\lib\IlmImfUtil-2_2_d_d.lib openexr\lib\IlmImfUtil_d_d.lib
# - copy openexr\lib\IlmThread-2_2.lib openexr\lib\IlmThread.lib
# - copy openexr\lib\IlmThread-2_2_d.lib openexr\lib\IlmThread_d.lib
# - copy openexr\lib\Imath-2_2.lib openexr\lib\Imath.lib
# - copy openexr\lib\Imath-2_2_d.lib openexr\lib\Imath_d.lib

- set EXRINSTALLDIR=%APPVEYOR_BUILD_FOLDER%/deps/openexr-install
- set EXRVERSION=2.2.0
- mkdir openexr-install
- git clone -b v%EXRVERSION% https://github.com/openexr/openexr.git ./openexr
- cd openexr
- dir
- cd IlmBase
- mkdir build
- cd build
- cmake -G "%CMAKE_PLATFORM%" --config Release -DCMAKE_INSTALL_PREFIX=C:/Sys ..
- cmake --build . --config Release
- cmake --build . --config Release --target install
- dir C:\Sys
- dir C:\Sys\lib
- dir C:\Sys\include
- cd ../../OpenEXR
- mkdir build
# Huge cheat -- substitute our own tables to save compile time, and
# a modified IlmImf/CMakeLists.txt that skips the files if already present
- copy %APPVEYOR_BUILD_FOLDER%\src\build-scripts\OpenEXR-CMakeLists.txt CMakeLists.txt
- copy %APPVEYOR_BUILD_FOLDER%\src\build-scripts\OpenEXR-IlmImf-CMakeLists.txt IlmImf\CMakeLists.txt
- cd build
- mkdir IlmImf
- 7z x -oIlmImf "%APPVEYOR_BUILD_FOLDER%/src/build-scripts/b44ExpLogTable.h.zip"
- 7z x -oIlmImf "%APPVEYOR_BUILD_FOLDER%/src/build-scripts/dwaLookups.h.zip"
- dir IlmImf
- cmake -G "%CMAKE_PLATFORM%" --config Release -DCMAKE_INSTALL_PREFIX=C:/Sys -DCMAKE_PREFIX_PATH=c:/sys -DILMBASE_PACKAGE_PREFIX=c:/sys -DBUILD_UTILS=0 -DBUILD_TESTS=0 ..
- cmake --build . --config Release
- cmake --build . --config Release --target install
- cd ../../..
- dir

# JPEG
- nuget install libjpeg-%tbs_tools%-%tbs_arch%-master -Version 1.4.80.21 -Source https://ci.appveyor.com/nuget/libjpegturbo-o6k4js4y7pjw
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/jpeg
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/libjpeg-msvc14-x64-master.1.4.80.21

# Boost
- set BOOST_ROOT=C:\Libraries\boost_1_59_0
- dir %BOOST_ROOT%
- set BOOST_LIBRARYDIR=C:\Libraries\boost_1_59_0\lib64-msvc-14.0
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_ROOT%

# OpenColorIO
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/OpenColorIO
# - set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/OpenColorIO

# FFmpeg
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64/ffmpeg
# - set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/ffmpeg

# Freetype
# - svn co https://svn.blender.org/svnroot/bf-blender/trunk//lib/win64_vc14/freetype
# - set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%APPVEYOR_BUILD_FOLDER%/deps/freetype

- cd ..
- dir C:\Sys
- dir C:\Sys\include
- dir C:\Sys\lib
- dir C:\projects\oiio\deps
- dir C:\projects\oiio\deps\include
- dir C:\projects\oiio\deps\lib
- dir C:\projects\oiio\deps\libjpeg-msvc14-x64-master.1.4.80.21
- dir C:\projects\oiio\deps\libpng-msvc14-x64-master.1.6.18.44


build_script:
- echo Running cmake...
- cd c:\projects\oiio
- mkdir build
- mkdir build\windows64
- cd build\windows64
- cmake -G "%CMAKE_PLATFORM%" -DPYTHON_INCLUDE_DIR:PATH=%PYTHON_DIR%/include -DPYTHON_LIBRARY:FILEPATH=%PYTHON_DIR%/libs/python27.lib -DPYTHON_EXECUTABLE:FILEPATH=%PYTHON_DIR%/python.exe -DCMAKE_LIBRARY_PATH=%CMAKE_LIBRARY_PATH% -DCMAKE_INCLUDE_PATH=%CMAKE_INCLUDE_PATH% -DCMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH% -DOPENEXR_HOME=C:\projects\oiio\deps -DOPENEXR_CUSTOM_LIB_SUFFIX=-2_2 -DVERBOSE=1 ../..
- dir c:\projects\oiio
- dir c:\projects\oiio\build
- dir c:\projects\oiio\build\windows64
- cmake --build . --config %CONFIGURATION%


matrix:
fast_finish: true

Loading

0 comments on commit 2e2f742

Please sign in to comment.