Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security fixes #401

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ missing
.DS_Store
*.project
*.cproject
build-win/
build-nuget/
*~
108 changes: 3 additions & 105 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,112 +4,13 @@ ELSE()
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
ENDIF()

# Version
set(OPENEXR_VERSION_MAJOR 2)
set(OPENEXR_VERSION_MINOR 3)
set(OPENEXR_VERSION_PATCH 0)
set(OPENEXR_VERSION ${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH})
set(OPENEXR_VERSION_API ${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
set(OPENEXR_SOVERSION 24)

project(OpenEXR VERSION ${OPENEXR_VERSION})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
#set(OPENEXR_LOCATION ${CMAKE_INSTALL_PREFIX})

#-------------------------------------------------------------------------------
# The following user options are cached. They are named with the OPENEXR
# prefix in order that they be grouped together in tools such as ccmake and cmake-gui.

option(OPENEXR_BUILD_ILMBASE "Build IlmBase" ON)
option(OPENEXR_BUILD_OPENEXR "Build OpenEXR" ON)
option(OPENEXR_BUILD_PYTHON_LIBS "Build the Python bindings" ON)
option(OPENEXR_BUILD_VIEWERS "Build the viewers" OFF)
option(OPENEXR_BUILD_TESTS "Enable the tests" ON)
# when enabled, adds the (long) running fuzz tests to the "make test" rule
# even when this is disabled, as long as OPENEXR_BUILD_TESTS is enabled, one
# can still run "make fuzz" (or equivalent)
option(OPENEXR_RUN_FUZZ_TESTS "Run damaged-input tests" OFF)
option(OPENEXR_BUILD_UTILS "Build the utility programs" ON)

option(OPENEXR_BUILD_SHARED "Build Shared Libraries" ON)
option(OPENEXR_BUILD_STATIC "Build Static Libraries" OFF)
option(OPENEXR_NAMESPACE_VERSIONING "Use Namespace Versioning" ON)
option(OPENEXR_FORCE_CXX03 "Force CXX03" OFF)
set(OPENEXR_PYTHON_MAJOR "2" CACHE STRING "Python major version")
set(OPENEXR_PYTHON_MINOR "7" CACHE STRING "Python minor version")

# For more info on finding boost python:
# https://cmake.org/cmake/help/v3.11/module/FindBoost.html

# end of user options
#-------------------------------------------------------------------------------

include(OpenEXRVersion)

if (OPENEXR_BUILD_VIEWERS AND NOT OPENEXR_BUILD_OPENEXR)
message(ERROR, "Configuration error, enable OPENEXR_BUILD_OPENEXR for OPENEXR_BUILD_VIEWERS")
endif()

if (WIN32 AND OPENEXR_BUILD_ILMBASE AND OPENEXR_BUILD_OPENEXR AND OPENEXR_BUILD_SHARED)
# necessary for building dwa lookup tables, and b44log tables on windows
set(BUILD_ILMBASE_STATIC ON)
elseif (OPENEXR_BUILD_ILMBASE AND OPENEXR_BUILD_STATIC)
set(BUILD_ILMBASE_STATIC ON)
else()
set(BUILD_ILMBASE_STATIC OFF)
endif()

if (NOT OPENEXR_BUILD_SHARED)
set(OPENEXR_TARGET_SUFFIX _static)
endif()

# Testing
set(ENABLE_TESTS ${OPENEXR_BUILD_TESTS})
if(ENABLE_TESTS)
include(CTest)
enable_testing()
endif()

# CPACK
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CPACK_SOURCE_IGNORE_FILES "/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENEXR_VERSION}" )
include(CPack)

# Configuration
if(OPENEXR_FORCE_CXX03)
ADD_DEFINITIONS ( -std=c++03 )
else(OPENEXR_FORCE_CXX03)
# VP18 switches to c++14, so let's do that by default
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ ISO Standard")
# but switch gnu++14 or other extensions off for portability
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

add_definitions( -DHAVE_CONFIG_H )

if(NOT WIN32)
add_definitions( -pthread )
endif()

if(WIN32)
set(RUNTIME_DIR bin)
else()
set(RUNTIME_DIR lib)
endif()

set(OPENEXR_LIBSUFFIX "")
set(ILMBASE_LIBSUFFIX "")
if(OPENEXR_NAMESPACE_VERSIONING)
set( OPENEXR_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
set( ILMBASE_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
endif()
project(OpenEXR VERSION ${OPENEXR_VERSION})

# MacOs/linux rpathing
set(CMAKE_MACOSX_RPATH 1)
set(BUILD_WITH_INSTALL_RPATH 1)
include(OpenEXRSettings)

# Packages
find_package(ZLIB)
Expand Down Expand Up @@ -170,9 +71,6 @@ if ((OPENEXR_BUILD_UTILS OR OPENEXR_BUILD_TESTS OR OPENEXR_BUILD_VIEWERS) AND NO
endif()
endif()

# Set position independent code (mostly for static builds, but not a bad idea regardless)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Perform the build
if(OPENEXR_BUILD_ILMBASE)
add_subdirectory(IlmBase)
Expand Down
146 changes: 146 additions & 0 deletions Contrib/NuGet/OpenEXR-msvc-x64-build.nuget.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
REM @echo off

Echo LIB Windows Build NuGet

REM # Build Vars #
set _SCRIPT_DRIVE=%~d0
set _SCRIPT_FOLDER=%~dp0
set INITDIR=%_SCRIPT_FOLDER%
set SRC=%INITDIR%\..\..\
set BUILDTREE=%SRC%\build-win\
SET tbs_arch=x64
SET vcvar_arg=x86_amd64
SET cmake_platform="Visual Studio 15 2017 Win64"

REM # VC Vars #
SET VCVAR="%programfiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"
if exist %VCVAR% call %VCVAR% %vcvar_arg%
SET VCVAR="%programfiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
if exist %VCVAR% call %VCVAR% %vcvar_arg%

REM # Clean Build Tree #
rd /s /q %BUILDTREE%
mkdir %BUILDTREE%
mkdir %BUILDTREE%\deps

REM # Change to Build Tree drive #
%_SCRIPT_DRIVE%
REM # Change to Build Tree directory #
cd %BUILDTREE%

:nuget_Dep
REM # packages from nuget #
mkdir %BUILDTREE%\deps
cd %BUILDTREE%\deps
SET VER=1.2.11.8899
set ZLIBDIR=%BUILDTREE%\deps\zlib-msvc-%tbs_arch%.%VER%\build\native
nuget install zlib-msvc-%tbs_arch% -Version %VER%
SET VER=1.3.4.8788
set FLTKDIR=%BUILDTREE%\deps\FLTK-msvc-%tbs_arch%.%VER%\build\native
nuget install FLTK-msvc-%tbs_arch% -Version %VER%

:copy_files
set BINDIR=%SRC%\build-nuget\
rd /s /q %BINDIR%
mkdir %BINDIR%
mkdir %BINDIR%\lib
set PATH=%BINDIR%\lib;%PATH%
echo %BINDIR%

:static_LIB
REM # LIB STATIC #
ECHO %cmake_platform% STATIC

rd /s /q %BUILDTREE%\OpenEXR
mkdir %BUILDTREE%\OpenEXR
cd %BUILDTREE%\OpenEXR
cmake -G %cmake_platform% ^
-DBUILD_ILMBASE_STATIC:BOOL=ON ^
-DOPENEXR_BUILD_ILMBASE:BOOL=ON ^
-DOPENEXR_BUILD_OPENEXR:BOOL=ON ^
-DOPENEXR_BUILD_PYTHON_LIBS:BOOL=OFF ^
-DOPENEXR_BUILD_VIEWERS:BOOL=ON ^
-DOPENEXR_BUILD_TESTS:BOOL=ON ^
-DOPENEXR_RUN_FUZZ_TESTS:BOOL=OFF ^
-DOPENEXR_BUILD_UTILS:BOOL=ON ^
-DOPENEXR_BUILD_SHARED:BOOL=OFF ^
-DOPENEXR_BUILD_STATIC:BOOL=ON ^
-DCMAKE_CXX_FLAGS_RELEASE="/MD" ^
-DCMAKE_CXX_FLAGS_DEBUG="/MDd" ^
-DCMAKE_C_FLAGS_RELEASE="/MD" ^
-DCMAKE_C_FLAGS_DEBUG="/MDd" ^
-DZLIB_LIBRARY=%ZLIBDIR%\lib_release\zlibstatic.lib ^
-DZLIB_INCLUDE_DIR=%ZLIBDIR%\include ^
-DFLTK_BASE_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk.lib ^
-DFLTK_GL_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_gl.lib ^
-DFLTK_FORMS_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_forms.lib ^
-DFLTK_IMAGES_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_images.lib ^
-DFLTK_BASE_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltkd.lib ^
-DFLTK_GL_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_gld.lib ^
-DFLTK_FORMS_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_formsd.lib ^
-DFLTK_IMAGES_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_imagesd.lib ^
-DFLTK_INCLUDE_DIR=%FLTKDIR%\include ^
-DCMAKE_INSTALL_PREFIX=%BINDIR% ^
-DCMAKE_BUILD_TYPE="Release" %SRC%
cmake --build . --config Release --target install

move %BINDIR%lib %BINDIR%lib_release
move %BINDIR%bin %BINDIR%bin_release

REM # DEBUG #
REM # Clean Build Tree #
rd /s /q %BUILDTREE%\OpenEXR
mkdir %BUILDTREE%\OpenEXR
cd %BUILDTREE%\OpenEXR
cmake -G %cmake_platform% ^
-DBUILD_ILMBASE_STATIC:BOOL=ON ^
-DOPENEXR_BUILD_ILMBASE:BOOL=ON ^
-DOPENEXR_BUILD_OPENEXR:BOOL=ON ^
-DOPENEXR_BUILD_PYTHON_LIBS:BOOL=OFF ^
-DOPENEXR_BUILD_VIEWERS:BOOL=ON ^
-DOPENEXR_BUILD_TESTS:BOOL=ON ^
-DOPENEXR_RUN_FUZZ_TESTS:BOOL=OFF ^
-DOPENEXR_BUILD_UTILS:BOOL=ON ^
-DOPENEXR_BUILD_SHARED:BOOL=OFF ^
-DOPENEXR_BUILD_STATIC:BOOL=ON ^
-DCMAKE_CXX_FLAGS_RELEASE="/MD" ^
-DCMAKE_CXX_FLAGS_DEBUG="/MDd" ^
-DCMAKE_C_FLAGS_RELEASE="/MD" ^
-DCMAKE_C_FLAGS_DEBUG="/MDd" ^
-DZLIB_LIBRARY=%ZLIBDIR%\lib_debug\zlibstaticd.lib ^
-DZLIB_INCLUDE_DIR=%ZLIBDIR%\include ^
-DFLTK_BASE_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk.lib ^
-DFLTK_GL_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_gl.lib ^
-DFLTK_FORMS_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_forms.lib ^
-DFLTK_IMAGES_LIBRARY_RELEASE=%FLTKDIR%\lib_release\fltk_images.lib ^
-DFLTK_BASE_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltkd.lib ^
-DFLTK_GL_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_gld.lib ^
-DFLTK_FORMS_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_formsd.lib ^
-DFLTK_IMAGES_LIBRARY_DEBUG=%FLTKDIR%\lib_debug\fltk_imagesd.lib ^
-DFLTK_INCLUDE_DIR=%FLTKDIR%\include ^
-DCMAKE_INSTALL_PREFIX=%BINDIR% ^
-DCMAKE_BUILD_TYPE="DEBUG" %SRC%
cmake --build . --config DEBUG --target install

move %BINDIR%lib %BINDIR%lib_debug
move %BINDIR%bin %BINDIR%bin_debug

REM # TODO: ENABLE SHARED Build
GOTO:nuget_req
mkdir %BINDIR%\static\
move /Y %BINDIR%\lib %BINDIR%\static\

:shared_LIB
REM # LIB SHARED #
ECHO %cmake_platform% SHARED


:nuget_req
cd %BINDIR%
REM # make nuget packages from binaries #
copy %INITDIR%\OpenEXR-msvc-%tbs_arch%.targets %BINDIR%\OpenEXR-msvc-%tbs_arch%.targets
cd %BUILDTREE%
nuget pack %INITDIR%\OpenEXR-msvc-%tbs_arch%.nuspec
cd %INITDIR%
REM --- exit ----
GOTO:eof
15 changes: 15 additions & 0 deletions Contrib/NuGet/OpenEXR-msvc-x64.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>openexr-msvc-x64</id>
<version>2.3.0.8788</version>
<authors>administrator</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Visual Studio 2017 Release OpenEXR as NuGet package.</description>
</metadata>
<files>
<file src="..\..\LICENSE" target="LICENSE" />
<file src="..\..\README.md" target="README.md" />
<file src="..\..\build-nuget\**\*.*" target="build\native" />
</files>
</package>
29 changes: 29 additions & 0 deletions Contrib/NuGet/OpenEXR-msvc-x64.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup Label="Release and x64" Condition="( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Platform.ToLower())' == 'x64'">
<ClCompile>
<PreprocessorDefinitions>HAS_OpenEXR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../..//build/native/include/OpenEXR;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../..//build/native/include/OpenEXR;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib_release/*.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Label="Debug and x64" Condition="( $(Configuration.ToLower().IndexOf('debug')) &gt; -1 ) And '$(Platform.ToLower())' == 'x64'">
<ClCompile>
<PreprocessorDefinitions>HAS_OpenEXR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../..//build/native/include/OpenEXR;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../..//build/native/include/OpenEXR;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib_debug/*.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Target Name="openexr-msvc">
</Target>
</Project>
Loading