2012-08-25 04:31:49 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# CMake file for openexr
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
project(openexr CXX)
|
|
|
|
|
2019-06-11 01:04:23 +08:00
|
|
|
|
|
|
|
if(NOT HAVE_CXX11)
|
|
|
|
ocv_check_compiler_flag(CXX "-std=c++11" HAVE_STD_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
|
|
|
|
if(HAVE_STD_CXX11)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
2017-08-14 22:19:51 +08:00
|
|
|
else()
|
2019-06-11 01:04:23 +08:00
|
|
|
if(BUILD_OPENEXR)
|
|
|
|
message(WARNING "OpenCV: builtin OpenEXR requires C++11 support. OpenEXR is disabled.")
|
|
|
|
endif()
|
|
|
|
return()
|
2017-08-14 22:19:51 +08:00
|
|
|
endif()
|
2012-08-25 04:31:49 +08:00
|
|
|
endif()
|
|
|
|
|
2019-06-11 01:04:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
set(ILMBASE_VERSION_MAJOR "2")
|
|
|
|
set(ILMBASE_VERSION_MINOR "3")
|
|
|
|
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})
|
|
|
|
|
|
|
|
set(OPENEXR_VERSION_MAJOR "2")
|
|
|
|
set(OPENEXR_VERSION_MINOR "3")
|
|
|
|
set(OPENEXR_VERSION_PATCH "0")
|
|
|
|
|
|
|
|
set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH}")
|
|
|
|
set(OPENEXR_VERSION_API ${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
|
|
|
|
|
|
|
|
set(OPENEXR_VERSION "${OPENEXR_VERSION}" PARENT_SCOPE)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(HAVE_COMPLETE_IOMANIP 1)
|
|
|
|
set(OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1)
|
|
|
|
set(PLATFORM_WINDOWS 1)
|
|
|
|
elseif(APPLE)
|
|
|
|
set(HAVE_POSIX_SEMAPHORES 0) # Unnamed semaphores are not supported: https://github.com/opencv/opencv/issues/9361
|
|
|
|
if(DARWIN)
|
|
|
|
set(OPENEXR_IMF_HAVE_DARWIN 1)
|
|
|
|
endif()
|
|
|
|
elseif(UNIX)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
check_include_file(semaphore.h HAVE_POSIX_SEMAPHORES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ILMBASE_VERSION_API "opencv")
|
|
|
|
set(ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1)
|
|
|
|
set(IMATH_INTERNAL_NAMESPACE "Imath_${ILMBASE_VERSION_API}")
|
|
|
|
set(IEX_INTERNAL_NAMESPACE "Iex_${ILMBASE_VERSION_API}")
|
|
|
|
set(ILMTHREAD_INTERNAL_NAMESPACE "IlmThread_${ILMBASE_VERSION_API}")
|
|
|
|
|
|
|
|
set(ILMBASE_NAMESPACE_CUSTOM 0)
|
|
|
|
set(IMATH_NAMESPACE "Imath")
|
|
|
|
set(IEX_NAMESPACE "Iex")
|
|
|
|
set(ILMTHREAD_NAMESPACE "IlmThread")
|
|
|
|
set(ILMBASE_VERSION_STRING "\"${ILMBASE_VERSION}\"" )
|
|
|
|
set(ILMBASE_PACKAGE_STRING "\"IlmBase ${ILMBASE_VERSION}\"" )
|
|
|
|
|
|
|
|
|
|
|
|
set(OPENEXR_VERSION_API "opencv")
|
|
|
|
set(OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 1)
|
|
|
|
set(OPENEXR_IMF_INTERNAL_NAMESPACE "Imf_${ILMBASE_VERSION_API}")
|
|
|
|
set(OPENEXR_IMF_NAMESPACE_CUSTOM 0)
|
|
|
|
set(OPENEXR_IMF_NAMESPACE "Imf")
|
|
|
|
|
|
|
|
set(OPENEXR_VERSION_STRING "\"${OPENEXR_VERSION}\"" )
|
|
|
|
set(OPENEXR_PACKAGE_STRING "\"OpenEXR ${OPENEXR_VERSION}\"" )
|
|
|
|
|
|
|
|
|
2012-08-25 04:31:49 +08:00
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/IlmBaseConfig.h.cmakein"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" @ONLY)
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenEXRConfig.h.cmakein"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h" @ONLY)
|
2012-09-03 19:58:30 +08:00
|
|
|
|
2012-08-25 04:31:49 +08:00
|
|
|
set(OPENEXR_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Half"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Iex"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/IlmThread"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Imath"
|
2019-06-11 01:04:23 +08:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/IlmImf"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}")
|
2012-08-25 04:31:49 +08:00
|
|
|
|
2013-08-22 22:04:50 +08:00
|
|
|
ocv_include_directories("${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS} ${OPENEXR_INCLUDE_PATHS})
|
2012-08-25 04:31:49 +08:00
|
|
|
|
|
|
|
file(GLOB lib_srcs Half/half.cpp Iex/*.cpp IlmThread/*.cpp Imath/*.cpp IlmImf/*.cpp)
|
|
|
|
file(GLOB lib_hdrs Half/*.h Iex/Iex*.h IlmThread/IlmThread*.h Imath/Imath*.h IlmImf/*.h)
|
|
|
|
list(APPEND lib_hdrs "${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" "${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h")
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
ocv_list_filterout(lib_srcs Posix.*cpp)
|
|
|
|
else()
|
|
|
|
ocv_list_filterout(lib_srcs Win32.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
source_group("Include" FILES ${lib_hdrs} )
|
|
|
|
source_group("Src" FILES ${lib_srcs})
|
|
|
|
|
2016-11-17 23:41:39 +08:00
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra
|
2017-10-18 18:06:23 +08:00
|
|
|
-Wdeprecated-declarations -Wmisleading-indentation -Wdeprecated
|
2018-03-15 21:04:21 +08:00
|
|
|
-Wsuggest-override -Winconsistent-missing-override
|
2018-04-20 00:54:03 +08:00
|
|
|
-Wimplicit-fallthrough
|
2019-06-11 01:04:23 +08:00
|
|
|
-Wtautological-compare # clang
|
|
|
|
-Wmissing-prototypes # gcc/clang
|
|
|
|
-Wreorder
|
|
|
|
-Wunused-result
|
2016-11-17 23:41:39 +08:00
|
|
|
)
|
2018-07-16 20:34:59 +08:00
|
|
|
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
|
|
|
|
endif()
|
|
|
|
|
2012-08-25 21:12:17 +08:00
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267) # vs2008 Win64
|
2015-10-16 22:10:00 +08:00
|
|
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456) # vs2015
|
2012-08-25 04:31:49 +08:00
|
|
|
|
2016-12-01 21:41:21 +08:00
|
|
|
if(MSVC AND CV_ICC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qrestrict")
|
|
|
|
endif()
|
|
|
|
|
2012-08-25 04:31:49 +08:00
|
|
|
add_library(IlmImf STATIC ${lib_hdrs} ${lib_srcs})
|
|
|
|
target_link_libraries(IlmImf ${ZLIB_LIBRARIES})
|
|
|
|
|
|
|
|
set_target_properties(IlmImf
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "IlmImf"
|
|
|
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
2015-08-17 08:28:22 +08:00
|
|
|
COMPILE_PDB_NAME "IlmImf"
|
|
|
|
COMPILE_PDB_NAME_DEBUG "IlmImf${OPENCV_DEBUG_POSTFIX}"
|
2012-08-25 04:31:49 +08:00
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_SOLUTION_FOLDERS)
|
|
|
|
set_target_properties(IlmImf PROPERTIES FOLDER "3rdparty")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2014-01-17 20:30:31 +08:00
|
|
|
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
2012-08-25 04:31:49 +08:00
|
|
|
endif()
|
|
|
|
|
2019-06-11 01:04:23 +08:00
|
|
|
ocv_install_3rdparty_licenses(openexr LICENSE AUTHORS.ilmbase AUTHORS.openexr)
|
2018-02-27 02:10:21 +08:00
|
|
|
|
2012-08-25 04:31:49 +08:00
|
|
|
set(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATHS} PARENT_SCOPE)
|