diff --git a/.github/workflows/all_build.yml b/.github/workflows/all_build.yml index ffe0fd4ea..65bcbb1a6 100644 --- a/.github/workflows/all_build.yml +++ b/.github/workflows/all_build.yml @@ -17,36 +17,31 @@ 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-${{steps.win-deps-ver.outputs.deps_version}} + key: win-deps-x64-${{ hashFiles('windows/Configure-vcpkg.ps1') }} - - name: Clone pre-setup VCPKG + - name: Set up Python 3.12 if: steps.win-deps.outputs.cache-hit != 'true' - run: git clone https://github.com/Aang23/vcpkg.git --depth 1 + uses: actions/setup-python@v5 + with: + python-version: 3.12 - - name: Download SDRPlay API + - 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 - run: Invoke-WebRequest -Uri "https://www.satdump.org/SDRPlay.zip" -OutFile ${{runner.workspace}}/sdrplay.zip + run: ${{github.workspace}}\windows\Configure-vcpkg.ps1 -platform x64-windows - - name: Install SDRPlay API + - name: Clean up vcpkg 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: 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' @@ -62,71 +57,41 @@ 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 -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 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/* - - name: Upload Installer uses: actions/upload-artifact@v4 with: name: SatDump-Windows_x64_Installer path: ${{runner.workspace}}/build/SatDump-*.exe + - name: Set PATH for dumpbin + 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 + 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/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 e59f14b27..b095fc9a5 100644 --- a/src-core/CMakeLists.txt +++ b/src-core/CMakeLists.txt @@ -48,6 +48,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}) @@ -158,16 +168,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) @@ -202,7 +202,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..48fe29fa9 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 -and $Env:GITHUB_WORKSPACE -eq $null) { 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 diff --git a/windows/Finish-Debug.ps1 b/windows/Finish-Debug.ps1 index 27d7b5aed..d5d36b57e 100644 --- a/windows/Finish-Debug.ps1 +++ b/windows/Finish-Debug.ps1 @@ -1,6 +1,35 @@ # 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 + +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 @@ -8,7 +37,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 +45,50 @@ 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) +{ + $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)) + { + $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 @@ -26,10 +98,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 b52c810f3..6845ce60b 100644 --- a/windows/Finish-Release.ps1 +++ b/windows/Finish-Release.ps1 @@ -1,11 +1,89 @@ -#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 +) + +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 +} + +#Copy all files into the Release folder +cd $BuildPath mkdir Release\plugins | Out-Null cp plugins\Release\*.dll Release\plugins -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 +$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)) + { + $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