From 38980ffd44f013ee43aad6329b157cde28d661e4 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 21 Mar 2023 23:22:07 +0100 Subject: [PATCH] (Windows) Added the libgit2 library as a dependency --- CMakeLists.txt | 3 +++ es-app/CMakeLists.txt | 2 ++ tools/Windows_dependencies_build_MSVC.bat | 19 +++++++++++++++++++ tools/Windows_dependencies_build_MinGW.sh | 16 ++++++++++++++++ tools/Windows_dependencies_setup_MSVC.bat | 20 ++++++++++++++++++++ tools/Windows_dependencies_setup_MinGW.sh | 15 +++++++++++++++ 6 files changed, 75 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7b5b0fd1..f8c9e3423 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,6 +438,7 @@ elseif(WIN32) ${CMAKE_CURRENT_SOURCE_DIR}/external/ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1/include ${CMAKE_CURRENT_SOURCE_DIR}/external/FreeImage/Dist/x64 ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/libgit2/include ${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src ${CMAKE_CURRENT_SOURCE_DIR}/external/SDL2-2.26.3) elseif(EMSCRIPTEN) @@ -499,6 +500,7 @@ elseif(WIN32) ${PROJECT_SOURCE_DIR}/swresample.lib ${PROJECT_SOURCE_DIR}/swscale.lib ${PROJECT_SOURCE_DIR}/FreeImage.lib + ${PROJECT_SOURCE_DIR}/git2.lib ${PROJECT_SOURCE_DIR}/glew32.lib ${PROJECT_SOURCE_DIR}/libcurl-x64.lib ${PROJECT_SOURCE_DIR}/freetype.lib @@ -516,6 +518,7 @@ elseif(WIN32) ${PROJECT_SOURCE_DIR}/swresample-4.dll ${PROJECT_SOURCE_DIR}/swscale-6.dll ${PROJECT_SOURCE_DIR}/FreeImage.dll + ${PROJECT_SOURCE_DIR}/libgit2.dll ${PROJECT_SOURCE_DIR}/glew32.dll ${PROJECT_SOURCE_DIR}/libcurl-x64.dll ${PROJECT_SOURCE_DIR}/libfreetype.dll diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index 772f49c80..c1320fe8b 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -139,6 +139,7 @@ if(WIN32) ../swscale-6.dll ../FreeImage.dll ../freetype.dll + ../git2.dll ../glew32.dll ../libcrypto-1_1-x64.dll ../libcurl-x64.dll @@ -165,6 +166,7 @@ if(WIN32) ../libcrypto-1_1-x64.dll ../libcurl-x64.dll ../libfreetype.dll + ../libgit2.dll ../liblunasvg.dll ../libpugixml.dll ../librlottie.dll diff --git a/tools/Windows_dependencies_build_MSVC.bat b/tools/Windows_dependencies_build_MSVC.bat index 4a15cc5d7..29eb126b9 100644 --- a/tools/Windows_dependencies_build_MSVC.bat +++ b/tools/Windows_dependencies_build_MSVC.bat @@ -46,6 +46,25 @@ copy /Y freetype.dll ..\..\..\ copy /Y freetype.lib ..\..\..\ cd ..\.. +echo Building libgit2 + +if not exist libgit2\build\ ( + echo libgit2 directory is missing, aborting. + cd .. + goto end +) + +cd libgit2\build +if exist CMakeCache.txt ( + nmake clean + del CMakeCache.txt +) + +cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF .. +nmake +copy /Y git2.dll ..\..\..\ +cd ..\.. + echo: echo Building pugixml diff --git a/tools/Windows_dependencies_build_MinGW.sh b/tools/Windows_dependencies_build_MinGW.sh index 78f0bfb04..a06b1e5b1 100644 --- a/tools/Windows_dependencies_build_MinGW.sh +++ b/tools/Windows_dependencies_build_MinGW.sh @@ -57,6 +57,22 @@ strip libfreetype.dll cp libfreetype.dll ../../.. cd ../.. +echo -e "\nBuilding libgit2" + +if [ ! -d libgit2/build ]; then + echo "libgit2 directory is missing, aborting." + exit +fi + +cd libgit2/build +rm -f CMakeCache.txt +cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF .. +make clean +make -j${JOBS} +strip libgit2.dll +cp libgit2.dll ../../.. +cd ../.. + echo -e "\nBuilding pugixml" if [ ! -d pugixml ]; then diff --git a/tools/Windows_dependencies_setup_MSVC.bat b/tools/Windows_dependencies_setup_MSVC.bat index e9300f826..b3dbfdd29 100644 --- a/tools/Windows_dependencies_setup_MSVC.bat +++ b/tools/Windows_dependencies_setup_MSVC.bat @@ -118,6 +118,26 @@ if not exist FreeImage\ ( copy /Y FreeImage\Dist\x64\FreeImage.dll .. copy /Y FreeImage\Dist\x64\FreeImage.lib .. +echo: +echo Setting up libgit2 + +if exist libgit2\ ( + rmdir /S /Q libgit2 +) + +git clone https://github.com/libgit2/libgit2.git + +if not exist libgit2\ ( + echo libgit2 directory is missing, aborting. + cd .. + goto end +) + +cd libgit2 +git checkout v1.6.3 +mkdir build +cd .. + echo: echo Setting up pugixml diff --git a/tools/Windows_dependencies_setup_MinGW.sh b/tools/Windows_dependencies_setup_MinGW.sh index daca7f189..57f02caf2 100644 --- a/tools/Windows_dependencies_setup_MinGW.sh +++ b/tools/Windows_dependencies_setup_MinGW.sh @@ -71,6 +71,21 @@ fi cp -p FreeImage/Dist/x64/FreeImage.dll .. +echo -e "\nSetting up libgit2" +rm -rf libgit2 + +git clone https://github.com/libgit2/libgit2.git + +if [ ! -d libgit2 ]; then + echo "libgit2 directory is missing, aborting." + exit +fi + +cd libgit2 +git checkout v1.6.3 +mkdir build +cd .. + echo -e "\nSetting up pugixml" rm -rf pugixml