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

Build: fix over-eager use of targets #3108

Merged
merged 1 commit into from
Sep 28, 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
5 changes: 3 additions & 2 deletions src/build-scripts/build_webp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
WEBP_SRC_DIR=${WEBP_SRC_DIR:=${LOCAL_DEPS_DIR}/webp}
WEBP_BUILD_DIR=${WEBP_BUILD_DIR:=${WEBP_SRC_DIR}/build}
WEBP_INSTALL_DIR=${WEBP_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
WEBP_BUILD_TYPE=${WEBP_BUILD_TYPE:=${CMAKE_BUILD_TYPE:-Release}}
#WEBP_CONFIG_OPTS=${WEBP_CONFIG_OPTS:=}

pwd
Expand All @@ -40,7 +41,7 @@ mkdir -p ${WEBP_BUILD_DIR}
cd ${WEBP_BUILD_DIR}

if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
time cmake -DCMAKE_BUILD_TYPE=${WEBP_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${WEBP_INSTALL_DIR} \
-DWEBP_BUILD_ANIM_UTILS=OFF \
-DWEBP_BUILD_CWEBP=OFF \
Expand All @@ -51,7 +52,7 @@ if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
-DWEBP_BUILD_EXTRAS=OFF \
-DBUILD_SHARED_LIBS=ON \
${WEBP_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
time cmake --build . --target install
fi


Expand Down
5 changes: 1 addition & 4 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ endif ()
checked_find_package (Freetype
DEFINITIONS -DUSE_FREETYPE=1 )

checked_find_package (HDF5
ISDEPOF Field3D)
checked_find_package (OpenColorIO
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1
# PREFER_CONFIG
Expand All @@ -179,8 +177,7 @@ checked_find_package (TBB 2017
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
checked_find_package (FFmpeg VERSION_MIN 3.0)
checked_find_package (Field3D
DEPS HDF5
DEFINITIONS -DUSE_FIELD3D=1)
DEFINITIONS -DUSE_FIELD3D=1)
checked_find_package (GIF
VERSION_MIN 4
RECOMMEND_MIN 5.0
Expand Down
35 changes: 27 additions & 8 deletions src/cmake/modules/FindLibsquish.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
# LIBSQUISH_VERSION Version of Libsquish (e.g., 3.6.2)

include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)

find_path (LIBSQUISH_INCLUDE_DIR squish.h
HINTS
${LIBSQUISH_INCLUDE_PATH}
ENV LIBSQUISH_INCLUDE_PATH
DOC "The directory where Libsquish headers reside")

find_library (LIBSQUISH_LIBRARY squish
HINTS
${LIBSQUISH_LIBRARY_PATH}
ENV LIBSQUISH_LIBRARY_PATH
DOC "The Libsquish libraries")
find_library (LIBSQUISH_LIBRARY_RELEASE squish
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
find_library (LIBSQUISH_LIBRARY_DEBUG squishd
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
select_library_configurations(LIBSQUISH)

find_package_handle_standard_args (Libsquish
REQUIRED_VARS
Expand All @@ -32,15 +33,33 @@ find_package_handle_standard_args (Libsquish

if (Libsquish_FOUND)
set (LIBSQUISH_INCLUDES ${LIBSQUISH_INCLUDE_DIR})
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
if (NOT LIBSQUISH_LIBRARIES)
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
endif ()

if (NOT TARGET Libsquish::Libsquish)
add_library(Libsquish::Libsquish UNKNOWN IMPORTED)
set_target_properties(Libsquish::Libsquish PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBSQUISH_INCLUDES}")

set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_LOCATION "${LIBSQUISH_LIBRARIES}")
if (LIBSQUISH_LIBRARY_RELEASE)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_RELEASE "${LIBSQUISH_LIBRARY_RELEASE}")
endif ()

if (LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_DEBUG "${LIBSQUISH_LIBRARY_DEBUG}")
endif ()

if (NOT LIBSQUISH_LIBRARY_RELEASE AND NOT LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_LOCATION "${LIBSQUISH_LIBRARY}")
endif ()
endif ()
endif ()

Expand Down
3 changes: 2 additions & 1 deletion src/dds.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
if (Libsquish_FOUND)
# External libsquish was found -- use it
add_oiio_plugin (ddsinput.cpp
LINK_LIBRARIES Libsquish::Libsquish
INCLUDE_DIRS ${LIBSQUISH_INCLUDES}
LINK_LIBRARIES ${LIBSQUISH_LIBRARIES}
)
else ()
# No external libsquish was found -- use the embedded version.
Expand Down
3 changes: 2 additions & 1 deletion src/field3d.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md

if (Field3D_FOUND)
# checked_find_package (HDF5)
find_library (SZIP_LIBRARY NAMES sz)
if (NOT SZIP_LIBRARY)
set (SZIP_LIBRARY "")
endif ()
add_oiio_plugin (field3dinput.cpp field3doutput.cpp
INCLUDE_DIRS ${FIELD3D_INCLUDES}
LINK_LIBRARIES Field3D::Field3D
LINK_LIBRARIES ${FIELD3D_LIBRARIES}
# ${HDF5_LIBRARIES}
${SZIP_LIBRARY})
endif()
3 changes: 2 additions & 1 deletion src/heif.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

if (Libheif_FOUND)
add_oiio_plugin (heifinput.cpp heifoutput.cpp
LINK_LIBRARIES Libheif::Libheif
INCLUDE_DIRS ${LIBHEIF_INCLUDES}
LINK_LIBRARIES ${LIBHEIF_LIBRARIES}
DEFINITIONS "-DUSE_HEIF=1")
else ()
message (WARNING "heif plugin will not be built")
Expand Down
5 changes: 3 additions & 2 deletions src/openvdb.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

if (OpenVDB_FOUND)
add_oiio_plugin (openvdbinput.cpp
INCLUDE_DIRS ${TBB_INCLUDE_DIRS}
LINK_LIBRARIES OpenVDB::OpenVDB ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES})
INCLUDE_DIRS ${OPENVDB_INCLUDES} ${TBB_INCLUDE_DIRS}
LINK_LIBRARIES ${OPENVDB_LIBRARIES}
${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES})
endif()
3 changes: 2 additions & 1 deletion src/webp.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

if (WebP_FOUND)
add_oiio_plugin (webpinput.cpp webpoutput.cpp
LINK_LIBRARIES WebP::WebP WebP::WebPDemux
INCLUDE_DIRS ${WEBP_INCLUDES}
LINK_LIBRARIES ${WEBP_LIBRARIES}
DEFINITIONS "-DUSE_WEBP=1")
else ()
message (STATUS "WebP plugin will not be built")
Expand Down