diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa92b31f4..36e8d5542 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: dnf install -y epel-release dnf config-manager --set-enabled ${{ matrix.extra_repo }} devel dnf groupinstall "Development Tools" -y - dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget + dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget dnf install -y xz-devel mesa-libGLU mesa-libGLU-devel - name: Install other system dependencies @@ -577,4 +577,4 @@ jobs: - name: Install OpenRV run: | cmake --install _build --prefix $(pwd)/_install --config ${{ matrix.build-type }} - shell: msys2 {0} \ No newline at end of file + shell: msys2 {0} diff --git a/cmake/dependencies/aja.cmake b/cmake/dependencies/aja.cmake index 7ddb2a976..37c8cdda9 100644 --- a/cmake/dependencies/aja.cmake +++ b/cmake/dependencies/aja.cmake @@ -7,84 +7,79 @@ INCLUDE(ProcessorCount) # require CMake 3.15+ PROCESSORCOUNT(_cpu_count) -RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_AJA" "16.2" "make" "") +RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_AJA" "17.1.0" "make" "") RV_SHOW_STANDARD_DEPS_VARIABLES() -SET(_patch - "bugfix5" -) +STRING(REPLACE "." "_" _version_with_underscore ${_version}) SET(_download_url - "https://github.com/aja-video/ntv2/archive/refs/tags/v${_version}-${_patch}.zip" + "https://github.com/aja-video/libajantv2/archive/refs/tags/ntv2_${_version_with_underscore}.zip" ) SET(_download_hash - "5ec7f3f7ecfc322ca9307203155a4481" + "b9d189f77e18dbdff7c39a339b1a5dd4" ) -SET(_install_dir - ${RV_DEPS_BASE_DIR}/${_target}/install +IF(RV_TARGET_WINDOWS) + RV_MAKE_STANDARD_LIB_NAME(ajantv2_vs143_MT "" "SHARED" "d") +ELSE() + RV_MAKE_STANDARD_LIB_NAME(ajantv2 "" "SHARED" "d") +ENDIF() + +SET(_aja_ntv2_include_dir + ${_include_dir}/libajantv2/ajantv2/includes ) -SET(_include_dir - ${_install_dir}/include +SET(_aja_include_dir + ${_include_dir}/libajantv2 ) -IF(RV_TARGET_LINUX) - SET(_lib_dir - ${_install_dir}/lib64 - ) +IF(RHEL_VERBOSE) +SET(_mbedtls_lib_dir + ${_build_dir}/ajantv2/mbedtls-install/lib64 +) ELSE() - SET(_lib_dir - ${_install_dir}/lib - ) +SET(_mbedtls_lib_dir + ${_build_dir}/ajantv2/mbedtls-install/lib +) ENDIF() -SET(_make_command - make -) -SET(_configure_command - cmake -) +SET(_mbedtls_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedtls${CMAKE_STATIC_LIBRARY_SUFFIX}) +SET(_mbedx509_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedx509${CMAKE_STATIC_LIBRARY_SUFFIX}) +SET(_mbedcrypto_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}) -IF(${RV_OSX_EMULATION}) - SET(_darwin_x86_64 - "arch" "${RV_OSX_EMULATION_ARCH}" - ) +LIST(APPEND _byproducts ${_mbedtls_lib} ${_mbedx509_lib} ${_mbedcrypto_lib}) - SET(_make_command - ${_darwin_x86_64} ${_make_command} +# There is an issue with the recent AJA SDK : the OS specific header files are no longer copied to _aja_ntv2_include_dir Adding custom paths here to work around +# this issue +IF(RV_TARGET_LINUX) + SET(_aja_ntv2_os_specific_include_dir + ${_include_dir}/libajantv2/ajantv2/src/lin ) - SET(_configure_command - ${_darwin_x86_64} ${_configure_command} +ELSEIF(RV_TARGET_DARWIN) + SET(_aja_ntv2_os_specific_include_dir + ${_include_dir}/libajantv2/ajantv2/src/mac ) -ENDIF() - -IF(RV_TARGET_WINDOWS) - # MSYS2/CMake defaults to Ninja - SET(_make_command - ninja - ) -ENDIF() - -IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - SET(AJA_DEBUG_POSTFIX - "d" +ELSEIF(RV_TARGET_WINDOWS) + SET(_aja_ntv2_os_specific_include_dir + ${_include_dir}/libajantv2/ajantv2/src/win ) ENDIF() -SET(_aja_ntv2_libname - ${CMAKE_STATIC_LIBRARY_PREFIX}ajantv2${AJA_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} +LIST(APPEND + _configure_options + "-DAJANTV2_DISABLE_DEMOS=ON" + "-DAJANTV2_DISABLE_TOOLS=ON" + "-DAJANTV2_DISABLE_TESTS=ON" + "-DAJANTV2_BUILD_SHARED=ON" ) -SET(_aja_ntv2_lib - ${_lib_dir}/${_aja_ntv2_libname} -) -SET(_aja_ntv2_include_dir - ${_include_dir}/ajalibraries/ajantv2/includes -) -SET(_aja_include_dir - ${_include_dir}/ajalibraries -) +# In Debug, the MSVC runtime library needs to be set to MultiThreadedDebug. Otherwise, it will be set to MultiThreaded. +IF(RV_TARGET_WINDOWS AND CMAKE_BUILD_TYPE MATCHES "^Debug$") + LIST(APPEND + _configure_options + "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug" + ) +ENDIF() EXTERNALPROJECT_ADD( ${_target} @@ -93,34 +88,46 @@ EXTERNALPROJECT_ADD( DOWNLOAD_NAME ${_target}_${_version}.zip DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR} DOWNLOAD_EXTRACT_TIMESTAMP TRUE - SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src + SOURCE_DIR ${_source_dir} + BINARY_DIR ${_build_dir} INSTALL_DIR ${_install_dir} - CONFIGURE_COMMAND ${CMAKE_COMMAND} -G Ninja -DCMAKE_INSTALL_PREFIX=${_install_dir} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DAJA_BUILD_APPS=OFF ${RV_DEPS_BASE_DIR}/${_target}/src - # Not using _cmake_build_command and _cmake_install_command since the build dir need to change. - BUILD_COMMAND ${CMAKE_COMMAND} --build ${RV_DEPS_BASE_DIR}/${_target}/src --config ${CMAKE_BUILD_TYPE} -j${_cpu_count} - INSTALL_COMMAND ${CMAKE_COMMAND} --install ${RV_DEPS_BASE_DIR}/${_target}/src --prefix ${_install_dir} --config ${CMAKE_BUILD_TYPE} - BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_configure_options} + BUILD_COMMAND ${_cmake_build_command} + INSTALL_COMMAND ${_cmake_install_command} && ${CMAKE_COMMAND} -E copy_directory ${_mbedtls_lib_dir} ${_lib_dir} + BUILD_IN_SOURCE FALSE BUILD_ALWAYS FALSE - BUILD_BYPRODUCTS ${_aja_ntv2_lib} + BUILD_BYPRODUCTS ${_byproducts} USES_TERMINAL_BUILD TRUE ) -ADD_LIBRARY(aja::ntv2 STATIC IMPORTED GLOBAL) +RV_COPY_LIB_BIN_FOLDERS() + +ADD_LIBRARY(aja::ntv2 SHARED IMPORTED GLOBAL) ADD_DEPENDENCIES(aja::ntv2 ${_target}) SET_PROPERTY( TARGET aja::ntv2 - PROPERTY IMPORTED_LOCATION ${_aja_ntv2_lib} + PROPERTY IMPORTED_LOCATION ${_libpath} ) SET_PROPERTY( TARGET aja::ntv2 - PROPERTY IMPORTED_SONAME ${_aja_ntv2_libname} + PROPERTY IMPORTED_SONAME ${_libname} ) +IF(RV_TARGET_WINDOWS) + SET_PROPERTY( + TARGET aja::ntv2 + PROPERTY IMPORTED_IMPLIB ${_implibpath} + ) +ENDIF() -FILE(MAKE_DIRECTORY ${_aja_include_dir} ${_aja_ntv2_include_dir}) +FILE(MAKE_DIRECTORY ${_aja_include_dir} ${_aja_ntv2_include_dir} ${_aja_ntv2_os_specific_include_dir}) TARGET_INCLUDE_DIRECTORIES( aja::ntv2 - INTERFACE ${_aja_include_dir} ${_aja_ntv2_include_dir} + INTERFACE ${_aja_include_dir} ${_aja_ntv2_include_dir} ${_aja_ntv2_os_specific_include_dir} +) + +TARGET_LINK_LIBRARIES( + aja::ntv2 INTERFACE + ${_mbedtls_lib} ${_mbedx509_lib} ${_mbedcrypto_lib} ) IF(RV_TARGET_DARWIN) @@ -140,37 +147,9 @@ SET(RV_DEPS_AJA_COMPILE_OPTIONS LIST(APPEND RV_DEPS_LIST aja::ntv2) -IF(RV_TARGET_WINDOWS) - FILE(MAKE_DIRECTORY ${_install_dir}/lib) - FILE(MAKE_DIRECTORY ${_install_dir}/bin) - - ADD_CUSTOM_COMMAND( - TARGET ${_target} - POST_BUILD - COMMENT "Installing ${_target}'s libs and bin into ${RV_STAGE_LIB_DIR} and ${RV_STAGE_BIN_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/lib ${RV_STAGE_LIB_DIR} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/bin ${RV_STAGE_BIN_DIR} - ) - ADD_CUSTOM_TARGET( - ${_target}-stage-target ALL - DEPENDS ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname} - ) -ELSE() - ADD_CUSTOM_COMMAND( - COMMENT "Installing ${_target}'s libs into ${RV_STAGE_LIB_DIR}" - OUTPUT ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${_lib_dir} ${RV_STAGE_LIB_DIR} - DEPENDS ${_target} - ) - ADD_CUSTOM_TARGET( - ${_target}-stage-target ALL - DEPENDS ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname} - ) -ENDIF() - ADD_DEPENDENCIES(dependencies ${_target}-stage-target) SET(RV_DEPS_AJA_VERSION ${_version} CACHE INTERNAL "" FORCE -) \ No newline at end of file +) diff --git a/docs/build_system/config_linux_centos7.md b/docs/build_system/config_linux_centos7.md index 2958cb1cd..964c2b83a 100644 --- a/docs/build_system/config_linux_centos7.md +++ b/docs/build_system/config_linux_centos7.md @@ -2,12 +2,14 @@ ## Summary -1. [Install Basics](#install-basics) -1. [Install devtoolset-9](#install-devtoolset-9) -1. [Install tools and build dependencies](#install-tools-and-build-dependencies) -1. [Install CMake](#install-cmake) -1. [Install nasm](#install-nasm) -1. [Install Qt5](#install-qt) +- [Summary](#summary) +- [Install Basics](#install-basics) +- [Install devtoolset-9](#install-devtoolset-9) +- [Install tools and build dependencies](#install-tools-and-build-dependencies) + - [Install the python requirements](#install-the-python-requirements) +- [Install CMake](#install-cmake) +- [Install nasm](#install-nasm) +- [Install Qt](#install-qt) ## Install Basics @@ -35,7 +37,7 @@ scl enable devtoolset-9 $SHELL Most of the build requirements can be installed using the following command: ```bash -sudo yum install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex glew-devel libXcomposite libXi-devel libaio-devel libffi-devel ncurses-devel libtool libxkbcommon openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 mesa-libOSMesa mesa-libOSMesa-devel ocl-icd opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tk-devel yasm zlib-devel +sudo yum install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex glew-devel libXcomposite libXi-devel libaio-devel libffi-devel ncurses-devel libtool libudev-devel libxkbcommon openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 mesa-libOSMesa mesa-libOSMesa-devel ocl-icd opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tk-devel yasm zlib-devel ``` ### Install the python requirements @@ -48,7 +50,7 @@ python3 -m pip install -r requirements.txt ## Install CMake -You need CMake version 3.24+ to build RV. The yum-installable version is not quite recent enough, you'll to build and install CMake from sources. +You need CMake version 3.24+ to build RV. The yum-installable version is not quite recent enough, you'll need to build and install CMake from source. ```bash wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz diff --git a/docs/build_system/config_linux_rocky8.md b/docs/build_system/config_linux_rocky8.md index f01e41415..7535dc155 100644 --- a/docs/build_system/config_linux_rocky8.md +++ b/docs/build_system/config_linux_rocky8.md @@ -25,7 +25,7 @@ Some of the build dependencies come from outside the main AppStream repo. So fir ```bash sudo dnf install epel-release sudo dnf config-manager --set-enabled powertools -sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel +sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel ``` You can disable the devel repo afterwards since dnf will warn about it: @@ -51,7 +51,7 @@ python3 -m pip install -r requirements.txt ## Install CMake -You need CMake version 3.27+ to build RV. The dnf-installable version is not quite recent enough, you'll to build and install CMake from sources. +You need CMake version 3.27+ to build RV. The dnf-installable version is not quite recent enough, you'll need to build and install CMake from source. ```bash wget https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3.tar.gz @@ -221,4 +221,4 @@ Container id is the same as the one used in the step [Go into the container](go_ ```bash docker cp :/home/rv/OpenRV/_build/stage ./openrv_stage -``` \ No newline at end of file +``` diff --git a/docs/build_system/config_linux_rocky9.md b/docs/build_system/config_linux_rocky9.md index 5f300d520..ef4d98e27 100644 --- a/docs/build_system/config_linux_rocky9.md +++ b/docs/build_system/config_linux_rocky9.md @@ -25,7 +25,7 @@ Some of the build dependencies come from outside the main AppStream repo. So fir ```bash sudo dnf install epel-release sudo dnf config-manager --set-enabled crb devel -sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch perl-FindBin pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel +sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch perl-FindBin pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel ``` You can disable the devel repo afterwards since dnf will warn about it: @@ -57,6 +57,22 @@ Some of the RV build scripts requires extra python packages. They can be install python3 -m pip install -r requirements.txt ``` +## Install CMake + +You need CMake version 3.27+ to build RV. The dnf-installable version is not quite recent enough, you'll need to build and install CMake from source. + +```bash +wget https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3.tar.gz +tar -zxvf cmake-3.30.3.tar.gz +cd cmake-3.30.3 +./bootstrap --parallel=32 # 32 or whatever your machine allows +make -j 32 # 32 or whatever your machine allows +sudo make install + +cmake --version # confirm the version of your newly installed version of CMake +cmake version3.30.3 +``` + ## Install Qt Download the last version of Qt 5.15.x that you can get using the online installer on the [Qt page](https://www.qt.io/download-open-source). During Qt Setup's Select Components phase, check the "Archive" box on the right side of the window then click on "Filter" to see Qt 5.15.x options. Logs, Android, iOS and WebAssembly are not required to build OpenRV. Make sure to note the destination of the Qt install, as you will have to set the `QT_HOME` environment variable to this location's build dir. @@ -213,4 +229,4 @@ Container id is the same as the one used in the step [Go into the container](go_ ```bash docker cp :/home/rv/OpenRV/_build/stage ./openrv_stage -``` \ No newline at end of file +``` diff --git a/src/plugins/output/AJADevices/AJADevices/AJAModule.h b/src/plugins/output/AJADevices/AJADevices/AJAModule.h index 56449553b..754150ccf 100644 --- a/src/plugins/output/AJADevices/AJADevices/AJAModule.h +++ b/src/plugins/output/AJADevices/AJADevices/AJAModule.h @@ -28,26 +28,19 @@ namespace AJADevices SimpleMode }; - AJAModule( NativeDisplayPtr, unsigned int app4CC, OperationMode ); - virtual ~AJAModule(); + AJAModule( NativeDisplayPtr, unsigned int appID, OperationMode ); + ~AJAModule() override; - virtual std::string name() const; - virtual std::string SDKIdentifier() const; - virtual std::string SDKInfo() const; - virtual void open(); - virtual void close(); - virtual bool isOpen() const; - - void* deviceScan() const - { - return m_devicescan; - } + [[nodiscard]] std::string name() const override; + [[nodiscard]] std::string SDKIdentifier() const override; + [[nodiscard]] std::string SDKInfo() const override; + void open() override; + void close() override; + [[nodiscard]] bool isOpen() const override; private: - void* m_devicescan{ nullptr }; OperationMode m_mode{ OperationMode::ProMode }; unsigned int m_appID{ 0 }; }; } // namespace AJADevices - diff --git a/src/plugins/output/AJADevices/AJADevices/KonaVideoDevice.h b/src/plugins/output/AJADevices/AJADevices/KonaVideoDevice.h index fa5c2b0ed..428215dc8 100644 --- a/src/plugins/output/AJADevices/AJADevices/KonaVideoDevice.h +++ b/src/plugins/output/AJADevices/AJADevices/KonaVideoDevice.h @@ -25,29 +25,21 @@ #include #endif -#if defined( PLATFORM_DARWIN ) -#include -#endif - #include #include #include #include #include "ajatypes.h" #include "ntv2enums.h" -#include "ntv2devicefeatures.h" -#include "ntv2devicescanner.h" -#include "ntv2utils.h" #include "ntv2card.h" -#include "ntv2vpid.h" namespace AJADevices { class AJAModule; - typedef boost::mutex::scoped_lock ScopedLock; - typedef boost::mutex Mutex; - typedef boost::condition_variable Condition; + using ScopedLock = boost::mutex::scoped_lock; + using Mutex = boost::mutex; + using Condition = boost::condition_variable; struct KonaAudioFormat { @@ -90,8 +82,8 @@ namespace AJADevices unsigned int flags{ 0 }; }; - typedef std::vector KonaVideoFormatVector; - typedef std::vector KonaDataFormatVector; + using KonaVideoFormatVector = std::vector; + using KonaDataFormatVector = std::vector; struct KonaSyncMode { @@ -188,17 +180,17 @@ namespace AJADevices // Types // - typedef TwkUtil::Timer Timer; - typedef TwkGLF::GLFence GLFence; - typedef std::vector BufferVector; - typedef stl_ext::thread_group ThreadGroup; - typedef std::vector AudioBuffer; - typedef std::vector AudioBufferVector; - typedef std::vector