From 3efb2b1a689e697cf096bfce1fe09cb898eea28b Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Mon, 22 May 2023 18:38:52 +0530 Subject: [PATCH] [FIX] Update Windows build (#1540) * fix: update windows ci * fix: update docs for compilation * fix: build runtime library --- .github/workflows/build_windows.yml | 16 ++++++++-------- docs/COMPILATION.MD | 9 +++++---- docs/FFMPEG.md | 7 ++++--- windows/ccextractor.vcxproj | 8 ++++---- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index d79c88fc..514d6f3f 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -1,5 +1,9 @@ name: Build CCExtractor on Windows +env: + RUSTFLAGS: -Ctarget-feature=+crt-static + VCPKG_DEFAULT_TRIPLET: x64-windows-static + on: workflow_dispatch: push: @@ -40,14 +44,13 @@ jobs: cache-version: "1" ignore-reserve-cache-error: true - name: Install dependencies - run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static-md + run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static - name: build Release env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" CARGO_TARGET_DIR: "..\\..\\windows" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 - VCPKG_DEFAULT_TRIPLET: x64-windows-static-md VCPKG_ROOT: ${{ github.workspace }}\vcpkg run: msbuild ccextractor.sln /p:Configuration=Release /p:Platform=x64 working-directory: ./windows @@ -83,14 +86,13 @@ jobs: cache-version: "1" ignore-reserve-cache-error: true - name: Install dependencies - run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static-md + run: cd vcpkg && vcpkg integrate install && vcpkg install libpng --triplet x64-windows-static - name: build Debug env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" CARGO_TARGET_DIR: "..\\..\\windows" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 - VCPKG_DEFAULT_TRIPLET: x64-windows-static-md VCPKG_ROOT: ${{ github.workspace }}\vcpkg run: msbuild ccextractor.sln /p:Configuration=Debug /p:Platform=x64 working-directory: ./windows @@ -127,14 +129,13 @@ jobs: cache-version: "1" ignore-reserve-cache-error: true - name: Install dependencies - run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static-md + run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static - name: build Release-Full env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" CARGO_TARGET_DIR: "..\\..\\windows" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 - VCPKG_DEFAULT_TRIPLET: x64-windows-static-md VCPKG_ROOT: ${{ github.workspace }}\vcpkg run: msbuild ccextractor.sln /p:Configuration=Release-Full /p:Platform=x64 working-directory: ./windows @@ -164,7 +165,7 @@ jobs: cache-version: "1" ignore-reserve-cache-error: true - name: Install dependencies - run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static-md + run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -177,7 +178,6 @@ jobs: LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" CARGO_TARGET_DIR: "..\\..\\windows" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 - VCPKG_DEFAULT_TRIPLET: x64-windows-static-md VCPKG_ROOT: ${{ github.workspace }}\vcpkg run: msbuild ccextractor.sln /p:Configuration=Debug-Full /p:Platform=x64 working-directory: ./windows diff --git a/docs/COMPILATION.MD b/docs/COMPILATION.MD index 91e83104..f90373ac 100644 --- a/docs/COMPILATION.MD +++ b/docs/COMPILATION.MD @@ -200,19 +200,20 @@ Other dependencies are required through vcpkg, so you can follow below steps: ``` 3. Set Environment Variable for Vcpkg triplet, you can choose between x86 or x64 based on your system. ``` - setx VCPKG_DEFAULT_TRIPLET "x64-windows-static-md" + setx VCPKG_DEFAULT_TRIPLET "x64-windows-static" + setx RUSTFLAGS "-Ctarget-feature=+crt-static" ``` 4. Install dependencies from vcpkg - In this step we are using `x64-windows-static-md` triplet, but you will have to use the triplet you set in Step 3 + In this step we are using `x64-windows-static` triplet, but you will have to use the triplet you set in Step 3 if building Debug-Full, Release-Full (HardSubx) ``` - vcpkg install ffmpeg leptonica tesseract --triplet x64-windows-static-md + vcpkg install ffmpeg leptonica tesseract --triplet x64-windows-static ``` otherwise if you have Debug, Release ``` - vcpkg install libpng --triplet x64-windows-static-md + vcpkg install libpng --triplet x64-windows-static ``` Note: Following screenshots and steps are based on Visual Studio 2017, but they should be more or less same for other versions. diff --git a/docs/FFMPEG.md b/docs/FFMPEG.md index 0c054988..a722c07a 100644 --- a/docs/FFMPEG.md +++ b/docs/FFMPEG.md @@ -23,15 +23,16 @@ Note:If you installed ffmpeg on non-standard location, please change/update your ``` 3. Set Environment Variable for Vcpkg triplet, you can choose between x86 or x64 based on your system. ``` - setx VCPKG_DEFAULT_TRIPLET "x64-windows-static-md" + setx VCPKG_DEFAULT_TRIPLET "x64-windows-static" + setx RUSTFLAGS "-Ctarget-feature=+crt-static" ``` 4. Install ffmpeg from vcpkg - In this step we are using `x64-windows-static-md` triplet, but you will have to use the triplet you set in Step 3 + In this step we are using `x64-windows-static` triplet, but you will have to use the triplet you set in Step 3 ``` - vcpkg install ffmpeg --triplet x64-windows-static-md + vcpkg install ffmpeg --triplet x64-windows-static ``` ## How to compile ccextractor diff --git a/windows/ccextractor.vcxproj b/windows/ccextractor.vcxproj index d897f5a9..355a7605 100644 --- a/windows/ccextractor.vcxproj +++ b/windows/ccextractor.vcxproj @@ -497,7 +497,7 @@ WIN32;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions) EnableFastChecks - MultiThreadedDebugDLL + MultiThreadedDebug Level3 @@ -576,7 +576,7 @@ SEGMENT_BY_FILE_TIME;ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;ENABLE_OCR;WIN32;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions) EnableFastChecks - MultiThreadedDebugDLL + MultiThreadedDebug Level3 @@ -655,7 +655,7 @@ ..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\gpacmp4;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories) ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;VERSION_FILE_PRESENT;ENABLE_OCR;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions) - MultiThreadedDebugDLL + MultiThreaded Level3 @@ -728,7 +728,7 @@ ..\src\thirdparty\freetype\include;..\src;../src/thirdparty/protobuf-c;../src/thirdparty/win_spec_incld;../src/lib_ccx;../src/thirdparty/lib_hash;../src/thirdparty/gpacmp4;../src/lib_ccx/zvbi;../src/thirdparty;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include\libpng16;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;%(AdditionalIncludeDirectories) VERSION_FILE_PRESENT;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;GPAC_HAVE_CONFIG_H;%(PreprocessorDefinitions) - MultiThreadedDLL + MultiThreaded Level3