Add hidapi project. Don't cache _DEPENDs macros, so depenendcies are only set when externalprojects are added.

pull/1261/head
srcejon 2022-05-26 21:33:11 +01:00
rodzic 60a114b7b8
commit b734c70543
1 zmienionych plików z 35 dodań i 14 usunięć

Wyświetl plik

@ -208,6 +208,8 @@ else()
set(USE_PRECOMPILED_LIBS TRUE)
endif()
# We don't CACHE for _DEPENDS variable, as the external project is only added when NOT _FOUND
if (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS)
# Cloning git repo doesn't include configure, so we download the bz2 which does
ExternalProject_Add(libusb
@ -218,7 +220,7 @@ if (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(libusb install_dir)
set(LIBUSB_DEPENDS libusb CACHE INTERNAL "")
set(LIBUSB_DEPENDS libusb)
set(LIBUSB_FOUND ON CACHE INTERNAL "")
set(LIBUSB_EXTERNAL ON CACHE INTERNAL "")
set(LIBUSB_INCLUDE_DIR "${install_dir}/include/libusb-1.0" CACHE INTERNAL "")
@ -232,6 +234,25 @@ if (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS)
endif ()
endif (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS)
if (NOT HIDAPI_FOUND AND NOT USE_PRECOMPILED_LIBS)
ExternalProject_Add(hidapi
GIT_REPOSITORY https://github.com/libusb/hidapi.git
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/hidapi"
CMAKE_ARGS ${COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
TEST_COMMAND ""
)
ExternalProject_Get_Property(hidapi install_dir)
set(HIDAPI_DEPENDS hidapi)
set(HIDAPI_FOUND ON CACHE INTERNAL "")
set(HIDAPI_EXTERNAL ON CACHE INTERNAL "")
set(HIDAPI_ROOT_DIR "${install_dir}" CACHE INTERNAL "")
set(HIDAPI_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "")
if (APPLE)
set(HIDAPI_LIBRARIES "${install_dir}/lib/libhidapi${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${install_dir}/lib")
endif ()
endif (NOT HIDAPI_FOUND AND NOT USE_PRECOMPILED_LIBS)
if (NOT OPUS_FOUND AND NOT USE_PRECOMPILED_LIBS)
ExternalProject_Add(opus
GIT_REPOSITORY https://github.com/xiph/opus
@ -241,7 +262,7 @@ if (NOT OPUS_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(opus install_dir)
set(OPUS_DEPENDS opus CACHE INTERNAL "")
set(OPUS_DEPENDS opus)
set(OPUS_FOUND ON CACHE INTERNAL "")
set(OPUS_EXTERNAL ON CACHE INTERNAL "")
set(OPUS_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "")
@ -264,7 +285,7 @@ if (NOT ZLIB_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(zlib install_dir)
set(ZLIB_DEPENDS zlib CACHE INTERNAL "")
set(ZLIB_DEPENDS zlib)
set(ZLIB_FOUND ON CACHE INTERNAL "")
set(ZLIB_EXTERNAL ON CACHE INTERNAL "")
set(ZLIB_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "")
@ -286,7 +307,7 @@ if (NOT FAAD_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(faad source_dir binary_dir install_dir)
set(FAAD_DEPENDS faad CACHE INTERNAL "")
set(FAAD_DEPENDS faad)
set(FAAD_FOUND ON CACHE INTERNAL "")
set(FAAD_EXTERNAL ON CACHE INTERNAL "")
set(FAAD_INCLUDE_DIR "${install_dir}/include" CACHE INTERNAL "")
@ -310,7 +331,7 @@ if (NOT FFTW3F_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(fftw3f source_dir binary_dir)
set(FFTW3F_DEPENDS fftw3f CACHE INTERNAL "")
set(FFTW3F_DEPENDS fftw3f)
set(FFTW3F_FOUND ON CACHE INTERNAL "")
set(FFTW3F_EXTERNAL ON CACHE INTERNAL "")
set(FFTW3F_INCLUDE_DIRS "${source_dir}/api" "${binary_dir}" CACHE INTERNAL "")
@ -393,7 +414,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(x264 install_dir)
set(X264_DEPENDS x264 CACHE INTERNAL "")
set(X264_DEPENDS x264)
set(X264_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig")
set(X264_FOUND ON CACHE INTERNAL "")
set(X264_EXTERNAL ON CACHE INTERNAL "")
@ -411,7 +432,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(x265 install_dir)
set(X265_DEPENDS x265 CACHE INTERNAL "")
set(X265_DEPENDS x265)
set(X265_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig")
set(X265_FOUND ON CACHE INTERNAL "")
set(X265_EXTERNAL ON CACHE INTERNAL "")
@ -428,7 +449,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(fdk_aac install_dir)
set(FDK_AAC_DEPENDS fdk_aac CACHE INTERNAL "")
set(FDK_AAC_DEPENDS fdk_aac)
set(FDK_AAC_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig")
set(FDK_AAC_FOUND ON CACHE INTERNAL "")
set(FDK_AAC_EXTERNAL ON CACHE INTERNAL "")
@ -447,7 +468,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(mpg123 install_dir)
set(MPG123_DEPENDS mpg123 CACHE INTERNAL "")
set(MPG123_DEPENDS mpg123)
set(MPG123_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig")
set(MPG123_FOUND ON CACHE INTERNAL "")
set(MPG123_EXTERNAL ON CACHE INTERNAL "")
@ -467,7 +488,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(lame install_dir)
set(LAME_DEPENDS lame CACHE INTERNAL "")
set(LAME_DEPENDS lame)
# ffmpeg doesn't try to use pkg-config for lame, as it doesn't include a .pc file
#set(LAME_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig")
set(LAME_EXTRA_CFLAGS "-I${install_dir}/include")
@ -491,7 +512,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(ffmpeg install_dir)
set(FFMPEG_DEPENDS ffmpeg CACHE INTERNAL "")
set(FFMPEG_DEPENDS ffmpeg)
set(FFMPEG_INSTALL_DIR "${install_dir}")
set(FFMPEG_FOUND ON CACHE INTERNAL "")
set(FFMPEG_EXTERNAL ON CACHE INTERNAL "")
@ -523,7 +544,7 @@ if (NOT OpenCV_FOUND AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(opencv source_dir binary_dir)
set(OpenCV_DEPENDS opencv CACHE INTERNAL "")
set(OpenCV_DEPENDS opencv)
set(OpenCV_FOUND ON CACHE INTERNAL "")
set(OpenCV_EXTERNAL ON CACHE INTERNAL "")
set(OpenCV_INCLUDE_DIRS
@ -578,7 +599,7 @@ if ((NOT CODEC2_FOUND OR CODEC2_EXTERNAL) AND NOT USE_PRECOMPILED_LIBS)
TEST_COMMAND ""
)
ExternalProject_Get_Property(codec2 source_dir binary_dir)
set(CODEC2_DEPENDS codec2 CACHE INTERNAL "")
set(CODEC2_DEPENDS codec2)
set(CODEC2_FOUND ON CACHE INTERNAL "")
set(CODEC2_EXTERNAL ON CACHE INTERNAL "")
set(CODEC2_INCLUDE_DIR "${source_dir}/src" "${binary_dir}" CACHE INTERNAL "")
@ -619,7 +640,7 @@ if (NOT CM256CC_FOUND OR CM256CC_EXTERNAL)
TEST_COMMAND ""
)
ExternalProject_Get_Property(cm256cc source_dir binary_dir)
set(CM256CC_DEPENDS cm256cc CACHE INTERNAL "")
set(CM256CC_DEPENDS cm256cc)
set(CM256CC_FOUND ON CACHE INTERNAL "")
set(CM256CC_EXTERNAL ON CACHE INTERNAL "")
# we need cm256cc/library.h