From f8e8da128c18547cb008efbf288997c45a8cd849 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 16:51:02 -0400 Subject: [PATCH 01/14] More dynamic vcpkg for Windows --- .github/workflows/all_build.yml | 84 ++------- CMakeLists.txt | 29 ++- .../portaudio_audio_sink/CMakeLists.txt | 6 +- .../rtaudio_audio_sink/CMakeLists.txt | 4 +- plugins/geonetcast_support/CMakeLists.txt | 6 +- .../airspy_sdr_support/CMakeLists.txt | 8 +- .../airspyhf_sdr_support/CMakeLists.txt | 8 +- .../bladerf_sdr_support/CMakeLists.txt | 9 +- .../hackrf_sdr_support/CMakeLists.txt | 8 +- .../limesdr_sdr_support/CMakeLists.txt | 8 +- .../mirisdr_sdr_support/CMakeLists.txt | 8 +- .../plutosdr_sdr_support/CMakeLists.txt | 8 +- .../rfnm_sdr_support/CMakeLists.txt | 9 +- .../rtaudio_sdr_support/CMakeLists.txt | 22 +-- .../rtlsdr_sdr_support/CMakeLists.txt | 8 +- .../sdrplay_sdr_support/CMakeLists.txt | 7 +- .../soapy_sdr_support/CMakeLists.txt | 15 +- .../usrp_sdr_support/CMakeLists.txt | 12 +- plugins/spacex_support/CMakeLists.txt | 6 +- src-core/CMakeLists.txt | 2 +- src-ui/CMakeLists.txt | 6 +- windows/Build-SatDump.ps1 | 8 +- windows/Configure-vcpkg.ps1 | 173 ++++++++++++++++-- 23 files changed, 287 insertions(+), 167 deletions(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index ffe0fd4ea..012c4ad78 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -17,39 +17,20 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Get dependency version - id: win-deps-ver - shell: bash - run: commit=$(git ls-remote https://github.com/Aang23/vcpkg HEAD) && echo deps_version=${commit:0:6} >> $GITHUB_OUTPUT +# - name: Cache dependencies +# uses: actions/cache@v4 +# id: win-deps +# with: +# path: vcpkg +# key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} - - name: Cache dependencies - uses: actions/cache@v4 - id: win-deps - with: - path: vcpkg - key: win-deps-${{steps.win-deps-ver.outputs.deps_version}} - - - name: Clone pre-setup VCPKG - if: steps.win-deps.outputs.cache-hit != 'true' - run: git clone https://github.com/Aang23/vcpkg.git --depth 1 - - - name: Download SDRPlay API - if: steps.win-deps.outputs.cache-hit != 'true' + - name: Configure VCPKG +# if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell - run: Invoke-WebRequest -Uri "https://www.satdump.org/SDRPlay.zip" -OutFile ${{runner.workspace}}/sdrplay.zip - - - name: Install SDRPlay API - if: steps.win-deps.outputs.cache-hit != 'true' - shell: powershell - run: 7z x ${{runner.workspace}}/sdrplay.zip -O"${{runner.workspace}}" - - - name: Copy SDRPlay API Files - if: steps.win-deps.outputs.cache-hit != 'true' - shell: powershell - run: cp -r "${{runner.workspace}}/SDRPlay/API/inc/*" $Env:GITHUB_WORKSPACE/vcpkg/installed/x64-windows/include/; cp "${{runner.workspace}}/SDRPlay/API/x64/sdrplay_api.dll" $Env:GITHUB_WORKSPACE/vcpkg/installed/x64-windows/bin/sdrplay_api.dll; cp "${{runner.workspace}}/SDRPlay/API/x64/sdrplay_api.lib" $Env:GITHUB_WORKSPACE/vcpkg/installed/x64-windows/lib/sdrplay_api.lib; + run: ${{github.workspace}}\windows\Configure-vcpkg.ps1 -platform x64-windows - name: Download Aaronia RTSA API - if: steps.win-deps.outputs.cache-hit != 'true' +# if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell run: Invoke-WebRequest -Uri "https://www.satdump.org/Aaronia_RTSA_Suite_PRO_2.2.0.12821_Setup_64bit.exe" -OutFile $Env:GITHUB_WORKSPACE/vcpkg/rtsa.exe @@ -62,64 +43,23 @@ jobs: run: ${{github.workspace}}\windows\Get-NSIS-LongStrings.ps1 - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{runner.workspace}}/build - name: Configure CMake working-directory: ${{runner.workspace}}/build - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake -G "Visual Studio 16 2019" -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE=..\vcpkg\scripts\buildsystems\vcpkg.cmake "$Env:GITHUB_WORKSPACE" -DPLUGIN_AARONIA_SDR_SUPPORT=ON + run: cmake -G "Visual Studio 16 2019" -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE="$($Env:GITHUB_WORKSPACE\vcpkg\scripts\buildsystems\vcpkg.cmake)" "$Env:GITHUB_WORKSPACE" -DPLUGIN_AARONIA_SDR_SUPPORT=ON -DVCPKG_TARGET_TRIPLET="x64-windows" - name: Build working-directory: ${{runner.workspace}}/build shell: bash - # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE - name: Build Installer working-directory: ${{runner.workspace}}/build shell: bash - # Execute the build. You can specify a specific target with "--target " run: cpack -C $BUILD_TYPE - - name: Copy DLLs - working-directory: ${{runner.workspace}}/build - shell: powershell - run: cp $Env:GITHUB_WORKSPACE/vcpkg/installed/x64-windows/bin/*.dll Release - - - name: Copy Resources - working-directory: ${{runner.workspace}}/build - shell: powershell - run: cp -r $Env:GITHUB_WORKSPACE/resources Release - - - name: Copy Pipelines - working-directory: ${{runner.workspace}}/build - shell: powershell - run: cp -r $Env:GITHUB_WORKSPACE/pipelines ${{runner.workspace}}/build/Release; - - - name: Create Plugins Dir - working-directory: ${{runner.workspace}}/build - shell: powershell - run: mkdir ${{runner.workspace}}/build/Release/plugins; - - - name: Copy Plugins - working-directory: ${{runner.workspace}}/build - shell: powershell - run: cp ${{runner.workspace}}/build/plugins/Release/*.dll ${{runner.workspace}}/build/Release/plugins; - - - name: Copy Config - working-directory: ${{runner.workspace}}/build - shell: powershell - run: cp $Env:GITHUB_WORKSPACE/satdump_cfg.json ${{runner.workspace}}/build/Release; - - - name: Upload ZIP - uses: actions/upload-artifact@v4 - with: - name: SatDump-Windows_x64_Portable - path: ${{runner.workspace}}/build/Release/* + #TODO: Make portable version again - name: Upload Installer uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6810be8b9..0deb1946d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +if(MSVC OR BUILD_MSVC) + set(VCPKG_TARGET_TRIPLET CACHE STRING "x64-windows") + set(VCPKG_APPLOCAL_DEPS CACHE BOOL FALSE) +endif() + project(SatDump) option(BUILD_GUI "Build the GUI" ON) @@ -99,8 +104,8 @@ if(MSVC OR BUILD_MSVC) set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4286,4217") set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - include_directories(vcpkg/installed/x64-windows/include) - link_directories(vcpkg/installed/x64-windows/lib) + include_directories(vcpkg/installed/${VCPKG_TARGET_TRIPLET}/include) + link_directories(vcpkg/installed/${VCPKG_TARGET_TRIPLET}/lib) endif() project(SatDump VERSION "1.2.1") @@ -267,7 +272,7 @@ if((NOT ANDROID) AND ENABLE_INSTALL) set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_BRANDING_TEXT "SatDump - General Purpose Satellite Data Processor") set(CPACK_NSIS_MUI_HEADERIMAGE "${PROJECT_SOURCE_DIR}\\\\windows\\\\installer-header.bmp") - set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\windows\\\\icon.ico") + set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}\\\\windows\\\\icon.ico") if(BUILD_GUI) set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\satdump-ui.exe") set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "satdump-ui" "SatDump") @@ -277,8 +282,22 @@ if((NOT ANDROID) AND ENABLE_INSTALL) if(PLUGIN_REMOTE_SDR_SUPPORT) set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "satdump_sdr_server" "SatDump SDR Server") endif() - file(GLOB_RECURSE SATDUMP_WINDOWS_DEPENDENCIES ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/installed/x64-windows/bin/*.dll) - install(FILES ${SATDUMP_WINDOWS_DEPENDENCIES} DESTINATION bin) + + install(RUNTIME_DEPENDENCY_SET satdump_deps + PRE_EXCLUDE_REGEXES + "api-ms-.*" + "ext-ms-.*" + "^hvsifiletrust\\.dll$" + "^pdmutilities\\.dll$" + "^vc.*" + "^msvcp.*" + "^concrt.*" + "satdump_core.dll" + POST_EXCLUDE_REGEXES + ".*system32/.*\\.dll" + DIRECTORIES + "${PROJECT_SOURCE_DIR}/vcpkg/installed/${VCPKG_TARGET_TRIPLET}/bin" + ) else() set(CPACK_GENERATOR DEB) #set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) diff --git a/plugins/audio_sinks/portaudio_audio_sink/CMakeLists.txt b/plugins/audio_sinks/portaudio_audio_sink/CMakeLists.txt index 542a532dd..c32bc0603 100644 --- a/plugins/audio_sinks/portaudio_audio_sink/CMakeLists.txt +++ b/plugins/audio_sinks/portaudio_audio_sink/CMakeLists.txt @@ -9,12 +9,12 @@ if(PORTAUDIO_LIBRARY OR MSVC) add_library(portaudio_audio_sink SHARED ${portaudio_audio_sink}) if(MSVC) - target_link_libraries(portaudio_audio_sink PUBLIC satdump_core portaudio_x64.dll) + target_link_libraries(portaudio_audio_sink PUBLIC satdump_core portaudio.dll) + install(TARGETS portaudio_audio_sink DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) else() target_link_libraries(portaudio_audio_sink PUBLIC satdump_core ${PORTAUDIO_LIBRARY}) + install(TARGETS portaudio_audio_sink DESTINATION lib/satdump/plugins) endif() - - install(TARGETS portaudio_audio_sink DESTINATION lib/satdump/plugins) else() message("PortAudio Library could not be found! Not building.") endif() diff --git a/plugins/audio_sinks/rtaudio_audio_sink/CMakeLists.txt b/plugins/audio_sinks/rtaudio_audio_sink/CMakeLists.txt index 3b6d6c6de..43caee159 100644 --- a/plugins/audio_sinks/rtaudio_audio_sink/CMakeLists.txt +++ b/plugins/audio_sinks/rtaudio_audio_sink/CMakeLists.txt @@ -10,11 +10,11 @@ if(RTAUDIO_LIBRARY) # OR MSVC) if(MSVC) target_link_libraries(rtaudio_audio_sink PUBLIC satdump_core rtaudio.dll) + install(TARGETS rtaudio_audio_sink DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) else() target_link_libraries(rtaudio_audio_sink PUBLIC satdump_core ${RTAUDIO_LIBRARY}) + install(TARGETS rtaudio_audio_sink DESTINATION lib/satdump/plugins) endif() - - install(TARGETS rtaudio_audio_sink DESTINATION lib/satdump/plugins) else() message("RtAudio Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/geonetcast_support/CMakeLists.txt b/plugins/geonetcast_support/CMakeLists.txt index da17aed4c..dcc37fa29 100644 --- a/plugins/geonetcast_support/CMakeLists.txt +++ b/plugins/geonetcast_support/CMakeLists.txt @@ -17,4 +17,8 @@ else() message("Could not find HDF5 libraries. Geonetcast HDF5 processing disabled!") endif() -install(TARGETS geonetcast_support DESTINATION lib/satdump/plugins) \ No newline at end of file +if(MSVC OR BUILD_MSVC) + install(TARGETS geonetcast_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) +else() + install(TARGETS geonetcast_support DESTINATION lib/satdump/plugins) +endif() \ No newline at end of file diff --git a/plugins/sdr_sources/airspy_sdr_support/CMakeLists.txt b/plugins/sdr_sources/airspy_sdr_support/CMakeLists.txt index fad3e3eba..a03d9a4bf 100644 --- a/plugins/sdr_sources/airspy_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/airspy_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(AIRSPY_LIBRARY OR MSVC OR ANDROID) message("Building with Airspy support") file(GLOB_RECURSE airspy_sdr_support_CPPS *.cpp) add_library(airspy_sdr_support SHARED ${airspy_sdr_support_CPPS}) + target_include_directories(airspy_sdr_support PUBLIC src) if(MSVC) target_link_libraries(airspy_sdr_support PUBLIC satdump_core airspy.dll) + install(TARGETS airspy_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(airspy_sdr_support PUBLIC satdump_core airspy usb) target_include_directories(airspy_sdr_support PUBLIC ../../../android/deps/libairspy) + install(TARGETS airspy_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(airspy_sdr_support PUBLIC satdump_core ${AIRSPY_LIBRARY}) + install(TARGETS airspy_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(airspy_sdr_support PUBLIC src) - - install(TARGETS airspy_sdr_support DESTINATION lib/satdump/plugins) else() message("Airspy Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/airspyhf_sdr_support/CMakeLists.txt b/plugins/sdr_sources/airspyhf_sdr_support/CMakeLists.txt index 8ad1ac46a..eafbdda78 100644 --- a/plugins/sdr_sources/airspyhf_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/airspyhf_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(AIRSPYHF_LIBRARY OR MSVC OR ANDROID) message("Building with AirspyHF support") file(GLOB_RECURSE airspyhf_sdr_support_CPPS *.cpp) add_library(airspyhf_sdr_support SHARED ${airspyhf_sdr_support_CPPS}) + target_include_directories(airspyhf_sdr_support PUBLIC src) if(MSVC) target_link_libraries(airspyhf_sdr_support PUBLIC satdump_core airspyhf.dll) + install(TARGETS airspyhf_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(airspyhf_sdr_support PUBLIC satdump_core airspyhf usb) target_include_directories(airspyhf_sdr_support PUBLIC ../../../android/deps/libairspyhf) + install(TARGETS airspyhf_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(airspyhf_sdr_support PUBLIC satdump_core ${AIRSPYHF_LIBRARY}) + install(TARGETS airspyhf_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(airspyhf_sdr_support PUBLIC src) - - install(TARGETS airspyhf_sdr_support DESTINATION lib/satdump/plugins) else() message("AirspyHF Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt b/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt index 995a491ae..dd7d5d91a 100644 --- a/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/bladerf_sdr_support/CMakeLists.txt @@ -8,6 +8,7 @@ if(BLADERF_LIBRARY OR MSVC) # OR ANDROID) message("Building with BladeRF support") file(GLOB_RECURSE bladerf_sdr_support_CPPS *.cpp) add_library(bladerf_sdr_support SHARED ${bladerf_sdr_support_CPPS}) + target_include_directories(bladerf_sdr_support PUBLIC src) set(BLADERF_WIDEBAND_TEST_SOURCE " @@ -42,9 +43,11 @@ if(BLADERF_LIBRARY OR MSVC) # OR ANDROID) target_compile_definitions(bladerf_sdr_support PUBLIC BLADERF_HAS_WIDEBAND=1) endif() - target_include_directories(bladerf_sdr_support PUBLIC src) - - install(TARGETS bladerf_sdr_support DESTINATION lib/satdump/plugins) + if(MSVC) + install(TARGETS bladerf_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) + else() + install(TARGETS bladerf_sdr_support DESTINATION lib/satdump/plugins) + endif() else() message("BladeRF Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/hackrf_sdr_support/CMakeLists.txt b/plugins/sdr_sources/hackrf_sdr_support/CMakeLists.txt index fdf2ee931..8f2b94880 100644 --- a/plugins/sdr_sources/hackrf_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/hackrf_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(HACKRF_LIBRARY OR MSVC OR ANDROID) message("Building with HackRF support") file(GLOB_RECURSE hackrf_sdr_support_CPPS *.cpp) add_library(hackrf_sdr_support SHARED ${hackrf_sdr_support_CPPS}) + target_include_directories(hackrf_sdr_support PUBLIC src) if(MSVC) target_link_libraries(hackrf_sdr_support PUBLIC satdump_core hackrf.dll) + install(TARGETS hackrf_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(hackrf_sdr_support PUBLIC satdump_core hackrf usb) target_include_directories(hackrf_sdr_support PUBLIC ../../../android/deps/libhackrf) + install(TARGETS hackrf_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(hackrf_sdr_support PUBLIC satdump_core ${HACKRF_LIBRARY}) + install(TARGETS hackrf_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(hackrf_sdr_support PUBLIC src) - - install(TARGETS hackrf_sdr_support DESTINATION lib/satdump/plugins) else() message("HackRF Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/limesdr_sdr_support/CMakeLists.txt b/plugins/sdr_sources/limesdr_sdr_support/CMakeLists.txt index a065469c2..41b26e7fd 100644 --- a/plugins/sdr_sources/limesdr_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/limesdr_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(LIMESDR_LIBRARY OR MSVC OR ANDROID) message("Building with LimeSDR support") file(GLOB_RECURSE limesdr_sdr_support_CPPS *.cpp) add_library(limesdr_sdr_support SHARED ${limesdr_sdr_support_CPPS}) + target_include_directories(limesdr_sdr_support PUBLIC src) if(MSVC) target_link_libraries(limesdr_sdr_support PUBLIC satdump_core LimeSuite.dll) + install(TARGETS limesdr_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(limesdr_sdr_support PUBLIC satdump_core limesuite usb) target_include_directories(limesdr_sdr_support PUBLIC ../../../android/deps/liblimesuite) + install(TARGETS limesdr_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(limesdr_sdr_support PUBLIC satdump_core ${LIMESDR_LIBRARY}) + install(TARGETS limesdr_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(limesdr_sdr_support PUBLIC src) - - install(TARGETS limesdr_sdr_support DESTINATION lib/satdump/plugins) else() message("LimeSDR Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/mirisdr_sdr_support/CMakeLists.txt b/plugins/sdr_sources/mirisdr_sdr_support/CMakeLists.txt index 4cf4a2714..22827784c 100644 --- a/plugins/sdr_sources/mirisdr_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/mirisdr_sdr_support/CMakeLists.txt @@ -9,19 +9,19 @@ if(USB_LIBRARY OR MSVC OR ANDROID) message("Building with MiriSDR support") file(GLOB_RECURSE mirisdr_sdr_support_CPPS *.cpp mirisdr/libmirisdr.c) add_library(mirisdr_sdr_support SHARED ${mirisdr_sdr_support_CPPS}) + target_include_directories(mirisdr_sdr_support PUBLIC src) if(MSVC) target_link_libraries(mirisdr_sdr_support PUBLIC satdump_core libusb-1.0.dll) + install(TARGETS mirisdr_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(mirisdr_sdr_support PUBLIC satdump_core usb) target_include_directories(mirisdr_sdr_support PUBLIC ../../../android/deps/libusb) + install(TARGETS mirisdr_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(mirisdr_sdr_support PUBLIC satdump_core ${USB_LIBRARY}) + install(TARGETS mirisdr_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(mirisdr_sdr_support PUBLIC src) - - install(TARGETS mirisdr_sdr_support DESTINATION lib/satdump/plugins) else() message("MiriSDR Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/plutosdr_sdr_support/CMakeLists.txt b/plugins/sdr_sources/plutosdr_sdr_support/CMakeLists.txt index ff349e24f..3b4e4a883 100644 --- a/plugins/sdr_sources/plutosdr_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/plutosdr_sdr_support/CMakeLists.txt @@ -9,19 +9,19 @@ if((IIO_LIBRARY AND AD9361_LIBRARY) OR MSVC OR ANDROID) message("Building with PlutoSDR support") file(GLOB_RECURSE plutosdr_sdr_support_CPPS *.cpp) add_library(plutosdr_sdr_support SHARED ${plutosdr_sdr_support_CPPS}) + target_include_directories(plutosdr_sdr_support PUBLIC src) if(MSVC) target_link_libraries(plutosdr_sdr_support PUBLIC satdump_core libiio.dll libad9361.dll) + install(TARGETS plutosdr_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(plutosdr_sdr_support PUBLIC satdump_core iio ad9361iio) target_include_directories(plutosdr_sdr_support PUBLIC ../../../android/deps/libiio ../../../android/deps/libad9361-iio) + install(TARGETS plutosdr_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(plutosdr_sdr_support PUBLIC satdump_core ${IIO_LIBRARY} ${AD9361_LIBRARY}) + install(TARGETS plutosdr_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(plutosdr_sdr_support PUBLIC src) - - install(TARGETS plutosdr_sdr_support DESTINATION lib/satdump/plugins) else() message("IIO or AD9361 Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/rfnm_sdr_support/CMakeLists.txt b/plugins/sdr_sources/rfnm_sdr_support/CMakeLists.txt index e82a81145..c845a9cc9 100644 --- a/plugins/sdr_sources/rfnm_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/rfnm_sdr_support/CMakeLists.txt @@ -8,19 +8,18 @@ if(RFNM_LIBRARY) # OR MSVC message("Building with RFNM support") file(GLOB_RECURSE rfnm_sdr_support_CPPS *.cpp) add_library(rfnm_sdr_support SHARED ${rfnm_sdr_support_CPPS}) + target_include_directories(rfnm_sdr_support PUBLIC src) if(MSVC) - target_link_libraries(rfnm_sdr_support PUBLIC satdump_core airspy.dll) + target_link_libraries(rfnm_sdr_support PUBLIC satdump_core rfnm.dll) + install(TARGETS rfnm_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) # elseif(ANDROID) # target_link_libraries(rfnm_sdr_support PUBLIC satdump_core airspy usb) # target_include_directories(rfnm_sdr_support PUBLIC ../../../android/deps/libairspy) else() target_link_libraries(rfnm_sdr_support PUBLIC satdump_core ${RFNM_LIBRARY}) + install(TARGETS rfnm_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(rfnm_sdr_support PUBLIC src) - - install(TARGETS rfnm_sdr_support DESTINATION lib/satdump/plugins) else() message("RFNM Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/rtaudio_sdr_support/CMakeLists.txt b/plugins/sdr_sources/rtaudio_sdr_support/CMakeLists.txt index 85dac25ce..aef6cdd6f 100644 --- a/plugins/sdr_sources/rtaudio_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/rtaudio_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(RTAUDIO_LIBRARY) # OR MSVC) # OR ANDROID) message("Building with RtAudio support") file(GLOB_RECURSE rtaudio_sdr_support_CPPS *.cpp) add_library(rtaudio_sdr_support SHARED ${rtaudio_sdr_support_CPPS}) - - if(MSVC) - target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core rtlsdr.dll) - # elseif(ANDROID) - # target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core rtlsdr usb) - # target_include_directories(rtaudio_sdr_support PUBLIC ../../../android/deps/librtlsdr) - else() - target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core ${RTAUDIO_LIBRARY}) - endif() - target_include_directories(rtaudio_sdr_support PUBLIC src) - install(TARGETS rtaudio_sdr_support DESTINATION lib/satdump/plugins) + if(MSVC) + target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core rtaudio.dll) + install(TARGETS rtaudio_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) + # elseif(ANDROID) + # target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core rtlsdr usb) + # target_include_directories(rtaudio_sdr_support PUBLIC ../../../android/deps/librtlsdr) + # install(TARGETS rtaudio_sdr_support DESTINATION lib/satdump/plugins) + else() + target_link_libraries(rtaudio_sdr_support PUBLIC satdump_core ${RTAUDIO_LIBRARY}) + install(TARGETS rtaudio_sdr_support DESTINATION lib/satdump/plugins) + endif() else() message("RtAudio Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/rtlsdr_sdr_support/CMakeLists.txt b/plugins/sdr_sources/rtlsdr_sdr_support/CMakeLists.txt index 3ac184bf7..1589f89a9 100644 --- a/plugins/sdr_sources/rtlsdr_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/rtlsdr_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(RTLSDR_LIBRARY OR MSVC OR ANDROID) message("Building with RTL-SDR support") file(GLOB_RECURSE rtlsdr_sdr_support_CPPS *.cpp) add_library(rtlsdr_sdr_support SHARED ${rtlsdr_sdr_support_CPPS}) + target_include_directories(rtlsdr_sdr_support PUBLIC src) if(MSVC) target_link_libraries(rtlsdr_sdr_support PUBLIC satdump_core rtlsdr.dll) + install(TARGETS rtlsdr_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) elseif(ANDROID) target_link_libraries(rtlsdr_sdr_support PUBLIC satdump_core rtlsdr usb) target_include_directories(rtlsdr_sdr_support PUBLIC ../../../android/deps/librtlsdr) + install(TARGETS rtlsdr_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(rtlsdr_sdr_support PUBLIC satdump_core ${RTLSDR_LIBRARY}) + install(TARGETS rtlsdr_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(rtlsdr_sdr_support PUBLIC src) - - install(TARGETS rtlsdr_sdr_support DESTINATION lib/satdump/plugins) else() message("RTL-SDR Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/sdrplay_sdr_support/CMakeLists.txt b/plugins/sdr_sources/sdrplay_sdr_support/CMakeLists.txt index f3dd9c3c7..93e1e557d 100644 --- a/plugins/sdr_sources/sdrplay_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/sdrplay_sdr_support/CMakeLists.txt @@ -13,16 +13,15 @@ if(SDRPLAY_LIBRARY OR MSVC) message("Building with SDRPlay support") file(GLOB_RECURSE sdrplay_sdr_support_CPPS *.cpp) add_library(sdrplay_sdr_support SHARED ${sdrplay_sdr_support_CPPS}) + target_include_directories(sdrplay_sdr_support PUBLIC src) if(MSVC) target_link_libraries(sdrplay_sdr_support PUBLIC satdump_core sdrplay_api.dll) + install(TARGETS sdrplay_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) else() target_link_libraries(sdrplay_sdr_support PUBLIC satdump_core ${SDRPLAY_LIBRARY}) + install(TARGETS sdrplay_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(sdrplay_sdr_support PUBLIC src) - - install(TARGETS sdrplay_sdr_support DESTINATION lib/satdump/plugins) else() message("SDRlay Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/soapy_sdr_support/CMakeLists.txt b/plugins/sdr_sources/soapy_sdr_support/CMakeLists.txt index b365db884..bcda976ea 100644 --- a/plugins/sdr_sources/soapy_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/soapy_sdr_support/CMakeLists.txt @@ -7,16 +7,15 @@ if(SOAPYSDR_LIBRARY) message("Building with SoapySDR support") file(GLOB_RECURSE soapy_sdr_support_CPPS *.cpp) add_library(soapy_sdr_support SHARED ${soapy_sdr_support_CPPS}) - - # if(MSVC) - # target_link_libraries(soapy_sdr_support PUBLIC satdump_core rtlsdr.dll) - # else() - target_link_libraries(soapy_sdr_support PUBLIC satdump_core ${SOAPYSDR_LIBRARY}) - - # endif() target_include_directories(soapy_sdr_support PUBLIC src) - install(TARGETS soapy_sdr_support DESTINATION lib/satdump/plugins) + # if(MSVC) + # target_link_libraries(soapy_sdr_support PUBLIC satdump_core soapysdr.dll) + # install(TARGETS soapy_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) + # else() + target_link_libraries(soapy_sdr_support PUBLIC satdump_core ${SOAPYSDR_LIBRARY}) + install(TARGETS soapy_sdr_support DESTINATION lib/satdump/plugins) + # endif() else() message("SoapySDR Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/sdr_sources/usrp_sdr_support/CMakeLists.txt b/plugins/sdr_sources/usrp_sdr_support/CMakeLists.txt index ef2162798..d1faf0202 100644 --- a/plugins/sdr_sources/usrp_sdr_support/CMakeLists.txt +++ b/plugins/sdr_sources/usrp_sdr_support/CMakeLists.txt @@ -8,19 +8,19 @@ if(UHD_LIBRARY OR MSVC) # OR ANDROID) message("Building with USRP support") file(GLOB_RECURSE usrp_sdr_support_CPPS *.cpp) add_library(usrp_sdr_support SHARED ${usrp_sdr_support_CPPS}) + target_include_directories(usrp_sdr_support PUBLIC src) if(MSVC) target_link_libraries(usrp_sdr_support PUBLIC satdump_core uhd.dll) + install(TARGETS usrp_sdr_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) # elseif(ANDROID) - # target_link_libraries(usrp_sdr_support PUBLIC satdump_core airspy usb) - # target_include_directories(usrp_sdr_support PUBLIC ../../../android/deps/libairspy) + # target_link_libraries(usrp_sdr_support PUBLIC satdump_core airspy usb) + # target_include_directories(usrp_sdr_support PUBLIC ../../../android/deps/libairspy) + # install(TARGETS usrp_sdr_support DESTINATION lib/satdump/plugins) else() target_link_libraries(usrp_sdr_support PUBLIC satdump_core ${UHD_LIBRARY}) + install(TARGETS usrp_sdr_support DESTINATION lib/satdump/plugins) endif() - - target_include_directories(usrp_sdr_support PUBLIC src) - - install(TARGETS usrp_sdr_support DESTINATION lib/satdump/plugins) else() message("UHD Library could not be found! Not building.") endif() \ No newline at end of file diff --git a/plugins/spacex_support/CMakeLists.txt b/plugins/spacex_support/CMakeLists.txt index 55409410b..dfd16a687 100644 --- a/plugins/spacex_support/CMakeLists.txt +++ b/plugins/spacex_support/CMakeLists.txt @@ -18,6 +18,7 @@ if(MSVC) # Enable it target_compile_definitions(satdump_core PUBLIC USE_VIDEO_ENCODER="1") + install(TARGETS spacex_support DESTINATION lib/satdump/plugins RUNTIME_DEPENDENCY_SET satdump_deps) endif() elseif(ANDROID) # NO encoder on Android @@ -41,7 +42,6 @@ else() # Enable it target_compile_definitions(satdump_core PUBLIC USE_VIDEO_ENCODER="1") + install(TARGETS spacex_support DESTINATION lib/satdump/plugins) endif() -endif() - -install(TARGETS spacex_support DESTINATION lib/satdump/plugins) \ No newline at end of file +endif() \ No newline at end of file diff --git a/src-core/CMakeLists.txt b/src-core/CMakeLists.txt index a9cf8e258..ad73e4ba7 100644 --- a/src-core/CMakeLists.txt +++ b/src-core/CMakeLists.txt @@ -200,7 +200,7 @@ endif() # Install if(MSVC OR BUILD_MSVC) - install(TARGETS satdump_core DESTINATION bin) + install(TARGETS satdump_core DESTINATION bin RUNTIME_DEPENDENCY_SET satdump_deps) else() install(TARGETS satdump_core DESTINATION lib) endif() diff --git a/src-ui/CMakeLists.txt b/src-ui/CMakeLists.txt index 0ab9f81ca..19ff80b0e 100644 --- a/src-ui/CMakeLists.txt +++ b/src-ui/CMakeLists.txt @@ -39,4 +39,8 @@ else() target_link_libraries(satdump-ui PRIVATE glfw) endif() -install(TARGETS satdump-ui DESTINATION bin) +if(MSVC OR BUILD_MSVC) + install(TARGETS satdump-ui DESTINATION bin RUNTIME_DEPENDENCY_SET satdump_deps) +else() + install(TARGETS satdump-ui DESTINATION bin) +endif() diff --git a/windows/Build-SatDump.ps1 b/windows/Build-SatDump.ps1 index f0313b835..c5af13d00 100644 --- a/windows/Build-SatDump.ps1 +++ b/windows/Build-SatDump.ps1 @@ -1,4 +1,8 @@ -if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false) +param([string]$platform="x64-windows") #or x86-windows, arm64-windows +$ErrorActionPreference = "Stop" +$PSDefaultParameterValues['*:ErrorAction']='Stop' + +if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false) { Write-Error "You must run this script within Developer Powershell for Visual Studio" exit @@ -8,6 +12,6 @@ cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\.." mkdir build | Out-Null cd build -cmake .. -G "Visual Studio 17 2022" -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE=..\vcpkg\scripts\buildsystems\vcpkg.cmake -A x64 +cmake .. -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE="$($(Get-Item ..\vcpkg\scripts\buildsystems\vcpkg.cmake).FullName)" -DVCPKG_TARGET_TRIPLET="$platform" cmake --build . --config Release cd .. \ No newline at end of file diff --git a/windows/Configure-vcpkg.ps1 b/windows/Configure-vcpkg.ps1 index 3a8a72a55..f2a7b8d00 100644 --- a/windows/Configure-vcpkg.ps1 +++ b/windows/Configure-vcpkg.ps1 @@ -1,29 +1,178 @@ -if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false) +param([string]$platform="x64-windows") #or x86-windows, arm64-windows +$ErrorActionPreference = "Stop" +$PSDefaultParameterValues['*:ErrorAction']='Stop' + +if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false) { Write-Error "You must run this script within Developer Powershell for Visual Studio" - exit + exit 1 } - if(Test-Path "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\vcpkg" -ErrorAction SilentlyContinue) { Write-Output "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\vcpkg already found! Not setting up." - exit + exit 1 } -#Download custom vcpkg -Write-Output "Configuing vcpkg..." +#Setup vcpkg +Write-Output "Configuring vcpkg..." cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\.." -mkdir vcpkg | Out-Null -git clone --depth 1 https://github.com/Aang23/vcpkg.git +git clone --depth 1 https://github.com/microsoft/vcpkg cd vcpkg +git checkout 9a6da16845eca8d6ed70be416c1acbd206894c7f +.\bootstrap-vcpkg.bat -#Install SDRPlay API into vcpkg +# Core packages. libxml2 is for libiio +.\vcpkg install --triplet $platform pthreads libjpeg-turbo tiff libpng glfw3 libusb fftw3 libxml2 portaudio nng[mbedtls] zstd armadillo opencl curl[schannel] + +# Entirely for UHD... +.\vcpkg install --triplet $platform boost-chrono boost-date-time boost-filesystem boost-program-options boost-system boost-serialization boost-thread ` + boost-test boost-format boost-asio boost-math boost-graph boost-units boost-lockfree boost-circular-buffer ` + boost-assign boost-dll + +#Start Building Dependencies +$null = mkdir build +cd build +$build_args="-DCMAKE_TOOLCHAIN_FILE=$($(Get-Item ..\scripts\buildsystems\vcpkg.cmake).FullName)", "-DVCPKG_TARGET_TRIPLET=$platform", "-DCMAKE_INSTALL_PREFIX=$($(Get-Item ..\installed\$platform).FullName)", "-DCMAKE_BUILD_TYPE=Release" +$standard_include=$(Get-Item ..\installed\$platform\include).FullName +$pthread_lib=$(Get-Item ..\installed\$platform\lib\pthreadVC3.lib).FullName +$libusb_include=$(Get-Item ..\installed\$platform\include\libusb-1.0).FullName +$libusb_lib=$(Get-Item ..\installed\$platform\lib\libusb-1.0.lib).FullName + +Write-Output "Building cpu_features..." +git clone https://github.com/google/cpu_features --depth 1 -b v0.9.0 +cd cpu_features +$null = mkdir build +cd build +cmake $build_args -DBUILD_TESTING=OFF -DBUILD_EXECUTABLE=OFF .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force cpu_features + +Write-Output "Building Volk..." +git clone https://github.com/gnuradio/volk --depth 1 -b v3.1.2 +cd volk +$null = mkdir build +cd build +cmake $build_args -DENABLE_TESTING=OFF -DENABLE_MODTOOL=OFF .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force volk + +Write-Output "Building Airspy..." +git clone https://github.com/airspy/airspyone_host --depth 1 -b v1.0.10 +cd airspyone_host\libairspy +$null = mkdir build +cd build +cmake $build_args -DLIBUSB_INCLUDE_DIR="$($libusb_include)" -DLIBUSB_LIBRARIES="$($libusb_lib)" -DTHREADS_PTHREADS_WIN32_LIBRARY="$($pthread_lib)" .. +cmake --build . --config Release +cmake --install . +cd ..\..\.. +rm -recurse -force airspyone_host + +Write-Output "Building Airspy HF..." +git clone https://github.com/airspy/airspyhf --depth 1 -b 1.6.8 +cd airspyhf\libairspyhf +$null = mkdir build +cd build +cmake $build_args -DLIBUSB_INCLUDE_DIR="$($libusb_include)" -DLIBUSB_LIBRARIES="$($libusb_lib)" -DTHREADS_PTHREADS_WIN32_LIBRARY="$($pthread_lib)" .. +cmake --build . --config Release +cmake --install . +cd ..\..\.. +rm -recurse -force airspyhf + +Write-Output "Building RTL-SDR..." +git clone https://github.com/osmocom/rtl-sdr --depth 1 -b v2.0.2 +cd rtl-sdr +$null = mkdir build +cd build +cmake $build_args -DLIBUSB_INCLUDE_DIRS="$($libusb_include)" -DLIBUSB_LIBRARIES="$($libusb_lib)" -DTHREADS_PTHREADS_INCLUDE_DIR="$($standard_include)" -DTHREADS_PTHREADS_LIBRARY="$($pthread_lib)" .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force rtl-sdr + +Write-Output "Building HackRF..." +git clone https://github.com/greatscottgadgets/hackrf --depth 1 -b v2024.02.1 +cd hackrf\host\libhackrf +$null = mkdir build +cd build +cmake $build_args -DLIBUSB_INCLUDE_DIR="$($libusb_include)" -DLIBUSB_LIBRARIES="$($libusb_lib)" -DTHREADS_PTHREADS_WIN32_LIBRARY="$($pthread_lib)" .. +cmake --build . --config Release +cmake --install . +cd ..\..\..\.. +rm -recurse -force hackrf + +Write-Output "Building LimeSuite..." +git clone https://github.com/myriadrf/LimeSuite --depth 1 -b v23.11.0 +cd LimeSuite +$null = mkdir build-dir +cd build-dir +cmake $build_args -DENABLE_GUI=OFF .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force LimeSuite + +Write-Output "Building libiio..." +git clone https://github.com/analogdevicesinc/libiio --depth 1 -b v0.25 +cd libiio +$null = mkdir build +cd build +cmake $build_args -DWITH_IIOD=OFF -DWITH_TESTS=OFF -DWITH_ZSTD=ON .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force libiio + +Write-Output "Building libad9361-iio..." +git clone https://github.com/analogdevicesinc/libad9361-iio --depth 1 -b v0.3 +cd libad9361-iio +$null = mkdir build +cd build +cmake $build_args -DLIBIIO_LIBRARIES="$($(Get-Item ..\..\..\installed\$platform\lib\libiio.lib).FullName)" -DENABLE_PACKAGING=OFF .. +cmake --build . --config Release +cmake --install . +cd ..\.. +rm -recurse -force libad9361-iio + +Write-Output "Building bladeRF..." +git clone https://github.com/Nuand/bladeRF --depth 1 -b 2024.05 +cd bladeRF\host +Clear-Content cmake/modules/FindLibPThreadsWin32.cmake +Clear-Content cmake/modules/FindLibUSB.cmake +(Get-Content -raw CMakeLists.txt) -replace "(?ms)find_package\(LibPThreadsWin32\).*endif\(LIBUSB_FOUND\)", "" | Set-Content -Encoding ASCII CMakeLists.txt +$null = mkdir build +cd build +cmake $build_args -DTREAT_WARNINGS_AS_ERRORS=OFF -DLIBPTHREADSWIN32_INCLUDE_DIRS="$($standard_include)" -DLIBUSB_INCLUDE_DIRS="$($libusb_include)" -DLIBUSB_LIBRARIES="$($libusb_lib)" -DLIBPTHREADSWIN32_LIBRARIES="$($pthread_lib)" -DTEST_LIBBLADERF=OFF -DLIBUSB_FOUND=ON -DLIBPTHREADSWIN32_FOUND=ON -DLIBUSB_VERSION="$($(ls ..\..\..\..\installed\vcpkg\info\libusb*).BaseName.split('_')[1])" .. +cmake --build . --config Release +cmake --install . +cd ..\..\.. +rm -recurse -force bladeRF + +Write-Output "Building UHD..." +git clone https://github.com/EttusResearch/uhd --depth 1 -b v4.7.0.0 +cd uhd\host +$null = mkdir build +cd build +cmake $build_args -DENABLE_MAN_PAGES=OFF -DENABLE_MANUAL=OFF -DENABLE_PYTHON_API=OFF -DENABLE_EXAMPLES=OFF -DENABLE_UTILS=OFF -DENABLE_TESTS=OFF .. +cmake --build . --config Release +cmake --install . +cd ..\..\..\.. +rm -recurse -force build + +#Install SDRPlay API Invoke-WebRequest -Uri "https://www.satdump.org/SDRPlay.zip" -OutFile sdrplay.zip mkdir sdrplay | Out-Null Expand-Archive sdrplay.zip . -cp sdrplay\API\inc\*.h installed\x64-windows\include -cp sdrplay\API\x64\sdrplay_api.dll installed\x64-windows\bin -cp sdrplay\API\x64\sdrplay_api.lib installed\x64-windows\lib +cp sdrplay\API\inc\*.h installed\$platform\include +cp sdrplay\API\x64\sdrplay_api.dll installed\$platform\bin +cp sdrplay\API\x64\sdrplay_api.lib installed\$platform\lib Remove-Item sdrplay -Force -Recurse -ErrorAction SilentlyContinue Remove-Item sdrplay.zip + +#Clean Up (Some packages are silly) +mv installed\$platform\lib\*.dll installed\$platform\bin\ +mv installed\$platform\bin\*.lib installed\$platform\lib\ cd .. \ No newline at end of file From 091e02eb124cd125e2ca8fc12849f59b09df1dc5 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 16:57:52 -0400 Subject: [PATCH 02/14] More work --- windows/Configure-vcpkg.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/Configure-vcpkg.ps1 b/windows/Configure-vcpkg.ps1 index f2a7b8d00..48fe29fa9 100644 --- a/windows/Configure-vcpkg.ps1 +++ b/windows/Configure-vcpkg.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop" $PSDefaultParameterValues['*:ErrorAction']='Stop' -if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false) +if(!!(Get-Command 'tf' -ErrorAction SilentlyContinue) -eq $false -and $Env:GITHUB_WORKSPACE -eq $null) { Write-Error "You must run this script within Developer Powershell for Visual Studio" exit 1 From 20762825d4d408f1fa2d9507b291ca359d702a35 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 17:09:21 -0400 Subject: [PATCH 03/14] Use armadillo on Windows --- src-core/CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src-core/CMakeLists.txt b/src-core/CMakeLists.txt index ad73e4ba7..bab7b5172 100644 --- a/src-core/CMakeLists.txt +++ b/src-core/CMakeLists.txt @@ -46,6 +46,16 @@ endif() find_package(Threads REQUIRED) target_link_libraries(satdump_core PUBLIC Threads::Threads) +# Armadillo +find_package(Armadillo) + +if(ARMADILLO_FOUND) + target_compile_definitions(satdump_core PUBLIC HAVE_ARMADILLO="1") + target_link_libraries(satdump_core PUBLIC ${ARMADILLO_LIBRARIES}) + target_include_directories(satdump_core PUBLIC ${ARMADILLO_INCLUDE_DIRS}) + message("-- Building with Armadillo!") +endif() + # OpenCL if we found it if(BUILD_OPENCL AND NOT ANDROID) target_link_libraries(satdump_core PUBLIC ${OpenCL_LIBRARIES}) @@ -156,16 +166,6 @@ else() # Lua target_include_directories(satdump_core PUBLIC libs/lua) - # Armadillo - find_package(Armadillo) - - if(ARMADILLO_FOUND) - target_compile_definitions(satdump_core PUBLIC HAVE_ARMADILLO="1") - target_link_libraries(satdump_core PUBLIC ${ARMADILLO_LIBRARIES}) - target_include_directories(satdump_core PUBLIC ${ARMADILLO_INCLUDE_DIRS}) - message("-- Building with Armadillo!") - endif() - # Curl find_package(CURL REQUIRED) From dd4adfe3ef4621806fde4bda46c51c1990647231 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 18:12:39 -0400 Subject: [PATCH 04/14] Install mako for win volk; uhd builds --- .github/workflows/all_build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index 012c4ad78..a59db47c0 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -24,6 +24,10 @@ jobs: # path: vcpkg # key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} + - name: Install mako +# if: steps.win-deps.outputs.cache-hit != 'true' + run: pip install mako + - name: Configure VCPKG # if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell From 6337462579f5a498f6e15d185534179fb9ea1048 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 19:17:43 -0400 Subject: [PATCH 05/14] Update all_build.yml --- .github/workflows/all_build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index a59db47c0..47b09efe1 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -24,6 +24,12 @@ jobs: # path: vcpkg # key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} + - name: Set up Python 3.12 +# if: steps.win-deps.outputs.cache-hit != 'true' + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install mako # if: steps.win-deps.outputs.cache-hit != 'true' run: pip install mako From f6100f5e09c9f4bc1bae106098a4b3a2f298f87b Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 20:13:28 -0400 Subject: [PATCH 06/14] Enable win dep caching again --- .github/workflows/all_build.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index 47b09efe1..0df805748 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -17,30 +17,30 @@ jobs: steps: - uses: actions/checkout@v4 -# - name: Cache dependencies -# uses: actions/cache@v4 -# id: win-deps -# with: -# path: vcpkg -# key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} + - name: Cache dependencies + uses: actions/cache@v4 + id: win-deps + with: + path: vcpkg + key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} - name: Set up Python 3.12 -# if: steps.win-deps.outputs.cache-hit != 'true' + if: steps.win-deps.outputs.cache-hit != 'true' uses: actions/setup-python@v5 with: python-version: 3.12 - name: Install mako -# if: steps.win-deps.outputs.cache-hit != 'true' + if: steps.win-deps.outputs.cache-hit != 'true' run: pip install mako - name: Configure VCPKG -# if: steps.win-deps.outputs.cache-hit != 'true' + if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell run: ${{github.workspace}}\windows\Configure-vcpkg.ps1 -platform x64-windows - name: Download Aaronia RTSA API -# if: steps.win-deps.outputs.cache-hit != 'true' + if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell run: Invoke-WebRequest -Uri "https://www.satdump.org/Aaronia_RTSA_Suite_PRO_2.2.0.12821_Setup_64bit.exe" -OutFile $Env:GITHUB_WORKSPACE/vcpkg/rtsa.exe @@ -57,7 +57,7 @@ jobs: - name: Configure CMake working-directory: ${{runner.workspace}}/build - run: cmake -G "Visual Studio 16 2019" -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE="$($Env:GITHUB_WORKSPACE\vcpkg\scripts\buildsystems\vcpkg.cmake)" "$Env:GITHUB_WORKSPACE" -DPLUGIN_AARONIA_SDR_SUPPORT=ON -DVCPKG_TARGET_TRIPLET="x64-windows" + run: cmake -DVCPKG_TARGET_TRIPLET="x64-windows" -DPLUGIN_AARONIA_SDR_SUPPORT=ON -DBUILD_MSVC=ON -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}\vcpkg\scripts\buildsystems\vcpkg.cmake" "$Env:GITHUB_WORKSPACE" - name: Build working-directory: ${{runner.workspace}}/build From 39055e02ffdd88805f36c57da08b6d7f71e18821 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 22:27:02 -0400 Subject: [PATCH 07/14] Shrink windows cache size --- .github/workflows/all_build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index 0df805748..fa4af6b12 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -34,11 +34,15 @@ jobs: if: steps.win-deps.outputs.cache-hit != 'true' run: pip install mako - - name: Configure VCPKG + - name: Configure vcpkg if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell run: ${{github.workspace}}\windows\Configure-vcpkg.ps1 -platform x64-windows + - name: Clean up vcpkg + if: steps.win-deps.outputs.cache-hit != 'true' + run: rm -recurse -force $Env:GITHUB_WORKSPACE/vcpkg/packages, $Env:GITHUB_WORKSPACE/vcpkg/downloads, $Env:GITHUB_WORKSPACE/vcpkg/buildtrees + - name: Download Aaronia RTSA API if: steps.win-deps.outputs.cache-hit != 'true' shell: powershell From 4ccf25a8b880c649c0c08801fcf94cc507b34741 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 23:28:05 -0400 Subject: [PATCH 08/14] Re-add portable version --- .github/workflows/all_build.yml | 12 +++++-- windows/Finish-Release.ps1 | 55 ++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index fa4af6b12..60c075cac 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -73,14 +73,22 @@ jobs: shell: bash run: cpack -C $BUILD_TYPE - #TODO: Make portable version again - - name: Upload Installer uses: actions/upload-artifact@v4 with: name: SatDump-Windows_x64_Installer path: ${{runner.workspace}}/build/SatDump-*.exe + - name: Build Portable + shell: powershell + run: ${{github.workspace}}\windows\Finish-Release.ps1 -platform x64-windows -BuildPath ${{runner.workspace}}/build + + - name: Upload Portable + uses: actions/upload-artifact@v4 + with: + name: SatDump-Windows_x64_Portable + path: ${{runner.workspace}}/build/Release/* + build_android: runs-on: android-release diff --git a/windows/Finish-Release.ps1 b/windows/Finish-Release.ps1 index b52c810f3..6fa49d277 100644 --- a/windows/Finish-Release.ps1 +++ b/windows/Finish-Release.ps1 @@ -1,11 +1,56 @@ -#Copy all files into the Release folder -cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\build" -cp ..\vcpkg\installed\x64-windows\bin\*.dll Release -cp -r ..\resources Release -cp -r ..\pipelines Release +param( + [string]$BuildPath="$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\build", + [string]$SourcePath="$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..", + [string]$platform="x64-windows" #or x86-windows, arm64-windows +) + +#Copy all files into the Release folder +cd $BuildPath mkdir Release\plugins | Out-Null cp plugins\Release\*.dll Release\plugins +cp -r ..\resources Release +cp -r ..\pipelines Release cp ..\satdump_cfg.json Release cd Release +$input_dlls = Get-ChildItem -Recurse -Filter *.dll +$input_dlls += Get-ChildItem -Recurse -Filter *.exe +$dll_array = @() + +foreach($input_dll in $input_dlls) +{ + $dumpbin_result = dumpbin /dependents $input_dll.FullName + $reading = $false + for($i = 0; $i -lt $dumpbin_result.Count; $i++) + { + $this_line = $dumpbin_result[$i].trim() + if($this_line -eq "Image has the following dependencies:") + { + $i++ + $reading = $true + continue + } + if($reading -and [string]::IsNullOrWhiteSpace($this_line)) + { + break + } + if($reading) + { + $dll_array += $this_line + } + } +} + + +$dll_array = $dll_array | select -Unique +$available_dlls = Get-ChildItem $SourcePath\vcpkg\installed\$platform\bin -Filter *.dll +foreach($available_dll in $available_dlls) +{ + if($dll_array.Contains($available_dll.Name)) + { + cp $available_dll.FullName . + } +} + +cd ..\.. Write-Output "Done!" \ No newline at end of file From d2fd2de58581bb3a6601b66f74554d203fe1a49c Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Thu, 15 Aug 2024 23:53:01 -0400 Subject: [PATCH 09/14] Fixup portable & debugging Windows scripts --- .github/workflows/all_build.yml | 2 +- windows/Finish-Debug.ps1 | 45 ++++++++++++++++++++++++++++++++- windows/Finish-Release.ps1 | 7 +++-- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index 60c075cac..c3cae9fab 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -81,7 +81,7 @@ jobs: - name: Build Portable shell: powershell - run: ${{github.workspace}}\windows\Finish-Release.ps1 -platform x64-windows -BuildPath ${{runner.workspace}}/build + run: ${{github.workspace}}\windows\Finish-Release.ps1 -platform x64-windows -BuildPath ${{runner.workspace}}\build - name: Upload Portable uses: actions/upload-artifact@v4 diff --git a/windows/Finish-Debug.ps1 b/windows/Finish-Debug.ps1 index 27d7b5aed..ac921b783 100644 --- a/windows/Finish-Debug.ps1 +++ b/windows/Finish-Debug.ps1 @@ -1,6 +1,8 @@ # Preps satdump for execution within the debugger # MSVC 2022 seems to build in a ./out/... folder # Assume this is true +param([string]$platform="x64-windows") #or x86-windows, arm64-windows + cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\out\build\x64-Debug" #Remove old dirs @@ -8,7 +10,6 @@ if(Test-Path Debug\resources -ErrorAction SilentlyContinue) {rm -Recurse Debug\r if(Test-Path Debug\pipelines -ErrorAction SilentlyContinue) {rm -Recurse Debug\pipelines} if(Test-Path Debug\plugins -ErrorAction SilentlyContinue) {rm -Recurse Debug\plugins} -cp -force ..\..\..\vcpkg\installed\x64-windows\bin\*.dll Debug cp -r ..\..\..\resources Debug cp -r ..\..\..\pipelines Debug @@ -17,6 +18,44 @@ cp -force plugins\Debug\*.dll Debug\plugins cp -force plugins\Debug\*.pdb Debug\plugins cp -force ..\..\..\satdump_cfg.json Debug +$input_dlls = Get-ChildItem Debug\ -Recurse -Filter *.dll +$input_dlls += Get-ChildItem Debug\ -Recurse -Filter *.exe +$dll_array = @() + +foreach($input_dll in $input_dlls) +{ + $dumpbin_result = dumpbin /dependents $input_dll.FullName + $reading = $false + for($i = 0; $i -lt $dumpbin_result.Count; $i++) + { + $this_line = $dumpbin_result[$i].trim() + if($this_line -eq "Image has the following dependencies:") + { + $i++ + $reading = $true + continue + } + if($reading -and [string]::IsNullOrWhiteSpace($this_line)) + { + break + } + if($reading) + { + $dll_array += $this_line + } + } +} + +$dll_array = $dll_array | select -Unique +$available_dlls = Get-ChildItem ..\..\..\vcpkg\installed\$platform\bin -Filter *.dll +foreach($available_dll in $available_dlls) +{ + if($dll_array.Contains($available_dll.Name)) + { + cp -force $available_dll.FullName Debug + } +} + #Overwrite debug DLLs cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\libpng16d.dll Debug\libpng16.dll cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\fftw3f.dll Debug\fftw3f.dll @@ -26,10 +65,14 @@ cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\tiffd.dll Debug\tiff.dl cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\liblzma.dll Debug\liblzma.dll cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\libcurl-d.dll Debug\libcurl.dll cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\libusb-1.0.dll Debug\libusb-1.0.dll +cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\pthreadVC3d.dll Debug\pthreadVC3.dll #Remove stray DLLs from plugin folder, if they're there rm Debug\plugins\fftw3f.dll | Out-Null +rm Debug\plugins\nng.dll | Out-Null rm Debug\plugins\libusb-1.0.dll | Out-Null +rm Debug\plugins\portaudio.dll | Out-Null +rm Debug\plugins\zstd.dll | Out-Null #Done cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\.." diff --git a/windows/Finish-Release.ps1 b/windows/Finish-Release.ps1 index 6fa49d277..fa17ce24e 100644 --- a/windows/Finish-Release.ps1 +++ b/windows/Finish-Release.ps1 @@ -8,9 +8,9 @@ cd $BuildPath mkdir Release\plugins | Out-Null cp plugins\Release\*.dll Release\plugins -cp -r ..\resources Release -cp -r ..\pipelines Release -cp ..\satdump_cfg.json Release +cp -r $SourcePath\resources Release +cp -r $SourcePath\pipelines Release +cp $SourcePath\satdump_cfg.json Release cd Release $input_dlls = Get-ChildItem -Recurse -Filter *.dll @@ -41,7 +41,6 @@ foreach($input_dll in $input_dlls) } } - $dll_array = $dll_array | select -Unique $available_dlls = Get-ChildItem $SourcePath\vcpkg\installed\$platform\bin -Filter *.dll foreach($available_dll in $available_dlls) From 5622f1f15c7ce8e9937d9402d172f87969d2e62b Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Fri, 16 Aug 2024 00:14:52 -0400 Subject: [PATCH 10/14] Add missing build dep --- .github/workflows/all_build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index c3cae9fab..d00665996 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -79,6 +79,9 @@ jobs: name: SatDump-Windows_x64_Installer path: ${{runner.workspace}}/build/SatDump-*.exe + - name: Install Dumpbin + uses: lorenalexm/install-dumpbin-action@v0.1.1 + - name: Build Portable shell: powershell run: ${{github.workspace}}\windows\Finish-Release.ps1 -platform x64-windows -BuildPath ${{runner.workspace}}\build From dfddd6fe215d7ec94cd77b56d1a8f1a7e0a47c79 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Fri, 16 Aug 2024 00:48:23 -0400 Subject: [PATCH 11/14] Update all_build.yml --- .github/workflows/all_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index d00665996..58ee840f7 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -79,8 +79,8 @@ jobs: name: SatDump-Windows_x64_Installer path: ${{runner.workspace}}/build/SatDump-*.exe - - name: Install Dumpbin - uses: lorenalexm/install-dumpbin-action@v0.1.1 + - name: Set PATH for dumpbin + run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\$((Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name)\bin\Hostx64\x64" >> $env:GITHUB_PATH - name: Build Portable shell: powershell From 6360ed5e08e7c715432800ac3987870b4f3d3e29 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Fri, 16 Aug 2024 01:11:54 -0400 Subject: [PATCH 12/14] Oops --- .github/workflows/all_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index 58ee840f7..ebcee9196 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -80,7 +80,7 @@ jobs: path: ${{runner.workspace}}/build/SatDump-*.exe - name: Set PATH for dumpbin - run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\$((Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name)\bin\Hostx64\x64" >> $env:GITHUB_PATH + run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\$((Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name)\bin\Hostx64\x64" >> $env:GITHUB_PATH - name: Build Portable shell: powershell From 6a2e557fcd67992b4f24a3887b88d8c0da42e26c Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Fri, 16 Aug 2024 01:30:23 -0400 Subject: [PATCH 13/14] Oops Redux --- .github/workflows/all_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index ebcee9196..65bcbb1a6 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -80,7 +80,7 @@ jobs: path: ${{runner.workspace}}/build/SatDump-*.exe - name: Set PATH for dumpbin - run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\$((Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name)\bin\Hostx64\x64" >> $env:GITHUB_PATH + run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\$((Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name)\bin\Hostx64\x64" >> $env:GITHUB_PATH - name: Build Portable shell: powershell From a1ceadd3d734b27812c9800143a8ffa40a1ee126 Mon Sep 17 00:00:00 2001 From: Jamie Vital Date: Fri, 16 Aug 2024 12:26:12 -0400 Subject: [PATCH 14/14] Fix Windows Portable builds --- windows/Finish-Debug.ps1 | 75 +++++++++++++++++++++++++++----------- windows/Finish-Release.ps1 | 68 +++++++++++++++++++++++++--------- 2 files changed, 105 insertions(+), 38 deletions(-) diff --git a/windows/Finish-Debug.ps1 b/windows/Finish-Debug.ps1 index ac921b783..d5d36b57e 100644 --- a/windows/Finish-Debug.ps1 +++ b/windows/Finish-Debug.ps1 @@ -3,6 +3,33 @@ # Assume this is true param([string]$platform="x64-windows") #or x86-windows, arm64-windows +function Parse-DumpBin($binary_path) +{ + $return_val = @() + $dumpbin_result = dumpbin /dependents $binary_path + $reading = $false + for($i = 0; $i -lt $dumpbin_result.Count; $i++) + { + $this_line = $dumpbin_result[$i].trim() + if($this_line -eq "Image has the following dependencies:") + { + $i++ + $reading = $true + continue + } + if($reading -and [string]::IsNullOrWhiteSpace($this_line)) + { + break + } + if($reading) + { + $return_val += $this_line + } + } + + return $return_val +} + cd "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\..\out\build\x64-Debug" #Remove old dirs @@ -24,38 +51,44 @@ $dll_array = @() foreach($input_dll in $input_dlls) { - $dumpbin_result = dumpbin /dependents $input_dll.FullName - $reading = $false - for($i = 0; $i -lt $dumpbin_result.Count; $i++) - { - $this_line = $dumpbin_result[$i].trim() - if($this_line -eq "Image has the following dependencies:") - { - $i++ - $reading = $true - continue - } - if($reading -and [string]::IsNullOrWhiteSpace($this_line)) - { - break - } - if($reading) - { - $dll_array += $this_line - } - } + $dll_array += Parse-Dumpbin $input_dll.FullName } $dll_array = $dll_array | select -Unique $available_dlls = Get-ChildItem ..\..\..\vcpkg\installed\$platform\bin -Filter *.dll +$dlls_to_copy = @() foreach($available_dll in $available_dlls) { if($dll_array.Contains($available_dll.Name)) { - cp -force $available_dll.FullName Debug + $dlls_to_copy += $available_dll } } +# Recursively get remaining dependencies +$last_count = 0 +while($last_count -ne $dlls_to_copy.Count) +{ + $last_count = $dlls_to_copy.Count + foreach($dll_to_copy in $dlls_to_copy) + { + $potential_dlls = Parse-DumpBin $dll_to_copy.FullName + foreach($available_dll in $available_dlls) + { + if($potential_dlls.Contains($available_dll.Name) -and -not $dlls_to_copy.Name.Contains($available_dll.Name)) + { + $dlls_to_copy += $available_dll + } + } + } +} + +# Copy determined dependencies +foreach($dll_to_copy in $dlls_to_copy) +{ + cp -Force $dll_to_copy.FullName Debug +} + #Overwrite debug DLLs cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\libpng16d.dll Debug\libpng16.dll cp -force ..\..\..\vcpkg\installed\x64-windows\debug\bin\fftw3f.dll Debug\fftw3f.dll diff --git a/windows/Finish-Release.ps1 b/windows/Finish-Release.ps1 index fa17ce24e..6845ce60b 100644 --- a/windows/Finish-Release.ps1 +++ b/windows/Finish-Release.ps1 @@ -4,22 +4,10 @@ [string]$platform="x64-windows" #or x86-windows, arm64-windows ) -#Copy all files into the Release folder -cd $BuildPath -mkdir Release\plugins | Out-Null -cp plugins\Release\*.dll Release\plugins -cp -r $SourcePath\resources Release -cp -r $SourcePath\pipelines Release -cp $SourcePath\satdump_cfg.json Release -cd Release - -$input_dlls = Get-ChildItem -Recurse -Filter *.dll -$input_dlls += Get-ChildItem -Recurse -Filter *.exe -$dll_array = @() - -foreach($input_dll in $input_dlls) +function Parse-DumpBin($binary_path) { - $dumpbin_result = dumpbin /dependents $input_dll.FullName + $return_val = @() + $dumpbin_result = dumpbin /dependents $binary_path $reading = $false for($i = 0; $i -lt $dumpbin_result.Count; $i++) { @@ -36,20 +24,66 @@ foreach($input_dll in $input_dlls) } if($reading) { - $dll_array += $this_line + $return_val += $this_line } } + + return $return_val +} + +#Copy all files into the Release folder +cd $BuildPath +mkdir Release\plugins | Out-Null +cp plugins\Release\*.dll Release\plugins +cp -r $SourcePath\resources Release +cp -r $SourcePath\pipelines Release +cp $SourcePath\satdump_cfg.json Release +cd Release + +$input_dlls = Get-ChildItem -Recurse -Filter *.dll +$input_dlls += Get-ChildItem -Recurse -Filter *.exe +$dll_array = @() + +# Read dependencies +foreach($input_dll in $input_dlls) +{ + $dll_array += Parse-Dumpbin $input_dll.FullName } $dll_array = $dll_array | select -Unique $available_dlls = Get-ChildItem $SourcePath\vcpkg\installed\$platform\bin -Filter *.dll +$dlls_to_copy = @() foreach($available_dll in $available_dlls) { if($dll_array.Contains($available_dll.Name)) { - cp $available_dll.FullName . + $dlls_to_copy += $available_dll } } +# Recursively get remaining dependencies +$last_count = 0 +while($last_count -ne $dlls_to_copy.Count) +{ + $last_count = $dlls_to_copy.Count + foreach($dll_to_copy in $dlls_to_copy) + { + $potential_dlls = Parse-DumpBin $dll_to_copy.FullName + foreach($available_dll in $available_dlls) + { + if($potential_dlls.Contains($available_dll.Name) -and -not $dlls_to_copy.Name.Contains($available_dll.Name)) + { + $dlls_to_copy += $available_dll + } + } + } +} + +# Copy determined dependencies +foreach($dll_to_copy in $dlls_to_copy) +{ + cp $dll_to_copy.FullName . +} + cd ..\.. Write-Output "Done!" \ No newline at end of file