Index: build/premake/extern_libs5.lua =================================================================== --- build/premake/extern_libs5.lua +++ build/premake/extern_libs5.lua @@ -314,6 +314,25 @@ end end }, + freetype = { + compile_settings = function() + if os.istarget("windows") then + add_default_include_paths("freetype") + else + pkgconfig.add_includes("freetype2") + end + end, + link_settings = function() + if os.istarget("windows") then + add_default_lib_paths("freetype") + else + pkgconfig.add_links("freetype2") + end + add_default_links({ + win_names = { "freetype" }, + }) + end, + }, gloox = { compile_settings = function() if os.istarget("windows") then Index: build/premake/premake5.lua =================================================================== --- build/premake/premake5.lua +++ build/premake/premake5.lua @@ -757,6 +757,7 @@ "iconv", "libsodium", "fmt", + "freetype", } if not _OPTIONS["without-audio"] then @@ -781,6 +782,7 @@ "spidermonkey", -- for graphics/scripting "boost", "fmt", + "freetype", "icu", } if not _OPTIONS["without-nvtt"] then @@ -964,6 +966,7 @@ "iconv", "libsodium", "fmt", + "freetype", "valgrind", } Index: libraries/osx/build-osx-libs.sh =================================================================== --- libraries/osx/build-osx-libs.sh +++ libraries/osx/build-osx-libs.sh @@ -32,6 +32,7 @@ # libpng was included as part of X11 but that's removed from Mountain Lion # (also the Snow Leopard version was ancient 1.2) PNG_VERSION="libpng-1.6.36" +FREETYPE_VERSION="freetype-2.10.4" OGG_VERSION="libogg-1.3.3" VORBIS_VERSION="libvorbis-1.3.7" # gloox requires GnuTLS, GnuTLS requires Nettle and GMP @@ -500,6 +501,42 @@ popd > /dev/null # -------------------------------------------------------------- +echo -e "Building freetype..." + +LIB_VERSION="${FREETYPE_VERSION}" +LIB_ARCHIVE="$LIB_VERSION.tar.gz" +LIB_DIRECTORY="$LIB_VERSION" +LIB_URL="https://download.savannah.gnu.org/releases/freetype/" + +mkdir -p freetype +pushd freetype > /dev/null + +if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] +then + INSTALL_DIR="$(pwd)" + + rm -f .already-built + download_lib $LIB_URL $LIB_ARCHIVE + + rm -rf $LIB_DIRECTORY bin include lib share + tar -xf $LIB_ARCHIVE + pushd $LIB_DIRECTORY + + (./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ + --prefix=$INSTALL_DIR \ + --enable-shared=no \ + --with-bzip2=no \ + --with-brotli=no \ + && make ${JOBS} && make install) || die "freetype build failed" + popd + cp -f lib/pkgconfig/* $PC_PATH + echo "$LIB_VERSION" > .already-built +else + already_built +fi +popd > /dev/null + +# -------------------------------------------------------------- # Dependency of vorbis echo -e "Building libogg..." Index: source/ps/GameSetup/HWDetect.cpp =================================================================== --- source/ps/GameSetup/HWDetect.cpp +++ source/ps/GameSetup/HWDetect.cpp @@ -48,6 +48,10 @@ #include "scriptinterface/Object.h" #include "scriptinterface/ScriptInterface.h" +// FreeType headers might have an include order. +#include +#include + #if OS_LINUX #include #endif @@ -81,9 +85,11 @@ #include #endif +#include #include static void ReportSDL(const ScriptRequest& rq, JS::HandleValue settings); +static void ReportFreeType(const ScriptRequest& rq, JS::HandleValue settings); static void ReportVulkan(const ScriptRequest& rq, JS::HandleValue settings); static void ReportGLLimits(const ScriptRequest& rq, JS::HandleValue settings); @@ -165,6 +171,8 @@ #endif ReportSDL(rq, settings); + ReportFreeType(rq, settings); + ReportVulkan(rq, settings); ReportGLLimits(rq, settings); @@ -226,7 +234,7 @@ Script::SetProperty(rq, settings, "timer_resolution", timer_Resolution()); // The version should be increased for every meaningful change. - const int reportVersion = 16; + const int reportVersion = 17; // Send the same data to the reporting system g_UserReporter.SubmitReport( @@ -258,6 +266,26 @@ Script::SetProperty(rq, settings, "sdl_video_backend", backend ? backend : "unknown"); } +static void ReportFreeType(const ScriptRequest& rq, JS::HandleValue settings) +{ + FT_Library FTLibrary; + std::string FTSupport = "unsupported"; + if (!FT_Init_FreeType(&FTLibrary)) + { + FT_Int major, minor, patch; + FT_Library_Version(FTLibrary, &major, &minor, &patch); + FT_Done_FreeType(FTLibrary); + std::stringstream version; + version << major << "." << minor << "." << patch; + FTSupport = version.str(); + } + else + { + FTSupport = "cantload"; + } + Script::SetProperty(rq, settings, "freetype", FTSupport); +} + static void ReportVulkan(const ScriptRequest& rq, JS::HandleValue settings) { std::string vulkanSupport = "unsupported";