diff --git a/CMakeLists.txt b/CMakeLists.txt index 1610c2e..b012008 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,25 +31,17 @@ # Author : Nicholas Yue yue.nicholas@gmail.com -CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.17 ) PROJECT ( field3d ) set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ) FIND_PACKAGE (Doxygen) -FIND_PACKAGE (HDF5 COMPONENTS C) -IF ( CMAKE_HOST_WIN32 ) -# f3dinfo relies on program_options but don't include it, since -# for some reason, unlike all the other boost components, a link is -# forced via a pragma. -FIND_PACKAGE (Boost COMPONENTS regex thread) -ELSE () -FIND_PACKAGE (Boost COMPONENTS regex thread program_options system) -FIND_PACKAGE (MPI) -ENDIF () +FIND_PACKAGE (HDF5 COMPONENTS C REQUIRED) +FIND_PACKAGE (Boost COMPONENTS regex thread program_options system REQUIRED) -FIND_PACKAGE (ILMBase) +FIND_PACKAGE (OpenEXR REQUIRED) # Allow the developer to select if Dynamic or Static libraries are built OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) @@ -79,26 +71,14 @@ IF ( CMAKE_HOST_UNIX ) ENDIF ( ) IF ( CMAKE_HOST_WIN32 ) ADD_DEFINITIONS ( - -D_HAS_ITERATOR_DEBUGGING=0 -D_CRT_SECURE_NO_WARNINGS=1 ) ENDIF ( ) SET ( LIB_TYPE SHARED ) IF ( NOT BUILD_SHARED_LIBS ) - IF ( CMAKE_HOST_WIN32 ) - # User wants to build static libraries, so change the LIB_TYPE variable to CMake keyword 'STATIC' SET ( LIB_TYPE STATIC ) ADD_DEFINITIONS( -DFIELD3D_STATIC ) - ENDIF() -ELSE () - IF ( CMAKE_HOST_WIN32 ) - ADD_DEFINITIONS ( - -DOPENEXR_DLL - -D_HDF5USEDLL_ - -DHDF5CPP_USEDLL - ) - ENDIF() ENDIF ( NOT BUILD_SHARED_LIBS ) ADD_LIBRARY ( Field3D ${LIB_TYPE} @@ -147,24 +128,22 @@ IF ( CMAKE_HOST_UNIX ) ${MPI_LIBRARIES} ) ENDIF ( MPI_FOUND ) LIST ( APPEND Field3D_Libraries_Shared - Iex Half IlmThread Imath pthread dl z ) SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} ) SET ( Field3D_BIN_Libraries Field3D ${Field3D_Libraries_Shared} ${Boost_LIBRARIES} ) ENDIF ( ) IF ( CMAKE_HOST_WIN32 ) - # Add OpenEXR and zlib release/debug - FOREACH ( lib Iex Half IlmThread Imath zdll ) + FOREACH ( lib zlib ) LIST ( APPEND Field3D_Libraries_Shared optimized ${lib} - debug ${lib}_d ) + debug ${lib}d ) ENDFOREACH() SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} Shlwapi.lib) SET ( Field3D_BIN_Libraries Field3D ${Boost_LIBRARIES} ) ENDIF () -TARGET_LINK_LIBRARIES ( Field3D ${Field3D_DSO_Libraries} ${Boost_LIBRARIES}) +TARGET_LINK_LIBRARIES ( Field3D ${Field3D_DSO_Libraries} ${Boost_LIBRARIES} OpenEXR::IlmImf) # Parase version and soversion from export/ns.h @@ -214,33 +193,7 @@ ADD_EXECUTABLE ( f3dinfo TARGET_LINK_LIBRARIES ( f3dinfo ${Field3D_BIN_Libraries} ) -# field3d - sparse_field_io -ADD_EXECUTABLE ( sparse_field_io - apps/sample_code/sparse_field_io/main.cpp - ) - -TARGET_LINK_LIBRARIES ( sparse_field_io ${Field3D_BIN_Libraries} ) - -# field3d - read -ADD_EXECUTABLE ( read - apps/sample_code/read/main.cpp - ) -TARGET_LINK_LIBRARIES ( read ${Field3D_BIN_Libraries} ) - -# field3d - mixed_types -ADD_EXECUTABLE ( mixed_types - apps/sample_code/mixed_types/main.cpp - ) - -TARGET_LINK_LIBRARIES ( mixed_types ${Field3D_BIN_Libraries} ) - -# field3d - create_and_write -ADD_EXECUTABLE ( create_and_write - apps/sample_code/create_and_write/main.cpp - ) - -TARGET_LINK_LIBRARIES ( create_and_write ${Field3D_BIN_Libraries} ) IF (DOXYGEN_FOUND) ADD_CUSTOM_TARGET ( doc @@ -249,7 +202,7 @@ IF (DOXYGEN_FOUND) WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY} ) IF (INSTALL_DOCS) - INSTALL (DIRECTORY + INSTALL (DIRECTORY ${CMAKE_HOME_DIRECTORY}/docs DESTINATION ${CMAKE_INSTALL_PREFIX} ) @@ -263,12 +216,11 @@ INSTALL ( TARGETS FILE(GLOB Field3d_Includes "${CMAKE_CURRENT_SOURCE_DIR}/export/*.h") -INSTALL ( FILES - ${Field3d_Includes} +INSTALL ( FILES + ${Field3d_Includes} DESTINATION include/Field3D ) -INSTALL ( TARGETS f3dinfo +INSTALL ( TARGETS f3dinfo RUNTIME DESTINATION bin ) -