From 2a1538417b8735d7c6eec24111c053a87985074b Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 27 Jul 2025 09:01:15 +0200 Subject: [PATCH] chore: cleanup SDL2 definitions (#6467) --- CMakeLists.txt | 2 +- cmake/FetchImgui.cmake | 2 + cmake/NativeTargets.cmake | 18 ++----- companion/src/CMakeLists.txt | 53 ++++++++++++------- companion/src/apppreferencesdialog.cpp | 8 +-- companion/src/apppreferencesdialog.h | 2 +- companion/src/companion.cpp | 16 ++---- companion/src/simulation/CMakeLists.txt | 9 ++-- .../src/simulation/simulatormainwindow.cpp | 6 +-- companion/src/simulation/simulatorwidget.cpp | 10 ++-- companion/src/simulation/simulatorwidget.h | 4 +- companion/src/simulator.cpp | 16 ++---- radio/src/audio.cpp | 13 ----- radio/src/audio.h | 5 +- radio/src/targets/simu/CMakeLists.txt | 50 ++++++++--------- radio/src/targets/simu/simuaudio.cpp | 6 +-- tools/build-companion.sh | 6 --- tools/msys2_fetch_and_build_all.sh | 2 +- 18 files changed, 98 insertions(+), 130 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44a5a169a..4bf1e6705 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ if(NATIVE_BUILD) include(NativeTargets) else() # Prevent CMake warnings - set(IGNORE "${SDL2_LIBRARY_PATH}" "${LIBUSB1_ROOT_DIR}" "${OPENSSL_ROOT_DIR}") + set(IGNORE "${LIBUSB1_ROOT_DIR}" "${OPENSSL_ROOT_DIR}") endif() add_subdirectory(${RADIO_SRC_DIR}) diff --git a/cmake/FetchImgui.cmake b/cmake/FetchImgui.cmake index 1eced2113..2beb108ec 100644 --- a/cmake/FetchImgui.cmake +++ b/cmake/FetchImgui.cmake @@ -24,3 +24,5 @@ target_include_directories(imgui PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/imgui ${CMAKE_CURRENT_BINARY_DIR}/imgui/backends ) + +target_link_libraries(imgui PUBLIC SDL2::SDL2) diff --git a/cmake/NativeTargets.cmake b/cmake/NativeTargets.cmake index 1f83ca39b..ac8eb08c2 100644 --- a/cmake/NativeTargets.cmake +++ b/cmake/NativeTargets.cmake @@ -5,21 +5,9 @@ if(NOT DISABLE_COMPANION) include(QtDefs) endif(NOT DISABLE_COMPANION) -# this prevents FindSDL from appending SDLmain lib to the results, which we don't want -set(SDL2_BUILDING_LIBRARY YES) -find_package("SDL2") - -if(SDL2_FOUND) - # find_package("SDL2") does not set a variable holding the path to the location of the SDL2 shared library - find_file(SDL2_LIB_PATH - NAMES - libSDL2.so - SDL2.dll - SDL2.dylib - HINTS - "/usr/lib/x86_64-linux-gnu" - ${SDL2_LIBRARY_PATH}) - message(STATUS "SDL2 Lib: ${SDL2_LIB_PATH} Libs: ${SDL2_LIBRARIES}; Headers: ${SDL2_INCLUDE_DIRS}") +find_package(SDL2 QUIET COMPONENTS SDL2 CONFIG) +if(TARGET SDL2::SDL2) + message(STATUS "SDL2 found") else() message(STATUS "SDL not found! Simulator audio, and joystick inputs, will not work.") endif() diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 1ddfb34d0..9dc68873e 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -44,12 +44,9 @@ if(WIN32) endif() endif() -if(SDL2_FOUND) - include_directories(${SDL2_INCLUDE_DIRS}) - add_definitions(-DJOYSTICKS -DSIMU_AUDIO) - if(TARGET SDL2::SDL2) - set(SDL2_LIBRARIES SDL2::SDL2) - endif() +if(TARGET SDL2::SDL2) + add_definitions(-DUSE_SDL) + set(SDL2_LIBRARIES SDL2::SDL2) endif() add_definitions(${APP_COMMON_DEFINES}) # set in top-level CMakeLists @@ -267,10 +264,21 @@ if(WIN32) set(icon_RC images/winicons/icon.rc) endif() -add_executable(${COMPANION_NAME} - MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${companion_HDRS} ${icon_RC}) -target_link_libraries(${COMPANION_NAME} - PRIVATE ${CPN_COMMON_LIB} generaledit modeledit qcustomplot miniz updates) +add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} + ${companion_SRCS} + ${companion_HDRS} + ${icon_RC} +) + +target_link_libraries(${COMPANION_NAME} PRIVATE + ${CPN_COMMON_LIB} + ${SDL2_LIBRARIES} + generaledit + modeledit + qcustomplot + miniz + updates +) PrintTargetReport("${COMPANION_NAME}") @@ -278,10 +286,15 @@ PrintTargetReport("${COMPANION_NAME}") set(simu_SRCS simulator.cpp ) -add_executable(${SIMULATOR_NAME} - MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${simu_SRCS} ${icon_RC}) -target_link_libraries(${SIMULATOR_NAME} - PRIVATE ${CPN_COMMON_LIB}) +add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} + ${simu_SRCS} + ${icon_RC} +) + +target_link_libraries(${SIMULATOR_NAME} PRIVATE + ${CPN_COMMON_LIB} + ${SDL2_LIBRARIES} +) add_subdirectory(tests) @@ -450,10 +463,14 @@ elseif(WIN32) endif() endif(OPENSSL_FOUND) - if(SDL2_FOUND AND DEFINED SDL2_LIB_PATH) - install(FILES "${SDL2_LIB_PATH}" - DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} - COMPONENT Runtime) + if(TARGET SDL2::SDL2) + # Get the SDL2 DLL location + get_target_property(SDL2_DLL_PATH SDL2::SDL2 IMPORTED_LOCATION) + if(SDL2_DLL_PATH) + install(FILES "${SDL2_DLL_PATH}" + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} + COMPONENT Runtime) + endif() endif() elseif(APPLE) diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 90599af12..611cb3135 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -24,7 +24,7 @@ #include "mainwindow.h" #include "helpers.h" #include "storage.h" -#if defined(JOYSTICKS) +#if defined(USE_SDL) #include "joystick.h" #include "joystickdialog.h" #endif @@ -57,7 +57,7 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * f connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings); connect(ui->opt_fwTraceLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings); -#if !defined(JOYSTICKS) +#if !defined(USE_SDL) ui->joystickCB->hide(); ui->joystickCB->setDisabled(true); ui->joystickcalButton->hide(); @@ -296,7 +296,7 @@ void AppPreferencesDialog::initSettings() ui->chkSimuScrollButtons->setChecked(g.simuScrollButtons()); ui->joystickWarningCB->setChecked(g.disableJoystickWarning()); -#if defined(JOYSTICKS) +#if defined(USE_SDL) ui->joystickChkB->setChecked(g.jsSupport()); if (ui->joystickChkB->isChecked()) { QStringList joystickNames; @@ -627,7 +627,7 @@ void AppPreferencesDialog::on_btnClearPos_clicked() g.profile[g.sessionId()].simulatorOptions(opts); } -#if defined(JOYSTICKS) +#if defined(USE_SDL) void AppPreferencesDialog::on_joystickChkB_clicked() { if (ui->joystickChkB->isChecked()) { QStringList joystickNames; diff --git a/companion/src/apppreferencesdialog.h b/companion/src/apppreferencesdialog.h index efc87e500..7424868e5 100644 --- a/companion/src/apppreferencesdialog.h +++ b/companion/src/apppreferencesdialog.h @@ -74,7 +74,7 @@ class AppPreferencesDialog : public QDialog void on_btn_appLogsDir_clicked(); void on_btnClearPos_clicked(); -#if defined(JOYSTICKS) +#if defined(USE_SDL) void on_joystickChkB_clicked(); void on_joystickcalButton_clicked(); #endif diff --git a/companion/src/companion.cpp b/companion/src/companion.cpp index 0d9a072fc..358f84f5b 100644 --- a/companion/src/companion.cpp +++ b/companion/src/companion.cpp @@ -25,7 +25,8 @@ #include #include #include -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) + +#if defined(USE_SDL) #include #undef main #endif @@ -216,18 +217,11 @@ int main(int argc, char *argv[]) Translations::installTranslators(); -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) - uint32_t sdlFlags = 0; - #ifdef JOYSTICKS - sdlFlags |= SDL_INIT_JOYSTICK; - #endif - #ifdef SIMU_AUDIO - sdlFlags |= SDL_INIT_AUDIO; - #endif +#if defined(USE_SDL) #if defined(_WIN32) || defined(_WIN64) putenv("SDL_AUDIODRIVER=directsound"); #endif - if (SDL_Init(sdlFlags) < 0) { + if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) { fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError()); } #endif @@ -269,7 +263,7 @@ int main(int argc, char *argv[]) unregisterStorageFactories(); gBoardFactories->unregisterBoardFactories(); -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) +#if defined(USE_SDL) SDL_Quit(); #endif diff --git a/companion/src/simulation/CMakeLists.txt b/companion/src/simulation/CMakeLists.txt index d09d631ce..b238a9154 100644 --- a/companion/src/simulation/CMakeLists.txt +++ b/companion/src/simulation/CMakeLists.txt @@ -24,9 +24,8 @@ set(${PROJECT_NAME}_NAMES simulateduiwidgetGeneric ) -if(SDL2_FOUND) - set(${PROJECT_NAME}_NAMES - ${${PROJECT_NAME}_NAMES} +if(TARGET SDL2::SDL2) + list(APPEND ${PROJECT_NAME}_NAMES joystick joystickdialog ) @@ -61,6 +60,10 @@ target_link_libraries(${PROJECT_NAME} Qt::Svg ) +if(TARGET SDL2::SDL2) + target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2) +endif() + target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}" diff --git a/companion/src/simulation/simulatormainwindow.cpp b/companion/src/simulation/simulatormainwindow.cpp index 9a0f0cc75..a8e1139e7 100644 --- a/companion/src/simulation/simulatormainwindow.cpp +++ b/companion/src/simulation/simulatormainwindow.cpp @@ -29,7 +29,7 @@ #include "simulatorinterface.h" #include "telemetrysimu.h" #include "trainersimu.h" -#ifdef JOYSTICKS +#ifdef USE_SDL #include "joystickdialog.h" #endif #include "serialportsdialog.h" @@ -128,7 +128,7 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, const QString & simula ui->actionReloadLua->setDisabled(true); if(!m_simulator->getCapability(SimulatorInterface::CAP_TELEM_FRSKY_SPORT)) m_telemetryDockWidget->toggleViewAction()->setDisabled(true); -#ifndef JOYSTICKS +#ifndef USE_SDL ui->actionJoystickSettings->setDisabled(true); #endif @@ -482,7 +482,7 @@ void SimulatorMainWindow::toggleRadioDocked(bool dock) void SimulatorMainWindow::openJoystickDialog(bool) { -#ifdef JOYSTICKS +#ifdef USE_SDL joystickDialog * jd = new joystickDialog(this); if (jd->exec() == QDialog::Accepted && m_simulatorWidget) m_simulatorWidget->setupJoysticks(); diff --git a/companion/src/simulation/simulatorwidget.cpp b/companion/src/simulation/simulatorwidget.cpp index f370c5401..cc7312b98 100644 --- a/companion/src/simulation/simulatorwidget.cpp +++ b/companion/src/simulation/simulatorwidget.cpp @@ -33,7 +33,7 @@ #include "simulateduiwidget.h" #include "storage.h" #include "virtualjoystickwidget.h" -#ifdef JOYSTICKS +#ifdef USE_SDL #include "joystick.h" #include "joystickdialog.h" #endif @@ -126,7 +126,7 @@ SimulatorWidget::~SimulatorWidget() delete radioUiWidget; delete vJoyLeft; delete vJoyRight; -#ifdef JOYSTICKS +#ifdef USE_SDL delete joystick; #endif firmware = nullptr; @@ -607,7 +607,7 @@ void SimulatorWidget::setupRadioWidgets() void SimulatorWidget::setupJoysticks() { -#ifdef JOYSTICKS +#ifdef USE_SDL bool joysticksEnabled = false; if (g.jsSupport()) { @@ -806,7 +806,7 @@ void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetTyp void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value) { -#ifdef JOYSTICKS +#ifdef USE_SDL static const int ttlSticks = 4; const int ttlKnobs = Boards::getCapability(m_board, Board::Pots); const int ttlFaders = Boards::getCapability(m_board, Board::Sliders); @@ -855,7 +855,7 @@ void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value) void SimulatorWidget::onjoystickButtonValueChanged(int button, bool state) { -#ifdef JOYSTICKS +#ifdef USE_SDL if (!joystick || button >= MAX_JS_BUTTONS) return; diff --git a/companion/src/simulation/simulatorwidget.h b/companion/src/simulation/simulatorwidget.h index bcbb93f94..5f1369596 100644 --- a/companion/src/simulation/simulatorwidget.h +++ b/companion/src/simulation/simulatorwidget.h @@ -38,7 +38,7 @@ class Firmware; class SimulatorInterface; class SimulatedUIWidget; class VirtualJoystickWidget; -#ifdef JOYSTICKS +#ifdef USE_SDL class Joystick; #endif @@ -149,7 +149,7 @@ class SimulatorWidget : public QWidget bool deleteTempRadioData = false; bool saveTempRadioData = false; -#ifdef JOYSTICKS +#ifdef USE_SDL Joystick * joystick = nullptr; int switchDirection[MAX_JS_BUTTONS]; #endif diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index ef2297e02..c5f78a98f 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -26,7 +26,8 @@ #include #include #include -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) + +#if defined(USE_SDL) #include #undef main #endif @@ -278,18 +279,11 @@ int main(int argc, char *argv[]) Translations::installTranslators(); -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) - uint32_t sdlFlags = 0; - #ifdef JOYSTICKS - sdlFlags |= SDL_INIT_JOYSTICK; - #endif - #ifdef SIMU_AUDIO - sdlFlags |= SDL_INIT_AUDIO; - #endif +#if defined(USE_SDL) #if defined(_WIN32) || defined(_WIN64) putenv("SDL_AUDIODRIVER=directsound"); #endif - if (SDL_Init(sdlFlags) < 0) { + if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) { showMessage(QApplication::translate("SimulatorMain", "WARNING: couldn't initialize SDL:\n%1").arg(SDL_GetError()), QMessageBox::Warning); } #endif @@ -403,7 +397,7 @@ int finish(int exitCode) unregisterStorageFactories(); gBoardFactories->unregisterBoardFactories(); -#if defined(JOYSTICKS) || defined(SIMU_AUDIO) +#if defined(USE_SDL) SDL_Quit(); #endif diff --git a/radio/src/audio.cpp b/radio/src/audio.cpp index 80efe3722..14d9ac568 100644 --- a/radio/src/audio.cpp +++ b/radio/src/audio.cpp @@ -706,11 +706,6 @@ bool AudioQueue::isPlaying(uint8_t id) void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t flags, int8_t freqIncr, int8_t fragmentVolume) { -#if defined(SIMU) && !defined(SIMU_AUDIO) - #warning "NO audio" - return; -#endif - _audio_lock(); freq = limit(BEEP_MIN_FREQ, freq, BEEP_MAX_FREQ); @@ -772,14 +767,6 @@ void AudioQueue::playFile(const char * filename, uint8_t flags, uint8_t id, int8 void AudioQueue::stopPlay(uint8_t id) { -#if defined(SIMU) - TRACE("stopPlay(id=%d)", id); -#endif - -#if defined(SIMU) && !defined(SIMU_AUDIO) - return; -#endif - _audio_lock(); fragmentsFifo.removePromptById(id); diff --git a/radio/src/audio.h b/radio/src/audio.h index 8bf7b11b9..410a9fbfe 100644 --- a/radio/src/audio.h +++ b/radio/src/audio.h @@ -88,7 +88,7 @@ constexpr uint8_t AUDIO_FILENAME_MAXLEN = (AUDIO_LUA_FILENAME_MAXLEN > AUDIO_MOD #endif #endif -#if defined(SIMU) && defined(SIMU_AUDIO) +#if defined(SIMU) #define AUDIO_BUFFER_COUNT (10) // simulator needs more buffers for smooth audio #elif defined(AUDIO_SPI) #define AUDIO_BUFFER_COUNT (2) // smaller than Taranis since there is also a buffer on the ADC chip @@ -421,9 +421,6 @@ class AudioFragmentFifo class AudioQueue { -#if defined(SIMU_AUDIO) - friend void fillAudioBuffer(void *, uint8_t *, int); -#endif #if defined(CLI) friend void printAudioVars(); #endif diff --git a/radio/src/targets/simu/CMakeLists.txt b/radio/src/targets/simu/CMakeLists.txt index 1f4e51ad2..b6c391d42 100644 --- a/radio/src/targets/simu/CMakeLists.txt +++ b/radio/src/targets/simu/CMakeLists.txt @@ -36,14 +36,6 @@ set(SIMU_DRIVERS ${SIMU_DRIVERS} ) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -if(SDL2_FOUND) - include_directories(${SDL2_INCLUDE_DIRS}) - target_compile_options(radiolib_native PUBLIC -DSIMU_AUDIO) - if(TARGET SDL2::SDL2) - set(SDL2_LIBRARIES SDL2::SDL2) - endif() -endif() - if(SIMU_LUA_COMPILER) add_definitions(-DLUA_COMPILER) endif() @@ -99,7 +91,9 @@ if(Qt6Widgets_FOUND) list(APPEND SIMULATOR_SRC ${SIMU_SRC} opentxsimulator.cpp) add_library(${SIMULATOR_TARGET} SHARED ${SIMULATOR_SRC}) - if(SDL2_FOUND) + + if(TARGET SDL2::SDL2) + set(SDL2_LIBRARIES SDL2::SDL2) target_sources(${SIMULATOR_TARGET} PRIVATE simuaudio.cpp) else() target_sources(${SIMULATOR_TARGET} PRIVATE no_audio.cpp) @@ -170,28 +164,26 @@ endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}") -add_executable(simu - EXCLUDE_FROM_ALL - ${SIMU_SRC} - simuaudio.cpp - display.cpp - widgets.cpp - knobs.cpp - sdl_simu.cpp -) +if(TARGET SDL2:SDL2) + add_executable(simu + EXCLUDE_FROM_ALL + ${SIMU_SRC} + simuaudio.cpp + display.cpp + widgets.cpp + knobs.cpp + sdl_simu.cpp + ) -include(FetchImgui) -target_compile_options(simu PUBLIC -DSIMU) + include(FetchImgui) + target_compile_options(simu PUBLIC -DSIMU) -add_png_target(image_assets "assets/images/*.png") -add_dependencies(simu image_assets) + add_png_target(image_assets "assets/images/*.png") + add_dependencies(simu image_assets) -set(STB_DIR ${RADIO_SRC_DIR}/thirdparty/stb) -target_include_directories(simu PUBLIC ${STB_DIR}) -target_link_libraries(simu PUBLIC imgui) - -target_link_libraries(simu PUBLIC - ${SDL2_LIBRARIES} -) + set(STB_DIR ${RADIO_SRC_DIR}/thirdparty/stb) + target_include_directories(simu PUBLIC ${STB_DIR}) + target_link_libraries(simu PUBLIC imgui) +endif() PrintTargetReport("simu/libsimulator") diff --git a/radio/src/targets/simu/simuaudio.cpp b/radio/src/targets/simu/simuaudio.cpp index 31f45e03c..2503697aa 100644 --- a/radio/src/targets/simu/simuaudio.cpp +++ b/radio/src/targets/simu/simuaudio.cpp @@ -25,7 +25,7 @@ #include #include -#define SIMU_AUDIO_FMT AUDIO_S16SYS +#define AUDIO_FMT AUDIO_S16SYS static SDL_AudioDeviceID _sdl_audio_device = 0; @@ -33,7 +33,7 @@ void simuQueueAudio(const uint8_t* data, uint32_t len) { #if !defined(SOFTWARE_VOLUME) int volume = (simuAudioGetVolume() * SDL_MIX_MAXVOLUME ) / VOLUME_LEVEL_MAX; - SDL_MixAudioFormat((uint8_t*)data, data, SIMU_AUDIO_FMT, len, volume); + SDL_MixAudioFormat((uint8_t*)data, data, AUDIO_FMT, len, volume); #endif SDL_QueueAudio(_sdl_audio_device, data, len); @@ -43,7 +43,7 @@ bool simuAudioInit() { SDL_AudioSpec wanted = { .freq = AUDIO_SAMPLE_RATE, - .format = SIMU_AUDIO_FMT, + .format = AUDIO_FMT, .channels = 1, .silence = 0, .samples = 1024, diff --git a/tools/build-companion.sh b/tools/build-companion.sh index 5779db28c..cda59a05d 100755 --- a/tools/build-companion.sh +++ b/tools/build-companion.sh @@ -25,12 +25,6 @@ fi COMMON_OPTIONS="${COMMON_OPTIONS} -DCMAKE_BUILD_TYPE=Release -DCMAKE_MESSAGE_LOG_LEVEL=WARNING -Wno-dev -DGVARS=YES -DHELI=YES -DLUA=YES" if [ "$(uname)" = "Darwin" ]; then COMMON_OPTIONS="${COMMON_OPTIONS} -DCMAKE_OSX_DEPLOYMENT_TARGET='10.15'" -elif [ "$(uname)" != "Linux" ]; then # Assume Windows and MSYS2 - if [ "${MSYSTEM,,}" == "mingw32" ]; then # MSYS 32bit detected - COMMON_OPTIONS="${COMMON_OPTIONS} -DSDL2_LIBRARY_PATH=/mingw32/bin/" - else # fallback to 64bit - COMMON_OPTIONS="${COMMON_OPTIONS} -DSDL2_LIBRARY_PATH=/mingw64/bin/" - fi fi # Generate EDGETX_VERSION_SUFFIX if not already set diff --git a/tools/msys2_fetch_and_build_all.sh b/tools/msys2_fetch_and_build_all.sh index 42296cc14..a575d14e8 100644 --- a/tools/msys2_fetch_and_build_all.sh +++ b/tools/msys2_fetch_and_build_all.sh @@ -209,7 +209,7 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then fi echo "=== Step $((STEP++)): Running CMake for ${RADIO_TYPE} as an example ===" -cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../ +cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../ check_command $? "cmake -G MSYS Makefiles -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../" if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."