From 496f3eb68c05d3b8ebd499e88e84a4aebfc0606a Mon Sep 17 00:00:00 2001 From: William Yang Date: Sat, 24 Feb 2024 16:52:02 +1100 Subject: [PATCH] Create binaries for sse2,avx,avx2 for windows --- .github/workflows/x86-windows.yml | 8 +++++--- .gitignore | 4 ++-- CMakePresets.json | 26 +++++++++++++++++++++++--- toolchains/windows/create_package.sh | 18 +++++++++--------- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.github/workflows/x86-windows.yml b/.github/workflows/x86-windows.yml index 07c4a95..a0f3a77 100644 --- a/.github/workflows/x86-windows.yml +++ b/.github/workflows/x86-windows.yml @@ -29,8 +29,10 @@ jobs: build: needs: skip_check if: needs.skip_check.outputs.should_skip != 'true' - runs-on: windows-2022 + strategy: + matrix: + architecture: ["sse2", "avx", "avx2" ] steps: - uses: actions/checkout@v3 @@ -48,7 +50,7 @@ jobs: path: vcpkg - name: Configure CMake - run: cmake . -B ${{env.BUILD_DIR}} --preset windows-msvc -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake + run: cmake . -B ${{env.BUILD_DIR}} --preset windows-msvc-${{matrix.architecture}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} @@ -65,5 +67,5 @@ jobs: - name: Upload files uses: actions/upload-artifact@v3 with: - name: dab_radio_windows_x64 + name: dab_radio_windows_x64_${{matrix.architecture}} path: ${{github.workspace}}/${{env.PACKAGE_DIR}} diff --git a/.gitignore b/.gitignore index dbc21a7..87ef063 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ imgui.ini *.ini *.log logs.txt -dab_radio_windows_x64/ -dab_radio_windows_x64.zip +dab_radio_windows_x64*/ +dab_radio_windows_x64*.zip .cache/ CMakeUserPresets.json \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 901ec3c..f7294dc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -12,13 +12,33 @@ "cacheVariables": { "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl", - "CMAKE_CXX_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING", - "CMAKE_C_FLAGS_INIT": "/MP /fp:fast /arch:AVX2 /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING" + "CMAKE_CXX_FLAGS_INIT": "/MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING", + "CMAKE_C_FLAGS_INIT": "/MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING" } }, { - "name": "windows-msvc-warnings", + "name": "windows-msvc-sse2", + "inherits": ["windows-msvc"] + }, + { + "name": "windows-msvc-avx", "inherits": ["windows-msvc"], + "cacheVariables": { + "CMAKE_CXX_FLAGS_INIT": "/arch:AVX /MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING", + "CMAKE_C_FLAGS_INIT": "/arch:AVX /MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING" + } + }, + { + "name": "windows-msvc-avx2", + "inherits": ["windows-msvc"], + "cacheVariables": { + "CMAKE_CXX_FLAGS_INIT": "/arch:AVX2 /MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING", + "CMAKE_C_FLAGS_INIT": "/arch:AVX2 /MP /fp:fast /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING" + } + }, + { + "name": "windows-msvc-warnings", + "inherits": ["windows-msvc-avx2"], "cacheVariables": { "PROJECT_TARGET_PRIVATE_COMPILER_FLAGS": "/W3 /WX" } diff --git a/toolchains/windows/create_package.sh b/toolchains/windows/create_package.sh index 4550713..48f7eb2 100755 --- a/toolchains/windows/create_package.sh +++ b/toolchains/windows/create_package.sh @@ -1,20 +1,20 @@ #!/bin/bash -output_dir="dab_radio_windows_x64" -build_dir="build-windows/examples" +PACKAGE_DIR="${PACKAGE_DIR:-dab_radio_windows_x64}" +BUILD_DIR="${BUILD_DIR:-build}" # clean directory -rm -rf ${output_dir} -mkdir -p ${output_dir} +rm -rf ${PACKAGE_DIR} +mkdir -p ${PACKAGE_DIR} # copy binaries -cp ${build_dir}/*.exe ${output_dir}/ -cp ${build_dir}/*.dll ${output_dir}/ +cp ${BUILD_DIR}/examples/*.exe ${PACKAGE_DIR}/ +cp ${BUILD_DIR}/examples/*.dll ${PACKAGE_DIR}/ # copy resources -cp -rf res/ ${output_dir}/ +cp -rf res/ ${PACKAGE_DIR}/ # copy imgui workspace files -cp *.ini ${output_dir}/ +cp *.ini ${PACKAGE_DIR}/ # copy user docs -cp README.md ${output_dir}/ \ No newline at end of file +cp README.md ${PACKAGE_DIR}/ \ No newline at end of file