Skip to content

Commit

Permalink
Cmake now building OpenEXR successfully for 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 965c1eb commit ac055a9
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 48 deletions.
57 changes: 27 additions & 30 deletions IlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ IF (BUILD_SHARED_LIBS)
ENDIF ()
ENDIF (BUILD_SHARED_LIBS)

IF (WIN32)
SET (RUNTIME_DIR bin)
ELSE ()
SET (RUNTIME_DIR lib)
ENDIF ()

ADD_SUBDIRECTORY ( Half )
ADD_SUBDIRECTORY ( Iex )
Expand Down Expand Up @@ -158,35 +163,26 @@ IF (NAMESPACE_VERSIONING)
SET ( ILMBASE_LIBSUFFIX "-${ILMBASE_VERSION_API}" )
ENDIF ()

SET_TARGET_PROPERTIES ( Half
PROPERTIES
VERSION 12.0.0
SOVERSION 12
)
SET_TARGET_PROPERTIES ( Iex
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "Iex${ILMBASE_LIBSUFFIX}"
)
SET_TARGET_PROPERTIES ( Imath
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "Imath${ILMBASE_LIBSUFFIX}"
)
SET_TARGET_PROPERTIES ( IlmThread
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "IlmThread${ILMBASE_LIBSUFFIX}"
)
SET_TARGET_PROPERTIES ( IexMath
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "IexMath${ILMBASE_LIBSUFFIX}"
)
SET (ILMBASE_LIBRARY_NAMES Half Iex Imath IlmThread IexMath)
FOREACH (LIBNAME ${ILMBASE_LIBRARY_NAMES})
IF (LIBNAME STREQUAL "Half")
SET(LIBNAMESUFFIX ${LIBNAME})
ELSE()
SET(LIBNAMESUFFIX ${LIBNAME}${ILMBASE_LIBSUFFIX})
ENDIF()
SET_TARGET_PROPERTIES ( ${LIBNAME}
PROPERTIES
VERSION 12.0.0
SOVERSION 12
OUTPUT_NAME "${LIBNAMESUFFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${RUNTIME_DIR}"
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${RUNTIME_DIR}"
)
ENDFOREACH()

IF ( NOT WIN32 )
CREATE_LIBTOOL_FILE ( Half /lib )
Expand All @@ -196,6 +192,7 @@ IF ( NOT WIN32 )
CREATE_LIBTOOL_FILE ( IlmThread /lib )
ENDIF ()


# Tests

ADD_SUBDIRECTORY ( HalfTest )
Expand All @@ -208,7 +205,6 @@ INSTALL ( FILES
${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h
DESTINATION
include/OpenEXR

)

FILE ( WRITE ${CMAKE_BINARY_DIR}/IlmBase.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" )
Expand All @@ -229,3 +225,4 @@ INSTALL ( FILES
DESTINATION
lib/pkgconfig
)

7 changes: 4 additions & 3 deletions IlmBase/Half/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ ADD_LIBRARY ( Half ${LIB_TYPE}
ADD_DEPENDENCIES ( Half toFloat eLut )

INSTALL ( TARGETS
Half
DESTINATION
lib
HALF
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)

INSTALL ( FILES
Expand Down
5 changes: 5 additions & 0 deletions IlmBase/HalfTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ ADD_EXECUTABLE ( HalfTest

TARGET_LINK_LIBRARIES ( HalfTest Half )

INSTALL ( TARGETS
HalfTest
RUNTIME DESTINATION bin
)

ADD_TEST ( TestHalf HalfTest )
6 changes: 3 additions & 3 deletions IlmBase/Iex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ADD_LIBRARY ( Iex ${LIB_TYPE}
IexThrowErrnoExc.cpp
)


INSTALL ( TARGETS
Iex
DESTINATION
lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)

INSTALL ( FILES
Expand Down
5 changes: 3 additions & 2 deletions IlmBase/IexMath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ TARGET_LINK_LIBRARIES(IexMath Iex)

INSTALL ( TARGETS
IexMath
DESTINATION
lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)

INSTALL ( FILES
Expand Down
5 changes: 5 additions & 0 deletions IlmBase/IexTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ ADD_EXECUTABLE ( IexTest

TARGET_LINK_LIBRARIES ( IexTest Iex )

INSTALL ( TARGETS
IexTest
RUNTIME DESTINATION bin
)

ADD_TEST ( TestIex IexTest )
5 changes: 3 additions & 2 deletions IlmBase/IlmThread/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ TARGET_LINK_LIBRARIES(IlmThread Iex)

INSTALL ( TARGETS
IlmThread
DESTINATION
lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)

INSTALL ( FILES
Expand Down
6 changes: 4 additions & 2 deletions IlmBase/Imath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ TARGET_LINK_LIBRARIES(Imath Iex)

INSTALL ( TARGETS
Imath
DESTINATION
lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)


INSTALL ( FILES
ImathBoxAlgo.h
ImathBox.h
Expand Down
6 changes: 6 additions & 0 deletions IlmBase/ImathTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ ADD_EXECUTABLE ( ImathTest
testVec.cpp
)

INSTALL ( TARGETS
ImathTest
RUNTIME DESTINATION bin
)


ADD_TEST ( TestImath ImathTest )
TARGET_LINK_LIBRARIES ( ImathTest Imath Iex )

6 changes: 6 additions & 0 deletions OpenEXR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ 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
Expand Down
17 changes: 13 additions & 4 deletions OpenEXR/IlmImf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

SET(CMAKE_INCLUDE_CURRENT_DIR 1)

IF (WIN32)
SET(RUNTIME_DIR ${ILMBASE_PACKAGE_PREFIX}/bin)
ELSE ()
SET(RUNTIME_DIR ${ILMBASE_PACKAGE_PREFIX}/lib)
ENDIF ()

ADD_EXECUTABLE ( b44ExpLogTable
b44ExpLogTable.cpp
)
Expand All @@ -17,7 +23,7 @@ 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
DEPENDS b44ExpLogTable
WORKING_DIRECTORY ${ILMBASE_PACKAGE_PREFIX}/lib
WORKING_DIRECTORY ${RUNTIME_DIR}
)

ADD_EXECUTABLE ( dwaLookups
Expand All @@ -34,9 +40,10 @@ TARGET_LINK_LIBRARIES ( dwaLookups

ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
COMMAND echo "${RUNTIME_DIR}"
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dwaLookups > ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
DEPENDS dwaLookups
WORKING_DIRECTORY ${ILMBASE_PACKAGE_PREFIX}/lib
WORKING_DIRECTORY ${RUNTIME_DIR}
)

SET ( ILMIMF_SRCS
Expand Down Expand Up @@ -169,10 +176,12 @@ SET_SOURCE_FILES_PROPERTIES (

INSTALL ( TARGETS
IlmImf
DESTINATION
${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)


# Headers
INSTALL ( FILES
ImfForward.h
Expand Down
5 changes: 3 additions & 2 deletions OpenEXR/IlmImfUtil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ TARGET_LINK_LIBRARIES ( IlmImfUtil

INSTALL ( TARGETS
IlmImfUtil
DESTINATION
${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${RUNTIME_DIR}
)

# Headers
Expand Down

0 comments on commit ac055a9

Please sign in to comment.