Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: fix MrSID support #4783

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions cmake/modules/packages/FindMRSID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ configure
find_path(MRSID_INCLUDE_DIR NAMES lt_base.h)

if( MRSID_INCLUDE_DIR )
find_library( MRSID_LIBRARY_LTI NAMES lti_dsdk ltidsdk)
find_library( MRSID_LIBRARY_LTI_LIDAR NAMES lti_lidar_dsdk)
if(MRSID_LIBRARY_LTI AND MRSID_LIBRARY_LTI_LIDAR)
set(MRSID_LIBRARIES ${MRSID_LIBRARY_LTI} ${MRSID_LIBRARY_LTI_LIDAR} CACHE PATH "")
endif()
find_library( MRSID_LIBRARY NAMES lti_dsdk ltidsdk)
endif()

if(MRSID_INCLUDE_DIR AND MRSID_LIBRARIES)
if(MRSID_INCLUDE_DIR AND MRSID_LIBRARY)
set(MAJOR_VERSION 0)
set(MINOR_VERSION 0)
set(SRV_VERSION 0)
Expand All @@ -50,29 +46,21 @@ if(MRSID_INCLUDE_DIR AND MRSID_LIBRARIES)
endif()
set(MRSID_VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${REV_VERSION}")
endif()
mark_as_advanced(MRSID_INCLUDE_DIR MRSID_LIBRARY_LTI MRSID_LIBRARY_LTI_LIDAR MRSID_VERSION_STRING)
mark_as_advanced(MRSID_INCLUDE_DIR MRSID_LIBRARY MRSID_VERSION_STRING)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MRSID FOUND_VAR MRSID_FOUND
REQUIRED_VARS MRSID_LIBRARY_LTI MRSID_LIBRARY_LTI_LIDAR MRSID_INCLUDE_DIR
REQUIRED_VARS MRSID_LIBRARY MRSID_INCLUDE_DIR
VERSION_VAR MRSID_VERSION_STRING)

# Copy the results to the output variables.
if(MRSID_FOUND)
set(MRSID_LIBRARY ${MRSID_LIBRARIES})
set(MRSID_LIBRARIES ${MRSID_LIBRARY})
set(MRSID_INCLUDE_DIRS ${MRSID_INCLUDE_DIR})
if(NOT TARGET MRSID::MRSID)
add_library(MRSID::MRSID UNKNOWN IMPORTED)
set_target_properties(MRSID::MRSID PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MRSID_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${MRSID_LIBRARY_LTI}")
endif()
if(NOT TARGET MRSID::LIDAR)
add_library(MRSID::LIDAR UNKNOWN IMPORTED)
set_target_properties(MRSID::LIDAR PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MRSID_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${MRSID_LIBRARY_LTI_LIDAR}")
IMPORTED_LOCATION "${MRSID_LIBRARY}")
endif()
endif()
17 changes: 17 additions & 0 deletions doc/source/build_hints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ Can be detected with pkg-config.
Path to a shared or static library file.


MRSID
*****

MRSID_ROOT or CMAKE_PREFIX_PATH should point to the directory of the SDK ending with
Raster_DSDK. Note that on Linux, its lib subdirectory should be in the
LD_LIBRARY_PATH so that the linking of applications succeeds and libtbb.so can
be found.

.. option:: MRSID_INCLUDE_DIR

Path to the include directory with the ``lt_base.h`` header file.

.. option:: MRSID_LIBRARY

Path to library file libltidsdk


PROJ
****

Expand Down
2 changes: 1 addition & 1 deletion frmts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ gdal_dependent_format(jp2lura JP2LURA "HAVE_LURA")
gdal_dependent_format(sde "ESRI ArcSDE Raster" "HAVE_SDE")
# LizardTech's decoding software development kit (DSDK)
gdal_dependent_format(mrsid "Multi-resolution Seamless Image Database" "HAVE_MRSID")
gdal_dependent_format(mrsid_lidar "Multi-resolution Seamless Image Database - LiDAR support" "HAVE_MRSID")
# gdal_dependent_format(mrsid_lidar "Multi-resolution Seamless Image Database - LiDAR support" "HAVE_MRSID")
gdal_dependent_format(georaster "Oracle Spatial GeoRaster" "HAVE_ORACLE")
gdal_dependent_format(ecw "ERDAS JPEG2000 (.jp2)" "HAVE_ECW")

Expand Down
14 changes: 7 additions & 7 deletions frmts/mrsid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
add_gdal_driver(TARGET gdal_MRSID SOURCES mrsidstream.h mrsidstream.cpp mrsiddataset.cpp)
gdal_standard_includes(gdal_MRSID)
gdal_target_link_libraries(TARGET gdal_MRSID LIBRARIES MRSID::MRSID)
add_gdal_driver(TARGET gdal_MrSID SOURCES mrsidstream.h mrsidstream.cpp mrsiddataset.cpp PLUGIN_CAPABLE_IF
"NOT GDAL_USE_LIBGEOTIFF_INTERNAL")
gdal_standard_includes(gdal_MrSID)
gdal_target_link_libraries(TARGET gdal_MrSID LIBRARIES MRSID::MRSID)
if (GDAL_USE_LIBGEOTIFF_INTERNAL)
if (RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS)
target_compile_definitions(gdal_MRSID PRIVATE -DRENAME_INTERNAL_LIBGEOTIFF_SYMBOLS)
target_compile_definitions(gdal_MrSID PRIVATE -DRENAME_INTERNAL_LIBGEOTIFF_SYMBOLS)
endif ()
target_include_directories(gdal_MRSID PRIVATE $<TARGET_PROPERTY:geotiff,SOURCE_DIR>)
target_include_directories(gdal_MrSID PRIVATE $<TARGET_PROPERTY:geotiff,SOURCE_DIR>)
else ()
target_include_directories(gdal_MRSID PRIVATE ${GEOTIFF_INCLUDE_DIR})
gdal_target_link_libraries(TARGET gdal_MRSID LIBRARIES GEOTIFF::GEOTIFF)
gdal_target_link_libraries(TARGET gdal_MrSID LIBRARIES GEOTIFF::GEOTIFF)
endif ()