Allow a more granular selection of third party library builds

This commit is contained in:
huelj 2022-05-25 14:10:30 -04:00 committed by GitHub
parent 5292728740
commit 7488c39fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View File

@ -285,6 +285,13 @@ if(BUILD_CODEC)
# OFF: It will only build 3rd party libs if they are not found on the system # OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used # ON: 3rd party libs will ALWAYS be build, and used
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF) option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
# More granualar dependency build selection
option(BUILD_THIRDPARTY_ZLIB "Build the thirdparty Z lib if it is needed" OFF)
option(BUILD_THIRDPARTY_PNG "Build the thirdparty PNG if it is needed" OFF)
option(BUILD_THIRDPARTY_TIFF "Build the thirdparty TIFF lib if it is needed" OFF)
option(BUILD_THIRDPARTY_LCMS2 "Build the thirdparty LCMS2 if it is needed" OFF)
add_subdirectory(thirdparty) add_subdirectory(thirdparty)
add_subdirectory(src/bin) add_subdirectory(src/bin)
endif () endif ()

View File

@ -6,14 +6,14 @@ endif(NOT BUILD_THIRDPARTY)
#------------ #------------
# Try to find lib Z # Try to find lib Z
if(BUILD_THIRDPARTY) if(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_ZLIB)
# Try to build it # Try to build it
message(STATUS "We will build Z lib from thirdparty") message(STATUS "We will build Z lib from thirdparty")
add_subdirectory(libz) add_subdirectory(libz)
set(Z_LIBNAME z PARENT_SCOPE) set(Z_LIBNAME z PARENT_SCOPE)
set(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE) set(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
set(ZLIB_FOUND 1) set(ZLIB_FOUND 1)
else(BUILD_THIRDPARTY) else(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_ZLIB)
# Try to find lib Z # Try to find lib Z
find_package(ZLIB) find_package(ZLIB)
if(ZLIB_FOUND) if(ZLIB_FOUND)
@ -24,12 +24,12 @@ else(BUILD_THIRDPARTY)
else(ZLIB_FOUND) # not found else(ZLIB_FOUND) # not found
message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)") message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
endif(BUILD_THIRDPARTY) endif(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_ZLIB)
#------------ #------------
# Try to find lib PNG (which depends on zlib) # Try to find lib PNG (which depends on zlib)
if(BUILD_THIRDPARTY) if(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_PNG)
# Try to build it # Try to build it
message(STATUS "We will build PNG lib from thirdparty") message(STATUS "We will build PNG lib from thirdparty")
add_subdirectory(libpng) add_subdirectory(libpng)
@ -37,7 +37,7 @@ if(BUILD_THIRDPARTY)
set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE) set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
set(PNG_LIBNAME png PARENT_SCOPE) set(PNG_LIBNAME png PARENT_SCOPE)
set(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE) set(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
else(BUILD_THIRDPARTY) else(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_PNG)
if(ZLIB_FOUND) if(ZLIB_FOUND)
find_package(PNG) find_package(PNG)
# Static only build: # Static only build:
@ -55,12 +55,12 @@ else(BUILD_THIRDPARTY)
message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it") message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
endif(PNG_FOUND) endif(PNG_FOUND)
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
endif(BUILD_THIRDPARTY) endif(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_PNG)
#------------ #------------
# Try to find lib TIFF # Try to find lib TIFF
if(BUILD_THIRDPARTY) if(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_TIFF)
# Try to build it # Try to build it
message(STATUS "We will build TIFF lib from thirdparty") message(STATUS "We will build TIFF lib from thirdparty")
add_subdirectory(libtiff) add_subdirectory(libtiff)
@ -71,7 +71,7 @@ if(BUILD_THIRDPARTY)
PARENT_SCOPE) PARENT_SCOPE)
set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE) set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE) set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
else(BUILD_THIRDPARTY) else(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_TIFF)
find_package(TIFF) find_package(TIFF)
# Static only build: # Static only build:
# it is necessary to invoke pkg_check_module on libtiff since it may have # it is necessary to invoke pkg_check_module on libtiff since it may have
@ -96,14 +96,14 @@ else(BUILD_THIRDPARTY)
set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE) set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it") message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
endif(TIFF_FOUND) endif(TIFF_FOUND)
endif(BUILD_THIRDPARTY) endif(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_TIFF)
#------------ #------------
# Try to find lib LCMS2 (or by default LCMS) # Try to find lib LCMS2 (or by default LCMS)
set(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE) set(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE)
set(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE) set(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE)
if( BUILD_THIRDPARTY) if( BUILD_THIRDPARTY OR BUILD_THIRDPARTY_LCMS2)
# Try to build lcms2 # Try to build lcms2
message(STATUS "We will build LCMS2 lib from thirdparty") message(STATUS "We will build LCMS2 lib from thirdparty")
add_subdirectory(liblcms2) add_subdirectory(liblcms2)
@ -111,7 +111,7 @@ if( BUILD_THIRDPARTY)
set(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) # set(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE) set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE) set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
else(BUILD_THIRDPARTY) else(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_LCMS2)
find_package(LCMS2) find_package(LCMS2)
# Static only build: # Static only build:
# it is necessary to invoke pkg_check_module on lcms2 since it may have # it is necessary to invoke pkg_check_module on lcms2 since it may have
@ -141,7 +141,7 @@ else(BUILD_THIRDPARTY)
message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it") message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
endif(LCMS_FOUND) endif(LCMS_FOUND)
endif(LCMS2_FOUND) endif(LCMS2_FOUND)
endif(BUILD_THIRDPARTY) endif(BUILD_THIRDPARTY OR BUILD_THIRDPARTY_LCMS2)
#------------ #------------