diff --git a/CMakeLists.txt b/CMakeLists.txt index b992d62..0293b38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,7 @@ add_library(cmp_core STATIC dep/compressonator/cmp_core/shaders/bc3_encode_kernel.cpp dep/compressonator/cmp_core/shaders/bc7_encode_kernel.cpp ) +set_target_properties(cmp_core PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(cmp_core PRIVATE dep/compressonator/applications/_libs/cmp_math @@ -168,9 +169,13 @@ add_library(imgui STATIC dep/imgui/misc/cpp/imgui_stdlib.h ) -target_compile_definitions(imgui PUBLIC - "IMGUI_IMPL_OPENGL_ES2" -) +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + # On Linux: use system GLES3 via EGL (same context as engine/glad), not ANGLE. + # IMGUI_IMPL_OPENGL_ES3 uses declarations resolved through glad at link time. + target_compile_definitions(imgui PUBLIC "IMGUI_IMPL_OPENGL_ES3") +else() + target_compile_definitions(imgui PUBLIC "IMGUI_IMPL_OPENGL_ES2") +endif() target_include_directories(imgui PUBLIC dep/imgui @@ -178,10 +183,12 @@ target_include_directories(imgui PUBLIC dep/imgui/misc/cpp ) -target_link_libraries(imgui PUBLIC - unofficial::angle::libGLESv2 - glfw -) +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + target_link_libraries(imgui PUBLIC glfw GLESv2) +else() + target_link_libraries(imgui PUBLIC unofficial::angle::libGLESv2 glfw) +endif() +set_target_properties(imgui PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(SimpleGraphic PRIVATE @@ -194,6 +201,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") PRIVATE "-export-dynamic" ) + target_compile_options(SimpleGraphic + PRIVATE + "-Wno-template-body" + ) endif () if (WIN32) @@ -240,11 +251,11 @@ target_link_libraries(SimpleGraphic Threads::Threads WebP::webpdecoder ZLIB::ZLIB - zstd::libzstd_shared + $,zstd::libzstd_shared,zstd::libzstd_static> ) install(FILES $ DESTINATION ".") -install(TARGETS SimpleGraphic RUNTIME DESTINATION ".") +install(TARGETS SimpleGraphic RUNTIME DESTINATION "." LIBRARY DESTINATION ".") if (WIN32) set(DEPS_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") @@ -282,29 +293,47 @@ endif () set(LCURL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/Lua-cURLv3) file(GLOB LCURL_SOURCES ${LCURL_SOURCE_DIR}/src/**.c) add_library(lcurl SHARED ${LCURL_SOURCES}) +if (NOT WIN32) + set_target_properties(lcurl PROPERTIES PREFIX "") +endif() target_include_directories(lcurl PRIVATE ${LCURL_SOURCE_DIR}/src ) +if (NOT WIN32) + # LuaJIT 2.1 already provides luaL_setfuncs; l52util.c also defines it as a Lua 5.1 compat shim + target_link_options(lcurl PRIVATE "-Wl,--allow-multiple-definition") +endif() + target_link_libraries(lcurl PRIVATE CURL::libcurl LuaJIT::LuaJIT ) -install(TARGETS lcurl RUNTIME DESTINATION ".") +install(TARGETS lcurl RUNTIME DESTINATION "." LIBRARY DESTINATION ".") install(FILES $ DESTINATION ".") # luautf8 module add_library(lua-utf8 SHARED libs/luautf8/lutf8lib.c) +if (NOT WIN32) + set_target_properties(lua-utf8 PROPERTIES OUTPUT_NAME "lua-utf8" PREFIX "") +endif() -target_compile_definitions(lua-utf8 - PRIVATE - LUA_BUILD_AS_DLL -) +if (WIN32) + target_compile_definitions(lua-utf8 + PRIVATE + LUA_BUILD_AS_DLL + ) +else() + target_compile_options(lua-utf8 + PRIVATE + "-include" "limits.h" + ) +endif() target_include_directories(lua-utf8 PRIVATE @@ -315,11 +344,18 @@ target_link_libraries(lua-utf8 LuaJIT::LuaJIT ) -install(TARGETS lua-utf8 RUNTIME DESTINATION ".") +install(TARGETS lua-utf8 RUNTIME DESTINATION "." LIBRARY DESTINATION ".") install(FILES $ DESTINATION ".") # luasocket module +set(LUASOCKET_PLATFORM_SOURCES) +if (WIN32) + set(LUASOCKET_PLATFORM_SOURCES "libs/luasocket/src/wsocket.c") +else() + set(LUASOCKET_PLATFORM_SOURCES "libs/luasocket/src/usocket.c") +endif() + add_library(luasocket SHARED "libs/luasocket/src/auxiliar.c" "libs/luasocket/src/buffer.c" @@ -333,7 +369,7 @@ add_library(luasocket SHARED "libs/luasocket/src/tcp.c" "libs/luasocket/src/timeout.c" "libs/luasocket/src/udp.c" - "libs/luasocket/src/wsocket.c" + ${LUASOCKET_PLATFORM_SOURCES} ) target_include_directories(luasocket @@ -341,20 +377,27 @@ target_include_directories(luasocket ${LSOCKET_SOURCE_DIR}/src ) +set(LUASOCKET_PLATFORM_LIBS) +if (WIN32) + set(LUASOCKET_PLATFORM_LIBS wsock32 ws2_32) +endif() + target_link_libraries(luasocket PRIVATE LuaJIT::LuaJIT - wsock32 - ws2_32 + ${LUASOCKET_PLATFORM_LIBS} ) -set_target_properties( luasocket PROPERTIES OUTPUT_NAME "socket" ) -install(TARGETS luasocket RUNTIME DESTINATION ".") +set_target_properties(luasocket PROPERTIES OUTPUT_NAME "socket" PREFIX "") +install(TARGETS luasocket RUNTIME DESTINATION "." LIBRARY DESTINATION ".") install(FILES $ DESTINATION ".") # lzip module add_library(lzip SHARED libs/LZip/lzip.cpp) +if (NOT WIN32) + set_target_properties(lzip PROPERTIES PREFIX "") +endif() target_include_directories(lzip PRIVATE @@ -366,5 +409,12 @@ target_link_libraries(lzip ZLIB::ZLIB ) -install(TARGETS lzip RUNTIME DESTINATION ".") +install(TARGETS lzip RUNTIME DESTINATION "." LIBRARY DESTINATION ".") install(FILES $ DESTINATION ".") + +# Linux launcher +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + add_executable(PathOfBuilding linux/launcher.c) + target_link_libraries(PathOfBuilding PRIVATE ${CMAKE_DL_LIBS}) + install(TARGETS PathOfBuilding RUNTIME DESTINATION ".") +endif() diff --git a/cmake/FindLuaJIT.cmake b/cmake/FindLuaJIT.cmake index a037bf5..f2b28c5 100644 --- a/cmake/FindLuaJIT.cmake +++ b/cmake/FindLuaJIT.cmake @@ -9,15 +9,15 @@ if (DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET) find_path(LuaJIT_INCLUDE_DIR luajit.h PATHS ${LuaJIT_SEARCH_ROOT}/include - PATH_SUFFIXES luajit + PATH_SUFFIXES luajit luajit-2.1 luajit-2.0 NO_DEFAULT_PATH) - find_library(LuaJIT_LIBRARY_RELEASE NAMES lua51 + find_library(LuaJIT_LIBRARY_RELEASE NAMES lua51 luajit-5.1 PATHS ${LuaJIT_SEARCH_ROOT} PATH_SUFFIXES lib NO_DEFAULT_PATH) - find_library(LuaJIT_LIBRARY_DEBUG NAMES lua51 + find_library(LuaJIT_LIBRARY_DEBUG NAMES lua51 luajit-5.1 PATHS ${LuaJIT_SEARCH_ROOT} PATH_SUFFIXES debug/lib NO_DEFAULT_PATH) diff --git a/engine/common/base64.c b/engine/common/base64.c index c02a2b6..13e4ddd 100644 --- a/engine/common/base64.c +++ b/engine/common/base64.c @@ -29,6 +29,7 @@ #include "base64.h" #include +#include /* ---- Base64 Encoding/Decoding Table --- */ /* Padding character string starts at offset 64. */ @@ -47,7 +48,7 @@ static const unsigned char decodetable[] = 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; /* - * Base64Decode() née Curl_base64_decode() + * Base64Decode() n�e Curl_base64_decode() * * Given a base64 NUL-terminated string at src, decode it and return a * pointer in *outptr to a newly allocated memory area holding decoded @@ -235,7 +236,7 @@ static bool base64_encode(const char* table64, } /* - * Base64Encode() née Curl_base64_encode() + * Base64Encode() n�e Curl_base64_encode() * * Given a pointer to an input buffer and an input size, encode it and * return a pointer in *outptr to a newly allocated memory area holding @@ -256,7 +257,7 @@ bool Base64Encode(const char* inputbuff, size_t insize, } /* - * Base64UrlEncode() née Curl_base64url_encode() + * Base64UrlEncode() n�e Curl_base64url_encode() * * Given a pointer to an input buffer and an input size, encode it and * return a pointer in *outptr to a newly allocated memory area holding diff --git a/engine/common/base64.h b/engine/common/base64.h index 5cb097f..e23e374 100644 --- a/engine/common/base64.h +++ b/engine/common/base64.h @@ -26,6 +26,7 @@ // Modified for standalone inclusion in SimpleGraphic. #include +#include #ifdef __cplusplus extern "C" { diff --git a/engine/common/common.cpp b/engine/common/common.cpp index 9242236..c38774b 100644 --- a/engine/common/common.cpp +++ b/engine/common/common.cpp @@ -430,6 +430,8 @@ char* NarrowUTF8String(const wchar_t* str) return NarrowCodepageString(str, CP_UTF8); } +#endif + IndexedUTF32String IndexUTF8ToUTF32(std::string_view input) { IndexedUTF32String ret{}; @@ -494,4 +496,3 @@ IndexedUTF32String IndexUTF8ToUTF32(std::string_view input) return ret; } -#endif diff --git a/engine/core/core_compress.cpp b/engine/core/core_compress.cpp index 813de37..91578b9 100644 --- a/engine/core/core_compress.cpp +++ b/engine/core/core_compress.cpp @@ -1,4 +1,5 @@ #include "core_compress.h" +#include std::optional> CompressZstandard(gsl::span src, std::optional level) { diff --git a/engine/render/r_font.cpp b/engine/render/r_font.cpp index 90375b3..dc35178 100644 --- a/engine/render/r_font.cpp +++ b/engine/render/r_font.cpp @@ -6,6 +6,7 @@ #include "r_local.h" +#include #include #include #include diff --git a/engine/render/r_main.cpp b/engine/render/r_main.cpp index 1d46715..955f1dd 100644 --- a/engine/render/r_main.cpp +++ b/engine/render/r_main.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include @@ -1084,7 +1086,7 @@ void r_renderer_c::Init(r_featureFlag_e features) ImGui::SetCurrentContext(imguiCtx); ImGui_ImplGlfw_InitForOpenGL((GLFWwindow*)sys->video->GetWindowHandle(), true); - ImGui_ImplOpenGL3_Init("#version 100"); + ImGui_ImplOpenGL3_Init(nullptr); fonts[F_FIXED] = new r_font_c(this, "Bitstream Vera Sans Mono"); fonts[F_VAR] = new r_font_c(this, "Liberation Sans"); @@ -1640,7 +1642,7 @@ void r_renderer_c::GetShaderImageSize(r_shaderHnd_c* hnd, int& width, int& heigh if (hnd) { while (hnd->sh->tex->status < r_tex_c::SIZE_KNOWN) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } width = hnd->sh->tex->fileWidth; height = hnd->sh->tex->fileHeight; diff --git a/engine/render/r_texture.cpp b/engine/render/r_texture.cpp index 07fdda8..91c5f9b 100644 --- a/engine/render/r_texture.cpp +++ b/engine/render/r_texture.cpp @@ -4,7 +4,9 @@ // Module: Render Texture // +#include #include +#include #include #include #include "r_local.h" @@ -504,7 +506,7 @@ static gli::texture2d_array TranscodeTexture(gli::texture2d_array src, gli::form for (size_t blockRow = 0; blockRow < srcBlocksPerRow; ++blockRow) { const size_t rowBase = blockRow * srcBlockSize.y; - const size_t rowsLeft = (std::min)(4ull, dstExtent.y - rowBase); + const size_t rowsLeft = (std::min)(size_t{4}, dstExtent.y - rowBase); for (size_t blockCol = 0; blockCol < srcBlocksPerColumn; ++blockCol) { // Read source 4x4 texel block, no branching needed. @@ -524,7 +526,7 @@ static gli::texture2d_array TranscodeTexture(gli::texture2d_array src, gli::form // Here we work off that dstData points at the top left pixel of the block row in the destination. const size_t colBase = blockCol * srcBlockSize.x; - const size_t colsLeft = (std::min)(4ull, dstExtent.x - colBase); + const size_t colsLeft = (std::min)(size_t{4}, dstExtent.x - colBase); const size_t colBytesLeft = colsLeft * 4; for (size_t innerRow = 0; innerRow < rowsLeft; ++innerRow) { auto* dstPtr = dstData + dstRowStride * innerRow + colBase * 4; diff --git a/engine/system/win/sys_main.cpp b/engine/system/win/sys_main.cpp index 3078e0d..8ad9dcb 100644 --- a/engine/system/win/sys_main.cpp +++ b/engine/system/win/sys_main.cpp @@ -18,6 +18,7 @@ #elif __linux__ #include #include +#include #elif __APPLE__ && __MACH__ #include #endif @@ -25,14 +26,15 @@ #ifndef _WIN32 #include #include -#include #endif #include #include #include #include +#include #include +#include #include @@ -429,8 +431,22 @@ void sys_main_c::SpawnProcess(std::filesystem::path cmdName, const char* argList } FreeWideString(wideArgs); #else -#warning LV: Subprocesses not implemented on this OS. - // TODO(LV): Implement subprocesses for other OSes. + std::vector args; + args.push_back(cmdName.string()); + // Split argList on spaces (simple split, sufficient for PoB's usage) + if (argList && argList[0]) { + std::istringstream iss(argList); + std::string token; + while (iss >> token) args.push_back(token); + } + pid_t pid = fork(); + if (pid == 0) { + std::vector argv; + for (auto& a : args) argv.push_back(const_cast(a.c_str())); + argv.push_back(nullptr); + execvp(argv[0], argv.data()); + _exit(1); + } #endif } @@ -468,9 +484,12 @@ const char* PlatformOpenURL(const char* url) ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOWDEFAULT); return nullptr; #else -#warning LV: URL opening not implemented on this OS. - // TODO(LV): Implement URL opening for other OSes. - return AllocString("URL opening not implemented on this OS."); + std::string cmd = std::string("xdg-open ") + url + " &"; + int ret = system(cmd.c_str()); + if (ret != 0) { + return AllocString("xdg-open failed to open URL."); + } + return nullptr; #endif } #else @@ -563,6 +582,11 @@ std::filesystem::path FindBasePath() GetModuleFileNameW(NULL, basePath.data(), basePath.size()); progPath = basePath.data(); #elif __linux__ + if (const char* sgBasePath = ::getenv("SG_BASE_PATH")) { + progPath = sgBasePath; + progPath = weakly_canonical(progPath); + return progPath; + } char basePath[PATH_MAX]; ssize_t len = ::readlink("/proc/self/exe", basePath, sizeof(basePath)); if (len == -1 || len == sizeof(basePath)) @@ -710,7 +734,7 @@ bool sys_main_c::Run(int argc, char** argv) } #else catch (std::exception& e) { - Error("Exception: ", e.what()); + Error("Exception: %s", e.what()); } #endif diff --git a/linux/launcher.c b/linux/launcher.c new file mode 100644 index 0000000..0a0a133 --- /dev/null +++ b/linux/launcher.c @@ -0,0 +1,100 @@ +// Linux launcher for SimpleGraphic / Path of Building +// Loads libSimpleGraphic.so from the same directory and calls RunLuaFileAsWin. + +#include +#include +#include +#include +#include +#include +#include + +typedef int (*RunLuaFileAsWin_t)(int argc, char** argv); + +int main(int argc, char** argv) +{ + // Resolve our own executable's directory + char exePath[PATH_MAX]; + ssize_t len = readlink("/proc/self/exe", exePath, sizeof(exePath) - 1); + if (len == -1) { + perror("readlink /proc/self/exe"); + return 1; + } + exePath[len] = '\0'; + + char exeDir[PATH_MAX]; + strncpy(exeDir, exePath, sizeof(exeDir)); + char* dir = dirname(exeDir); + + // Load libSimpleGraphic.so from the same directory + char libPath[PATH_MAX]; + snprintf(libPath, sizeof(libPath), "%s/libSimpleGraphic.so", dir); + + void* lib = dlopen(libPath, RTLD_LAZY | RTLD_GLOBAL); + if (!lib) { + fprintf(stderr, "Failed to load %s: %s\n", libPath, dlerror()); + return 1; + } + + RunLuaFileAsWin_t runLua = (RunLuaFileAsWin_t)dlsym(lib, "RunLuaFileAsWin"); + if (!runLua) { + fprintf(stderr, "dlsym RunLuaFileAsWin: %s\n", dlerror()); + return 1; + } + + // argv[0] for RunLuaFileAsWin must be the Lua script path. + // Skip our own argv[0] (the launcher binary). + if (argc < 2) { + fprintf(stderr, "Usage: %s [args...]\n", argv[0]); + return 1; + } + + // Resolve script path to absolute so basePath resolution inside SimpleGraphic works correctly. + // basePath is derived from /proc/self/exe (the launcher's dir), so a relative script path + // would be resolved relative to the build dir rather than the current working directory. + char scriptAbs[PATH_MAX]; + if (realpath(argv[1], scriptAbs) == NULL) { + perror(argv[1]); + return 1; + } + argv[1] = scriptAbs; + + // Derive the PoB root from the script location: + // script = /src/Launch.lua → script_dir = /src → pob_root = + // (the runtime Lua modules live at /runtime/lua/) + char scriptDirBuf[PATH_MAX]; + strncpy(scriptDirBuf, scriptAbs, sizeof(scriptDirBuf)); + char* scriptDir = dirname(scriptDirBuf); + + char pobRoot[PATH_MAX]; + snprintf(pobRoot, sizeof(pobRoot), "%s/..", scriptDir); + char pobRootAbs[PATH_MAX]; + if (!realpath(pobRoot, pobRootAbs)) + strncpy(pobRootAbs, pobRoot, sizeof(pobRootAbs)); + + // Tell SimpleGraphic where the runtime data (fonts, etc.) lives. + // When installed, SimpleGraphic/Fonts/ sits alongside the launcher binary, + // so the launcher's own directory serves as the base path. + if (!getenv("SG_BASE_PATH")) + setenv("SG_BASE_PATH", dir, 1); + + // Set LUA_PATH to include the PoB runtime Lua directory. + // Work around pob-wide-crt.patch bug: _lua_getenvcopy() calls strdup(getenv(name)) + // which crashes on NULL, so we always set these even if we're not overriding. + if (!getenv("LUA_PATH")) { + char luaPath[PATH_MAX * 4]; + snprintf(luaPath, sizeof(luaPath), + "%s/runtime/lua/?.lua;%s/runtime/lua/?/init.lua;;", + pobRootAbs, pobRootAbs); + setenv("LUA_PATH", luaPath, 1); + } + + // Set LUA_CPATH to include the build dir (where our .so modules live without lib prefix). + if (!getenv("LUA_CPATH")) { + char luaCPath[PATH_MAX * 4]; + snprintf(luaCPath, sizeof(luaCPath), "%s/?.so;;", dir); + setenv("LUA_CPATH", luaCPath, 1); + } + + return runLua(argc - 1, argv + 1); +} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 3782776..af7b8f5 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -8,7 +8,7 @@ "kind": "filesystem", "path": "vcpkg-ports", "baseline": "2025-10-07", - "packages": ["glfw3", "gli", "luajit"] + "packages": ["angle", "glfw3", "gli", "luajit", "openssl", "pthread-stubs"] } ] } diff --git a/vcpkg-ports/ports/angle/001-fix-uwp.patch b/vcpkg-ports/ports/angle/001-fix-uwp.patch new file mode 100644 index 0000000..cba68d6 --- /dev/null +++ b/vcpkg-ports/ports/angle/001-fix-uwp.patch @@ -0,0 +1,30 @@ +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp +index 7d3f078d6..fac057dd6 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp +@@ -213,16 +213,20 @@ HRESULT GetCoreWindowSizeInPixels(const ComPtr displayProperties; ++ ComPtr displayInformationStatics; ++ ComPtr displayInformation; + + if (SUCCEEDED(GetActivationFactory( +- HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), +- displayProperties.GetAddressOf()))) ++ HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(), ++ displayInformationStatics.GetAddressOf()))) + { + float dpi = 96.0f; +- if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi))) ++ if (SUCCEEDED(displayInformationStatics->GetForCurrentView(&displayInformation))) + { +- return dpi; ++ if (SUCCEEDED(displayInformation->get_LogicalDpi(&dpi))) ++ { ++ return dpi; ++ } + } + } + diff --git a/vcpkg-ports/ports/angle/002-fix-builder-error.patch b/vcpkg-ports/ports/angle/002-fix-builder-error.patch new file mode 100644 index 0000000..a6d56ac --- /dev/null +++ b/vcpkg-ports/ports/angle/002-fix-builder-error.patch @@ -0,0 +1,40 @@ +diff --git a/src/gpu_info_util/SystemInfo_win.cpp b/src/gpu_info_util/SystemInfo_win.cpp +index f4bb137f2..86495013b 100644 +--- a/src/gpu_info_util/SystemInfo_win.cpp ++++ b/src/gpu_info_util/SystemInfo_win.cpp +@@ -6,11 +6,6 @@ + + // SystemInfo_win.cpp: implementation of the Windows-specific parts of SystemInfo.h + +-#include "gpu_info_util/SystemInfo_internal.h" +- +-#include "common/debug.h" +-#include "common/string_utils.h" +- + // Windows.h needs to be included first + #include + +@@ -19,6 +14,11 @@ + #include + #include + ++#include "gpu_info_util/SystemInfo_internal.h" ++ ++#include "common/debug.h" ++#include "common/string_utils.h" ++ + namespace angle + { + +diff --git a/include/GLSLANG/ShaderVars.h b/include/GLSLANG/ShaderVars.h +index 94cb93e..5593f66 100644 +--- a/include/GLSLANG/ShaderVars.h ++++ b/include/GLSLANG/ShaderVars.h +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + namespace sh + { diff --git a/vcpkg-ports/ports/angle/003-fix-mingw.patch b/vcpkg-ports/ports/angle/003-fix-mingw.patch new file mode 100644 index 0000000..304d822 --- /dev/null +++ b/vcpkg-ports/ports/angle/003-fix-mingw.patch @@ -0,0 +1,22 @@ +diff --git a/src/common/mathutil.h b/src/common/mathutil.h +index 1d73bbf..c5b9cc8 100644 +--- a/src/common/mathutil.h ++++ b/src/common/mathutil.h +@@ -1073,7 +1073,7 @@ inline int BitCount(uint64_t bits) + # endif // defined(_M_IX86) || defined(_M_X64) + #endif // defined(_MSC_VER) && !defined(__clang__) + +-#if defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) ++#if defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) || defined(__MINGW32__) + inline int BitCount(uint32_t bits) + { + return __builtin_popcount(bits); +@@ -1083,7 +1083,7 @@ inline int BitCount(uint64_t bits) + { + return __builtin_popcountll(bits); + } +-#endif // defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) ++#endif // defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) || defined(__MINGW32__) + + inline int BitCount(uint8_t bits) + { diff --git a/vcpkg-ports/ports/angle/004-fix-cstdint.patch b/vcpkg-ports/ports/angle/004-fix-cstdint.patch new file mode 100644 index 0000000..6ca23f4 --- /dev/null +++ b/vcpkg-ports/ports/angle/004-fix-cstdint.patch @@ -0,0 +1,10 @@ +--- a/src/image_util/AstcDecompressor.h ++++ b/src/image_util/AstcDecompressor.h +@@ -13,6 +13,7 @@ + + #include + #include ++#include + + namespace angle + { diff --git a/vcpkg-ports/ports/angle/angle_commit.h.in b/vcpkg-ports/ports/angle/angle_commit.h.in new file mode 100644 index 0000000..60abdb8 --- /dev/null +++ b/vcpkg-ports/ports/angle/angle_commit.h.in @@ -0,0 +1,4 @@ +#cmakedefine ANGLE_COMMIT_HASH "@ANGLE_COMMIT_HASH@" +#cmakedefine ANGLE_COMMIT_HASH_SIZE @ANGLE_COMMIT_HASH_SIZE@ +#cmakedefine ANGLE_COMMIT_DATE "@ANGLE_COMMIT_DATE@" +#cmakedefine ANGLE_REVISION @ANGLE_REVISION@ diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/CMakeLists.txt b/vcpkg-ports/ports/angle/cmake-buildsystem/CMakeLists.txt new file mode 100644 index 0000000..110c5a0 --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/CMakeLists.txt @@ -0,0 +1,477 @@ +cmake_minimum_required(VERSION 3.8) +project(angle CXX C) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +include(WebKitCommon-minimal) + +set(ANGLE_FRAMEWORK_HEADERS_DIR "${CMAKE_BINARY_DIR}/ANGLE/headers") + +set(USE_ANGLE_EGL ON) +if (NOT WINDOWS_STORE) + set(USE_OPENGL ON) +endif() + +if(MSVC) + add_compile_options(/d2guard4 /Wv:18 /guard:cf /permissive /bigobj) + add_link_options(/guard:cf) +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +if(WIN32) + set(CMAKE_SHARED_LIBRARY_PREFIX "") +endif() + +if (WINDOWS_STORE) + set(WINRT_DEFINES -DANGLE_ENABLE_WINDOWS_UWP -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP) +else() + set(WINRT_DEFINES) +endif() +add_definitions( + -D_CRT_SECURE_NO_DEPRECATE + -D_SCL_SECURE_NO_WARNINGS + -DGL_SILENCE_DEPRECATION + -D_HAS_EXCEPTIONS=0 + -DNOMINMAX + -DANGLE_STANDALONE_BUILD + ${WINRT_DEFINES} +) +add_compile_options("$<$:-DANGLE_ENABLE_DEBUG_ANNOTATIONS>") +if(WIN32) + add_definitions(-DANGLE_IS_WIN) +endif() +if(LINUX) + add_definitions(-DANGLE_IS_LINUX) +endif() +if(ANGLE_IS_64_BIT_CPU) + add_definitions(-DANGLE_IS_64_BIT_CPU) +elseif(ANGLE_IS_32_BIT_CPU) + add_definitions(-DANGLE_IS_32_BIT_CPU) +endif() +if(ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW) + if(NOT WIN32) + message(FATAL_ERROR "ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW is set, but is only supported on Windows") + endif() + set(angle_enable_d3d11_compositor_native_window TRUE) +endif() +if(NOT BUILD_SHARED_LIBS) + add_definitions( + -DANGLE_EXPORT= + -DANGLE_STATIC=1 + -DANGLE_UTIL_EXPORT= + -DEGLAPI= + -DGL_APICALL= + -DGL_API= + ) +endif() + +find_package(ZLIB REQUIRED) + +################################################## + +# Derived from: https://github.com/WebKit/WebKit/blob/92dbcacf4c3e3a8fc6eea68e7022ca59401749e0/Source/ThirdParty/ANGLE/CMakeLists.txt +# With modifications for vcpkg port (marked with "VCPKG EDIT:" comments) + +set_property(DIRECTORY . PROPERTY FOLDER "ANGLE") + +# VCPKG EDIT: modified block +if (APPLE) + set(is_apple TRUE) + if (IOS) + set(is_ios TRUE) + if (USE_OPENGL) + set(angle_enable_eagl TRUE) + endif() + else() + set(is_mac TRUE) + endif() + if (USE_OPENGL AND NOT angle_enable_eagl) + set(angle_enable_cgl TRUE) + endif() +elseif (WIN32) + set(is_win TRUE) + if (NOT WINDOWS_STORE) + set(angle_is_winuwp FALSE) + else() + set(angle_is_winuwp TRUE) + set(target_os "winuwp") + endif() + if (NOT angle_is_winuwp) + set(angle_enable_d3d9 TRUE) + endif() + set(angle_enable_d3d11 TRUE) +elseif (UNIX) + set(is_linux TRUE) + if(LINUX) + set(angle_use_x11 TRUE) + endif() +endif () +# VCPKG EDIT: end vcpkg modified block + +include(Compiler.cmake) +include(GLESv2.cmake) + +# ANGLE Renderer backends +include(D3D.cmake) +include(GL.cmake) +include(Metal.cmake) + +set(no_gl_prototypes + GL_GLES_PROTOTYPES=0 + EGL_EGL_PROTOTYPES=0 +) + +set(gl_prototypes + GL_GLES_PROTOTYPES=1 + EGL_EGL_PROTOTYPES=1 + GL_GLEXT_PROTOTYPES + EGL_EGLEXT_PROTOTYPES +) + +# Default library types for ANGLE +# Override these in Platform*.cmake for your port as needed. +set(ANGLE_LIBRARY_TYPE STATIC) # libANGLE static library (matches expected behavior & prior behavior) +set(GLESv2_LIBRARY_TYPE) # VCPKG EDIT: Default to BUILD_SHARED_LIBS setting +set(EGL_LIBRARY_TYPE) # VCPKG EDIT: Default to BUILD_SHARED_LIBS setting + +# ANGLE makes a number of small static libraries that are then joined into a +# bigger library that is built shared. Rather than making the small libraries +# there will be a ANGLE whose sources are dependent on whether the library +# is being used as a compiler or as a GLES implementation. +# +# The corresponding gn targets are described below +# +# ANGLE (Compiler only) +# + angle_common +# + preprocessor +# + translator +# +# ANGLE (GLES) +# + ANGLE (Compiler only) +# + xxhash +# + angle_image_util +# + angle_system_utils (OS specific) +# + angle_(renderer) (Backend and OS specific) + +set(ANGLE_PRIVATE_INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/include/KHR" + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_SOURCE_DIR}/src/common/third_party/base" + "${CMAKE_CURRENT_SOURCE_DIR}/src/common/base" + "${CMAKE_CURRENT_SOURCE_DIR}/src/common/third_party/xxhash" + "${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib/google" + "${CMAKE_CURRENT_BINARY_DIR}/include" +) + +set(ANGLE_DEFINITIONS + ANGLE_ENABLE_ESSL + ANGLE_ENABLE_GLSL +) + +# VCPKG EDIT +list(APPEND ANGLE_DEFINITIONS ANGLE_CAPTURE_ENABLED=0) +if (NOT WIN32) + list(APPEND ANGLE_DEFINITIONS + "-DGL_API=__attribute__((visibility(\"default\")))" + "-DGL_APICALL=__attribute__((visibility(\"default\")))" + ) +endif() +# END VCPKG EDIT + +set(ANGLE_SOURCES + ${libangle_common_sources} + ${libangle_common_shader_state_sources} + ${angle_preprocessor_sources} + ${angle_translator_glsl_base_sources} + ${angle_translator_essl_sources} + ${angle_translator_essl_symbol_table_sources} + ${angle_translator_glsl_and_vulkan_base_sources} + ${angle_translator_glsl_sources} + ${angle_translator_sources} + ${angle_system_utils_sources} + src/common/angle_version_info.cpp + src/libANGLE/capture/FrameCapture_mock.cpp + src/libANGLE/capture/serialize_mock.cpp +) + +if (WIN32) + # FIXME: DX11 support will not compile if this preprocessor definition is set + # DirectX Documentation is setting that version to 0x700 but there is no + # corresponding value in sdkddkver.h + remove_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601) + + list(APPEND ANGLE_SOURCES + "src/libANGLE/renderer/dxgi_format_map.h" + "src/libANGLE/renderer/dxgi_format_map_autogen.cpp" + "src/libANGLE/renderer/dxgi_support_table.h" + "src/libANGLE/renderer/dxgi_support_table_autogen.cpp" + ) + if (NOT angle_is_winuwp) + list(APPEND ANGLE_SOURCES + "src/libANGLE/renderer/d3d_format.cpp" + "src/libANGLE/renderer/d3d_format.h" + ) + endif() +endif () + +set(ANGLEGLESv2_LIBRARIES + ANGLE +) + +set(zlib_wrapper_sources + "third_party/zlib/google/compression_utils_portable.h" + "third_party/zlib/google/compression_utils_portable.cc" +) + +set(angle_gl_enum_utils # VCPKG EDIT: Update paths + "src/common/gl_enum_utils.cpp" + "src/common/gl_enum_utils.h" + "src/common/gl_enum_utils_autogen.cpp" + "src/common/gl_enum_utils_autogen.h" +) + +set(angle_glslang_wrapper + "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.cpp" + "src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.h" + "src/libANGLE/renderer/glslang_wrapper_utils.cpp" + "src/libANGLE/renderer/glslang_wrapper_utils.h" +) + +WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() + +add_subdirectory(include) + +add_library(ANGLEFramework INTERFACE) +add_dependencies(ANGLEFramework GLSLANGHeaders ANGLEHeaders) + +if (USE_ANGLE_EGL OR ENABLE_WEBGL) + add_library(ANGLE ${ANGLE_LIBRARY_TYPE} + ${ANGLE_SOURCES} + ${libangle_sources} + ${libangle_headers} + ${libangle_image_util_sources} + ${libangle_image_util_headers} + ${xxhash_sources} + ${zlib_wrapper_sources} + ${angle_gl_enum_utils} + ) + target_include_directories(ANGLE PRIVATE ${ANGLE_PRIVATE_INCLUDE_DIRECTORIES}) + target_compile_definitions(ANGLE PRIVATE + ${no_gl_prototypes} + LIBANGLE_IMPLEMENTATION + ) + target_compile_definitions(ANGLE PUBLIC ${ANGLE_DEFINITIONS}) + target_link_libraries(ANGLE PRIVATE ZLIB::ZLIB ${CMAKE_DL_LIBS}) + + target_compile_definitions(ANGLEFramework INTERFACE ${gl_prototypes}) + + add_library(GLESv2 ${GLESv2_LIBRARY_TYPE} + ${libglesv2_sources} + ) + target_include_directories(GLESv2 PRIVATE ${ANGLE_PRIVATE_INCLUDE_DIRECTORIES}) + target_compile_definitions(GLESv2 PRIVATE + ${no_gl_prototypes} + LIBGLESV2_IMPLEMENTATION + ) + + target_link_libraries(GLESv2 PRIVATE ${ANGLEGLESv2_LIBRARIES} ${CMAKE_DL_LIBS}) + + if (WIN32) + # Output library name according to the .def + target_sources(GLESv2 PRIVATE src/libGLESv2/libGLESv2_autogen.def) + set_target_properties(GLESv2 PROPERTIES OUTPUT_NAME libGLESv2) + endif () + # Rename libs to avoid conflict with system OpenGL + if(NOT VCPKG_TARGET_IS_WINDOWS) + set_target_properties(GLESv2 PROPERTIES OUTPUT_NAME libGLESv2_angle) + endif() + + add_library(GLESv2Framework INTERFACE) + target_link_libraries(GLESv2Framework INTERFACE GLESv2) + target_include_directories(GLESv2Framework INTERFACE ${ANGLE_FRAMEWORK_HEADERS_DIR}) + target_compile_definitions(GLESv2Framework INTERFACE USE_SYSTEM_EGL) + add_library(ANGLE::GLES ALIAS GLESv2Framework) + + if (USE_ANGLE_EGL) + add_library(EGL ${EGL_LIBRARY_TYPE} + ${libegl_sources} + ) + target_include_directories(EGL PRIVATE ${ANGLE_PRIVATE_INCLUDE_DIRECTORIES}) + target_compile_definitions(EGL PRIVATE + ${ANGLE_DEFINITIONS} + ${gl_prototypes} + EGLAPI= + ) + + target_link_libraries(EGL PRIVATE GLESv2 ${CMAKE_DL_LIBS}) + + set_target_properties(EGL PROPERTIES LINKER_LANGUAGE CXX) + if (WIN32) + # Output library names according to the .def + target_sources(EGL PRIVATE src/libEGL/libEGL_autogen.def) + set_target_properties(EGL PROPERTIES OUTPUT_NAME libEGL) + endif () + # Rename libs to avoid conflict with system OpenGL + if(NOT VCPKG_TARGET_IS_WINDOWS) + set_target_properties(EGL PROPERTIES OUTPUT_NAME libEGL_angle) + endif() + + add_library(EGLFramework INTERFACE) + target_include_directories(EGLFramework INTERFACE ${ANGLE_FRAMEWORK_HEADERS_DIR}/) + target_compile_definitions(EGLFramework INTERFACE ${gl_prototypes}) + target_link_libraries(EGLFramework INTERFACE EGL) + add_library(ANGLE::EGL ALIAS EGLFramework) + endif () +else () + add_library(ANGLE ${ANGLE_LIBRARY_TYPE} ${ANGLE_SOURCES}) + target_include_directories(ANGLE PRIVATE ${ANGLE_PRIVATE_INCLUDE_DIRECTORIES}) + target_link_libraries(ANGLE PRIVATE ${CMAKE_DL_LIBS}) + target_compile_definitions(ANGLE PRIVATE + ${ANGLE_DEFINITIONS} + ${no_gl_prototypes} + LIBANGLE_IMPLEMENTATION + ) +endif () + +if (ENABLE_WEBGL) + set(libglesv2_entry_points_headers + src/libGLESv2/entry_points_egl_autogen.h + src/libGLESv2/entry_points_egl_ext_autogen.h + src/libGLESv2/entry_points_gles_2_0_autogen.h + src/libGLESv2/entry_points_gles_3_0_autogen.h + src/libGLESv2/entry_points_gles_ext_autogen.h + ) + + WEBKIT_COPY_FILES(LibGLESv2EntryPointsHeaders + DESTINATION ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE + FILES ${libglesv2_entry_points_headers} + FLATTENED + ) + if (WIN32 AND TARGET GLESv2) + # GLESv2 needs to have a direct or indirect dependency to + # LibGLESv2EntryPointsHeaders for CMake Visual Studio generator + # to eliminate duplicated custom commands. Otherwise, + # entry_points_*.h will be copied twice in both projects. + add_dependencies(GLESv2 LibGLESv2EntryPointsHeaders) + endif () + + add_custom_target(ANGLE-webgl-headers + DEPENDS LibGLESv2EntryPointsHeaders ANGLEWebGLHeaders + COMMAND ${CMAKE_COMMAND} -E env + BUILT_PRODUCTS_DIR=${ANGLE_FRAMEWORK_HEADERS_DIR} + PUBLIC_HEADERS_FOLDER_PATH=/ANGLE + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/adjust-angle-include-paths.py + VERBATIM + ) + add_dependencies(GLESv2Framework ANGLE-webgl-headers) +endif () + +if (COMPILER_IS_GCC_OR_CLANG) + foreach (angle_target ANGLE EGL GLESv2) + if (TARGET ${angle_target}) + WEBKIT_ADD_TARGET_C_FLAGS(${angle_target} -w) + WEBKIT_ADD_TARGET_CXX_FLAGS(${angle_target} -w) + endif () + endforeach () +endif () + +target_link_libraries(ANGLEFramework INTERFACE ANGLE) +target_include_directories(ANGLEFramework INTERFACE ${ANGLE_FRAMEWORK_HEADERS_DIR}) + +add_library(ANGLE::ANGLE ALIAS ANGLEFramework) + + +################################################## + +#### VCPKG EDIT: +#### various vcpkg additions and install commands + +# X11 support +if (angle_use_x11) + find_package(X11 COMPONENTS Xext Xi REQUIRED) + target_include_directories(ANGLE PRIVATE ${X11_INCLUDE_DIR}) + target_sources(ANGLE PRIVATE ${libangle_gpu_info_util_x11_sources}) + target_sources(ANGLE PRIVATE "src/gpu_info_util/SystemInfo_x11.cpp") + target_compile_definitions(ANGLE PRIVATE ANGLE_USE_X11 GPU_INFO_USE_X11) + target_link_libraries(ANGLE PRIVATE ${X11_LIBRARIES} X11::X11 X11::Xi X11::Xext) +endif() + +# set export names of some targets to match prior vcpkg port buildsystem +if(TARGET EGL) + set_target_properties(EGL PROPERTIES EXPORT_NAME libEGL) +endif() +if(TARGET GLESv2) + set_target_properties(GLESv2 PROPERTIES EXPORT_NAME libGLESv2) +endif() +set_target_properties(ANGLE PROPERTIES EXPORT_NAME libANGLE) + +set(_possibleTargets EGL GLESv2 ANGLE) +foreach(_target IN LISTS _possibleTargets) + if(TARGET ${_target}) + list(APPEND _installableTargets "${_target}") + endif() +endforeach() + +install(TARGETS ${_installableTargets} EXPORT ANGLEExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(EXPORT ANGLEExport FILE unofficial-angle-targets.cmake NAMESPACE unofficial::angle:: DESTINATION share/unofficial-angle) +install(FILES unofficial-angle-config.cmake DESTINATION share/unofficial-angle) + +install( + DIRECTORY "${ANGLE_FRAMEWORK_HEADERS_DIR}/" + DESTINATION include + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.inc" + PATTERN "CL" EXCLUDE + PATTERN "GLSLANG" EXCLUDE + PATTERN "EGL/egl.h" EXCLUDE + PATTERN "EGL/eglext.h" EXCLUDE + PATTERN "EGL/eglplatform.h" EXCLUDE + PATTERN "KHR" EXCLUDE + PATTERN "WGL" EXCLUDE + PATTERN "export.h" EXCLUDE + PATTERN "GLES/egl.h" EXCLUDE + PATTERN "GLES/gl.h" EXCLUDE + PATTERN "GLES/glext.h" EXCLUDE + PATTERN "GLES/glplatform.h" EXCLUDE + PATTERN "GLES2/gl2.h" EXCLUDE + PATTERN "GLES2/gl2ext.h" EXCLUDE + PATTERN "GLES2/gl2platform.h" EXCLUDE + PATTERN "GLES3/gl3.h" EXCLUDE + PATTERN "GLES3/gl31.h" EXCLUDE + PATTERN "GLES3/gl32.h" EXCLUDE + PATTERN "GLES3/gl3platform.h" EXCLUDE +) +install( + DIRECTORY "${ANGLE_FRAMEWORK_HEADERS_DIR}/" + DESTINATION include/angle + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.inc" + PATTERN "CL" EXCLUDE + PATTERN "GLSLANG" EXCLUDE + PATTERN "EGL/egl.h" EXCLUDE + PATTERN "EGL/eglext.h" EXCLUDE + PATTERN "EGL/eglplatform.h" EXCLUDE + PATTERN "KHR" EXCLUDE + PATTERN "WGL" EXCLUDE + PATTERN "export.h" EXCLUDE +) + +if(NOT BUILD_SHARED_LIBS) + foreach(angle_target EGL GLESv2 ANGLE) + if(TARGET ${angle_target}) + target_compile_definitions(${angle_target} INTERFACE $) + endif() + endforeach() +endif() diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformLinux.cmake b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformLinux.cmake new file mode 100644 index 0000000..018bf7f --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformLinux.cmake @@ -0,0 +1,30 @@ +list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_LINUX USE_SYSTEM_EGL) +include(linux.cmake) + +if (USE_OPENGL) + # Enable GLSL compiler output. + list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL) +endif () + +if (USE_ANGLE_EGL OR ENABLE_WEBGL) + list(APPEND ANGLE_SOURCES + ${_gl_backend_sources} + + ${angle_system_utils_sources_linux} + ${angle_system_utils_sources_posix} + + ${angle_dma_buf_sources} + + ${libangle_gl_egl_dl_sources} + ${libangle_gl_egl_sources} + ${libangle_gl_sources} + + ${libangle_gpu_info_util_sources} + ${libangle_gpu_info_util_linux_sources} + ) + + list(APPEND ANGLE_DEFINITIONS + ANGLE_ENABLE_OPENGL + ) + +endif () diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformMac.cmake b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformMac.cmake new file mode 100644 index 0000000..4fda2ba --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformMac.cmake @@ -0,0 +1,59 @@ +find_package(ZLIB REQUIRED) + +list(APPEND ANGLE_SOURCES + ${libangle_gpu_info_util_mac_sources} + ${libangle_gpu_info_util_sources} + ${libangle_mac_sources} +) + +list(APPEND ANGLEGLESv2_LIBRARIES + "-framework CoreGraphics" + "-framework Foundation" + "-framework IOKit" + "-framework IOSurface" + "-framework Quartz" +) + +# Metal backend +if(USE_METAL) + list(APPEND ANGLE_SOURCES + ${_metal_backend_sources} + + ${angle_translator_lib_metal_sources} + + ${angle_glslang_wrapper} + ) + + list(APPEND ANGLE_DEFINITIONS + ANGLE_ENABLE_METAL + ) + + list(APPEND ANGLEGLESv2_LIBRARIES + "-framework Metal" + ) +endif() + +# OpenGL backend +if(USE_OPENGL) + list(APPEND ANGLE_SOURCES + ${angle_translator_glsl_base_sources} + ${angle_translator_glsl_sources} + ${angle_translator_apple_sources} + ) + # Enable GLSL compiler output. + list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL ANGLE_ENABLE_GL_DESKTOP_BACKEND ANGLE_ENABLE_APPLE_WORKAROUNDS) +endif() + +if(USE_ANGLE_EGL OR ENABLE_WEBGL) + list(APPEND ANGLE_SOURCES + ${_gl_backend_sources} + + ${libangle_gl_egl_dl_sources} + ${libangle_gl_egl_sources} + ${libangle_gl_sources} + ) + + list(APPEND ANGLE_DEFINITIONS + ANGLE_ENABLE_OPENGL + ) +endif() diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformWin.cmake b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformWin.cmake new file mode 100644 index 0000000..97ac619 --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/PlatformWin.cmake @@ -0,0 +1,67 @@ +# We're targeting Windows 10 which will have DirectX 11 on it so require that +# but make DirectX 9 optional + +list(APPEND ANGLE_DEFINITIONS + GL_APICALL= + GL_API= + NOMINMAX +) + +# We're targeting Windows 10 which will have DirectX 11 +list(APPEND ANGLE_SOURCES + ${_d3d11_backend_sources} + ${_d3d_shared_sources} + + ${angle_translator_hlsl_sources} + + ${libangle_gpu_info_util_sources} + ${libangle_gpu_info_util_win_sources} +) + +list(APPEND ANGLE_DEFINITIONS + ANGLE_ENABLE_D3D11 + ANGLE_ENABLE_HLSL + # VCPKG EDIT: add ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES + "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" +) + +list(APPEND ANGLEGLESv2_LIBRARIES dxguid dxgi) + +if(NOT angle_is_winuwp) # vcpkg EDIT: Exclude DirectX 9 on UWP + # DirectX 9 support should be optional but ANGLE will not compile without it + list(APPEND ANGLE_SOURCES ${_d3d9_backend_sources}) + list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_D3D9) + list(APPEND ANGLEGLESv2_LIBRARIES d3d9) +endif() + +# VCPKG EDITS: + +# Do not specify library type here + +# Handle angle_enable_d3d11_compositor_native_window defines + +if(angle_enable_d3d11_compositor_native_window) + list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_D3D11_COMPOSITOR_NATIVE_WINDOW) +endif() + +# OpenGL backend + +if(USE_OPENGL) + # Enable GLSL compiler output. + list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL) + + if(USE_ANGLE_EGL OR ENABLE_WEBGL) + list(APPEND ANGLE_SOURCES + ${_gl_backend_sources} + + ${libangle_gl_egl_dl_sources} + ${libangle_gl_egl_sources} + ${libangle_gl_sources} + ) + + list(APPEND ANGLE_DEFINITIONS + ANGLE_ENABLE_OPENGL + ANGLE_ENABLE_GL_DESKTOP_BACKEND + ) + endif() +endif() diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake b/vcpkg-ports/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake new file mode 100644 index 0000000..b0df91f --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake @@ -0,0 +1,192 @@ +# VCPKG NOTE: A minimal version of WebKit's https://github.com/WebKit/WebKit/blob/647e67b23883960fef8890465c0f70d7ab6e63f1/Source/cmake/WebKitCommon.cmake +# To support the adapted ANGLE CMake buildsystem + +# ----------------------------------------------------------------------------- +# This file is included individually from various subdirectories (JSC, WTF, +# WebCore, WebKit) in order to allow scripts to build only part of WebKit. +# We want to run this file only once. +# ----------------------------------------------------------------------------- +if (NOT HAS_RUN_WEBKIT_COMMON) + set(HAS_RUN_WEBKIT_COMMON TRUE) + + if (NOT CMAKE_BUILD_TYPE) + message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to RelWithDebInfo.") + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE) + else () + message(STATUS "The CMake build type is: ${CMAKE_BUILD_TYPE}") + endif () + + # ----------------------------------------------------------------------------- + # Determine which port will be built + # ----------------------------------------------------------------------------- + set(ALL_PORTS + AppleWin + Efl + FTW + GTK + JSCOnly + Mac + PlayStation + WPE + WinCairo + Linux # VCPKG EDIT: Add "Linux" so it's properly supported for ANGLE build + Win # VCPKG EDIT: Add "Win" so it's properly supported for ANGLE build + ) + set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})") + + list(FIND ALL_PORTS ${PORT} RET) + if (${RET} EQUAL -1) + if (APPLE) + set(PORT "Mac") + else () + message(WARNING "Please choose which WebKit port to build (one of ${ALL_PORTS})") + endif () + endif () + + string(TOLOWER ${PORT} WEBKIT_PORT_DIR) + + # ----------------------------------------------------------------------------- + # Determine the compiler + # ----------------------------------------------------------------------------- + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + set(COMPILER_IS_CLANG ON) + endif () + + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.3.0") + message(FATAL_ERROR "GCC 9.3 or newer is required to build WebKit. Use a newer GCC version or Clang.") + endif () + endif () + + if (CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG) + set(COMPILER_IS_GCC_OR_CLANG ON) + endif () + + if (MSVC AND COMPILER_IS_CLANG) + set(COMPILER_IS_CLANG_CL ON) + endif () + + # ----------------------------------------------------------------------------- + # Determine the target processor + # ----------------------------------------------------------------------------- + # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined, + # since the later one just resolves to the host processor on Windows. + if (MSVC_CXX_ARCHITECTURE_ID) + string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR) + else () + string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR) + endif () + if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(^aarch64|^arm64|^cortex-?[am][2-7][2-8])") + set(WTF_CPU_ARM64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(^arm|^cortex)") + set(WTF_CPU_ARM 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64") + set(WTF_CPU_MIPS64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + set(WTF_CPU_MIPS 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)") + # FORCE_32BIT is set in the build script when --32-bit is passed + # on a Linux/intel 64bit host. This allows us to produce 32bit + # binaries without setting the build up as a crosscompilation, + # which is the only way to modify CMAKE_SYSTEM_PROCESSOR. + if (FORCE_32BIT) + set(WTF_CPU_X86 1) + else () + set(WTF_CPU_X86_64 1) + endif () + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)") + set(WTF_CPU_X86 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc") + set(WTF_CPU_PPC 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") + set(WTF_CPU_PPC64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") + set(WTF_CPU_PPC64LE 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64") + set(WTF_CPU_RISCV64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch64") + set(WTF_CPU_LOONGARCH64 1) + else () + set(WTF_CPU_UNKNOWN 1) + endif () + + # ----------------------------------------------------------------------------- + # Determine the operating system + # ----------------------------------------------------------------------------- + if (UNIX) + if (APPLE) + set(WTF_OS_MAC_OS_X 1) + elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") + set(WTF_OS_LINUX 1) + else () + set(WTF_OS_UNIX 1) + endif () + elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") + set(WTF_OS_WINDOWS 1) + elseif (CMAKE_SYSTEM_NAME MATCHES "Fuchsia") + set(WTF_OS_FUCHSIA 1) + else () + message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'") + endif () + + # ----------------------------------------------------------------------------- + # Default library types + # ----------------------------------------------------------------------------- + + set(CMAKE_POSITION_INDEPENDENT_CODE True) + + # ----------------------------------------------------------------------------- + # Default output directories, which can be overwritten by ports + #------------------------------------------------------------------------------ + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + + # ----------------------------------------------------------------------------- + # Find common packages (used by all ports) + # ----------------------------------------------------------------------------- + if (WIN32) + list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin) + endif () + + # ----------------------------------------------------------------------------- + # Helper macros and feature defines + # ----------------------------------------------------------------------------- + + # To prevent multiple inclusion, most modules should be included once here. + include(CheckCCompilerFlag) + include(CheckCXXCompilerFlag) + include(CheckCXXSourceCompiles) + include(CheckFunctionExists) + include(CheckIncludeFile) + include(CheckSymbolExists) + include(CheckStructHasMember) + include(CheckTypeSize) + include(CMakeDependentOption) + include(CMakeParseArguments) + include(CMakePushCheckState) + include(ProcessorCount) + + # include(WebKitPackaging) + include(WebKitMacros) + # include(WebKitFS) + # include(WebKitCCache) + include(WebKitCompilerFlags) + # include(WebKitStaticAnalysis) + # include(WebKitFeatures) + # include(WebKitFindPackage) + + # include(OptionsCommon) + # include(Options${PORT}) + + # ----------------------------------------------------------------------------- + # Job pool to avoid running too many memory hungry linker processes + # ----------------------------------------------------------------------------- + if (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel") + set_property(GLOBAL PROPERTY JOB_POOLS link_pool_jobs=4) + else () + set_property(GLOBAL PROPERTY JOB_POOLS link_pool_jobs=2) + endif () + set(CMAKE_JOB_POOL_LINK link_pool_jobs) + +endif () diff --git a/vcpkg-ports/ports/angle/cmake-buildsystem/linux.cmake b/vcpkg-ports/ports/angle/cmake-buildsystem/linux.cmake new file mode 100644 index 0000000..f3d9cc0 --- /dev/null +++ b/vcpkg-ports/ports/angle/cmake-buildsystem/linux.cmake @@ -0,0 +1,6 @@ +if(is_android OR is_linux OR is_chromeos) + set(angle_dma_buf_sources + "src/common/linux/dma_buf_utils.cpp" + "src/common/linux/dma_buf_utils.h" + ) +endif() diff --git a/vcpkg-ports/ports/angle/portfile.cmake b/vcpkg-ports/ports/angle/portfile.cmake new file mode 100644 index 0000000..b93ab87 --- /dev/null +++ b/vcpkg-ports/ports/angle/portfile.cmake @@ -0,0 +1,187 @@ +if (VCPKG_TARGET_IS_LINUX) + message(WARNING "Building with a gcc version less than 6.1 is not supported.") + message(WARNING "${PORT} currently requires the following libraries from the system package manager:\n libx11-dev\n mesa-common-dev\n libxi-dev\n libxext-dev\n\nThese can be installed on Ubuntu systems via apt-get install libx11-dev mesa-common-dev libxi-dev libxext-dev.") +endif() + +if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(ANGLE_CPU_BITNESS ANGLE_IS_32_BIT_CPU) +elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(ANGLE_CPU_BITNESS ANGLE_IS_64_BIT_CPU) +elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(ANGLE_CPU_BITNESS ANGLE_IS_32_BIT_CPU) +elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(ANGLE_CPU_BITNESS ANGLE_IS_64_BIT_CPU) +else() + message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") +endif() + +set(ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW "OFF") +if (VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) + set(ANGLE_BUILDSYSTEM_PORT "Win") + if (NOT VCPKG_TARGET_IS_MINGW) + set(ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW "ON") + endif() +elseif (VCPKG_TARGET_IS_OSX) + set(ANGLE_BUILDSYSTEM_PORT "Mac") +elseif (VCPKG_TARGET_IS_LINUX) + set(ANGLE_BUILDSYSTEM_PORT "Linux") +else() + # default other platforms to "Linux" config + set(ANGLE_BUILDSYSTEM_PORT "Linux") +endif() + +# chromium/5414 +set(ANGLE_COMMIT aa63ea230e0c507e7b4b164a30e502fb17168c17) +set(ANGLE_VERSION 5414) +set(ANGLE_SHA512 a3b55d4b484e1e9ece515d60af1d47a80a0576b198d9a2397e4e68b16efd83468dcdfadc98dae57ff17f01d02d74526f8b59fdf00661b70a45b6dd266e5ffe38) +set(ANGLE_THIRDPARTY_ZLIB_COMMIT 44d9b490c721abdb923d5c6c23ac211e45ffb1a5) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/angle + REF ${ANGLE_COMMIT} + SHA512 ${ANGLE_SHA512} + # On update check headers against opengl-registry + PATCHES + 001-fix-uwp.patch + 002-fix-builder-error.patch + 003-fix-mingw.patch + 004-fix-cstdint.patch +) + +# Generate angle_commit.h +set(ANGLE_COMMIT_HASH_SIZE 12) +string(SUBSTRING "${ANGLE_COMMIT}" 0 ${ANGLE_COMMIT_HASH_SIZE} ANGLE_COMMIT_HASH) +set(ANGLE_COMMIT_DATE "invalid-date") +set(ANGLE_REVISION "${ANGLE_VERSION}") +configure_file("${CMAKE_CURRENT_LIST_DIR}/angle_commit.h.in" "${SOURCE_PATH}/angle_commit.h" @ONLY) +configure_file("${CMAKE_CURRENT_LIST_DIR}/angle_commit.h.in" "${SOURCE_PATH}/src/common/angle_commit.h" @ONLY) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-angle-config.cmake" DESTINATION "${SOURCE_PATH}") + +set(ANGLE_WEBKIT_BUILDSYSTEM_COMMIT "bb1da00b9ba878d228a5e9834a0767dbca2fee43") + +# Download WebKit gni-to-cmake.py conversion script +vcpkg_download_distfile(GNI_TO_CMAKE_PY + URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/ThirdParty/ANGLE/gni-to-cmake.py" + FILENAME "gni-to-cmake.py" + SHA512 9da35caf2db2e849d6cc85721ba0b77eee06b6f65a7c5314fb80483db4949b0b6e9bf4b2d4fc63613665629b24e9b052e03fb1451b09313d881297771a4f2736 +) + +# Generate CMake files from GN / GNI files +vcpkg_find_acquire_program(PYTHON3) + +set(_root_gni_files_to_convert + "compiler.gni Compiler.cmake" + "libGLESv2.gni GLESv2.cmake" +) +set(_renderer_gn_files_to_convert + "libANGLE/renderer/d3d/BUILD.gn D3D.cmake" + "libANGLE/renderer/gl/BUILD.gn GL.cmake" + "libANGLE/renderer/metal/BUILD.gn Metal.cmake" +) + +foreach(_root_gni_file IN LISTS _root_gni_files_to_convert) + separate_arguments(_file_values UNIX_COMMAND "${_root_gni_file}") + list(GET _file_values 0 _src_gn_file) + list(GET _file_values 1 _dst_file) + vcpkg_execute_required_process( + COMMAND "${PYTHON3}" "${GNI_TO_CMAKE_PY}" "src/${_src_gn_file}" "${_dst_file}" + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "gni-to-cmake-${_dst_file}-${TARGET_TRIPLET}" + ) +endforeach() + +foreach(_renderer_gn_file IN LISTS _renderer_gn_files_to_convert) + separate_arguments(_file_values UNIX_COMMAND "${_renderer_gn_file}") + list(GET _file_values 0 _src_gn_file) + list(GET _file_values 1 _dst_file) + get_filename_component(_src_dir "${_src_gn_file}" DIRECTORY) + vcpkg_execute_required_process( + COMMAND "${PYTHON3}" "${GNI_TO_CMAKE_PY}" "src/${_src_gn_file}" "${_dst_file}" --prepend "src/${_src_dir}/" + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "gni-to-cmake-${_dst_file}-${TARGET_TRIPLET}" + ) +endforeach() + +# Fetch additional CMake files from WebKit ANGLE buildsystem +vcpkg_download_distfile(WK_ANGLE_INCLUDE_CMAKELISTS + URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/ThirdParty/ANGLE/include/CMakeLists.txt" + FILENAME "include_CMakeLists.txt" + SHA512 a7ddf3c6df7565e232f87ec651cc4fd84240b8866609e23e3e6e41d22532fd34c70e0f3b06120fd3d6d930ca29c1d0d470d4c8cb7003a66f8c1a840a42f32949 +) +configure_file("${WK_ANGLE_INCLUDE_CMAKELISTS}" "${SOURCE_PATH}/include/CMakeLists.txt" COPYONLY) + +vcpkg_download_distfile(WK_ANGLE_CMAKE_WEBKITCOMPILERFLAGS + URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/cmake/WebKitCompilerFlags.cmake" + FILENAME "WebKitCompilerFlags.cmake" + SHA512 63f981694ae37d4c4ca4c34e2bf62b4d4602b6a1a660851304fa7a6ee834fc58fa6730eeb41ef4e075550f3c8b675823d4d00bdcd72ca869c6d5ab11196b33bb +) +file(COPY "${WK_ANGLE_CMAKE_WEBKITCOMPILERFLAGS}" DESTINATION "${SOURCE_PATH}/cmake") + +vcpkg_download_distfile(WK_ANGLE_CMAKE_WEBKITMACROS + URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/cmake/WebKitMacros.cmake" + FILENAME "WebKitMacros.cmake" + SHA512 0d126b1d1b0ca995c2ea6e51c73326db363f560f3f07912ce58c7c022d9257d27b963dac56aee0e9604ca7a3d74c5aa9f0451c243fec922fb485dd2253685ab6 +) +file(COPY "${WK_ANGLE_CMAKE_WEBKITMACROS}" DESTINATION "${SOURCE_PATH}/cmake") + +# Copy additional custom CMake buildsystem into appropriate folders +file(GLOB MAIN_BUILDSYSTEM "${CMAKE_CURRENT_LIST_DIR}/cmake-buildsystem/CMakeLists.txt" "${CMAKE_CURRENT_LIST_DIR}/cmake-buildsystem/*.cmake") +file(COPY ${MAIN_BUILDSYSTEM} DESTINATION "${SOURCE_PATH}") +file(GLOB MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake-buildsystem/cmake/*.cmake") +file(COPY ${MODULES} DESTINATION "${SOURCE_PATH}/cmake") + +function(checkout_in_path PATH URL REF) + if(EXISTS "${PATH}") + return() + endif() + + vcpkg_from_git( + OUT_SOURCE_PATH DEP_SOURCE_PATH + URL "${URL}" + REF "${REF}" + ) + file(RENAME "${DEP_SOURCE_PATH}" "${PATH}") + file(REMOVE_RECURSE "${DEP_SOURCE_PATH}") +endfunction() + +checkout_in_path( + "${SOURCE_PATH}/third_party/zlib" + "https://chromium.googlesource.com/chromium/src/third_party/zlib" + "${ANGLE_THIRDPARTY_ZLIB_COMMIT}" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=1 + OPTIONS + "-D${ANGLE_CPU_BITNESS}=1" + "-DPORT=${ANGLE_BUILDSYSTEM_PORT}" + "-DANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW=${ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW}" + "-DVCPKG_TARGET_IS_WINDOWS=${VCPKG_TARGET_IS_WINDOWS}" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH share/unofficial-angle PACKAGE_NAME unofficial-angle) + +vcpkg_copy_pdbs() + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +# Remove empty directories inside include directory +file(GLOB directory_children RELATIVE "${CURRENT_PACKAGES_DIR}/include" "${CURRENT_PACKAGES_DIR}/include/*") +foreach(directory_child ${directory_children}) + if(IS_DIRECTORY "${CURRENT_PACKAGES_DIR}/include/${directory_child}") + file(GLOB_RECURSE subdirectory_children "${CURRENT_PACKAGES_DIR}/include/${directory_child}/*") + if("${subdirectory_children}" STREQUAL "") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/${directory_child}") + endif() + endif() +endforeach() +unset(subdirectory_children) +unset(directory_child) +unset(directory_children) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg-ports/ports/angle/unofficial-angle-config.cmake b/vcpkg-ports/ports/angle/unofficial-angle-config.cmake new file mode 100644 index 0000000..79abf89 --- /dev/null +++ b/vcpkg-ports/ports/angle/unofficial-angle-config.cmake @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) +find_dependency(ZLIB) +if(UNIX AND NOT APPLE) + find_dependency(X11 COMPONENTS Xext Xi) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-angle-targets.cmake") diff --git a/vcpkg-ports/ports/angle/usage b/vcpkg-ports/ports/angle/usage new file mode 100644 index 0000000..b1fdc14 --- /dev/null +++ b/vcpkg-ports/ports/angle/usage @@ -0,0 +1,8 @@ +The package angle provides unofficial CMake targets: + + find_package(unofficial-angle REQUIRED CONFIG) + target_link_libraries(main PRIVATE unofficial::angle::libGLESv2) + + # Or use the EGL target + find_package(unofficial-angle REQUIRED CONFIG) + target_link_libraries(main PRIVATE unofficial::angle::libEGL) diff --git a/vcpkg-ports/ports/angle/vcpkg.json b/vcpkg-ports/ports/angle/vcpkg.json new file mode 100644 index 0000000..a42d935 --- /dev/null +++ b/vcpkg-ports/ports/angle/vcpkg.json @@ -0,0 +1,36 @@ +{ + "name": "angle", + "version-string": "chromium_5414", + "port-version": 9, + "description": [ + "A conformant OpenGL ES implementation for Windows, Mac and Linux.", + "The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is underway, and future plans include compute shader support (ES 3.1) and MacOS support." + ], + "homepage": "https://github.com/google/angle", + "license": "BSD-3-Clause", + "dependencies": [ + "egl-registry", + { + "name": "libx11", + "platform": "linux" + }, + { + "name": "libxext", + "platform": "linux" + }, + { + "name": "libxi", + "platform": "linux" + }, + "opengl-registry", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} diff --git a/vcpkg-ports/ports/luajit/2025-07-24_1/006-fix-getenvcopy-linux.patch b/vcpkg-ports/ports/luajit/2025-07-24_1/006-fix-getenvcopy-linux.patch new file mode 100644 index 0000000..1934957 --- /dev/null +++ b/vcpkg-ports/ports/luajit/2025-07-24_1/006-fix-getenvcopy-linux.patch @@ -0,0 +1,17 @@ +--- a/src/lj_utf8win.h ++++ b/src/lj_utf8win.h +@@ -18,7 +18,12 @@ + #else ++#include ++#include + #define _lua_fopen(path, mode) fopen(path, mode) +-#define _lua_getenvcopy(name) strdup(getenv(name)) +-#define _lua_getenvfree(name) free(name) ++static inline char* _lua_getenvcopy(const char* name) { ++ const char* v = getenv(name); ++ return v ? strdup(v) : NULL; ++} ++static inline void _lua_getenvfree(const char* v) { free((void*)v); } + #define _lua_remove(path) remove(path) + #define _lua_rename(oldpath, newpath) rename(oldpath, newpath) + #define _lua_system(cmd) system(cmd) diff --git a/vcpkg-ports/ports/luajit/2025-07-24_1/portfile.cmake b/vcpkg-ports/ports/luajit/2025-07-24_1/portfile.cmake index c03b461..392c0e8 100644 --- a/vcpkg-ports/ports/luajit/2025-07-24_1/portfile.cmake +++ b/vcpkg-ports/ports/luajit/2025-07-24_1/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( msvcbuild.patch 003-do-not-set-macosx-deployment-target.patch pob-wide-crt.patch + 006-fix-getenvcopy-linux.patch ${extra_patches} ) @@ -62,6 +63,10 @@ else() set(strip_options " -x") elseif(VCPKG_TARGET_IS_LINUX) vcpkg_list(APPEND make_options "TARGET_SYS=Linux") + # Enable GC64 mode so LuaJIT works when statically linked into a dlopen'd shared library. + # Without GC64, LuaJIT requires all GC memory within 4GB of its code, which fails at + # high virtual addresses common when a .so is loaded via dlopen. + vcpkg_list(APPEND make_options "XCFLAGS=-DLUAJIT_ENABLE_GC64") elseif(VCPKG_TARGET_IS_WINDOWS) vcpkg_list(APPEND make_options "TARGET_SYS=Windows") set(strip_options " --strip-unneeded") @@ -76,6 +81,7 @@ else() endif() file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}") + file(CHMOD "${SOURCE_PATH}/configure" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE OPTIONS @@ -91,6 +97,26 @@ else() "TARGET_AR=${VCPKG_DETECTED_CMAKE_AR} rcus" "TARGET_STRIP=${VCPKG_DETECTED_CMAKE_STRIP}${strip_options}" ) + + # The install step creates a circular symlink bin/luajit -> luajit because + # INSTALL_TNAME and INSTALL_TSYMNAME are both "luajit". Fix it by replacing + # the broken symlink with the real binary from the build tree. + foreach(BUILDTYPE "release" "debug") + if(BUILDTYPE STREQUAL "release") + set(BUILD_SUBDIR "x64-linux-rel") + set(DEST_DIR "${CURRENT_PACKAGES_DIR}/bin") + else() + set(BUILD_SUBDIR "x64-linux-dbg") + set(DEST_DIR "${CURRENT_PACKAGES_DIR}/debug/bin") + endif() + set(REAL_BIN "${CURRENT_BUILDTREES_DIR}/${BUILD_SUBDIR}/src/luajit") + set(DEST_BIN "${DEST_DIR}/luajit") + if(EXISTS "${REAL_BIN}") + file(REMOVE "${DEST_BIN}") + file(COPY "${REAL_BIN}" DESTINATION "${DEST_DIR}") + file(CHMOD "${DEST_BIN}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + endif() + endforeach() endif() file(REMOVE_RECURSE diff --git a/vcpkg-ports/ports/luajit/2025-07-24_1/vcpkg.json b/vcpkg-ports/ports/luajit/2025-07-24_1/vcpkg.json index ea922b1..3897299 100644 --- a/vcpkg-ports/ports/luajit/2025-07-24_1/vcpkg.json +++ b/vcpkg-ports/ports/luajit/2025-07-24_1/vcpkg.json @@ -1,7 +1,7 @@ { "name": "luajit", "version-date": "2025-07-24", - "port-version": 1, + "port-version": 3, "description": "LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.", "homepage": "https://github.com/LuaJIT/LuaJIT", "license": "MIT", diff --git a/vcpkg-ports/ports/openssl/portfile.cmake b/vcpkg-ports/ports/openssl/portfile.cmake new file mode 100644 index 0000000..78c1d35 --- /dev/null +++ b/vcpkg-ports/ports/openssl/portfile.cmake @@ -0,0 +1,68 @@ +set(VCPKG_BUILD_TYPE release) + +# Use the system-installed OpenSSL instead of building from source. +# Fedora 43 ships OpenSSL 3.5.4 with full headers at /usr/include/openssl +# and libraries at /usr/lib64/libssl.so + /usr/lib64/libcrypto.so. + +set(prefix "${CURRENT_PACKAGES_DIR}") + +# Write a cmake config so downstream find_package(OpenSSL) works. +file(WRITE "${prefix}/share/openssl/openssl-config.cmake" " +set(OPENSSL_FOUND TRUE) +set(OPENSSL_INCLUDE_DIR \"/usr/include\") +set(OPENSSL_VERSION \"3.5.4\") + +if(NOT TARGET OpenSSL::Crypto) + add_library(OpenSSL::Crypto SHARED IMPORTED) + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LOCATION \"/usr/lib64/libcrypto.so\" + INTERFACE_INCLUDE_DIRECTORIES \"/usr/include\" + ) +endif() + +if(NOT TARGET OpenSSL::SSL) + add_library(OpenSSL::SSL SHARED IMPORTED) + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LOCATION \"/usr/lib64/libssl.so\" + INTERFACE_INCLUDE_DIRECTORIES \"/usr/include\" + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto + ) +endif() + +set(OPENSSL_SSL_LIBRARY \"/usr/lib64/libssl.so\") +set(OPENSSL_CRYPTO_LIBRARY \"/usr/lib64/libcrypto.so\") +set(OPENSSL_LIBRARIES \"/usr/lib64/libssl.so;/usr/lib64/libcrypto.so\") +") + +# Write pkg-config file for packages that use pkg-config to find OpenSSL. +file(MAKE_DIRECTORY "${prefix}/lib/pkgconfig") +file(WRITE "${prefix}/lib/pkgconfig/openssl.pc" +"Name: OpenSSL +Description: Secure Sockets Layer and cryptography libraries (system) +Version: 3.5.4 +Libs: -L/usr/lib64 -lssl -lcrypto +Cflags: -I/usr/include +") +file(WRITE "${prefix}/lib/pkgconfig/libssl.pc" +"Name: libssl +Description: Secure Sockets Layer library (system) +Version: 3.5.4 +Libs: -L/usr/lib64 -lssl +Cflags: -I/usr/include +Requires.private: libcrypto +") +file(WRITE "${prefix}/lib/pkgconfig/libcrypto.pc" +"Name: libcrypto +Description: OpenSSL cryptography library (system) +Version: 3.5.4 +Libs: -L/usr/lib64 -lcrypto +Cflags: -I/usr/include +") + +file(WRITE "${prefix}/share/openssl/copyright" + "OpenSSL is distributed under the Apache License 2.0.\n" + "See https://openssl.org/source/license.html\n" +) + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg-ports/ports/openssl/vcpkg.json b/vcpkg-ports/ports/openssl/vcpkg.json new file mode 100644 index 0000000..a074dbc --- /dev/null +++ b/vcpkg-ports/ports/openssl/vcpkg.json @@ -0,0 +1,5 @@ +{ + "name": "openssl", + "version": "3.5.4", + "description": "System OpenSSL wrapper (uses /usr/include/openssl and /usr/lib64/libssl)" +} diff --git a/vcpkg-ports/ports/pthread-stubs/portfile.cmake b/vcpkg-ports/ports/pthread-stubs/portfile.cmake new file mode 100644 index 0000000..f2f8aa2 --- /dev/null +++ b/vcpkg-ports/ports/pthread-stubs/portfile.cmake @@ -0,0 +1,20 @@ +# On Linux, all pthread functions are provided by glibc. +# pthread-stubs is only needed on systems where they aren't — we just +# emit an empty pkg-config file so downstream ports that require +# pthread-stubs find something to link against. +set(VCPKG_BUILD_TYPE release) + +file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/pthread-stubs.pc" +"Name: pthread-stubs +Description: Weak aliases for pthread functions (native pthreads available) +Version: 0.4 +Libs: +Cflags: +") + +file(WRITE "${CURRENT_PACKAGES_DIR}/share/pthread-stubs/copyright" +"pthread-stubs is in the public domain / X11 license. +On this system, native pthreads (glibc) are used instead.") + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg-ports/ports/pthread-stubs/vcpkg.json b/vcpkg-ports/ports/pthread-stubs/vcpkg.json new file mode 100644 index 0000000..aab142c --- /dev/null +++ b/vcpkg-ports/ports/pthread-stubs/vcpkg.json @@ -0,0 +1,5 @@ +{ + "name": "pthread-stubs", + "version": "0.4", + "description": "Provides weak aliases for pthread functions (native glibc pthreads used on Linux)" +} diff --git a/vcpkg-ports/versions/a-/angle.json b/vcpkg-ports/versions/a-/angle.json new file mode 100644 index 0000000..70e783c --- /dev/null +++ b/vcpkg-ports/versions/a-/angle.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "version-string": "chromium_5414", + "port-version": 9, + "path": "$/ports/angle" + } + ] +} diff --git a/vcpkg-ports/versions/baseline.json b/vcpkg-ports/versions/baseline.json index 4a6f04d..b03bb02 100644 --- a/vcpkg-ports/versions/baseline.json +++ b/vcpkg-ports/versions/baseline.json @@ -8,8 +8,11 @@ "luajit": { "baseline": "2023-04-16", "port-version": 1 } }, "2025-10-07": { + "angle": { "baseline": "chromium_5414", "port-version": 9 }, "glfw3": { "baseline": "3.4", "port-version": 1 }, "gli": { "baseline": "2021-07-06", "port-version": 3 }, - "luajit": { "baseline": "2025-07-24", "port-version": 1 } + "luajit": { "baseline": "2025-07-24", "port-version": 3 }, + "openssl": { "baseline": "3.5.4", "port-version": 0 }, + "pthread-stubs": { "baseline": "0.4", "port-version": 0 } } } \ No newline at end of file diff --git a/vcpkg-ports/versions/l-/luajit.json b/vcpkg-ports/versions/l-/luajit.json index 158fee9..810c293 100644 --- a/vcpkg-ports/versions/l-/luajit.json +++ b/vcpkg-ports/versions/l-/luajit.json @@ -1,5 +1,15 @@ { "versions": [ + { + "version-date": "2025-07-24", + "port-version": 3, + "path": "$/ports/luajit/2025-07-24_1" + }, + { + "version-date": "2025-07-24", + "port-version": 2, + "path": "$/ports/luajit/2025-07-24_1" + }, { "version-date": "2025-07-24", "port-version": 1, diff --git a/vcpkg-ports/versions/o-/openssl.json b/vcpkg-ports/versions/o-/openssl.json new file mode 100644 index 0000000..85c04f5 --- /dev/null +++ b/vcpkg-ports/versions/o-/openssl.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "version": "3.5.4", + "port-version": 0, + "path": "$/ports/openssl" + } + ] +} diff --git a/vcpkg-ports/versions/p-/pthread-stubs.json b/vcpkg-ports/versions/p-/pthread-stubs.json new file mode 100644 index 0000000..4c2b7e2 --- /dev/null +++ b/vcpkg-ports/versions/p-/pthread-stubs.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "version": "0.4", + "port-version": 0, + "path": "$/ports/pthread-stubs" + } + ] +}