diff --git a/pkgs/applications/misc/opentx/default.nix b/pkgs/applications/misc/opentx/default.nix index c3e100db084b..2d3389ff0faa 100644 --- a/pkgs/applications/misc/opentx/default.nix +++ b/pkgs/applications/misc/opentx/default.nix @@ -26,6 +26,10 @@ mkDerivation rec { sha256 = "sha256-F3zykJhKuIpLQSTjn7mcdjEmgRAlwCZpkTaKQR9ve3g="; }; + patches = [ + # fix error "The LOCATION property may not be read from target" and ensure proper linking of Qt modules so build don't fail + ./fix-cmake-qt-linking-and-location.patch + ]; nativeBuildInputs = [ cmake gcc-arm-embedded @@ -44,6 +48,12 @@ mkDerivation rec { sed -i companion/src/burnconfigdialog.cpp \ -e 's|/usr/.*bin/dfu-util|${dfu-util}/bin/dfu-util|' \ -e 's|/usr/.*bin/avrdude|${avrdude}/bin/avrdude|' + + substituteInPlace CMakeLists.txt \ + --replace-fail "cmake_minimum_required(VERSION 2.8)" "cmake_minimum_required(VERSION 3.10)" \ + --replace-fail "cmake_policy(SET CMP0023 OLD)" "cmake_policy(SET CMP0023 NEW)" + substituteInPlace companion/src/thirdparty/maxlibqt/src/widgets/CMakeLists.txt \ + --replace-fail "cmake_minimum_required(VERSION 2.8.12)" "cmake_minimum_required(VERSION 3.10)" ''; cmakeFlags = [ diff --git a/pkgs/applications/misc/opentx/fix-cmake-qt-linking-and-location.patch b/pkgs/applications/misc/opentx/fix-cmake-qt-linking-and-location.patch new file mode 100644 index 000000000000..857fca37716c --- /dev/null +++ b/pkgs/applications/misc/opentx/fix-cmake-qt-linking-and-location.patch @@ -0,0 +1,27 @@ +--- a/companion/src/CMakeLists.txt ++++ b/companion/src/CMakeLists.txt +@@ -313,8 +313,8 @@ + qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS}) + + add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${icon_RC}) +-target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit qcustomplot shared ${CPN_COMMON_LIB}) +- ++target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit qcustomplot shared ${CPN_COMMON_LIB} ++Qt5::Network Qt5::PrintSupport) + PrintTargetReport("${COMPANION_NAME}") + + ############# Standalone simulator ############### +@@ -371,11 +371,11 @@ + string(TOLOWER ${PCB} FLAVOUR) + endif() + if(POLICY CMP0026) +- cmake_policy(SET CMP0026 OLD) # https://cmake.org/cmake/help/v3.0/policy/CMP0026.html ++ cmake_policy(SET CMP0026 NEW) # https://cmake.org/cmake/help/v3.0/policy/CMP0026.html + endif() + + if(SIMU_TARGET) +- get_property(current_plugin TARGET opentx-${FLAVOUR}-simulator PROPERTY LOCATION) ++ set(current_plugin $) + list(APPEND simulator_plugins "${current_plugin}") + endif() +