From b2d37be8b874b300be1907f10339cac47e39170b Mon Sep 17 00:00:00 2001 From: Nick Porcino Date: Sun, 29 Jul 2018 23:42:46 -0700 Subject: [PATCH] CMake3 port. Various Windows fixes --- CMakeLists.txt | 158 ++++++++++++++++++ IlmBase/CMakeLists.txt | 123 +++++--------- IlmBase/Half/CMakeLists.txt | 40 ++--- IlmBase/HalfTest/CMakeLists.txt | 2 +- IlmBase/Iex/CMakeLists.txt | 19 ++- IlmBase/Iex/IexBaseExc.h | 39 +++-- IlmBase/IexMath/CMakeLists.txt | 32 ++-- IlmBase/IexTest/CMakeLists.txt | 2 +- IlmBase/IlmThread/CMakeLists.txt | 25 ++- IlmBase/IlmThread/IlmThread.cpp | 4 +- IlmBase/Imath/CMakeLists.txt | 22 ++- IlmBase/Imath/ImathEuler.h | 7 +- IlmBase/ImathTest/CMakeLists.txt | 2 +- OpenEXR/AUTHORS | 2 + OpenEXR/CMakeLists.txt | 124 ++++---------- OpenEXR/IlmImf/CMakeLists.txt | 95 ++++++----- OpenEXR/IlmImf/ImfCompositeDeepScanLine.h | 2 +- OpenEXR/IlmImfExamples/CMakeLists.txt | 18 +- OpenEXR/IlmImfFuzzTest/CMakeLists.txt | 14 +- OpenEXR/IlmImfTest/CMakeLists.txt | 13 +- OpenEXR/IlmImfUtil/CMakeLists.txt | 32 ++-- OpenEXR/IlmImfUtil/ImfDeepImageChannel.h | 19 +-- OpenEXR/IlmImfUtil/ImfFlatImageChannel.h | 2 +- OpenEXR/IlmImfUtilTest/CMakeLists.txt | 15 +- OpenEXR/exr2aces/CMakeLists.txt | 10 +- OpenEXR/exrbuild/CMakeLists.txt | 13 +- OpenEXR/exrenvmap/CMakeLists.txt | 10 +- OpenEXR/exrheader/CMakeLists.txt | 13 +- OpenEXR/exrmakepreview/CMakeLists.txt | 10 +- OpenEXR/exrmaketiled/CMakeLists.txt | 9 +- OpenEXR/exrmultipart/CMakeLists.txt | 13 +- OpenEXR/exrmultiview/CMakeLists.txt | 12 +- OpenEXR/exrstdattr/CMakeLists.txt | 13 +- OpenEXR_Viewers/CMakeLists.txt | 67 ++------ OpenEXR_Viewers/exrdisplay/CMakeLists.txt | 11 +- OpenEXR_Viewers/exrdisplay/GlWindow3d.h | 5 + OpenEXR_Viewers/playexr/CMakeLists.txt | 8 +- PyIlmBase/CMakeLists.txt | 142 +++++----------- PyIlmBase/PyIex/CMakeLists.txt | 38 +++-- PyIlmBase/PyIex/PyIex.cpp | 4 +- PyIlmBase/PyIex/PyIex.h | 4 +- PyIlmBase/PyImath/CMakeLists.txt | 30 ++-- PyIlmBase/PyImath/PyImath.cpp | 4 +- PyIlmBase/PyImath/PyImath.h | 8 +- PyIlmBase/PyImath/PyImathAutovectorize.cpp | 2 +- PyIlmBase/PyImath/PyImathAutovectorize.h | 6 +- PyIlmBase/PyImath/PyImathBasicTypes.cpp | 10 +- PyIlmBase/PyImath/PyImathBox.cpp | 2 +- PyIlmBase/PyImath/PyImathBox.h | 4 +- PyIlmBase/PyImath/PyImathBox2Array.cpp | 4 +- PyIlmBase/PyImath/PyImathBox3Array.cpp | 4 +- PyIlmBase/PyImath/PyImathBoxArrayImpl.h | 10 +- PyIlmBase/PyImath/PyImathColor.h | 3 +- PyIlmBase/PyImath/PyImathColor3.cpp | 8 +- PyIlmBase/PyImath/PyImathColor3ArrayImpl.h | 4 +- PyIlmBase/PyImath/PyImathColor4.cpp | 6 +- PyIlmBase/PyImath/PyImathColor4Array2DImpl.h | 7 +- PyIlmBase/PyImath/PyImathColor4ArrayImpl.h | 4 +- PyIlmBase/PyImath/PyImathEuler.cpp | 8 +- PyIlmBase/PyImath/PyImathEuler.h | 3 +- PyIlmBase/PyImath/PyImathFixedArray.cpp | 2 +- PyIlmBase/PyImath/PyImathFixedArray.h | 2 +- PyIlmBase/PyImath/PyImathFixedVArray.cpp | 4 +- PyIlmBase/PyImath/PyImathFixedVArray.h | 2 +- PyIlmBase/PyImath/PyImathFrustum.cpp | 8 +- PyIlmBase/PyImath/PyImathFrustum.h | 3 +- PyIlmBase/PyImath/PyImathFun.cpp | 8 +- PyIlmBase/PyImath/PyImathFun.h | 2 +- PyIlmBase/PyImath/PyImathLine.cpp | 8 +- PyIlmBase/PyImath/PyImathLine.h | 2 +- PyIlmBase/PyImath/PyImathM44Array.cpp | 6 +- PyIlmBase/PyImath/PyImathM44Array.h | 2 +- PyIlmBase/PyImath/PyImathMatrix.h | 3 +- PyIlmBase/PyImath/PyImathMatrix33.cpp | 8 +- PyIlmBase/PyImath/PyImathMatrix44.cpp | 10 +- PyIlmBase/PyImath/PyImathOperators.h | 4 +- PyIlmBase/PyImath/PyImathPlane.cpp | 8 +- PyIlmBase/PyImath/PyImathPlane.h | 2 +- PyIlmBase/PyImath/PyImathQuat.cpp | 10 +- PyIlmBase/PyImath/PyImathQuat.h | 3 +- PyIlmBase/PyImath/PyImathRandom.cpp | 8 +- PyIlmBase/PyImath/PyImathShear.cpp | 8 +- PyIlmBase/PyImath/PyImathStringArray.cpp | 6 +- PyIlmBase/PyImath/PyImathStringArray.h | 4 +- .../PyImath/PyImathStringArrayRegister.h | 2 +- PyIlmBase/PyImath/PyImathStringTable.cpp | 4 +- PyIlmBase/PyImath/PyImathTask.cpp | 2 +- PyIlmBase/PyImath/PyImathTask.h | 2 +- PyIlmBase/PyImath/PyImathUtil.cpp | 2 +- PyIlmBase/PyImath/PyImathUtil.h | 2 +- PyIlmBase/PyImath/PyImathVec.h | 4 +- PyIlmBase/PyImath/PyImathVec2Impl.h | 12 +- PyIlmBase/PyImath/PyImathVec3ArrayImpl.h | 12 +- PyIlmBase/PyImath/PyImathVec3Impl.h | 6 +- PyIlmBase/PyImath/PyImathVec4ArrayImpl.h | 10 +- PyIlmBase/PyImath/PyImathVec4Impl.h | 6 +- PyIlmBase/PyImath/imathmodule.cpp | 38 ++--- PyIlmBase/PyImathNumpy/CMakeLists.txt | 5 +- README.md | 55 ++++++ 99 files changed, 864 insertions(+), 741 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..48ce9a8d98 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,158 @@ +IF (WIN32) + CMAKE_MINIMUM_REQUIRED(VERSION 3.11) +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}) + +project(OpenEXR VERSION ${OPENEXR_VERSION}) + +#------------------------------------------------------------------------------- +# 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" OFF) +option(OPENEXR_BUILD_VIEWERS "Build the viewers" OFF) +option(OPENEXR_BUILD_TESTS "Enable the tests" 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 +#------------------------------------------------------------------------------- + + +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() + +# 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() + +# MacOs/linux rpathing +set(CMAKE_MACOSX_RPATH 1) +set(BUILD_WITH_INSTALL_RPATH 1) + +# Packages +find_package(ZLIB) +if(OPENEXR_BUILD_OPENEXR AND NOT ZLIB_FOUND) + message(WARNING "Make Zlib available to CMake's search path, and re-run configuration") + message(FATAL_ERROR "Zlib is a required dependency when OPENEXR_BUILD_OPENEXR is set") +endif() + +if (OPENEXR_BUILD_PYTHON_LIBS) + find_package(PythonLibs ${OPENEXR_PYTHON_MAJOR}.${OPENEXR_PYTHON_MINOR}) + if(NOT PythonLibs_FOUND) + message(WARNING "Make Python ${OPENEXR_PYTHON_MAJOR}.${OPENEXR_PYTHON_MINOR} available to CMake's search path, and re-run configuration") + message(FATAL_ERROR "Python is a required dependency when OPENEXR_BUILD_PYTHON_LIBS is set") + endif() + + find_package(Boost COMPONENTS python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR}) + if(NOT Boost_PYTHON${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR}_FOUND) + message(WARNING "Make boost Python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR} available to CMake's search path, and re-run configuration") + message(FATAL_ERROR "boost Python is a required dependency when OPENEXR_BUILD_PYTHON_LIBS is set") + endif() + + find_package(NumPy) + if(NOT NumPy_FOUND) + message(WARNING "Numpy not found, PyImathNumpy will not be built") + endif() +endif() + +if(OPENEXR_BUILD_VIEWERS) + message(WARNING "Viewers are currently out of order. Building anyway") + SET (FLTK_SKIP_FLUID 1) + find_package(FLTK) + if(NOT FLTK_FOUND) + message(WARNING "FLTK not found, exrdisplay will not be built") + endif() + find_package(OpenGL) + if(NOT OpenGL_FOUND) + message(WARNING "OpenGL not found, exrdisplay will not be built") + endif() +endif() + +# Perform the build +if(OPENEXR_BUILD_ILMBASE) + add_subdirectory(IlmBase) +endif() +if(OPENEXR_BUILD_OPENEXR) + add_subdirectory(OpenEXR) +else() + message(INFO, "Skipping OpenEXR build") +endif() +if(OPENEXR_BUILD_PYTHON_LIBS) + add_subdirectory(PyIlmBase) +else() + message(INFO, "Skipping Python bindings") +endif() +if(OPENEXR_BUILD_VIEWERS AND FLTK_FOUND AND OpenGL_FOUND) + add_subdirectory(OpenEXR_Viewers) +else() + message(INFO, "Skipping OpenEXR Viewers") +endif() diff --git a/IlmBase/CMakeLists.txt b/IlmBase/CMakeLists.txt index 87c7405d09..8aa2193cfd 100644 --- a/IlmBase/CMakeLists.txt +++ b/IlmBase/CMakeLists.txt @@ -1,56 +1,22 @@ -# yue.nicholas@gmail.com -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT ( ilmbase ) - -SET(ILMBASE_VERSION_MAJOR "2") -SET(ILMBASE_VERSION_MINOR "2") -SET(ILMBASE_VERSION_PATCH "0") - -SET(ILMBASE_VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}) -SET(ILMBASE_VERSION_API ${ILMBASE_VERSION_MAJOR}_${ILMBASE_VERSION_MINOR}) - - -ENABLE_TESTING() - -SET(CPACK_PACKAGE_VERSION_MAJOR "${ILMBASE_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${ILMBASE_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${ILMBASE_VERSION_PATCH}") -SET(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${ILMBASE_VERSION}" - ) -set(CPACK_SOURCE_IGNORE_FILES - "/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}") -INCLUDE ( CPack ) - - -# Allow the developer to select if Dynamic or Static libraries are built -OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) -OPTION (BUILD_STATIC_LIBS "Build Static Libraries" OFF) - -# Enable namespace versioning -OPTION (NAMESPACE_VERSIONING "Namespace Versioning" ON) - -OPTION (FORCE_CXX03 "Force CXX03" OFF) -IF (FORCE_CXX03) - ADD_DEFINITIONS ( -std=c++03 ) -ELSE (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 () +IF (WIN32) + CMAKE_MINIMUM_REQUIRED(VERSION 3.11) +ELSE() + CMAKE_MINIMUM_REQUIRED(VERSION 3.2) +ENDIF() -# Setup osx rpathing -SET (CMAKE_MACOSX_RPATH 1) -SET (BUILD_WITH_INSTALL_RPATH 1) +PROJECT ( ilmbase ) -IF ( NOT WIN32) - ADD_DEFINITIONS ( -pthread ) -ENDIF () +set(ILMBASE_BASEVERSION ${OPENEXR_BASEVERSION}) +set(ILMBASE_VERSION_MAJOR ${OPENEXR_VERSION_MAJOR}) +set(ILMBASE_VERSION_MINOR ${OPENEXR_VERSION_MINOR}) +set(ILMBASE_VERSION_PATCH ${OPENEXR_VERSION_PATCH}) +set(ILMBASE_VERSION ${OPENEXR_VERSION}) +set(ILMBASE_VERSION_API ${OPENEXR_VERSION_API}) -INCLUDE_DIRECTORIES ( Iex IexMath Imath Half ${CMAKE_CURRENT_BINARY_DIR}/config IlmThread IexTest ImathTest HalfTest ) +INCLUDE_DIRECTORIES ( Iex IexMath Imath Half + IlmThread IexTest ImathTest HalfTest + ${CMAKE_CURRENT_BINARY_DIR}/config ) # also add the current directory to pick up the autogenerated headers SET(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -63,7 +29,7 @@ MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_valu ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT) MACRO(CREATE_LIBTOOL_FILE _target _install_DIR) - GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) + SET(_target_location $) GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "") GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "") GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0) @@ -73,8 +39,8 @@ MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_valu GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes) GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "") GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "") - GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) - GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) + SET(_laname ${_target}${OPENEXR_LIBSUFFIX}) + SET(_soname ${_laname}) SET(_laname ${PROJECT_BINARY_DIR}/${_laname}.la) FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n") FILE(APPEND ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n") @@ -105,17 +71,6 @@ MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_valu INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR}) ENDMACRO(CREATE_LIBTOOL_FILE) -IF (WIN32) - SET (RUNTIME_DIR bin) -ELSE () - SET (RUNTIME_DIR lib) -ENDIF () - -SET (ILMBASE_LIBSUFFIX "") -IF (NAMESPACE_VERSIONING) - SET ( ILMBASE_LIBSUFFIX "-${ILMBASE_VERSION_API}" ) -ENDIF () - ADD_SUBDIRECTORY ( Half ) ADD_SUBDIRECTORY ( Iex ) ADD_SUBDIRECTORY ( IexMath ) @@ -123,9 +78,13 @@ ADD_SUBDIRECTORY ( Imath ) ADD_SUBDIRECTORY ( IlmThread ) IF (WIN32) - FILE ( COPY ${CMAKE_CURRENT_SOURCE_DIR}/config.windows/IlmBaseConfig.h - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/config - ) + FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#ifdef HAVE_PTHREAD\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "# undef HAVE_PTHREAD\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#endif\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#ifdef HAVE_POSIX_SEMAPHORES\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "# undef HAVE_POSIX_SEMAPHORES\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#endif\n" ) + FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define PLATFORM_WINDOWS 1\n" ) ELSE () IF (APPLE) FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define HAVE_PTHREAD 1\n" ) @@ -137,7 +96,7 @@ ELSE () ENDIF () ENDIF () -IF (FORCE_CXX03) +IF (OPENEXR_FORCE_CXX03) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_FORCE_CXX03 1\n" ) ELSEIF (NOT WIN32) # really only care about c++11 right now for the threading bits, but this can be changed to 14 @@ -146,7 +105,7 @@ ELSEIF (NOT WIN32) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#if __cplusplus < 201103L\n# error \"Modern C++ 11/14 not enabled but force cxx03 not set\"\n#endif\n" ) ENDIF () -IF (NAMESPACE_VERSIONING) +IF (OPENEXR_NAMESPACE_VERSIONING) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1\n") FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define IMATH_INTERNAL_NAMESPACE Imath_${ILMBASE_VERSION_API}\n") FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define IEX_INTERNAL_NAMESPACE Iex_${ILMBASE_VERSION_API}\n") @@ -184,21 +143,23 @@ ENDIF () # Tests - -ADD_SUBDIRECTORY ( HalfTest ) -ADD_SUBDIRECTORY ( IexTest ) -ADD_SUBDIRECTORY ( ImathTest ) +IF ( ENABLE_TESTS ) + ADD_SUBDIRECTORY ( HalfTest ) + ADD_SUBDIRECTORY ( IexTest ) + ADD_SUBDIRECTORY ( ImathTest ) +ENDIF () # Installation -INSTALL ( FILES +INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h DESTINATION include/OpenEXR ) -FILE ( WRITE ${CMAKE_BINARY_DIR}/IlmBase.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" ) -FILE ( APPEND ${CMAKE_BINARY_DIR}/IlmBase.pc "exec_prefix=\${prefix} +IF ( NOT WIN32 ) + FILE ( WRITE ${CMAKE_BINARY_DIR}/IlmBase.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" ) + FILE ( APPEND ${CMAKE_BINARY_DIR}/IlmBase.pc "exec_prefix=\${prefix} libdir=\${exec_prefix}/lib includedir=\${prefix}/include OpenEXR_includedir=\${prefix}/include/OpenEXR @@ -210,9 +171,9 @@ Libs: -L\${libdir} -lImath${ILMBASE_LIBSUFFIX} -lIexMath${ILMBASE_LIBSUFFIX} -lH Cflags: -pthread -I\${OpenEXR_includedir} ") -INSTALL ( FILES - ${CMAKE_BINARY_DIR}/IlmBase.pc - DESTINATION - lib/pkgconfig -) - + INSTALL ( FILES + ${CMAKE_BINARY_DIR}/IlmBase.pc + DESTINATION + lib/pkgconfig + ) +ENDIF() diff --git a/IlmBase/Half/CMakeLists.txt b/IlmBase/Half/CMakeLists.txt index beea9a9950..c23bc6a528 100644 --- a/IlmBase/Half/CMakeLists.txt +++ b/IlmBase/Half/CMakeLists.txt @@ -3,26 +3,21 @@ ADD_EXECUTABLE ( eLut eLut.cpp ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/eLut.h - COMMAND eLut ARGS > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h - DEPENDS eLut - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) + COMMAND $ ARGS > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h + DEPENDS eLut) SET_SOURCE_FILES_PROPERTIES( ${CMAKE_CURRENT_BINARY_DIR}/eLut.h - PROPERTIES HEADER_FILE_ONLY TRUE - ) + PROPERTIES HEADER_FILE_ONLY TRUE) ADD_EXECUTABLE ( toFloat toFloat.cpp ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h - COMMAND toFloat ARGS > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h - DEPENDS toFloat - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) + COMMAND $ ARGS > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h + DEPENDS toFloat) + SET_SOURCE_FILES_PROPERTIES( ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h - PROPERTIES HEADER_FILE_ONLY TRUE - ) + PROPERTIES HEADER_FILE_ONLY TRUE) SET_SOURCE_FILES_PROPERTIES( half.cpp @@ -33,7 +28,7 @@ SET_SOURCE_FILES_PROPERTIES( SET (ILMBASE_LIB_TARGETS "") -IF (BUILD_SHARED_LIBS) +IF (OPENEXR_BUILD_SHARED) LIST ( APPEND ILMBASE_LIB_TARGETS Half ) ADD_LIBRARY ( Half SHARED @@ -47,15 +42,15 @@ IF (BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES ( Half PROPERTIES - VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH} - SOVERSION ${ILMBASE_VERSION_MAJOR} + VERSION ${OPENEXR_VERSION} + SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "Half${ILMBASE_LIBSUFFIX}" ) ADD_DEPENDENCIES ( Half toFloat eLut ) ENDIF () -IF (BUILD_STATIC_LIBS) +IF (BUILD_ILMBASE_STATIC) LIST ( APPEND ILMBASE_LIB_TARGETS Half_static ) ADD_LIBRARY ( Half_static STATIC @@ -71,7 +66,7 @@ IF (BUILD_STATIC_LIBS) ADD_DEPENDENCIES ( Half_static toFloat eLut ) ENDIF () -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR BUILD_ILMBASE_STATIC) INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS} ARCHIVE DESTINATION lib @@ -80,8 +75,8 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ) ENDIF () -INSTALL ( - FILES +INSTALL ( + FILES half.h halfFunction.h halfExport.h @@ -90,3 +85,10 @@ INSTALL ( DESTINATION include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(IlmBase::Half ALIAS Half) +endif() +if (BUILD_ILMBASE_STATIC) + add_library(IlmBase::Half_static ALIAS Half_static) +endif() diff --git a/IlmBase/HalfTest/CMakeLists.txt b/IlmBase/HalfTest/CMakeLists.txt index 2ab1eab0fc..11dc84fdb7 100644 --- a/IlmBase/HalfTest/CMakeLists.txt +++ b/IlmBase/HalfTest/CMakeLists.txt @@ -11,6 +11,6 @@ ADD_EXECUTABLE ( HalfTest testSize.cpp ) -TARGET_LINK_LIBRARIES ( HalfTest Half ) +TARGET_LINK_LIBRARIES ( HalfTest IlmBase::Half ) ADD_TEST ( TestHalf HalfTest ) diff --git a/IlmBase/Iex/CMakeLists.txt b/IlmBase/Iex/CMakeLists.txt index 8510d0bb96..a6cf517fdb 100644 --- a/IlmBase/Iex/CMakeLists.txt +++ b/IlmBase/Iex/CMakeLists.txt @@ -2,7 +2,7 @@ SET (ILMBASE_LIB_TARGETS "") -IF(BUILD_SHARED_LIBS) +IF(OPENEXR_BUILD_SHARED) LIST ( APPEND ILMBASE_LIB_TARGETS Iex ) ADD_LIBRARY ( Iex SHARED @@ -17,13 +17,13 @@ IF(BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES ( Iex PROPERTIES - VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH} - SOVERSION ${ILMBASE_VERSION_MAJOR} + VERSION ${OPENEXR_VERSION} + SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "Iex${ILMBASE_LIBSUFFIX}" ) ENDIF() -IF (BUILD_STATIC_LIBS) +IF (BUILD_ILMBASE_STATIC) LIST ( APPEND ILMBASE_LIB_TARGETS Iex_static ) ADD_LIBRARY ( Iex_static STATIC @@ -38,7 +38,7 @@ IF (BUILD_STATIC_LIBS) ) ENDIF() -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR BUILD_ILMBASE_STATIC) INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -47,7 +47,7 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ENDIF () INSTALL ( - FILES + FILES IexBaseExc.h IexMathExc.h IexThrowErrnoExc.h @@ -61,3 +61,10 @@ INSTALL ( DESTINATION include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(IlmBase::Iex ALIAS Iex) +endif() +if (BUILD_ILMBASE_STATIC) + add_library(IlmBase::Iex_static ALIAS Iex_static) +endif() diff --git a/IlmBase/Iex/IexBaseExc.h b/IlmBase/Iex/IexBaseExc.h index 87501da023..4e50c29344 100644 --- a/IlmBase/Iex/IexBaseExc.h +++ b/IlmBase/Iex/IexBaseExc.h @@ -72,7 +72,7 @@ IEX_INTERNAL_NAMESPACE_HEADER_ENTER // Our most basic exception class //------------------------------- -class IEX_EXPORT BaseExc: public std::exception +class BaseExc: public std::exception { public: @@ -80,30 +80,30 @@ class IEX_EXPORT BaseExc: public std::exception // Constructors and destructor //---------------------------- - BaseExc (const char *s = 0) throw(); // std::string (s) - BaseExc (const std::string &s) throw(); // std::string (s) - BaseExc (std::stringstream &s) throw(); // std::string (s.str()) + IEX_EXPORT BaseExc (const char *s = 0) throw(); // std::string (s) + IEX_EXPORT BaseExc (const std::string &s) throw(); // std::string (s) + IEX_EXPORT BaseExc (std::stringstream &s) throw(); // std::string (s.str()) - BaseExc (const BaseExc &be) throw(); - virtual ~BaseExc () throw (); + IEX_EXPORT BaseExc (const BaseExc &be) throw(); + IEX_EXPORT virtual ~BaseExc () throw (); //-------------------------------------------- // what() method -- e.what() returns e.c_str() //-------------------------------------------- - virtual const char * what () const throw (); - const std::string & name() const; + IEX_EXPORT virtual const char * what () const throw (); + IEX_EXPORT const std::string & name() const; //-------------------------------------------------- // Convenient methods to change the exception's text //-------------------------------------------------- - BaseExc & assign (std::stringstream &s); // assign (s.str()) - BaseExc & operator = (std::stringstream &s); + IEX_EXPORT BaseExc & assign (std::stringstream &s); // assign (s.str()) + IEX_EXPORT BaseExc & operator = (std::stringstream &s); - BaseExc & append (std::stringstream &s); // append (s.str()) - BaseExc & operator += (std::stringstream &s); + IEX_EXPORT BaseExc & append (std::stringstream &s); // append (s.str()) + IEX_EXPORT BaseExc & operator += (std::stringstream &s); //-------------------------------------------------- @@ -111,11 +111,11 @@ class IEX_EXPORT BaseExc: public std::exception // the definitions above. //-------------------------------------------------- - BaseExc & assign (const char *s); - BaseExc & operator = (const char *s); + IEX_EXPORT BaseExc & assign (const char *s); + IEX_EXPORT BaseExc & operator = (const char *s); - BaseExc & append (const char *s); - BaseExc & operator += (const char *s); + IEX_EXPORT BaseExc & append (const char *s); + IEX_EXPORT BaseExc & operator += (const char *s); //-------------------------------------------------- @@ -125,18 +125,17 @@ class IEX_EXPORT BaseExc: public std::exception // has been installed (see below, setStackTracer()). //-------------------------------------------------- - const std::string & stackTrace () const; + IEX_EXPORT const std::string & stackTrace () const; //-------------------------------------------------- // Conversion operators. //-------------------------------------------------- - operator const char *() const - { return what(); } + IEX_EXPORT operator const char *() const { return what(); } private: - std::string _what; + std::string _what; std::string _stackTrace; }; diff --git a/IlmBase/IexMath/CMakeLists.txt b/IlmBase/IexMath/CMakeLists.txt index eea0881193..bc6454d637 100644 --- a/IlmBase/IexMath/CMakeLists.txt +++ b/IlmBase/IexMath/CMakeLists.txt @@ -2,11 +2,11 @@ SET (ILMBASE_LIB_TARGETS "") -IF ( BUILD_SHARED_LIBS ) +IF ( OPENEXR_BUILD_SHARED ) LIST ( APPEND ILMBASE_LIB_TARGETS IexMath ) ADD_LIBRARY ( IexMath SHARED - IexMathFloatExc.cpp + IexMathFloatExc.cpp IexMathFpu.cpp ) @@ -15,20 +15,21 @@ IF ( BUILD_SHARED_LIBS ) TARGET_COMPILE_DEFINITIONS ( IexMath PUBLIC OPENEXR_DLL ) ENDIF () - TARGET_LINK_LIBRARIES(IexMath Iex) + TARGET_LINK_LIBRARIES( IexMath + PUBLIC IlmBase::Iex ) SET_TARGET_PROPERTIES ( IexMath PROPERTIES - VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH} - SOVERSION ${ILMBASE_VERSION_MAJOR} + VERSION ${OPENEXR_VERSION} + SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "IexMath${ILMBASE_LIBSUFFIX}" ) ENDIF () -IF (BUILD_STATIC_LIBS) +IF (BUILD_ILMBASE_STATIC) LIST ( APPEND ILMBASE_LIB_TARGETS IexMath_static ) ADD_LIBRARY ( IexMath_static STATIC - IexMathFloatExc.cpp + IexMathFloatExc.cpp IexMathFpu.cpp ) @@ -39,7 +40,7 @@ IF (BUILD_STATIC_LIBS) ) ENDIF( ) -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR BUILD_ILMBASE_STATIC) INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -47,12 +48,19 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ) ENDIF () -INSTALL ( - FILES - IexMathFloatExc.h - IexMathFpu.h +INSTALL ( + FILES + IexMathFloatExc.h + IexMathFpu.h IexMathIeeeExc.h DESTINATION include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(IlmBase::IexMath ALIAS IexMath) +endif() +if (BUILD_ILMBASE_STATIC) + add_library(IlmBase::IexMath_static ALIAS IexMath_static) +endif() diff --git a/IlmBase/IexTest/CMakeLists.txt b/IlmBase/IexTest/CMakeLists.txt index ca714c3b74..282bc779d7 100644 --- a/IlmBase/IexTest/CMakeLists.txt +++ b/IlmBase/IexTest/CMakeLists.txt @@ -5,7 +5,7 @@ ADD_EXECUTABLE ( IexTest testBaseExc.cpp ) -TARGET_LINK_LIBRARIES ( IexTest Iex ) +TARGET_LINK_LIBRARIES ( IexTest IlmBase::Iex ) INSTALL ( TARGETS IexTest diff --git a/IlmBase/IlmThread/CMakeLists.txt b/IlmBase/IlmThread/CMakeLists.txt index 3a1d031d91..5a28089a44 100644 --- a/IlmBase/IlmThread/CMakeLists.txt +++ b/IlmBase/IlmThread/CMakeLists.txt @@ -20,7 +20,7 @@ ENDIF() SET (ILMBASE_LIB_TARGETS "") -IF ( BUILD_SHARED_LIBS ) +IF ( OPENEXR_BUILD_SHARED ) LIST ( APPEND ILMBASE_LIB_TARGETS IlmThread ) ADD_LIBRARY ( IlmThread SHARED ${ILMTHREAD_LIBRARY_SOURCES} ) @@ -30,16 +30,18 @@ IF ( BUILD_SHARED_LIBS ) TARGET_COMPILE_DEFINITIONS ( IlmThread PUBLIC OPENEXR_DLL ) ENDIF () - TARGET_LINK_LIBRARIES( IlmThread Iex ) + TARGET_LINK_LIBRARIES( IlmThread + PUBLIC IlmBase::Iex ) + SET_TARGET_PROPERTIES ( IlmThread PROPERTIES - VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH} - SOVERSION ${ILMBASE_VERSION_MAJOR} + VERSION ${OPENEXR_VERSION} + SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "IlmThread${ILMBASE_LIBSUFFIX}" ) ENDIF () -IF (BUILD_STATIC_LIBS) +IF (BUILD_ILMBASE_STATIC) LIST ( APPEND ILMBASE_LIB_TARGETS IlmThread_static ) ADD_LIBRARY ( IlmThread_static STATIC ${ILMTHREAD_LIBRARY_SOURCES} ) @@ -51,7 +53,7 @@ IF (BUILD_STATIC_LIBS) ) ENDIF () -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR BUILD_ILMBASE_STATIC) INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -59,8 +61,8 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ) ENDIF () -INSTALL ( - FILES +INSTALL ( + FILES IlmThreadPool.h IlmThread.h IlmThreadSemaphore.h @@ -72,3 +74,10 @@ INSTALL ( DESTINATION include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(IlmBase::IlmThread ALIAS IlmThread) +endif() +if (BUILD_ILMBASE_STATIC) + add_library(IlmBase::IlmThread_static ALIAS IlmThread_static) +endif() diff --git a/IlmBase/IlmThread/IlmThread.cpp b/IlmBase/IlmThread/IlmThread.cpp index 6ad573a3fb..45c958c28c 100644 --- a/IlmBase/IlmThread/IlmThread.cpp +++ b/IlmBase/IlmThread/IlmThread.cpp @@ -36,7 +36,7 @@ // // class Thread -- this file contains two implementations of thread: // - dummy implementation for platforms that do not support threading -// when FORCE_CXX03 is on +// when OPENEXR_FORCE_CXX03 is on // - c++11 and newer version // //----------------------------------------------------------------------------- @@ -82,7 +82,7 @@ Thread::start () #else # if !defined (_WIN32) &&!(_WIN64) && !(HAVE_PTHREAD) //----------------------------------------------------------------------------- -// FORCE_CXX03 with no windows / pthread support +// OPENEXR_FORCE_CXX03 with no windows / pthread support //----------------------------------------------------------------------------- bool supportsThreads () diff --git a/IlmBase/Imath/CMakeLists.txt b/IlmBase/Imath/CMakeLists.txt index aaa93cf0b9..19c3c5a2e6 100644 --- a/IlmBase/Imath/CMakeLists.txt +++ b/IlmBase/Imath/CMakeLists.txt @@ -12,7 +12,7 @@ SET ( IMATH_SOURCES ImathMatrixAlgo.cpp ) -IF ( BUILD_SHARED_LIBS ) +IF ( OPENEXR_BUILD_SHARED ) LIST ( APPEND ILMBASE_LIB_TARGETS Imath ) ADD_LIBRARY ( Imath SHARED ${IMATH_SOURCES} ) @@ -22,16 +22,16 @@ IF ( BUILD_SHARED_LIBS ) TARGET_COMPILE_DEFINITIONS ( Imath PUBLIC OPENEXR_DLL ) ENDIF () - TARGET_LINK_LIBRARIES(Imath Iex) + TARGET_LINK_LIBRARIES(Imath PUBLIC IlmBase::Iex) SET_TARGET_PROPERTIES ( Imath PROPERTIES - VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH} - SOVERSION ${ILMBASE_VERSION_MAJOR} + VERSION ${OPENEXR_VERSION} + SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "Imath${ILMBASE_LIBSUFFIX}" ) ENDIF () -IF (BUILD_STATIC_LIBS) +IF (BUILD_ILMBASE_STATIC) LIST ( APPEND ILMBASE_LIB_TARGETS Imath_static ) ADD_LIBRARY ( Imath_static STATIC ${IMATH_SOURCES} ) @@ -43,7 +43,7 @@ IF (BUILD_STATIC_LIBS) ) ENDIF () -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR BUILD_ILMBASE_STATIC) INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -51,8 +51,8 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ) ENDIF () -INSTALL ( - FILES +INSTALL ( + FILES ImathBoxAlgo.h ImathBox.h ImathColorAlgo.h @@ -91,3 +91,9 @@ INSTALL ( include/OpenEXR ) +if (OPENEXR_BUILD_SHARED) + add_library(IlmBase::Imath ALIAS Imath) +endif() +if (BUILD_ILMBASE_STATIC) + add_library(IlmBase::Imath_static ALIAS Imath_static) +endif() diff --git a/IlmBase/Imath/ImathEuler.h b/IlmBase/Imath/ImathEuler.h index 254c76f6c6..6b2b39e692 100644 --- a/IlmBase/Imath/ImathEuler.h +++ b/IlmBase/Imath/ImathEuler.h @@ -848,10 +848,11 @@ template float Euler::angleMod (T angle) { - angle = fmod(T (angle), T (2 * M_PI)); + const T pi = static_cast(M_PI); + angle = fmod(T (angle), T (2 * pi)); - if (angle < -M_PI) angle += 2 * M_PI; - if (angle > +M_PI) angle -= 2 * M_PI; + if (angle < -pi) angle += 2 * pi; + if (angle > +pi) angle -= 2 * pi; return angle; } diff --git a/IlmBase/ImathTest/CMakeLists.txt b/IlmBase/ImathTest/CMakeLists.txt index f6469ee10e..f23064a4a1 100644 --- a/IlmBase/ImathTest/CMakeLists.txt +++ b/IlmBase/ImathTest/CMakeLists.txt @@ -27,5 +27,5 @@ ADD_EXECUTABLE ( ImathTest ) ADD_TEST ( TestImath ImathTest ) -TARGET_LINK_LIBRARIES ( ImathTest Imath Iex ) +TARGET_LINK_LIBRARIES ( ImathTest IlmBase::Imath IlmBase::Iex ) diff --git a/OpenEXR/AUTHORS b/OpenEXR/AUTHORS index e16202d8fd..57299bc391 100644 --- a/OpenEXR/AUTHORS +++ b/OpenEXR/AUTHORS @@ -10,6 +10,8 @@ Wojciech Jarosz Andrew Kunz Piotr Stanczyk Peter Hillman +Nick Porcino +Kimball Thurston Contributors: ------------- diff --git a/OpenEXR/CMakeLists.txt b/OpenEXR/CMakeLists.txt index ea5c93ff15..9d93dfddf8 100644 --- a/OpenEXR/CMakeLists.txt +++ b/OpenEXR/CMakeLists.txt @@ -1,88 +1,40 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +IF (WIN32) + CMAKE_MINIMUM_REQUIRED(VERSION 3.11) +ELSE() + CMAKE_MINIMUM_REQUIRED(VERSION 3.2) +ENDIF() PROJECT (openexr) -SET(OPENEXR_VERSION_MAJOR "2") -SET(OPENEXR_VERSION_MINOR "2") -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}) - -# enable the tests -ENABLE_TESTING() - -# distro building -SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENEXR_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${OPENEXR_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${OPENEXR_VERSION_PATCH}") -SET(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${OPENEXR_VERSION}" - ) -set(CPACK_SOURCE_IGNORE_FILES - "/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}") -INCLUDE ( CPack ) - - -# Allow the developer to select if Dynamic or Static libraries are built -OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) -OPTION (BUILD_STATIC_LIBS "Build Shared Libraries" OFF) -OPTION (USE_ZLIB_WINAPI "Use ZLib Win API" OFF) -OPTION (NAMESPACE_VERSIONING "Use Namespace Versioning" ON) - IF (NOT ILMBASE_PACKAGE_PREFIX) SET (ILMBASE_PACKAGE_PREFIX ${CMAKE_INSTALL_PREFIX}) ENDIF () -OPTION (FORCE_CXX03 "Force CXX03" OFF) -IF (FORCE_CXX03) - ADD_DEFINITIONS ( -std=c++03 ) -ELSE (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 () - -# Setup osx rpathing -SET (CMAKE_MACOSX_RPATH 1) -SET (BUILD_WITH_INSTALL_RPATH 1) - -ADD_DEFINITIONS ( -DHAVE_CONFIG_H -DILM_IMF_TEST_IMAGEDIR="${CMAKE_SOURCE_DIR}/IlmImfTest/" ) - -IF (WIN32) - SET (RUNTIME_DIR bin) -ELSE () - SET (RUNTIME_DIR lib) -ENDIF () - -INCLUDE_DIRECTORIES ( - ${CMAKE_CURRENT_BINARY_DIR}/config - IlmImf - IlmImfUtil - exrmaketiled - exrenvmap - exrmakepreview - exrmultiview - IlmImfFuzzTest -) - -FIND_PACKAGE(ZLIB REQUIRED) -INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +ADD_DEFINITIONS (-DILM_IMF_TEST_IMAGEDIR="${CMAKE_SOURCE_DIR}/IlmImfTest/" ) IF (NOT WIN32) SET ( PTHREAD_LIB pthread ) ENDIF() -INCLUDE_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/include/OpenEXR ) +MACRO(SET_ILMBASE_INCLUDE_DIRS _target) + TARGET_INCLUDE_DIRECTORIES(${_target} + PRIVATE ${ZLIB_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/config + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../IlmImf + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../IlmImfUtil + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Half + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Iex + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/IexMath + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/IlmThread + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Imath + ) +ENDMACRO() + LINK_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/lib ) MESSAGE ( "ILMBASE_PACKAGE_PREFIX = " ${ILMBASE_PACKAGE_PREFIX}) -IF (USE_ZLIB_WINAPI) - ADD_DEFINITIONS(-DZLIB_WINAPI) -ENDIF () - IF (NOT WIN32 AND NOT APPLE) # Test for GCC-style inline asm support with AVX instructions INCLUDE (CheckCXXSourceCompiles) @@ -90,7 +42,7 @@ IF (NOT WIN32 AND NOT APPLE) " int main() { - #if defined(__GNUC__) && defined(__SSE2__) + #if defined(__GNUC__) && defined(__SSE2__) int n = 0; int eax = 0; int edx = 0; @@ -131,8 +83,8 @@ ELSE () FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" ) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_LARGE_STACK 1\n" ) ENDIF() - -IF (NAMESPACE_VERSIONING) + +IF (OPENEXR_NAMESPACE_VERSIONING) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 1\n") FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_NAMESPACE Imf\n" ) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf_${OPENEXR_VERSION_API}\n\n" ) @@ -163,18 +115,11 @@ FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h " IF (HAVE_GCC_INLINE_ASM_AVX) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1\n" ) ENDIF() - + IF (HAVE_SYSCONF_NPROCESSORS_ONLN) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1\n" ) ENDIF() - -SET (OPENEXR_LIBSUFFIX "") -SET (ILMBASE_LIBSUFFIX "") -IF (NAMESPACE_VERSIONING) - SET ( OPENEXR_LIBSUFFIX "-${OPENEXR_VERSION_API}" ) - # assume same NAMESPACE_VERSION setting for IlmBase for now - SET ( ILMBASE_LIBSUFFIX "-${OPENEXR_VERSION_API}" ) -ENDIF () + ########################## # IlmImf library @@ -187,7 +132,7 @@ SET_TARGET_PROPERTIES ( IlmImf SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "IlmImf${OPENEXR_LIBSUFFIX}" ) - + ########################## # IlmImfUtil library ########################## @@ -199,20 +144,21 @@ SET_TARGET_PROPERTIES ( IlmImfUtil SOVERSION ${OPENEXR_VERSION_MAJOR} OUTPUT_NAME "IlmImfUtil${OPENEXR_LIBSUFFIX}" ) - + ########################## # Example Code ########################## ADD_SUBDIRECTORY ( IlmImfExamples ) - + ########################## # Tests ########################## -ADD_SUBDIRECTORY ( IlmImfTest ) -ADD_SUBDIRECTORY ( IlmImfUtilTest ) -ADD_SUBDIRECTORY ( IlmImfFuzzTest ) - +IF (ENABLE_TESTS) + ADD_SUBDIRECTORY ( IlmImfTest ) + ADD_SUBDIRECTORY ( IlmImfUtilTest ) + ADD_SUBDIRECTORY ( IlmImfFuzzTest ) +ENDIF () ########################## # Binaries / Utilities diff --git a/OpenEXR/IlmImf/CMakeLists.txt b/OpenEXR/IlmImf/CMakeLists.txt index eeb9471ba5..15b277f5c4 100644 --- a/OpenEXR/IlmImf/CMakeLists.txt +++ b/OpenEXR/IlmImf/CMakeLists.txt @@ -3,58 +3,64 @@ SET(CMAKE_INCLUDE_CURRENT_DIR 1) IF (WIN32) - SET(RUNTIME_DIR ${ILMBASE_PACKAGE_PREFIX}/bin) + SET(RUNTIME_DIR ${OPENEXR_PACKAGE_PREFIX}/bin) + SET(WORKING_DIR ${RUNTIME_DIR}) ELSE () - SET(RUNTIME_DIR ${ILMBASE_PACKAGE_PREFIX}/lib) + SET(RUNTIME_DIR ${OPENEXR_PACKAGE_PREFIX}/lib) + SET(WORKING_DIR .) ENDIF () + ADD_EXECUTABLE ( b44ExpLogTable b44ExpLogTable.cpp ) -TARGET_LINK_LIBRARIES ( b44ExpLogTable - Half${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - ${PTHREAD_LIB} -) - -TARGET_INCLUDE_DIRECTORIES ( b44ExpLogTable - PRIVATE ${CMAKE_INSTALL_PREFIX}/include/OpenEXR ) - -IF (BUILD_SHARED_LIBS AND WIN32) - TARGET_COMPILE_DEFINITIONS( b44ExpLogTable PUBLIC OPENEXR_DLL ) +IF (WIN32) + TARGET_LINK_LIBRARIES ( b44ExpLogTable + IlmBase::Half_static + IlmBase::IlmThread_static + IlmBase::Iex_static) +ELSE() + TARGET_LINK_LIBRARIES ( b44ExpLogTable + IlmBase::Half + IlmBase::IlmThread + IlmBase::Iex + ${PTHREAD_LIB}) ENDIF() - +TARGET_INCLUDE_DIRECTORIES ( b44ExpLogTable + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Half +) ADD_CUSTOM_COMMAND ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/b44ExpLogTable > ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h + COMMAND $ > ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h DEPENDS b44ExpLogTable - WORKING_DIRECTORY ${RUNTIME_DIR} ) ADD_EXECUTABLE ( dwaLookups dwaLookups.cpp ) -IF (BUILD_SHARED_LIBS AND WIN32) - TARGET_COMPILE_DEFINITIONS( dwaLookups PUBLIC OPENEXR_DLL ) -ENDIF() +SET_ILMBASE_INCLUDE_DIRS(dwaLookups) -TARGET_LINK_LIBRARIES ( dwaLookups - Half${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - ${PTHREAD_LIB} -) +IF (WIN32) + TARGET_LINK_LIBRARIES ( dwaLookups + IlmBase::Half_static + IlmBase::IlmThread_static + IlmBase::Iex_static) +ELSE() + TARGET_LINK_LIBRARIES ( dwaLookups + IlmBase::Half + IlmBase::IlmThread + IlmBase::Iex + ${PTHREAD_LIB}) +ENDIF() ADD_CUSTOM_COMMAND ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dwaLookups > ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h + COMMAND $ > ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h DEPENDS dwaLookups - WORKING_DIRECTORY ${RUNTIME_DIR} ) SET ( ILMIMF_SRCS @@ -160,10 +166,9 @@ SET_SOURCE_FILES_PROPERTIES ( OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h ) - SET (OPENEXR_LIB_TARGETS "") -IF ( BUILD_SHARED_LIBS ) +IF ( OPENEXR_BUILD_SHARED ) LIST ( APPEND OPENEXR_LIB_TARGETS IlmImf ) ADD_LIBRARY ( IlmImf SHARED ${ILMIMF_SRCS} ) @@ -175,12 +180,14 @@ IF ( BUILD_SHARED_LIBS ) ENDIF () TARGET_LINK_LIBRARIES ( IlmImf - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - ${PTHREAD_LIB} ${ZLIB_LIBRARIES} + PUBLIC IlmBase::Iex + PUBLIC IlmBase::Half + PUBLIC IlmBase::Imath + PUBLIC IlmBase::IlmThread + PRIVATE ${PTHREAD_LIB} + PRIVATE ${ZLIB_LIBRARIES} ) + SET_ILMBASE_INCLUDE_DIRS(IlmImf) SET_TARGET_PROPERTIES ( IlmImf PROPERTIES @@ -194,7 +201,7 @@ IF ( BUILD_SHARED_LIBS ) ENDIF () -IF (BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_STATIC) LIST ( APPEND OPENEXR_LIB_TARGETS IlmImf_static ) ADD_LIBRARY ( IlmImf_static STATIC ${ILMIMF_SRCS} ) @@ -204,9 +211,10 @@ IF (BUILD_STATIC_LIBS) VERSION ${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH} OUTPUT_NAME "IlmImf${OPENEXR_LIBSUFFIX}_s" ) + SET_ILMBASE_INCLUDE_DIRS(IlmImf_static) IF (WIN32) - TARGET_COMPILE_DEFINITIONS ( IlmImf PUBLIC _CRT_SECURE_NO_WARNINGS ) + TARGET_COMPILE_DEFINITIONS ( IlmImf_static PUBLIC _CRT_SECURE_NO_WARNINGS ) ENDIF () ADD_DEPENDENCIES ( IlmImf_static b44ExpLogTable ) @@ -214,7 +222,7 @@ IF (BUILD_STATIC_LIBS) ENDIF () -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR OPENEXR_BUILD_STATIC) INSTALL ( TARGETS ${OPENEXR_LIB_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -222,8 +230,8 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ) ENDIF () -INSTALL ( - FILES +INSTALL ( + FILES ImfForward.h ImfExport.h ImfAttribute.h @@ -316,3 +324,10 @@ INSTALL ( DESTINATION include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(OpenEXR::IlmImf ALIAS IlmImf) +endif() +if (OPENEXR_BUILD_STATIC) + add_library(OpenEXR::IlmImf_static ALIAS IlmImf_static) +endif() diff --git a/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h b/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h index 0d1656dd05..13c3fbe220 100644 --- a/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h +++ b/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h @@ -62,7 +62,7 @@ #include "ImfForward.h" #include "ImfNamespace.h" #include "ImfExport.h" -#include "ImathBox.h" +#include OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER diff --git a/OpenEXR/IlmImfExamples/CMakeLists.txt b/OpenEXR/IlmImfExamples/CMakeLists.txt index 386f182b00..89a34fc3f0 100644 --- a/OpenEXR/IlmImfExamples/CMakeLists.txt +++ b/OpenEXR/IlmImfExamples/CMakeLists.txt @@ -11,13 +11,13 @@ ADD_EXECUTABLE ( IlmImfExamples rgbaInterfaceTiledExamples.cpp ) + SET_ILMBASE_INCLUDE_DIRS( IlmImfExamples ) -TARGET_LINK_LIBRARIES ( IlmImfExamples - IlmImf - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - ${PTHREAD_LIB} ${ZLIB_LIBRARIES} - ) - +TARGET_LINK_LIBRARIES ( IlmImfExamples + OpenEXR::IlmImf + IlmBase::Half + IlmBase::Iex + IlmBase::Imath + IlmBase::IlmThread + ${PTHREAD_LIB} ${ZLIB_LIBRARIES} +) diff --git a/OpenEXR/IlmImfFuzzTest/CMakeLists.txt b/OpenEXR/IlmImfFuzzTest/CMakeLists.txt index af0c22bcae..2533cc8720 100644 --- a/OpenEXR/IlmImfFuzzTest/CMakeLists.txt +++ b/OpenEXR/IlmImfFuzzTest/CMakeLists.txt @@ -9,12 +9,14 @@ ADD_EXECUTABLE ( IlmImfFuzzTest testFuzzTiles.cpp ) -TARGET_LINK_LIBRARIES ( IlmImfFuzzTest - IlmImf - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} +SET_ILMBASE_INCLUDE_DIRS( IlmImfFuzzTest ) + +TARGET_LINK_LIBRARIES ( IlmImfFuzzTest + OpenEXR::IlmImf + IlmBase::Half + IlmBase::Iex + IlmBase::Imath + IlmBase::IlmThread ${PTHREAD_LIB} ${ZLIB_LIBRARIES}) ADD_TEST ( TestIlmImfFuzz IlmImfFuzzTest ) diff --git a/OpenEXR/IlmImfTest/CMakeLists.txt b/OpenEXR/IlmImfTest/CMakeLists.txt index 6c61e00b7f..56bce878af 100644 --- a/OpenEXR/IlmImfTest/CMakeLists.txt +++ b/OpenEXR/IlmImfTest/CMakeLists.txt @@ -62,14 +62,15 @@ ADD_EXECUTABLE ( IlmImfTest testYca.cpp ) + SET_ILMBASE_INCLUDE_DIRS( IlmImfTest ) ADD_TEST ( TestIlmImf IlmImfTest ) -TARGET_LINK_LIBRARIES ( IlmImfTest - IlmImf - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} +TARGET_LINK_LIBRARIES ( IlmImfTest + OpenEXR::IlmImf + IlmBase::Half + IlmBase::Iex + IlmBase::Imath + IlmBase::IlmThread ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/IlmImfUtil/CMakeLists.txt b/OpenEXR/IlmImfUtil/CMakeLists.txt index 22919845d9..975af35b34 100644 --- a/OpenEXR/IlmImfUtil/CMakeLists.txt +++ b/OpenEXR/IlmImfUtil/CMakeLists.txt @@ -20,23 +20,25 @@ SET (OPENEXR_LIB_TARGETS "") LINK_DIRECTORIES ( ${CMAKE_CURRENT_BINARY_DIR}/../IlmImf ) -IF(BUILD_SHARED_LIBS) +IF(OPENEXR_BUILD_SHARED) LIST ( APPEND OPENEXR_LIB_TARGETS IlmImfUtil ) ADD_LIBRARY ( IlmImfUtil SHARED ${ILMIMFUTIL_SRCS} ) + SET_ILMBASE_INCLUDE_DIRS( IlmImfUtil ) TARGET_COMPILE_DEFINITIONS ( IlmImfUtil PRIVATE ILMIMFUTIL_EXPORTS ) IF (WIN32) TARGET_COMPILE_DEFINITIONS ( IlmImfUtil PUBLIC OPENEXR_DLL ) ENDIF () - TARGET_LINK_LIBRARIES ( IlmImfUtil - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - IlmImf - ${PTHREAD_LIB} ${ZLIB_LIBRARIES} + TARGET_LINK_LIBRARIES ( IlmImfUtil + PUBLIC IlmBase::Iex + PUBLIC IlmBase::Half + PUBLIC IlmBase::Imath + PUBLIC IlmBase::IlmThread + PUBLIC OpenEXR::IlmImf + PRIVATE ${PTHREAD_LIB} + PRIVATE ${ZLIB_LIBRARIES} ) SET_TARGET_PROPERTIES ( IlmImfUtil @@ -48,10 +50,11 @@ IF(BUILD_SHARED_LIBS) ENDIF() -IF ( BUILD_STATIC_LIBS ) +IF ( OPENEXR_BUILD_STATIC ) LIST ( APPEND OPENEXR_LIB_TARGETS IlmImfUtil_static ) ADD_LIBRARY ( IlmImfUtil_static STATIC ${ILMIMFUTIL_SRCS} ) + SET_ILMBASE_INCLUDE_DIRS( IlmImf_static ) SET_TARGET_PROPERTIES ( IlmImfUtil_static PROPERTIES @@ -62,7 +65,7 @@ IF ( BUILD_STATIC_LIBS ) ENDIF() -IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) +IF (OPENEXR_BUILD_SHARED OR OPENEXR_BUILD_STATIC) INSTALL ( TARGETS ${OPENEXR_LIB_TARGETS} ARCHIVE DESTINATION lib @@ -72,7 +75,7 @@ IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS) ENDIF () # Headers -INSTALL ( +INSTALL ( FILES ImfImageChannel.h ImfFlatImageChannel.h @@ -94,3 +97,10 @@ INSTALL ( DESTINATION ${CMAKE_INSTALL_PREFIX}/include/OpenEXR ) + +if (OPENEXR_BUILD_SHARED) + add_library(OpenEXR::IlmImfUtil ALIAS IlmImfUtil) +endif() +if (OPENEXR_BUILD_STATIC) + add_library(OpenEXR::IlmImfUtil_static ALIAS IlmImfUtil_static) +endif() diff --git a/OpenEXR/IlmImfUtil/ImfDeepImageChannel.h b/OpenEXR/IlmImfUtil/ImfDeepImageChannel.h index 5a817ad793..6944ff1902 100644 --- a/OpenEXR/IlmImfUtil/ImfDeepImageChannel.h +++ b/OpenEXR/IlmImfUtil/ImfDeepImageChannel.h @@ -68,7 +68,7 @@ class SampleCountChannel; // of the level. // -class IMFUTIL_EXPORT DeepImageChannel: public ImageChannel +class DeepImageChannel: public ImageChannel { public: @@ -84,26 +84,24 @@ class IMFUTIL_EXPORT DeepImageChannel: public ImageChannel // Access to the image level to which this channel belongs. // - DeepImageLevel & deepLevel(); - const DeepImageLevel & deepLevel() const; + IMFUTIL_EXPORT DeepImageLevel & deepLevel(); + IMFUTIL_EXPORT const DeepImageLevel & deepLevel() const; // // Access to the sample count channel for this deep channel. // - SampleCountChannel & sampleCounts(); - const SampleCountChannel & sampleCounts() const; + IMFUTIL_EXPORT SampleCountChannel & sampleCounts(); + IMFUTIL_EXPORT const SampleCountChannel & sampleCounts() const; protected: friend class DeepImageLevel; - IMF_EXPORT - DeepImageChannel (DeepImageLevel &level, bool pLinear); - IMF_EXPORT - virtual ~DeepImageChannel(); + IMFUTIL_EXPORT DeepImageChannel (DeepImageLevel &level, bool pLinear); + IMFUTIL_EXPORT virtual ~DeepImageChannel(); virtual void setSamplesToZero (size_t i, @@ -123,8 +121,7 @@ class IMFUTIL_EXPORT DeepImageChannel: public ImageChannel virtual void initializeSampleLists () = 0; - IMF_EXPORT - virtual void resize (); + IMFUTIL_EXPORT virtual void resize (); virtual void resetBasePointer () = 0; }; diff --git a/OpenEXR/IlmImfUtil/ImfFlatImageChannel.h b/OpenEXR/IlmImfUtil/ImfFlatImageChannel.h index 9cf29f9181..c983e77e81 100644 --- a/OpenEXR/IlmImfUtil/ImfFlatImageChannel.h +++ b/OpenEXR/IlmImfUtil/ImfFlatImageChannel.h @@ -67,7 +67,7 @@ class FlatImageLevel; // only for pixels within the data window of the level. // -class IMF_EXPORT FlatImageChannel: public ImageChannel +class FlatImageChannel: public ImageChannel { public: diff --git a/OpenEXR/IlmImfUtilTest/CMakeLists.txt b/OpenEXR/IlmImfUtilTest/CMakeLists.txt index f43d2e648c..8e67cda3b0 100644 --- a/OpenEXR/IlmImfUtilTest/CMakeLists.txt +++ b/OpenEXR/IlmImfUtilTest/CMakeLists.txt @@ -11,15 +11,16 @@ ADD_EXECUTABLE ( IlmImfUtilTest testIO.cpp ) + SET_ILMBASE_INCLUDE_DIRS( IlmImfUtilTest ) ADD_TEST ( TestIlmImfUtil IlmImfUtilTest ) -TARGET_LINK_LIBRARIES ( IlmImfUtilTest - IlmImfUtil - IlmImf - Half${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} +TARGET_LINK_LIBRARIES ( IlmImfUtilTest + OpenEXR::IlmImfUtil + OpenEXR::IlmImf + IlmBase::Half + IlmBase::Iex + IlmBase::Imath + IlmBase::IlmThread ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exr2aces/CMakeLists.txt b/OpenEXR/exr2aces/CMakeLists.txt index cbd9f2bcb1..79cd5de306 100644 --- a/OpenEXR/exr2aces/CMakeLists.txt +++ b/OpenEXR/exr2aces/CMakeLists.txt @@ -5,14 +5,16 @@ ADD_EXECUTABLE ( exr2aces ) TARGET_LINK_LIBRARIES ( exr2aces - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) +SET_ILMBASE_INCLUDE_DIRS( exr2aces ) + INSTALL ( TARGETS exr2aces DESTINATION diff --git a/OpenEXR/exrbuild/CMakeLists.txt b/OpenEXR/exrbuild/CMakeLists.txt index 05e265aa33..1d92f0066e 100644 --- a/OpenEXR/exrbuild/CMakeLists.txt +++ b/OpenEXR/exrbuild/CMakeLists.txt @@ -1,14 +1,13 @@ # yue.nicholas@gmail.com -ADD_EXECUTABLE ( exrbuild - exrbuild.cpp -) +ADD_EXECUTABLE ( exrbuild exrbuild.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrbuild ) TARGET_LINK_LIBRARIES ( exrbuild - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrenvmap/CMakeLists.txt b/OpenEXR/exrenvmap/CMakeLists.txt index 42a15fee32..5ce750bd49 100644 --- a/OpenEXR/exrenvmap/CMakeLists.txt +++ b/OpenEXR/exrenvmap/CMakeLists.txt @@ -10,11 +10,13 @@ ADD_EXECUTABLE ( exrenvmap EnvmapImage.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrenvmap ) + TARGET_LINK_LIBRARIES ( exrenvmap - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrheader/CMakeLists.txt b/OpenEXR/exrheader/CMakeLists.txt index 1027e67219..e835e9cd5d 100644 --- a/OpenEXR/exrheader/CMakeLists.txt +++ b/OpenEXR/exrheader/CMakeLists.txt @@ -1,14 +1,13 @@ # yue.nicholas@gmail.com -ADD_EXECUTABLE ( exrheader - main.cpp -) +ADD_EXECUTABLE ( exrheader main.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrheader ) TARGET_LINK_LIBRARIES ( exrheader - IlmImf - Iex${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::Iex + IlmBase::IlmThread + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrmakepreview/CMakeLists.txt b/OpenEXR/exrmakepreview/CMakeLists.txt index 6300310b2f..e329061c07 100644 --- a/OpenEXR/exrmakepreview/CMakeLists.txt +++ b/OpenEXR/exrmakepreview/CMakeLists.txt @@ -4,12 +4,14 @@ ADD_EXECUTABLE ( exrmakepreview makePreview.cpp main.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrmakepreview ) + TARGET_LINK_LIBRARIES ( exrmakepreview - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrmaketiled/CMakeLists.txt b/OpenEXR/exrmaketiled/CMakeLists.txt index 26eb2c358c..79a95b14c5 100644 --- a/OpenEXR/exrmaketiled/CMakeLists.txt +++ b/OpenEXR/exrmaketiled/CMakeLists.txt @@ -5,12 +5,13 @@ ADD_EXECUTABLE ( exrmaketiled main.cpp Image.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrmaketiled ) TARGET_LINK_LIBRARIES ( exrmaketiled - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrmultipart/CMakeLists.txt b/OpenEXR/exrmultipart/CMakeLists.txt index 04b7e23555..c1b50f95c1 100644 --- a/OpenEXR/exrmultipart/CMakeLists.txt +++ b/OpenEXR/exrmultipart/CMakeLists.txt @@ -1,14 +1,13 @@ # yue.nicholas@gmail.com -ADD_EXECUTABLE ( exrmultipart - exrmultipart.cpp -) +ADD_EXECUTABLE ( exrmultipart exrmultipart.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrmultipart ) TARGET_LINK_LIBRARIES ( exrmultipart - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrmultiview/CMakeLists.txt b/OpenEXR/exrmultiview/CMakeLists.txt index 203ef1b80f..9d29ab1c5d 100644 --- a/OpenEXR/exrmultiview/CMakeLists.txt +++ b/OpenEXR/exrmultiview/CMakeLists.txt @@ -6,12 +6,14 @@ ADD_EXECUTABLE ( exrmultiview Image.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrmultiview ) + TARGET_LINK_LIBRARIES ( exrmultiview - IlmImf - Half${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::Half + IlmBase::Imath + IlmBase::Iex + IlmBase::IlmThread ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR/exrstdattr/CMakeLists.txt b/OpenEXR/exrstdattr/CMakeLists.txt index 814e89402e..1cc841f911 100644 --- a/OpenEXR/exrstdattr/CMakeLists.txt +++ b/OpenEXR/exrstdattr/CMakeLists.txt @@ -1,14 +1,13 @@ # yue.nicholas@gmail.com -ADD_EXECUTABLE ( exrstdattr - main.cpp -) +ADD_EXECUTABLE ( exrstdattr main.cpp ) +SET_ILMBASE_INCLUDE_DIRS( exrstdattr ) TARGET_LINK_LIBRARIES ( exrstdattr - IlmImf - IlmThread${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::IlmThread + IlmBase::Iex + IlmBase::Half ${PTHREAD_LIB} ${ZLIB_LIBRARIES} ) diff --git a/OpenEXR_Viewers/CMakeLists.txt b/OpenEXR_Viewers/CMakeLists.txt index 4a9cc4c96b..50ce30931e 100644 --- a/OpenEXR_Viewers/CMakeLists.txt +++ b/OpenEXR_Viewers/CMakeLists.txt @@ -1,66 +1,27 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +IF (WIN32) + CMAKE_MINIMUM_REQUIRED(VERSION 3.11) +ELSE() + CMAKE_MINIMUM_REQUIRED(VERSION 3.2) +ENDIF() PROJECT (openexr_viewers) -SET(OPENEXR_VERSION_MAJOR "2") -SET(OPENEXR_VERSION_MINOR "2") -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}) - - -# distro building -SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENEXR_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${OPENEXR_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${OPENEXR_VERSION_PATCH}") -SET(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${OPENEXR_VERSION}" - ) -set(CPACK_SOURCE_IGNORE_FILES - "/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}") -INCLUDE ( CPack ) - -OPTION (NAMESPACE_VERSIONING "Use Namespace Versioning" ON) - -OPTION (FORCE_CXX03 "Force CXX03" OFF) -IF (FORCE_CXX03) - ADD_DEFINITIONS ( -std=c++03 ) -ELSE (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) +IF (NOT ILMBASE_PACKAGE_PREFIX) + SET (ILMBASE_PACKAGE_PREFIX ${CMAKE_INSTALL_PREFIX}) ENDIF () -# Setup osx rpathing -SET (CMAKE_MACOSX_RPATH 1) -SET (BUILD_WITH_INSTALL_RPATH 1) - -ADD_DEFINITIONS ( -DHAVE_CONFIG_H ) - -SET (FLTK_SKIP_FLUID 1) -FIND_PACKAGE (OpenGL REQUIRED) -FIND_PACKAGE (FLTK) -FIND_PACKAGE (GLUT) -FIND_PACKAGE (Cg) - -IF (NOT WIN32) - SET ( PTHREAD_LIB pthread ) -ENDIF() +#FIND_PACKAGE (OpenGL REQUIRED) +#FIND_PACKAGE (FLTK) +#FIND_PACKAGE (GLUT) +#FIND_PACKAGE (Cg) INCLUDE_DIRECTORIES ( ${OPENEXR_PACKAGE_PREFIX}/include/OpenEXR ) LINK_DIRECTORIES ( ${OPENEXR_PACKAGE_PREFIX}/lib ) MESSAGE ( "OPENEXR_PACKAGE_PREFIX = " ${OPENEXR_PACKAGE_PREFIX}) -SET (OPENEXR_LIBSUFFIX "") -SET (ILMBASE_LIBSUFFIX "") -IF (NAMESPACE_VERSIONING) - SET ( OPENEXR_LIBSUFFIX "-${OPENEXR_VERSION_API}" ) - # assume same NAMESPACE_VERSION setting for IlmBase for now - SET ( ILMBASE_LIBSUFFIX "-${OPENEXR_VERSION_API}" ) -ENDIF () +IF (NOT WIN32) + SET ( PTHREAD_LIB pthread ) +ENDIF() ########################## IF (FLTK_FOUND) diff --git a/OpenEXR_Viewers/exrdisplay/CMakeLists.txt b/OpenEXR_Viewers/exrdisplay/CMakeLists.txt index b009a9cdbe..d9227a5506 100644 --- a/OpenEXR_Viewers/exrdisplay/CMakeLists.txt +++ b/OpenEXR_Viewers/exrdisplay/CMakeLists.txt @@ -17,10 +17,15 @@ INCLUDE_DIRECTORIES ( ${FLTK_INCLUDE_DIR} ) +TARGET_INCLUDE_DIRECTORIES ( exrdisplay + PRIVATE + ${CMAKE_INSTALL_PREFIX}/include/OpenEXR + ${FLTK_INCLUDE_DIR} ) + TARGET_LINK_LIBRARIES ( exrdisplay - IlmImf${OPENEXR_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::Iex + IlmBase::Half ${FLTK_LIBRARIES} ${OPENGL_LIBRARIES} ) diff --git a/OpenEXR_Viewers/exrdisplay/GlWindow3d.h b/OpenEXR_Viewers/exrdisplay/GlWindow3d.h index bb39684f47..3000c935c5 100644 --- a/OpenEXR_Viewers/exrdisplay/GlWindow3d.h +++ b/OpenEXR_Viewers/exrdisplay/GlWindow3d.h @@ -44,6 +44,11 @@ #include + +#ifdef _MSC_VER +#define _USE_MATH_DEFINES +#endif + #include #include #include diff --git a/OpenEXR_Viewers/playexr/CMakeLists.txt b/OpenEXR_Viewers/playexr/CMakeLists.txt index f89bb60ac8..b23976cbab 100644 --- a/OpenEXR_Viewers/playexr/CMakeLists.txt +++ b/OpenEXR_Viewers/playexr/CMakeLists.txt @@ -22,10 +22,10 @@ INCLUDE_DIRECTORIES ( ) TARGET_LINK_LIBRARIES ( playexr - IlmImf${OPENEXR_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} - IlmThread${ILMBASE_LIBSUFFIX} - Half${ILMBASE_LIBSUFFIX} + OpenEXR::IlmImf + IlmBase::Iex + IlmBase::IlmThread + IlmBase::Half ${CG_LIBRARY} ${CG_GL_LIBRARY} ${OPENGL_LIBRARIES} diff --git a/PyIlmBase/CMakeLists.txt b/PyIlmBase/CMakeLists.txt index 2e4fdfb7c7..5ef6319558 100644 --- a/PyIlmBase/CMakeLists.txt +++ b/PyIlmBase/CMakeLists.txt @@ -1,96 +1,46 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) - -PROJECT (pyilmbase) - -SET(ILMBASE_VERSION_MAJOR "2") -SET(ILMBASE_VERSION_MINOR "2") -SET(ILMBASE_VERSION_PATCH "0") - -SET(ILMBASE_VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}) -SET(ILMBASE_VERSION_API ${ILMBASE_VERSION_MAJOR}_${ILMBASE_VERSION_MINOR}) - - -# enable the tests -ENABLE_TESTING() - - -# distro building -SET(CPACK_PACKAGE_VERSION_MAJOR "${ILMBASE_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${ILMBASE_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${ILMBASE_VERSION_PATCH}") -SET(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${ILMBASE_VERSION}" - ) -set(CPACK_SOURCE_IGNORE_FILES - "/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}") -INCLUDE ( CPack ) - -# Set this option to find the C++ libs with their namespaced versions -# The python modules themselves are built without versioning -OPTION (NAMESPACE_VERSIONING "Use Namespace Versioning" ON) -# Allow the developer to select if Dynamic or Static libraries are built -OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) - -OPTION (FORCE_CXX03 "Force CXX03" OFF) -IF (FORCE_CXX03) - ADD_DEFINITIONS ( -std=c++03 ) -ELSE (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 () - -# Setup osx rpathing -SET (CMAKE_MACOSX_RPATH 1) -SET (BUILD_WITH_INSTALL_RPATH 1) - -IF (BUILD_SHARED_LIBS) - # User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED' - SET (LIB_TYPE SHARED) - IF (WIN32) - ADD_DEFINITIONS(-DOPENEXR_DLL) - ENDIF () -ENDIF (BUILD_SHARED_LIBS) - -FIND_PACKAGE ( PythonLibs REQUIRED ) -FIND_PACKAGE ( PythonInterp REQUIRED ) -FIND_PACKAGE ( Boost - COMPONENTS Python -) -FIND_PACKAGE ( NumPy ) - -INCLUDE_DIRECTORIES ( - ${ILMBASE_PACKAGE_PREFIX}/include/OpenEXR - PyIex - PyImath - PyImathNumpy - ${PYTHON_INCLUDE_PATH} - ${Boost_INCLUDE_DIRS} -) - -LINK_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/lib ) -MESSAGE ( "ILMBASE_PACKAGE_PREFIX = " ${ILMBASE_PACKAGE_PREFIX}) - - -SET (ILMBASE_LIBSUFFIX "") -IF (NAMESPACE_VERSIONING) - SET ( ILMBASE_LIBSUFFIX "-${ILMBASE_VERSION_API}" ) -ENDIF () - -########################## -ADD_SUBDIRECTORY ( PyIex ) -ADD_SUBDIRECTORY ( PyImath ) - -IF (NUMPY_FOUND) - ADD_SUBDIRECTORY ( PyImathNumpy ) - ADD_SUBDIRECTORY ( PyImathNumpyTest ) -ENDIF () - -########################## -# Tests -########################## -ADD_SUBDIRECTORY ( PyIexTest ) -ADD_SUBDIRECTORY ( PyImathTest ) - + +PROJECT (pyilmbase) + +IF (OPENEXR_BUILD_SHARED) + # User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED' + SET (LIB_TYPE SHARED) + IF (WIN32) + ADD_DEFINITIONS(-DOPENEXR_DLL) + ENDIF () +ENDIF (OPENEXR_BUILD_SHARED) + +LINK_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/lib ) +MESSAGE ( "ILMBASE_PACKAGE_PREFIX = " ${ILMBASE_PACKAGE_PREFIX}) + +MACRO(SET_ILMBASE_INCLUDE_DIRS _target) + TARGET_INCLUDE_DIRECTORIES(${_target} + PRIVATE ${PYTHON_INCLUDE_PATH} + PRIVATE ${Boost_INCLUDE_DIRS} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../../IlmBase/config + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../PyIex + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../PyImath + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../PyImathNumpy + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Half + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Iex + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/IexMath + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/IlmThread + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../IlmBase/Imath + ) +ENDMACRO() + +########################## +ADD_SUBDIRECTORY ( PyIex ) +ADD_SUBDIRECTORY ( PyImath ) + +IF (NUMPY_FOUND) + ADD_SUBDIRECTORY ( PyImathNumpy ) + ADD_SUBDIRECTORY ( PyImathNumpyTest ) +ENDIF () + +########################## +# Tests +########################## +ADD_SUBDIRECTORY ( PyIexTest ) +ADD_SUBDIRECTORY ( PyImathTest ) diff --git a/PyIlmBase/PyIex/CMakeLists.txt b/PyIlmBase/PyIex/CMakeLists.txt index 1cab73e293..891db37e17 100644 --- a/PyIlmBase/PyIex/CMakeLists.txt +++ b/PyIlmBase/PyIex/CMakeLists.txt @@ -1,17 +1,19 @@ -ADD_LIBRARY ( PyIex ${LIB_TYPE} - PyIex.cpp -) +ADD_LIBRARY ( PyIex ${LIB_TYPE} PyIex.cpp) + +target_compile_definitions( PyIex PRIVATE PYIEX_BUILD ) -IF(BUILD_SHARED_LIBS) - target_compile_definitions( PyIex PRIVATE -DPYIEX_EXPORTS ) +IF (WIN32) + target_compile_definitions( PyIex + PRIVATE OPENEXR_DLL) ENDIF() -target_compile_definitions( PyIex PRIVATE PYIEX_BUILD ) +SET_ILMBASE_INCLUDE_DIRS( PyIex ) TARGET_LINK_LIBRARIES ( PyIex - ${PYTHON_LIBRARIES} - ${Boost_LIBRARIES} + PUBLIC IlmBase::Iex + PRIVATE ${PYTHON_LIBRARIES} + PRIVATE ${Boost_LIBRARIES} ) INSTALL ( TARGETS PyIex @@ -19,15 +21,26 @@ INSTALL ( TARGETS PyIex lib ) +INSTALL ( + FILES + PyIex.h + PyIexExport.h + PyIexTypeTranslator.h + + DESTINATION + include/OpenEXR +) + + ADD_LIBRARY ( iexmodule ${LIB_TYPE} iexmodule.cpp ) if (WIN32) SET_TARGET_PROPERTIES ( iexmodule - PROPERTIES + PROPERTIES PREFIX "" - OUTPUT_NAME "iex" + OUTPUT_NAME "iex" SUFFIX ".pyd" ) else() @@ -38,10 +51,13 @@ endif() TARGET_LINK_LIBRARIES ( iexmodule PyIex - Iex${ILMBASE_LIBSUFFIX} + IlmBase::Iex + ${PYTHON_LIBRARIES} ${Boost_LIBRARIES} ) +SET_ILMBASE_INCLUDE_DIRS( iexmodule ) + INSTALL ( TARGETS iexmodule DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages ) diff --git a/PyIlmBase/PyIex/PyIex.cpp b/PyIlmBase/PyIex/PyIex.cpp index 45896814cb..36583f54f5 100644 --- a/PyIlmBase/PyIex/PyIex.cpp +++ b/PyIlmBase/PyIex/PyIex.cpp @@ -39,8 +39,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "PyIex.h" +#include "PyIexExport.h" #include namespace PyIex { diff --git a/PyIlmBase/PyIex/PyIex.h b/PyIlmBase/PyIex/PyIex.h index 711388c9c6..ceab6cf591 100644 --- a/PyIlmBase/PyIex/PyIex.h +++ b/PyIlmBase/PyIex/PyIex.h @@ -47,8 +47,8 @@ #include #include #include -#include -#include +#include "PyIexTypeTranslator.h" +#include "PyIexExport.h" namespace PyIex { diff --git a/PyIlmBase/PyImath/CMakeLists.txt b/PyIlmBase/PyImath/CMakeLists.txt index 5630535f03..f5bdd17935 100644 --- a/PyIlmBase/PyImath/CMakeLists.txt +++ b/PyIlmBase/PyImath/CMakeLists.txt @@ -32,17 +32,22 @@ ADD_LIBRARY ( PyImath ${LIB_TYPE} PyImathVec4si.cpp ) -IF(BUILD_SHARED_LIBS) - target_compile_definitions( PyImath PRIVATE -DPYIMATH_EXPORTS ) +target_compile_definitions( PyImath PRIVATE -DPYIMATH_BUILD ) + +IF (WIN32) + target_compile_definitions( PyImath + PRIVATE OPENEXR_DLL) ENDIF() -target_compile_definitions( PyImath PRIVATE -DPYIMATH_BUILD ) +SET_ILMBASE_INCLUDE_DIRS( PyImath ) + TARGET_LINK_LIBRARIES ( PyImath - Iex${ILMBASE_LIBSUFFIX} - IexMath${ILMBASE_LIBSUFFIX} - Imath${ILMBASE_LIBSUFFIX} + IlmBase::Iex + IlmBase::IexMath + IlmBase::Imath + PyIex ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ) @@ -53,7 +58,7 @@ INSTALL ( TARGETS PyImath ) INSTALL (DIRECTORY ./ - DESTINATION include + DESTINATION include/OpenEXR FILES_MATCHING PATTERN "*.h" ) @@ -65,9 +70,9 @@ ADD_LIBRARY ( imathmodule ${LIB_TYPE} if (WIN32) SET_TARGET_PROPERTIES ( imathmodule - PROPERTIES + PROPERTIES PREFIX "" - OUTPUT_NAME "imath" + OUTPUT_NAME "imath" SUFFIX ".pyd" ) else() @@ -76,12 +81,15 @@ else() ) endif() +SET_ILMBASE_INCLUDE_DIRS( imathmodule ) + TARGET_LINK_LIBRARIES ( imathmodule PyImath PyIex - Imath${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} + IlmBase::Imath + IlmBase::Iex ${Boost_LIBRARIES} + ${PYTHON_LIBRARIES} ) INSTALL ( TARGETS imathmodule diff --git a/PyIlmBase/PyImath/PyImath.cpp b/PyIlmBase/PyImath/PyImath.cpp index 0f123d5ab6..318a14d409 100644 --- a/PyIlmBase/PyImath/PyImath.cpp +++ b/PyIlmBase/PyImath/PyImath.cpp @@ -32,9 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImath.h" #include -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImath.h b/PyIlmBase/PyImath/PyImath.h index 779ca6b976..43778eb864 100644 --- a/PyIlmBase/PyImath/PyImath.h +++ b/PyIlmBase/PyImath/PyImath.h @@ -37,10 +37,10 @@ #include #include -#include -#include -#include -#include +#include "PyImathFixedArray.h" +#include "PyImathFixedMatrix.h" +#include "PyImathFixedArray2D.h" +#include "PyImathFixedVArray.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathAutovectorize.cpp b/PyIlmBase/PyImath/PyImathAutovectorize.cpp index eeb7062f70..937305928d 100644 --- a/PyIlmBase/PyImath/PyImathAutovectorize.cpp +++ b/PyIlmBase/PyImath/PyImathAutovectorize.cpp @@ -32,7 +32,7 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathAutovectorize.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathAutovectorize.h b/PyIlmBase/PyImath/PyImathAutovectorize.h index 2702e79fac..e9df0b6240 100644 --- a/PyIlmBase/PyImath/PyImathAutovectorize.h +++ b/PyIlmBase/PyImath/PyImathAutovectorize.h @@ -56,9 +56,9 @@ #include #include #include -#include -#include -#include +#include "PyImathFixedArray.h" +#include "PyImathTask.h" +#include "PyImathUtil.h" #include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathBasicTypes.cpp b/PyIlmBase/PyImath/PyImathBasicTypes.cpp index 00daba8e7b..717f010a3e 100644 --- a/PyIlmBase/PyImath/PyImathBasicTypes.cpp +++ b/PyIlmBase/PyImath/PyImathBasicTypes.cpp @@ -32,13 +32,13 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathBasicTypes.h" #include #include -#include -#include -#include -#include +#include "PyImath.h" +#include "PyImathExport.h" +#include "PyImathFixedArray.h" +#include "PyImathFixedVArray.h" using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathBox.cpp b/PyIlmBase/PyImath/PyImathBox.cpp index a9d55e5ea8..baea0e8d0d 100644 --- a/PyIlmBase/PyImath/PyImathBox.cpp +++ b/PyIlmBase/PyImath/PyImathBox.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include "PyImathTask.h" #include #include "PyImathBoxArrayImpl.h" diff --git a/PyIlmBase/PyImath/PyImathBox.h b/PyIlmBase/PyImath/PyImathBox.h index 9d78b19aee..13683bc7dd 100644 --- a/PyIlmBase/PyImath/PyImathBox.h +++ b/PyIlmBase/PyImath/PyImathBox.h @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include "PyImathVec.h" +#include "PyImathFixedArray.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathBox2Array.cpp b/PyIlmBase/PyImath/PyImathBox2Array.cpp index fef39158f9..e9d6298a4b 100644 --- a/PyIlmBase/PyImath/PyImathBox2Array.cpp +++ b/PyIlmBase/PyImath/PyImathBox2Array.cpp @@ -33,8 +33,8 @@ /////////////////////////////////////////////////////////////////////////// -#include -#include +#include "PyImathBoxArrayImpl.h" +#include "PyImathExport.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathBox3Array.cpp b/PyIlmBase/PyImath/PyImathBox3Array.cpp index fc9ef4e24f..dd2801a2bd 100644 --- a/PyIlmBase/PyImath/PyImathBox3Array.cpp +++ b/PyIlmBase/PyImath/PyImathBox3Array.cpp @@ -32,8 +32,8 @@ // /////////////////////////////////////////////////////////////////////////// -#include -#include +#include "PyImathBoxArrayImpl.h" +#include "PyImathExport.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathBoxArrayImpl.h b/PyIlmBase/PyImath/PyImathBoxArrayImpl.h index 94486bf7b0..40cec2bd7f 100644 --- a/PyIlmBase/PyImath/PyImathBoxArrayImpl.h +++ b/PyIlmBase/PyImath/PyImathBoxArrayImpl.h @@ -41,20 +41,20 @@ // order to work around MSVC limitations. // -#include +#include "PyImathBox.h" #include "PyImathDecorators.h" #include #include #include #include -#include +#include "PyImath.h" #include #include #include #include -#include -#include -#include +#include "PyImathMathExc.h" +#include "PyImathOperators.h" +#include "PyImathVecOperators.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathColor.h b/PyIlmBase/PyImath/PyImathColor.h index 8d060e8dac..b8b0fc56b0 100644 --- a/PyIlmBase/PyImath/PyImathColor.h +++ b/PyIlmBase/PyImath/PyImathColor.h @@ -37,9 +37,8 @@ #include #include -#include +#include "PyImath.h" #include -#include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathColor3.cpp b/PyIlmBase/PyImath/PyImathColor3.cpp index 9c858f89db..e4322eb3b0 100644 --- a/PyIlmBase/PyImath/PyImathColor3.cpp +++ b/PyIlmBase/PyImath/PyImathColor3.cpp @@ -38,16 +38,16 @@ // order to work around MSVC limitations. // -#include -#include +#include "PyImathColor.h" +#include "PyImathVec.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h b/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h index 0fb35cde5b..c49ea569ee 100644 --- a/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h +++ b/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h @@ -46,9 +46,9 @@ #include #include #include -#include +#include "PyImath.h" #include -#include +#include "PyImathMathExc.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathColor4.cpp b/PyIlmBase/PyImath/PyImathColor4.cpp index 6e52642695..ca31af729d 100644 --- a/PyIlmBase/PyImath/PyImathColor4.cpp +++ b/PyIlmBase/PyImath/PyImathColor4.cpp @@ -32,15 +32,15 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathColor.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathColor4Array2DImpl.h b/PyIlmBase/PyImath/PyImathColor4Array2DImpl.h index 9641dfca9a..864313cdea 100644 --- a/PyIlmBase/PyImath/PyImathColor4Array2DImpl.h +++ b/PyIlmBase/PyImath/PyImathColor4Array2DImpl.h @@ -41,17 +41,14 @@ // order to work around MSVC limitations. // -// #include #include "PyImathDecorators.h" #include #include #include #include -#include -// #include -// #include +#include "PyImath.h" #include -#include +#include "PyImathMathExc.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathColor4ArrayImpl.h b/PyIlmBase/PyImath/PyImathColor4ArrayImpl.h index 08bb566a49..e1851342d6 100644 --- a/PyIlmBase/PyImath/PyImathColor4ArrayImpl.h +++ b/PyIlmBase/PyImath/PyImathColor4ArrayImpl.h @@ -46,9 +46,9 @@ #include #include #include -#include +#include "PyImath.h" #include -#include +#include "PyImathMathExc.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathEuler.cpp b/PyIlmBase/PyImath/PyImathEuler.cpp index e83d494ec4..b18cae32ad 100644 --- a/PyIlmBase/PyImath/PyImathEuler.cpp +++ b/PyIlmBase/PyImath/PyImathEuler.cpp @@ -32,18 +32,18 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathEuler.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" #include #include -#include +#include "PyImathOperators.h" // XXX incomplete array wrapping, docstrings missing diff --git a/PyIlmBase/PyImath/PyImathEuler.h b/PyIlmBase/PyImath/PyImathEuler.h index 104e20d8dc..d0ece04956 100644 --- a/PyIlmBase/PyImath/PyImathEuler.h +++ b/PyIlmBase/PyImath/PyImathEuler.h @@ -37,10 +37,9 @@ #include #include -#include +#include "PyImath.h" #include #include -#include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathFixedArray.cpp b/PyIlmBase/PyImath/PyImathFixedArray.cpp index 106a05fd6d..4b518e5268 100644 --- a/PyIlmBase/PyImath/PyImathFixedArray.cpp +++ b/PyIlmBase/PyImath/PyImathFixedArray.cpp @@ -33,7 +33,7 @@ /////////////////////////////////////////////////////////////////////////// #include "PyImathFixedArray.h" -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathFixedArray.h b/PyIlmBase/PyImath/PyImathFixedArray.h index 7a3d89d951..6a9d034abd 100644 --- a/PyIlmBase/PyImath/PyImathFixedArray.h +++ b/PyIlmBase/PyImath/PyImathFixedArray.h @@ -42,7 +42,7 @@ #include #include #include -#include +#include "PyImathUtil.h" #define PY_IMATH_LEAVE_PYTHON IEX_NAMESPACE::MathExcOn mathexcon (IEX_NAMESPACE::IEEE_OVERFLOW | \ IEX_NAMESPACE::IEEE_DIVZERO | \ diff --git a/PyIlmBase/PyImath/PyImathFixedVArray.cpp b/PyIlmBase/PyImath/PyImathFixedVArray.cpp index 7d827d86ed..5e2ecd981d 100644 --- a/PyIlmBase/PyImath/PyImathFixedVArray.cpp +++ b/PyIlmBase/PyImath/PyImathFixedVArray.cpp @@ -32,13 +32,13 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathFixedVArray.h" #include #include #include #include -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathFixedVArray.h b/PyIlmBase/PyImath/PyImathFixedVArray.h index 22c8aeecba..5910564cd3 100644 --- a/PyIlmBase/PyImath/PyImathFixedVArray.h +++ b/PyIlmBase/PyImath/PyImathFixedVArray.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include "PyImathFixedArray.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathFrustum.cpp b/PyIlmBase/PyImath/PyImathFrustum.cpp index d6b0674fb4..8897bdcdb0 100644 --- a/PyIlmBase/PyImath/PyImathFrustum.cpp +++ b/PyIlmBase/PyImath/PyImathFrustum.cpp @@ -32,15 +32,15 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathFrustum.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" +#include "PyImathVec.h" #include namespace PyImath{ diff --git a/PyIlmBase/PyImath/PyImathFrustum.h b/PyIlmBase/PyImath/PyImathFrustum.h index b28cff071e..d47e0928f9 100644 --- a/PyIlmBase/PyImath/PyImathFrustum.h +++ b/PyIlmBase/PyImath/PyImathFrustum.h @@ -37,10 +37,9 @@ #include #include -//#include #include #include -#include +#include "PyImath.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathFun.cpp b/PyIlmBase/PyImath/PyImathFun.cpp index a8086f1b16..6875c2110d 100644 --- a/PyIlmBase/PyImath/PyImathFun.cpp +++ b/PyIlmBase/PyImath/PyImathFun.cpp @@ -32,10 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include +#include "PyImathFun.h" +#include "PyImathDecorators.h" +#include "PyImathExport.h" +#include "PyImathAutovectorize.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathFun.h b/PyIlmBase/PyImath/PyImathFun.h index d2c4e65488..65ec062384 100644 --- a/PyIlmBase/PyImath/PyImathFun.h +++ b/PyIlmBase/PyImath/PyImathFun.h @@ -35,7 +35,7 @@ #ifndef _PyImathFun_h_ #define _PyImathFun_h_ -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathLine.cpp b/PyIlmBase/PyImath/PyImathLine.cpp index e7dfca50b8..b332d1ee6c 100644 --- a/PyIlmBase/PyImath/PyImathLine.cpp +++ b/PyIlmBase/PyImath/PyImathLine.cpp @@ -32,16 +32,16 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathLine.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathVec.h" +#include "PyImathMathExc.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathLine.h b/PyIlmBase/PyImath/PyImathLine.h index a40f6c8982..13eb40e33e 100644 --- a/PyIlmBase/PyImath/PyImathLine.h +++ b/PyIlmBase/PyImath/PyImathLine.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include "PyImath.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathM44Array.cpp b/PyIlmBase/PyImath/PyImathM44Array.cpp index 2050b4f3d0..1ee46e1da9 100644 --- a/PyIlmBase/PyImath/PyImathM44Array.cpp +++ b/PyIlmBase/PyImath/PyImathM44Array.cpp @@ -32,9 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// -#include -#include -#include +#include "PyImathM44Array.h" +#include "PyImathMatrix.h" +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathM44Array.h b/PyIlmBase/PyImath/PyImathM44Array.h index 78c3da0aad..36889b7425 100644 --- a/PyIlmBase/PyImath/PyImathM44Array.h +++ b/PyIlmBase/PyImath/PyImathM44Array.h @@ -37,7 +37,7 @@ #include #include -#include +#include "PyImathOperators.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathMatrix.h b/PyIlmBase/PyImath/PyImathMatrix.h index 639c3e6555..f7c61991ba 100644 --- a/PyIlmBase/PyImath/PyImathMatrix.h +++ b/PyIlmBase/PyImath/PyImathMatrix.h @@ -37,10 +37,9 @@ #include #include -#include +#include "PyImath.h" #include #include -#include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathMatrix33.cpp b/PyIlmBase/PyImath/PyImathMatrix33.cpp index 6b3c620530..e1e4412e16 100644 --- a/PyIlmBase/PyImath/PyImathMatrix33.cpp +++ b/PyIlmBase/PyImath/PyImathMatrix33.cpp @@ -34,7 +34,7 @@ #define BOOST_PYTHON_MAX_ARITY 17 -#include +#include "PyImathMatrix.h" #include "PyImathExport.h" #include "PyImathDecorators.h" #include @@ -44,9 +44,9 @@ #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathVec.h" +#include "PyImathMathExc.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathMatrix44.cpp b/PyIlmBase/PyImath/PyImathMatrix44.cpp index 62fee3cc95..edb66b1f9b 100644 --- a/PyIlmBase/PyImath/PyImathMatrix44.cpp +++ b/PyIlmBase/PyImath/PyImathMatrix44.cpp @@ -34,7 +34,7 @@ #define BOOST_PYTHON_MAX_ARITY 17 -#include +#include "PyImathMatrix.h" #include "PyImathExport.h" #include "PyImathDecorators.h" #include @@ -44,13 +44,13 @@ #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathVec.h" +#include "PyImathMathExc.h" #include #include #include -#include +#include "PyImathTask.h" namespace PyImath { template<> const char PYIMATH_EXPORT *PyImath::M44fArray::name() { return "M44fArray"; } diff --git a/PyIlmBase/PyImath/PyImathOperators.h b/PyIlmBase/PyImath/PyImathOperators.h index 06467be923..85915ba730 100644 --- a/PyIlmBase/PyImath/PyImathOperators.h +++ b/PyIlmBase/PyImath/PyImathOperators.h @@ -35,8 +35,8 @@ #ifndef _PyImathOperators_h_ #define _PyImathOperators_h_ -#include -#include +#include "PyImathFixedArray.h" +#include "PyImathAutovectorize.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathPlane.cpp b/PyIlmBase/PyImath/PyImathPlane.cpp index a31f24594e..d382ba20cf 100644 --- a/PyIlmBase/PyImath/PyImathPlane.cpp +++ b/PyIlmBase/PyImath/PyImathPlane.cpp @@ -33,16 +33,16 @@ /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathPlane.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathVec.h" +#include "PyImathMathExc.h" #include namespace PyImath{ diff --git a/PyIlmBase/PyImath/PyImathPlane.h b/PyIlmBase/PyImath/PyImathPlane.h index a8b905d2bc..21a3d75cf8 100644 --- a/PyIlmBase/PyImath/PyImathPlane.h +++ b/PyIlmBase/PyImath/PyImathPlane.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include "PyImath.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathQuat.cpp b/PyIlmBase/PyImath/PyImathQuat.cpp index 5425d95f06..e1e70c1e26 100644 --- a/PyIlmBase/PyImath/PyImathQuat.cpp +++ b/PyIlmBase/PyImath/PyImathQuat.cpp @@ -33,19 +33,19 @@ /////////////////////////////////////////////////////////////////////////// -#include -#include +#include "PyImathQuat.h" +#include "PyImathExport.h" #include "PyImathDecorators.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" #include #include #include -#include +#include "PyImathOperators.h" // XXX incomplete array wrapping, docstrings missing diff --git a/PyIlmBase/PyImath/PyImathQuat.h b/PyIlmBase/PyImath/PyImathQuat.h index e693b8d3ae..b63a7c7033 100644 --- a/PyIlmBase/PyImath/PyImathQuat.h +++ b/PyIlmBase/PyImath/PyImathQuat.h @@ -37,10 +37,9 @@ #include #include -#include +#include "PyImath.h" #include #include -#include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathRandom.cpp b/PyIlmBase/PyImath/PyImathRandom.cpp index 8056b5980a..e28423e1fc 100644 --- a/PyIlmBase/PyImath/PyImathRandom.cpp +++ b/PyIlmBase/PyImath/PyImathRandom.cpp @@ -33,15 +33,15 @@ /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathRandom.h" #include "PyImathDecorators.h" #include #include #include #include -#include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" +#include "PyImathFixedArray.h" namespace PyImath{ diff --git a/PyIlmBase/PyImath/PyImathShear.cpp b/PyIlmBase/PyImath/PyImathShear.cpp index c9969b8dda..c809e0c8cb 100644 --- a/PyIlmBase/PyImath/PyImathShear.cpp +++ b/PyIlmBase/PyImath/PyImathShear.cpp @@ -33,17 +33,17 @@ /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathShear.h" -#include +#include "PyImathPlane.h" #include "PyImathDecorators.h" #include "PyImathExport.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathMathExc.h" #include diff --git a/PyIlmBase/PyImath/PyImathStringArray.cpp b/PyIlmBase/PyImath/PyImathStringArray.cpp index 5ba8af79d2..63662023a0 100644 --- a/PyIlmBase/PyImath/PyImathStringArray.cpp +++ b/PyIlmBase/PyImath/PyImathStringArray.cpp @@ -32,9 +32,9 @@ // /////////////////////////////////////////////////////////////////////////// -#include -#include -#include +#include "PyImathStringArrayRegister.h" +#include "PyImathStringArray.h" +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathStringArray.h b/PyIlmBase/PyImath/PyImathStringArray.h index 6ce7d11b03..89d3ce9862 100644 --- a/PyIlmBase/PyImath/PyImathStringArray.h +++ b/PyIlmBase/PyImath/PyImathStringArray.h @@ -35,8 +35,8 @@ #ifndef _PyImathStringArray_h_ #define _PyImathStringArray_h_ -#include -#include +#include "PyImathFixedArray.h" +#include "PyImathStringTable.h" // // A fixed lengy array class for string and wide string type in python. diff --git a/PyIlmBase/PyImath/PyImathStringArrayRegister.h b/PyIlmBase/PyImath/PyImathStringArrayRegister.h index 588668ec97..123ed8ab90 100644 --- a/PyIlmBase/PyImath/PyImathStringArrayRegister.h +++ b/PyIlmBase/PyImath/PyImathStringArrayRegister.h @@ -35,7 +35,7 @@ #ifndef _PyImathStringArrayRegister_h_ #define _PyImathStringArrayRegister_h_ -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathStringTable.cpp b/PyIlmBase/PyImath/PyImathStringTable.cpp index 1cc29ce158..38543f4bb8 100644 --- a/PyIlmBase/PyImath/PyImathStringTable.cpp +++ b/PyIlmBase/PyImath/PyImathStringTable.cpp @@ -32,10 +32,10 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathStringTable.h" #include #include -#include +#include "PyImathExport.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathTask.cpp b/PyIlmBase/PyImath/PyImathTask.cpp index 08ca7c82e2..538c393ba4 100644 --- a/PyIlmBase/PyImath/PyImathTask.cpp +++ b/PyIlmBase/PyImath/PyImathTask.cpp @@ -32,7 +32,7 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathTask.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathTask.h b/PyIlmBase/PyImath/PyImathTask.h index 5cd7d07e1a..88dedea509 100644 --- a/PyIlmBase/PyImath/PyImathTask.h +++ b/PyIlmBase/PyImath/PyImathTask.h @@ -35,7 +35,7 @@ #ifndef _PyImathTask_h_ #define _PyImathTask_h_ -#include +#include "PyImathExport.h" #include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathUtil.cpp b/PyIlmBase/PyImath/PyImathUtil.cpp index dc105173a5..b2c0aa6951 100644 --- a/PyIlmBase/PyImath/PyImathUtil.cpp +++ b/PyIlmBase/PyImath/PyImathUtil.cpp @@ -32,7 +32,7 @@ // /////////////////////////////////////////////////////////////////////////// -#include +#include "PyImathUtil.h" #include #include #include diff --git a/PyIlmBase/PyImath/PyImathUtil.h b/PyIlmBase/PyImath/PyImathUtil.h index 6435216ed2..24b42da020 100644 --- a/PyIlmBase/PyImath/PyImathUtil.h +++ b/PyIlmBase/PyImath/PyImathUtil.h @@ -43,7 +43,7 @@ // //---------------------------------------------------------------------------- -#include +#include "PyImathExport.h" #include namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathVec.h b/PyIlmBase/PyImath/PyImathVec.h index d4467a67a1..6096e0affe 100644 --- a/PyIlmBase/PyImath/PyImathVec.h +++ b/PyIlmBase/PyImath/PyImathVec.h @@ -37,9 +37,9 @@ #include #include -#include +#include "PyImath.h" #include -#include +#include "PyImathFixedArray.h" namespace PyImath { diff --git a/PyIlmBase/PyImath/PyImathVec2Impl.h b/PyIlmBase/PyImath/PyImathVec2Impl.h index be41275da4..1e9aa39fae 100644 --- a/PyIlmBase/PyImath/PyImathVec2Impl.h +++ b/PyIlmBase/PyImath/PyImathVec2Impl.h @@ -41,21 +41,21 @@ // order to work around MSVC limitations. // -#include +#include "PyImathVec.h" #include "PyImathDecorators.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathBox.h" #include #include #include -#include +#include "PyImathMathExc.h" #include -#include -#include +#include "PyImathOperators.h" +#include "PyImathVecOperators.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathVec3ArrayImpl.h b/PyIlmBase/PyImath/PyImathVec3ArrayImpl.h index 179b5ee569..d00a586a82 100644 --- a/PyIlmBase/PyImath/PyImathVec3ArrayImpl.h +++ b/PyIlmBase/PyImath/PyImathVec3ArrayImpl.h @@ -41,20 +41,20 @@ // order to work around MSVC limitations. // -#include +#include "PyImathVec.h" #include "PyImathDecorators.h" #include #include #include #include -#include -#include +#include "PyImath.h" +#include "PyImathBox.h" #include #include #include -#include -#include -#include +#include "PyImathMathExc.h" +#include "PyImathOperators.h" +#include "PyImathVecOperators.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathVec3Impl.h b/PyIlmBase/PyImath/PyImathVec3Impl.h index d87fb9d179..be198a0e92 100644 --- a/PyIlmBase/PyImath/PyImathVec3Impl.h +++ b/PyIlmBase/PyImath/PyImathVec3Impl.h @@ -41,17 +41,17 @@ // order to work around MSVC limitations. // -#include +#include "PyImathVec.h" #include "PyImathDecorators.h" #include #include #include #include -#include +#include "PyImath.h" #include #include #include -#include +#include "PyImathMathExc.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathVec4ArrayImpl.h b/PyIlmBase/PyImath/PyImathVec4ArrayImpl.h index 5047b1baf4..eb3270fa34 100644 --- a/PyIlmBase/PyImath/PyImathVec4ArrayImpl.h +++ b/PyIlmBase/PyImath/PyImathVec4ArrayImpl.h @@ -41,19 +41,19 @@ // order to work around MSVC limitations. // -#include +#include "PyImathVec.h" #include "PyImathDecorators.h" #include #include #include #include -#include +#include "PyImath.h" #include #include #include -#include -#include -#include +#include "PyImathMathExc.h" +#include "PyImathOperators.h" +#include "PyImathVecOperators.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/PyImathVec4Impl.h b/PyIlmBase/PyImath/PyImathVec4Impl.h index 4d7bb91cf3..4f1bd4471c 100644 --- a/PyIlmBase/PyImath/PyImathVec4Impl.h +++ b/PyIlmBase/PyImath/PyImathVec4Impl.h @@ -41,17 +41,17 @@ // order to work around MSVC limitations. // -#include +#include "PyImathVec.h" #include "PyImathDecorators.h" #include #include #include #include -#include +#include "PyImath.h" #include #include #include -#include +#include "PyImathMathExc.h" namespace PyImath { using namespace boost::python; diff --git a/PyIlmBase/PyImath/imathmodule.cpp b/PyIlmBase/PyImath/imathmodule.cpp index fbcbf128aa..92675dad92 100644 --- a/PyIlmBase/PyImath/imathmodule.cpp +++ b/PyIlmBase/PyImath/imathmodule.cpp @@ -43,25 +43,25 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "PyImathFixedArray.h" +#include "PyImath.h" +#include "PyImathExport.h" +#include "PyImathBasicTypes.h" +#include "PyImathVec.h" +#include "PyImathMatrix.h" +#include "PyImathBox.h" +#include "PyImathFun.h" +#include "PyImathQuat.h" +#include "PyImathEuler.h" +#include "PyImathColor.h" +#include "PyImathFrustum.h" +#include "PyImathPlane.h" +#include "PyImathLine.h" +#include "PyImathRandom.h" +#include "PyImathShear.h" +#include "PyImathMathExc.h" +#include "PyImathAutovectorize.h" +#include "PyImathStringArrayRegister.h" #include using namespace boost::python; diff --git a/PyIlmBase/PyImathNumpy/CMakeLists.txt b/PyIlmBase/PyImathNumpy/CMakeLists.txt index 1dc74dc014..6e213bcf8b 100644 --- a/PyIlmBase/PyImathNumpy/CMakeLists.txt +++ b/PyIlmBase/PyImathNumpy/CMakeLists.txt @@ -19,12 +19,13 @@ ENDIF () INCLUDE_DIRECTORIES ( ${NUMPY_INCLUDE_DIRS} ) +SET_ILMBASE_INCLUDE_DIRS( imathnumpymodule ) TARGET_LINK_LIBRARIES ( imathnumpymodule PyImath PyIex - Imath${ILMBASE_LIBSUFFIX} - Iex${ILMBASE_LIBSUFFIX} + IlmBase::Imath + IlmBase::Iex ${Boost_LIBRARIES} ) diff --git a/README.md b/README.md index ed0678da24..027aa52148 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,58 @@ Please see the README files of each of the individual directories for more infor A collection of OpenEXR images is available from the adjacent repository [openexr-images](https://github.com/openexr/openexr-images). + +## Building with CMake + +To build with CMake, OpenEXR has a few prerequisites. + +* CMake 3.11 or newer +* zlib +* boost-python (if the python bindings are to be built) +* fltk (if the openexr viewer is to be built) +* Cg (if playexr is to be built) + +When these prerequisites are fulfulled, prepare the build environment. + +In the root CMakeLists.txt file, or using a tools such as ccmake or cmake-gui, +configure the OpenEXR build. The options are detailed below. + +Create a build directory, cd into it, and run cmake to configure the build. +Select an appropriate generator, such as "Unix Makefiles", or "Visual Studio 15 2017 Win64". + +```` +cmake -DCMAKE_INSTALL_PREFIX= -G "selected generator" -DCMAKE_PREFIX_PATH= +```` + + +The available options are: + +* OPENEXR_BUILD_ILMBASE (ON) +By default, IlmBase is always built. + +* OPENEXR_BUILD_OPENEXR (ON) +By default, OpenEXR is always built. + +* OPENEXR_BUILD_PYTHON_LIBS (ON) +By default, the Python bindings will be built. + +* OPENEXR_BUILD_VIEWERS (OFF) +By default, the viewers are not built, as they have not been updated for +modern OpenGL. + +* OPENEXR_BUILD_SHARED (ON) +* OPENEXR_BUILD_STATIC (OFF) +The build can be configured to create either shared libraries, or static +libraries, or both. + +* OPENEXR_NAMESPACE_VERSIONING (ON) +OpenEXR symbols will be contained within a namespace + +* OPENEXR_FORCE_CXX03 (OFF) +C++03 compatibility is possible as an option + +* OPENEXR_ENABLE_TESTS (ON) +By default, the tests will be built. + +* OPENEXR_PYTHON_MAJOR, OPENEXR_PYTHON_MINOR "2", "7" +By default, OpenEXR is built against Python 2.7.x.