Skip to content

Commit

Permalink
IlmImfUtil now builds on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
meshula authored and nickrasmussen committed Aug 8, 2018
1 parent c7a7322 commit 55c3f5f
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 82 deletions.
22 changes: 2 additions & 20 deletions IlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ 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)

# Allow the developer to select if Dynamic or Static libraries are built
# Enable namespace versioning
OPTION (NAMESPACE_VERSIONING "Namespace Versioning" ON)

OPTION (FORCE_CXX03 "Force CXX03" OFF)
Expand Down Expand Up @@ -104,15 +105,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)

SET (LIB_TYPE STATIC)
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)

IF (WIN32)
SET (RUNTIME_DIR bin)
ELSE ()
Expand Down Expand Up @@ -182,16 +174,6 @@ IF (NAMESPACE_VERSIONING)
SET ( ILMBASE_LIBSUFFIX "-${ILMBASE_VERSION_API}" )
ENDIF ()

SET (ILMBASE_LIBRARY_NAMES Half Iex Imath IlmThread IexMath)
FOREACH (LIBNAME ${ILMBASE_LIBRARY_NAMES})
SET_TARGET_PROPERTIES ( ${LIBNAME}
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "${LIBNAME}${ILMBASE_LIBSUFFIX}"
)
ENDFOREACH()

IF ( NOT WIN32 )
CREATE_LIBTOOL_FILE ( Half /lib )
CREATE_LIBTOOL_FILE ( Iex /lib )
Expand Down
71 changes: 52 additions & 19 deletions IlmBase/Half/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,62 @@ SET_SOURCE_FILES_PROPERTIES(
"${CMAKE_CURRENT_BINARY_DIR}/eLut.h;${CMAKE_CURRENT_BINARY_DIR}/toFloat.h"
)

IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DHALF_EXPORTS)
ENDIF()
SET (ILMBASE_LIB_TARGETS "")

ADD_LIBRARY ( Half ${LIB_TYPE}
half.cpp
)
IF (BUILD_SHARED_LIBS)
LIST ( APPEND ILMBASE_LIB_TARGETS Half )

ADD_LIBRARY ( Half SHARED
half.cpp
)

ADD_DEPENDENCIES ( Half toFloat eLut )
TARGET_COMPILE_DEFINITIONS ( Half PRIVATE HALF_EXPORTS )
IF (WIN32)
TARGET_COMPILE_DEFINITIONS ( Half PUBLIC OPENEXR_DLL )
ENDIF ()

INSTALL ( TARGETS
Half
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)
SET_TARGET_PROPERTIES ( Half
PROPERTIES
VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}
SOVERSION ${ILMBASE_VERSION_MAJOR}
OUTPUT_NAME "Half${ILMBASE_LIBSUFFIX}"
)

ADD_DEPENDENCIES ( Half toFloat eLut )
ENDIF ()

IF (BUILD_STATIC_LIBS)
LIST ( APPEND ILMBASE_LIB_TARGETS Half_static )

ADD_LIBRARY ( Half_static STATIC
half.cpp
)

SET_TARGET_PROPERTIES ( Half_static
PROPERTIES
VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}
OUTPUT_NAME "Half${ILMBASE_LIBSUFFIX}_s"
)

ADD_DEPENDENCIES ( Half_static toFloat eLut )
ENDIF ()

IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS)
INSTALL ( TARGETS
${ILMBASE_LIB_TARGETS}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)
ENDIF ()

INSTALL (
FILES
half.h
halfFunction.h
halfExport.h
halfLimits.h

INSTALL ( FILES
half.h
halfFunction.h
halfExport.h
halfLimits.h
DESTINATION
include/OpenEXR
include/OpenEXR
)
116 changes: 73 additions & 43 deletions IlmBase/Imath/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# [email protected]

IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DIMATH_EXPORTS)
ENDIF()
SET (ILMBASE_LIB_TARGETS "")

ADD_LIBRARY ( Imath ${LIB_TYPE}
SET ( IMATH_SOURCES
ImathBox.cpp
ImathRandom.cpp
ImathColorAlgo.cpp
Expand All @@ -13,51 +11,83 @@ ADD_LIBRARY ( Imath ${LIB_TYPE}
ImathVec.cpp
ImathMatrixAlgo.cpp
)
TARGET_LINK_LIBRARIES(Imath Iex)

IF ( BUILD_SHARED_LIBS )
LIST ( APPEND ILMBASE_LIB_TARGETS Imath )

INSTALL ( TARGETS
Imath
ADD_LIBRARY ( Imath SHARED ${IMATH_SOURCES} )

TARGET_COMPILE_DEFINITIONS ( Imath PRIVATE IMATH_EXPORTS )
IF (WIN32)
TARGET_COMPILE_DEFINITIONS ( Imath PUBLIC OPENEXR_DLL )
ENDIF ()

TARGET_LINK_LIBRARIES(Imath Iex)
SET_TARGET_PROPERTIES ( Imath
PROPERTIES
VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}
SOVERSION ${ILMBASE_VERSION_MAJOR}
OUTPUT_NAME "Imath${ILMBASE_LIBSUFFIX}"
)
ENDIF ()

IF (BUILD_STATIC_LIBS)
LIST ( APPEND ILMBASE_LIB_TARGETS Imath_static )

ADD_LIBRARY ( Imath_static STATIC ${IMATH_SOURCES} )

SET_TARGET_PROPERTIES ( Imath_static
PROPERTIES
VERSION ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}
OUTPUT_NAME "Imath${ILMBASE_LIBSUFFIX}_s"
)
ENDIF ()

IF (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS)
INSTALL ( TARGETS ${ILMBASE_LIB_TARGETS}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)
)
ENDIF ()

INSTALL (
FILES
ImathBoxAlgo.h
ImathBox.h
ImathColorAlgo.h
ImathColor.h
ImathEuler.h
ImathExc.h
ImathExport.h
ImathForward.h
ImathFrame.h
ImathFrustum.h
ImathFrustumTest.h
ImathFun.h
ImathGL.h
ImathGLU.h
ImathHalfLimits.h
ImathInt64.h
ImathInterval.h
ImathLimits.h
ImathLineAlgo.h
ImathLine.h
ImathMath.h
ImathMatrixAlgo.h
ImathMatrix.h
ImathNamespace.h
ImathPlane.h
ImathPlatform.h
ImathQuat.h
ImathRandom.h
ImathRoots.h
ImathShear.h
ImathSphere.h
ImathVecAlgo.h
ImathVec.h

INSTALL ( FILES
ImathBoxAlgo.h
ImathBox.h
ImathColorAlgo.h
ImathColor.h
ImathEuler.h
ImathExc.h
ImathExport.h
ImathForward.h
ImathFrame.h
ImathFrustum.h
ImathFrustumTest.h
ImathFun.h
ImathGL.h
ImathGLU.h
ImathHalfLimits.h
ImathInt64.h
ImathInterval.h
ImathLimits.h
ImathLineAlgo.h
ImathLine.h
ImathMath.h
ImathMatrixAlgo.h
ImathMatrix.h
ImathNamespace.h
ImathPlane.h
ImathPlatform.h
ImathQuat.h
ImathRandom.h
ImathRoots.h
ImathShear.h
ImathSphere.h
ImathVecAlgo.h
ImathVec.h
DESTINATION
include/OpenEXR
include/OpenEXR
)

0 comments on commit 55c3f5f

Please sign in to comment.