(Windows) Removed support for building the application using MinGW

This commit is contained in:
Leon Styhre 2023-12-19 17:38:21 +01:00
parent 116d73c62a
commit 717dce004d
8 changed files with 66 additions and 457 deletions

View file

@ -127,8 +127,7 @@ if(APPLE)
endif()
find_package(CURL REQUIRED)
elseif(WIN32)
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/external/pugixml/libpugixml.dll AND # MinGW
NOT EXISTS ${PROJECT_SOURCE_DIR}/external/pugixml/pugixml.dll) # MSVC
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/external/pugixml/pugixml.dll)
message(FATAL_ERROR "-- You need to build the dependencies in ./external first")
endif()
elseif(NOT EMSCRIPTEN AND NOT ANDROID)
@ -164,12 +163,9 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1)
message(SEND_ERROR "You need at least GCC 7.1 to compile ES-DE")
endif()
if(WIN32)
set(CMAKE_CXX_FLAGS "-mwindows ${CMAKE_CXX_FLAGS}")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
message("-- Compiler is MSVC")
# If using the MSVC compiler on Windows, disable the built-in min() and max() macros.
# Disable the built-in min() and max() macros.
add_compile_definitions(NOMINMAX)
endif()
@ -525,44 +521,23 @@ if(APPLE)
${PROJECT_SOURCE_DIR}/libpugixml.a
${PROJECT_SOURCE_DIR}/libSDL2-2.0.0.dylib)
elseif(WIN32)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(COMMON_LIBRARIES ${PROJECT_SOURCE_DIR}/avcodec.lib
${PROJECT_SOURCE_DIR}/avfilter.lib
${PROJECT_SOURCE_DIR}/avformat.lib
${PROJECT_SOURCE_DIR}/avutil.lib
${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
${PROJECT_SOURCE_DIR}/lunasvg.lib
${PROJECT_SOURCE_DIR}/pugixml.lib
${PROJECT_SOURCE_DIR}/rlottie.lib
${PROJECT_SOURCE_DIR}/SDL2main.lib
${PROJECT_SOURCE_DIR}/SDL2.lib
Winmm.dll)
else()
set(COMMON_LIBRARIES ${PROJECT_SOURCE_DIR}/avcodec-60.dll
${PROJECT_SOURCE_DIR}/avfilter-9.dll
${PROJECT_SOURCE_DIR}/avformat-60.dll
${PROJECT_SOURCE_DIR}/avutil-58.dll
${PROJECT_SOURCE_DIR}/swresample-4.dll
${PROJECT_SOURCE_DIR}/swscale-7.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
${PROJECT_SOURCE_DIR}/liblunasvg.dll
${PROJECT_SOURCE_DIR}/libpugixml.dll
${PROJECT_SOURCE_DIR}/libSDL2main.a
${PROJECT_SOURCE_DIR}/librlottie.dll
${PROJECT_SOURCE_DIR}/SDL2.dll
mingw32
Winmm.dll)
endif()
set(COMMON_LIBRARIES ${PROJECT_SOURCE_DIR}/avcodec.lib
${PROJECT_SOURCE_DIR}/avfilter.lib
${PROJECT_SOURCE_DIR}/avformat.lib
${PROJECT_SOURCE_DIR}/avutil.lib
${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
${PROJECT_SOURCE_DIR}/lunasvg.lib
${PROJECT_SOURCE_DIR}/pugixml.lib
${PROJECT_SOURCE_DIR}/rlottie.lib
${PROJECT_SOURCE_DIR}/SDL2main.lib
${PROJECT_SOURCE_DIR}/SDL2.lib
Winmm.dll)
elseif(ANDROID)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES}
# FFmpeg libraries.

View file

@ -147,124 +147,49 @@ endif()
if(WIN32)
install(TARGETS ES-DE RUNTIME DESTINATION .)
install(TARGETS es-pdf-convert RUNTIME DESTINATION es-pdf-converter)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
endif()
install(FILES ../avcodec-60.dll
../avfilter-9.dll
../avformat-60.dll
../avutil-58.dll
../postproc-57.dll
../swresample-4.dll
../swscale-7.dll
../FreeImage.dll
../freetype.dll
../git2.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libssl-1_1-x64.dll
../lunasvg.dll
../pugixml.dll
../rlottie.dll
../SDL2.dll
../vcomp140.dll
DESTINATION .)
install(FILES ../es-pdf-converter/charset.dll
../es-pdf-converter/deflate.dll
../es-pdf-converter/freetype.dll
../es-pdf-converter/iconv.dll
../es-pdf-converter/jpeg8.dll
../es-pdf-converter/lcms2.dll
../es-pdf-converter/Lerc.dll
../es-pdf-converter/libcrypto-3-x64.dll
../es-pdf-converter/libcurl.dll
../es-pdf-converter/liblzma.dll
../es-pdf-converter/libpng16.dll
../es-pdf-converter/libssh2.dll
../es-pdf-converter/openjp2.dll
../es-pdf-converter/poppler.dll
../es-pdf-converter/poppler-cpp.dll
../es-pdf-converter/tiff.dll
../es-pdf-converter/zlib.dll
../es-pdf-converter/zstd.dll
DESTINATION es-pdf-converter)
else()
install(FILES ../avcodec-60.dll
../avfilter-9.dll
../avformat-60.dll
../avutil-58.dll
../postproc-57.dll
../swresample-4.dll
../swscale-7.dll
../FreeImage.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libfreetype.dll
../libgit2.dll
../liblunasvg.dll
../libpugixml.dll
../librlottie.dll
../libssl-1_1-x64.dll
../SDL2.dll
../vcomp140.dll
DESTINATION .)
install(FILES ../es-pdf-converter/libbrotlicommon.dll
../es-pdf-converter/libbrotlidec.dll
../es-pdf-converter/libbz2-1.dll
../es-pdf-converter/libcairo-2.dll
../es-pdf-converter/libcrypto-3-x64.dll
../es-pdf-converter/libcurl-4.dll
../es-pdf-converter/libdeflate.dll
../es-pdf-converter/libexpat-1.dll
../es-pdf-converter/libffi-8.dll
../es-pdf-converter/libfontconfig-1.dll
../es-pdf-converter/libfreetype-6.dll
../es-pdf-converter/libgcc_s_seh-1.dll
../es-pdf-converter/libgio-2.0-0.dll
../es-pdf-converter/libglib-2.0-0.dll
../es-pdf-converter/libgmodule-2.0-0.dll
../es-pdf-converter/libgobject-2.0-0.dll
../es-pdf-converter/libgraphite2.dll
../es-pdf-converter/libharfbuzz-0.dll
../es-pdf-converter/libiconv-2.dll
../es-pdf-converter/libidn2-0.dll
../es-pdf-converter/libintl-8.dll
../es-pdf-converter/libjbig-0.dll
../es-pdf-converter/libjpeg-8.dll
../es-pdf-converter/liblcms2-2.dll
../es-pdf-converter/libLerc.dll
../es-pdf-converter/liblzma-5.dll
../es-pdf-converter/libnghttp2-14.dll
../es-pdf-converter/libnspr4.dll
../es-pdf-converter/libopenjp2-7.dll
../es-pdf-converter/libpcre2-8-0.dll
../es-pdf-converter/libpixman-1-0.dll
../es-pdf-converter/libplc4.dll
../es-pdf-converter/libplds4.dll
../es-pdf-converter/libpng16-16.dll
../es-pdf-converter/libpoppler-129.dll
../es-pdf-converter/libpoppler-cpp-0.dll
../es-pdf-converter/libpoppler-glib-8.dll
../es-pdf-converter/libpsl-5.dll
../es-pdf-converter/libsharpyuv-0.dll
../es-pdf-converter/libssh2-1.dll
../es-pdf-converter/libssl-3-x64.dll
../es-pdf-converter/libstdc++-6.dll
../es-pdf-converter/libtiff-6.dll
../es-pdf-converter/libunistring-5.dll
../es-pdf-converter/libwebp-7.dll
../es-pdf-converter/libwinpthread-1.dll
../es-pdf-converter/libzstd.dll
../es-pdf-converter/nss3.dll
../es-pdf-converter/nssutil3.dll
../es-pdf-converter/smime3.dll
../es-pdf-converter/zlib1.dll
DESTINATION es-pdf-converter)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
endif()
install(FILES ../avcodec-60.dll
../avfilter-9.dll
../avformat-60.dll
../avutil-58.dll
../postproc-57.dll
../swresample-4.dll
../swscale-7.dll
../FreeImage.dll
../freetype.dll
../git2.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libssl-1_1-x64.dll
../lunasvg.dll
../pugixml.dll
../rlottie.dll
../SDL2.dll
../vcomp140.dll
DESTINATION .)
install(FILES ../es-pdf-converter/charset.dll
../es-pdf-converter/deflate.dll
../es-pdf-converter/freetype.dll
../es-pdf-converter/iconv.dll
../es-pdf-converter/jpeg8.dll
../es-pdf-converter/lcms2.dll
../es-pdf-converter/Lerc.dll
../es-pdf-converter/libcrypto-3-x64.dll
../es-pdf-converter/libcurl.dll
../es-pdf-converter/liblzma.dll
../es-pdf-converter/libpng16.dll
../es-pdf-converter/libssh2.dll
../es-pdf-converter/openjp2.dll
../es-pdf-converter/poppler.dll
../es-pdf-converter/poppler-cpp.dll
../es-pdf-converter/tiff.dll
../es-pdf-converter/zlib.dll
../es-pdf-converter/zstd.dll
DESTINATION es-pdf-converter)
install(FILES ../LICENSE DESTINATION .)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses DESTINATION .)

View file

@ -10,14 +10,9 @@ project(es-pdf-convert)
if(WIN32)
set(POPPLER_CPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/poppler/Library/include/poppler/cpp)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/poppler-cpp.lib)
# Disable DLL interface warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
else()
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/libpoppler-cpp-0.dll)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode")
endif()
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/poppler-cpp.lib)
# Disable DLL interface warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
elseif(APPLE)
set(POPPLER_CPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/poppler/cpp ${CMAKE_CURRENT_SOURCE_DIR}/../external/poppler/build/cpp)
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/../libpoppler-cpp.0.dylib)

View file

@ -27,11 +27,6 @@ endif()
unset(CMAKE_CXX_FLAGS)
unset(CMAKE_EXE_LINKER_FLAGS)
# Strip the DLL files when building with MinGW.
if(WIN32 AND NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
endif()
if (WIN32)
set(BUILD_SHARED_LIBS ON)
else()

View file

@ -1,7 +1,7 @@
:: SPDX-License-Identifier: MIT
::
:: ES-DE
:: Windows_dependencies_build_MSVC.bat
:: Windows_dependencies_build.bat
::
:: Builds the external dependencies in-tree using MSVC.
:: The Windows_dependencies_setup_MSVC.bat script must have been executed prior to this.

View file

@ -1,93 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# ES-DE
# Windows_dependencies_build_MinGW.sh
#
# Builds the external dependencies in-tree.
# The Windows_dependencies_setup_MinGW.sh script must have been executed prior to this.
# All libraries will be recompiled from scratch every time.
#
# This script needs to run from the root of the repository.
#
# How many CPU threads to use for the compilation.
JOBS=4
if [ ! -f .clang-format ]; then
echo "You need to run this script from the root of the repository."
exit
fi
cd external
if [ ! -d pugixml ]; then
echo "You need to first run tools/Windows_dependencies_setup_MinGW.sh to download and configure the dependencies."
exit
fi
echo "Building all dependencies in the ./external directory..."
echo -e "\nBuilding GLEW"
if [ ! -d glew ]; then
echo "GLEW directory is missing, aborting."
exit
fi
cd glew
make clean
make -j${JOBS} 2>/dev/null
cp lib/glew32.dll ../..
cd ..
echo -e "\nBuilding FreeType"
if [ ! -d freetype/build ]; then
echo "FreeType directory is missing, aborting."
exit
fi
cd freetype/build
rm -f CMakeCache.txt
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
make clean
make -j${JOBS}
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
echo "pugixml directory is missing, aborting."
exit
fi
cd pugixml
rm -f CMakeCache.txt
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .
make clean
make -j${JOBS}
strip libpugixml.dll
cp libpugixml.dll ../..
cd ..
echo
echo "Done building all dependencies."

View file

@ -1,7 +1,7 @@
:: SPDX-License-Identifier: MIT
::
:: ES-DE
:: Windows_dependencies_setup_MSVC.bat
:: Windows_dependencies_setup.bat
::
:: Downloads and prepares the external dependencies for building in-tree using MSVC.
:: If the directories already exist they will be removed and the libraries will be downloaded again.

View file

@ -1,188 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# ES-DE
# Windows_dependencies_setup_MinGW.sh
#
# Downloads and prepares the external dependencies for building in-tree.
# If the directories already exist they will be removed and the libraries will be downloaded again.
#
# This script needs to run from the root of the repository.
#
if [ ! -f .clang-format ]; then
echo "You need to run this script from the root of the repository."
exit
fi
echo -e "Setting up dependencies in the ./external directory..."
cd external
echo -e "\nSetting up curl"
rm -rf curl*
curl -O https://curl.se/windows/dl-8.2.1_11/curl-8.2.1_11-win64-mingw.zip
unzip curl-8.2.1_11-win64-mingw.zip
if [ ! -d curl-8.2.1_11-win64-mingw ]; then
echo "curl directory is missing, aborting."
exit
fi
# Needed due to some kind of file system race condition that sometimes occurs on Windows.
sleep 3
mv curl-8.2.1_11-win64-mingw curl
cp -p curl/bin/libcurl-x64.dll ..
echo -e "\nSetting up GLEW"
rm -rf glew*
curl -LO https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip
unzip glew-2.1.0.zip
if [ ! -d glew-2.1.0 ]; then
echo "GLEW directory is missing, aborting."
exit
fi
sleep 3
mv glew-2.1.0 glew
echo -e "\nSetting up FreeType"
rm -rf freetype
git clone https://github.com/freetype/freetype.git
if [ ! -d freetype ]; then
echo "FreeType directory is missing, aborting."
exit
fi
cd freetype
git checkout VER-2-13-0
mkdir build
cd ..
echo -e "\nSetting up FreeImage"
rm -rf FreeImage*
curl -LO https://downloads.sourceforge.net/project/freeimage/Binary%20Distribution/3.18.0/FreeImage3180Win32Win64.zip
unzip FreeImage3180Win32Win64.zip
if [ ! -d FreeImage ]; then
echo "FreeImage directory is missing, aborting."
exit
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.7.1
mkdir build
cd ..
echo -e "\nSetting up Poppler"
rm -rf [pP]oppler*
curl -JO https://gitlab.com/es-de/emulationstation-de/-/package_files/83268133/download
unzip Poppler_Windows_MinGW_23.06.0-1.zip
if [ ! -d poppler ]; then
echo "Poppler directory is missing, aborting."
exit
fi
cp -p poppler/Library/bin/*.dll ../es-pdf-converter
echo -e "\nSetting up pugixml"
rm -rf pugixml
git clone https://github.com/zeux/pugixml.git
if [ ! -d pugixml ]; then
echo "pugixml directory is missing, aborting."
exit
fi
cd pugixml
git checkout v1.13
cd ..
echo -e "\nSetting up SDL"
rm -rf SDL2*
curl -O https://libsdl.org/release/SDL2-devel-2.28.5-mingw.tar.gz
tar xvzf SDL2-devel-2.28.5-mingw.tar.gz
if [ ! -d SDL2-2.28.5 ]; then
echo "SDL directory is missing, aborting."
exit
fi
sleep 3
mv SDL2-2.28.5 SDL2
mv SDL2/x86_64-w64-mingw32/include/SDL2 SDL2/
cp -p SDL2/x86_64-w64-mingw32/lib/libSDL2main.a ..
cp -p SDL2/x86_64-w64-mingw32/bin/SDL2.dll ..
echo -e "\nSetting up FFmpeg"
rm -rf ffmpeg*
# This package should be available for download for two years.
curl -LO https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2023-05-31-12-47/ffmpeg-n6.0-22-g549430e14d-win64-gpl-shared-6.0.zip
unzip ffmpeg-n6.0-22-g549430e14d-win64-gpl-shared-6.0.zip
if [ ! -d ffmpeg-n6.0-22-g549430e14d-win64-gpl-shared-6.0 ]; then
echo "FFmpeg directory is missing, aborting."
exit
fi
sleep 3
mv ffmpeg-n6.0-22-g549430e14d-win64-gpl-shared-6.0 ffmpeg
cp -p ffmpeg/bin/avcodec-60.dll ..
cp -p ffmpeg/bin/avfilter-9.dll ..
cp -p ffmpeg/bin/avformat-60.dll ..
cp -p ffmpeg/bin/avutil-58.dll ..
cp -p ffmpeg/bin/postproc-57.dll ..
cp -p ffmpeg/bin/swresample-4.dll ..
cp -p ffmpeg/bin/swscale-7.dll ..
echo -e "\nSetting up OpenSSL"
if [ ! -f /c/Program\ Files/OpenSSL-Win64/libcrypto-1_1-x64.dll ]; then
curl -O https://slproweb.com/download/Win64OpenSSL_Light-1_1_1m.exe
# Run the installer.
./Win64OpenSSL_Light-1_1_1m.exe
fi
# Return to the root of the repository.
cd ..
cp -p /c/Program\ Files/OpenSSL-Win64/libcrypto-1_1-x64.dll .
cp -p /c/Program\ Files/OpenSSL-Win64/libssl-1_1-x64.dll .
echo -e "\nCopying DLL files from Windows\System32"
cp /c/Windows/System32/vcomp140.dll .
echo
echo "Done setting up all dependencies."