diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f002b5..dd9b1df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,6 @@ option(K4A_BUILD_DOCS "Build K4A doxygen documentation" OFF) option(K4A_MTE_VERSION "Skip FW version check" OFF) option(K4A_SOURCE_LINK "Enable source linking on MSVC" OFF) -include(GitCommands) - # Set the project version include(K4AProjectVersion) @@ -101,7 +99,59 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL endif() # Find all dependencies -add_subdirectory(extern) +find_package(azure_c_shared_utility CONFIG REQUIRED) +add_library(azure::aziotsharedutil ALIAS aziotsharedutil) + +find_package(cJSON CONFIG REQUIRED) +add_library(cJSON::cJSON ALIAS cjson) + +find_package(EBML CONFIG REQUIRED) +add_library(ebml::ebml ALIAS EBML::ebml) + +find_package(libjpeg-turbo CONFIG REQUIRED) +if(TARGET libjpeg-turbo::turbojpeg) + add_library(libjpeg-turbo::libjpeg-turbo ALIAS libjpeg-turbo::turbojpeg) +else() + add_library(libjpeg-turbo::libjpeg-turbo ALIAS libjpeg-turbo::turbojpeg-static) +endif() + +find_package(libsoundio CONFIG REQUIRED) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0) +add_library(LibUSB::LibUSB ALIAS PkgConfig::libusb) + +if(NOT WIN32) + find_package(libuvc CONFIG REQUIRED) + if(TARGET LibUVC::UVCShared) + add_library(libuvc::libuvc ALIAS LibUVC::UVCShared) + else() + add_library(libuvc::libuvc ALIAS LibUVC::UVCStatic) + endif() +endif() + +find_package(libyuv CONFIG REQUIRED) +add_library(libyuv::libyuv ALIAS yuv) + +find_package(Matroska CONFIG REQUIRED) +add_library(matroska::matroska ALIAS Matroska::matroska) +add_definitions(-DMATROSKA_VERSION=2) + +find_package(spdlog CONFIG REQUIRED) + +if (BUILD_TOOLS) + find_package(gl3w CONFIG REQUIRED) + + find_package(glfw3 CONFIG REQUIRED) + add_library(glfw::glfw ALIAS glfw) + + find_package(imgui CONFIG REQUIRED) +endif() + +# Fix embl error +if (MSVC) + add_compile_options(/wd4828 /wd4251 /wd4275) +endif() # Don't enable testing until after building dependencies enable_testing() @@ -161,10 +211,13 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") endif() endif() -add_subdirectory(examples) -add_subdirectory(src) -add_subdirectory(tests) -add_subdirectory(tools) +if (BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + add_subdirectory(src) +if (BUILD_TOOLS) + add_subdirectory(tools) +endif() if (K4A_BUILD_DOCS) find_package(Doxygen 1.8.14 EXACT) diff --git a/src/calibration/calibration.c b/src/calibration/calibration.c index bf5f34a..d37c4e6 100644 --- a/src/calibration/calibration.c +++ b/src/calibration/calibration.c @@ -6,7 +6,7 @@ // Dependent libraries #include -#include +#include #include //cJSON.h need this set correctly. // System dependencies diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp index 05264c5..41185de 100644 --- a/src/logging/logging.cpp +++ b/src/logging/logging.cpp @@ -24,6 +24,9 @@ #pragma warning(disable : 4702) #endif #include +#include +#include +#include #ifdef _MSC_VER #pragma warning(default : 4702) #endif diff --git a/src/usbcommand/usb_cmd_priv.h b/src/usbcommand/usb_cmd_priv.h index 0aa502c..0405b58 100644 --- a/src/usbcommand/usb_cmd_priv.h +++ b/src/usbcommand/usb_cmd_priv.h @@ -20,7 +20,7 @@ #include // Exteranl dependencis -#include +#include // Ensure we have LIBUSB_API_VERSION defined if not defined by libusb.h #ifndef LIBUSB_API_VERSION diff --git a/tools/k4aviewer/CMakeLists.txt b/tools/k4aviewer/CMakeLists.txt index 98578c0..244c867 100644 --- a/tools/k4aviewer/CMakeLists.txt +++ b/tools/k4aviewer/CMakeLists.txt @@ -64,6 +64,7 @@ set(EXTERNAL_LIBRARIES libyuv::libyuv glfw::glfw ${OPENGL_LIBRARIES} + unofficial::gl3w::gl3w ) # On Windows, we need to call into setupapi to get USB container ID information diff --git a/tools/k4aviewer/k4aaudiomanager.cpp b/tools/k4aviewer/k4aaudiomanager.cpp index 243c800..ef85d45 100644 --- a/tools/k4aviewer/k4aaudiomanager.cpp +++ b/tools/k4aviewer/k4aaudiomanager.cpp @@ -11,7 +11,7 @@ // Library headers // -#include +#include // Project headers // diff --git a/tools/k4aviewer/k4asoundio_util.h b/tools/k4aviewer/k4asoundio_util.h index c9c2718..011a76e 100644 --- a/tools/k4aviewer/k4asoundio_util.h +++ b/tools/k4aviewer/k4asoundio_util.h @@ -16,7 +16,7 @@ // This disables that behavior. // #define NOMINMAX -#include +#include // Project headers //