diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/wxwidgets | |
Diffstat (limited to 'vcpkg/ports/wxwidgets')
| -rw-r--r-- | vcpkg/ports/wxwidgets/example/CMakeLists.txt | 33 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/fix-libs-export.patch | 21 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/fix-pcre2.patch | 23 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/gtk3-link-libraries.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/install-layout.patch | 46 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/nanosvg-ext-depend.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/portfile.cmake | 238 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/relocatable-wx-config.patch | 40 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/sdl2.patch | 29 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/setup.h.in | 5 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/vcpkg-cmake-wrapper.cmake | 87 | ||||
| -rw-r--r-- | vcpkg/ports/wxwidgets/vcpkg.json | 109 |
13 files changed, 665 insertions, 0 deletions
diff --git a/vcpkg/ports/wxwidgets/example/CMakeLists.txt b/vcpkg/ports/wxwidgets/example/CMakeLists.txt new file mode 100644 index 0000000..11d3084 --- /dev/null +++ b/vcpkg/ports/wxwidgets/example/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.7) + +project(wxwidgets-example) + +add_executable(main WIN32 popup.cpp) + +find_package(wxWidgets REQUIRED) +target_compile_features(main PRIVATE cxx_std_11) +target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$<CONFIG:DEBUG>:${wxWidgets_DEFINITIONS_DEBUG}>") +target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS}) +target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES}) + +add_executable(main2 WIN32 popup.cpp) + +find_package(wxWidgets CONFIG REQUIRED) +target_link_libraries(main2 PRIVATE wx::core wx::base) +target_compile_features(main2 PRIVATE cxx_std_11) + +option(USE_WXRC "Use the wxrc resource compiler" ON) +if(USE_WXRC) + execute_process( + COMMAND "${wxWidgets_wxrc_EXECUTABLE}" --help + RESULTS_VARIABLE error_result + ) + if(error_result) + message(FATAL_ERROR "Failed to run wxWidgets_wxrc_EXECUTABLE (${wxWidgets_wxrc_EXECUTABLE})") + endif() +endif() + +set(PRINT_VARS "" CACHE STRING "Variables to print at the end of configuration") +foreach(var IN LISTS PRINT_VARS) + message(STATUS "${var}:=${${var}}") +endforeach() diff --git a/vcpkg/ports/wxwidgets/fix-libs-export.patch b/vcpkg/ports/wxwidgets/fix-libs-export.patch new file mode 100644 index 0000000..63bb9d3 --- /dev/null +++ b/vcpkg/ports/wxwidgets/fix-libs-export.patch @@ -0,0 +1,21 @@ +diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake
+index b359560..7504458 100644
+--- a/build/cmake/config.cmake
++++ b/build/cmake/config.cmake
+@@ -39,8 +39,14 @@ macro(wx_get_dependencies var lib)
+ else()
+ # For the value like $<$<CONFIG:DEBUG>:LIB_PATH>
+ # Or $<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>
+- string(REGEX REPLACE "^.+>:(.+)>$" "\\1" dep_name ${dep})
+- if (NOT dep_name)
++ if(dep MATCHES "^(.+>):(.+)>$")
++ if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_MATCH_1 STREQUAL [[$<$<NOT:$<CONFIG:DEBUG>>]])
++ continue()
++ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_MATCH_1 STREQUAL [[$<$<CONFIG:DEBUG>]])
++ continue()
++ endif()
++ set(dep_name "${CMAKE_MATCH_2}")
++ else()
+ set(dep_name ${dep})
+ endif()
+ endif()
diff --git a/vcpkg/ports/wxwidgets/fix-pcre2.patch b/vcpkg/ports/wxwidgets/fix-pcre2.patch new file mode 100644 index 0000000..20063f4 --- /dev/null +++ b/vcpkg/ports/wxwidgets/fix-pcre2.patch @@ -0,0 +1,23 @@ +diff --git a/build/cmake/modules/FindPCRE2.cmake b/build/cmake/modules/FindPCRE2.cmake +index a27693a..455675a 100644 +--- a/build/cmake/modules/FindPCRE2.cmake ++++ b/build/cmake/modules/FindPCRE2.cmake +@@ -24,7 +24,10 @@ set(PCRE2_CODE_UNIT_WIDTH_USED "${PCRE2_CODE_UNIT_WIDTH}" CACHE INTERNAL "") + + find_package(PkgConfig QUIET) + pkg_check_modules(PC_PCRE2 QUIET libpcre2-${PCRE2_CODE_UNIT_WIDTH}) ++set(PCRE2_LIBRARIES ${PC_PCRE2_LINK_LIBRARIES}) ++set(PCRE2_INCLUDE_DIRS ${PC_PCRE2_INCLUDE_DIRS}) + ++if (0) + find_path(PCRE2_INCLUDE_DIRS + NAMES pcre2.h + HINTS ${PC_PCRE2_INCLUDEDIR} +@@ -36,6 +39,7 @@ find_library(PCRE2_LIBRARIES + HINTS ${PC_PCRE2_LIBDIR} + ${PC_PCRE2_LIBRARY_DIRS} + ) ++endif() + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS VERSION_VAR PC_PCRE2_VERSION) diff --git a/vcpkg/ports/wxwidgets/gtk3-link-libraries.patch b/vcpkg/ports/wxwidgets/gtk3-link-libraries.patch new file mode 100644 index 0000000..4e4c481 --- /dev/null +++ b/vcpkg/ports/wxwidgets/gtk3-link-libraries.patch @@ -0,0 +1,17 @@ +diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake +index d2939a1..daf33fe 100644 +--- a/build/cmake/modules/FindGTK3.cmake ++++ b/build/cmake/modules/FindGTK3.cmake +@@ -47,6 +47,12 @@ include(CheckSymbolExists) + set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS}) + check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND) + check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11) ++# With Lerc support in TIFF, Gtk3 may carry C++ compiler libs which break FindWxWidgets.cmake. ++# WxWidgets is C++, so we can remove them here using the inverse pattern. ++set(cxx_libs "${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}") ++list(REMOVE_ITEM cxx_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES}) ++list(REMOVE_ITEM GTK3_LINK_LIBRARIES ${cxx_libs}) ++set(GTK3_LIBRARIES "${GTK3_LINK_LIBRARIES}" CACHE INTERNAL "") + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK) + diff --git a/vcpkg/ports/wxwidgets/install-layout.patch b/vcpkg/ports/wxwidgets/install-layout.patch new file mode 100644 index 0000000..3a8b545 --- /dev/null +++ b/vcpkg/ports/wxwidgets/install-layout.patch @@ -0,0 +1,46 @@ +diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake +index f044d22d4d..a78b9aa1e9 100644 +--- a/build/cmake/init.cmake ++++ b/build/cmake/init.cmake +@@ -200,12 +200,12 @@ endif() + + if(WIN32_MSVC_NAMING) + if(wxBUILD_SHARED) +- set(lib_suffix "_dll") ++ # set(lib_suffix "_dll") + else() +- set(lib_suffix "_lib") ++ # set(lib_suffix "_lib") + endif() + +- set(wxPLATFORM_LIB_DIR "${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}${lib_suffix}") ++ # set(wxPLATFORM_LIB_DIR "${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}${lib_suffix}") + + # Generator expression to not create different Debug and Release directories + set(GEN_EXPR_DIR "$<1:/>") +diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake +index a373983043..2e1ace7bf9 100644 +--- a/build/cmake/install.cmake ++++ b/build/cmake/install.cmake +@@ -63,7 +63,7 @@ else() + + install(DIRECTORY DESTINATION "bin") + install(CODE "execute_process( \ +- COMMAND ${CMAKE_COMMAND} -E create_symlink \ ++ COMMAND ${CMAKE_COMMAND} -E copy \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID}\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \ + )" +diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt +index 15f4339ef9..f93849e025 100644 +--- a/build/cmake/utils/CMakeLists.txt ++++ b/build/cmake/utils/CMakeLists.txt +@@ -39,7 +39,7 @@ if(wxUSE_XRC) + + # Don't use wx_install() here to preserve escaping. + install(CODE "execute_process( \ +- COMMAND ${CMAKE_COMMAND} -E create_symlink \ ++ COMMAND ${CMAKE_COMMAND} -E copy \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \ + )" diff --git a/vcpkg/ports/wxwidgets/nanosvg-ext-depend.patch b/vcpkg/ports/wxwidgets/nanosvg-ext-depend.patch new file mode 100644 index 0000000..f76a456 --- /dev/null +++ b/vcpkg/ports/wxwidgets/nanosvg-ext-depend.patch @@ -0,0 +1,13 @@ +diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in +index b251109..60cf762 100644 +--- a/build/cmake/wxWidgetsConfig.cmake.in ++++ b/build/cmake/wxWidgetsConfig.cmake.in +@@ -1,5 +1,8 @@ + @PACKAGE_INIT@ + ++include(CMakeFindDependencyMacro) ++find_dependency(NanoSVG CONFIG) ++ + cmake_policy(PUSH) + # Set policies to prevent warnings + if(POLICY CMP0057) diff --git a/vcpkg/ports/wxwidgets/portfile.cmake b/vcpkg/ports/wxwidgets/portfile.cmake new file mode 100644 index 0000000..8c42132 --- /dev/null +++ b/vcpkg/ports/wxwidgets/portfile.cmake @@ -0,0 +1,238 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO wxWidgets/wxWidgets + REF "v${VERSION}" + SHA512 8ad17582c4ba721ffe76ada4bb8bd7bc4b050491220aca335fd0506a51354fb789d5bc3d965f0f459dc81784d6427c88272e2acc2099cddf73730231b5a16f62 + HEAD_REF master + PATCHES + install-layout.patch + relocatable-wx-config.patch + nanosvg-ext-depend.patch + fix-libs-export.patch + fix-pcre2.patch + gtk3-link-libraries.patch + sdl2.patch +) + +# Submodule dependencies +vcpkg_from_github( + OUT_SOURCE_PATH lexilla_SOURCE_PATH + REPO wxWidgets/lexilla + REF "27c20a6ae5eebf418debeac0166052ed6fb653bc" + SHA512 7e5de7f664509473b691af8261fca34c2687772faca7260eeba5f2984516e6f8edf88c27192e056c9dda996e2ad2c20f6d1dff1c4bd2f3c0d74852cb50ca424a + HEAD_REF wx +) +file(COPY "${lexilla_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/src/stc/lexilla") +vcpkg_from_github( + OUT_SOURCE_PATH scintilla_SOURCE_PATH + REPO wxWidgets/scintilla + REF "0b90f31ced23241054e8088abb50babe9a44ae67" + SHA512 db1f3007f4bd8860fad0817b6cf87980a4b713777025128cf5caea8d6d17b6fafe23fd22ff6886d7d5a420f241d85b7502b85d7e52b4ddb0774edc4b0a0203e7 + HEAD_REF wx +) +file(COPY "${scintilla_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/src/stc/scintilla") + +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + fonts wxUSE_PRIVATE_FONTS + media wxUSE_MEDIACTRL + secretstore wxUSE_SECRETSTORE + sound wxUSE_SOUND + webview wxUSE_WEBVIEW + webview wxUSE_WEBVIEW_EDGE +) + +set(OPTIONS_RELEASE "") +if(NOT "debug-support" IN_LIST FEATURES) + list(APPEND OPTIONS_RELEASE "-DwxBUILD_DEBUG_LEVEL=0") +endif() + +set(OPTIONS "") +if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")) + list(APPEND OPTIONS + -DwxUSE_STACKWALKER=OFF + ) +endif() + +if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_OSX) + list(APPEND OPTIONS -DwxUSE_WEBREQUEST_CURL=OFF) +else() + list(APPEND OPTIONS -DwxUSE_WEBREQUEST_CURL=ON) +endif() + +if(VCPKG_TARGET_IS_WINDOWS) + if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + list(APPEND OPTIONS -DwxBUILD_USE_STATIC_RUNTIME=OFF) + else() + list(APPEND OPTIONS -DwxBUILD_USE_STATIC_RUNTIME=ON) + endif() +endif() + +if("webview" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") + list(APPEND OPTIONS -DwxUSE_WEBVIEW_EDGE_STATIC=ON) +endif() + +vcpkg_find_acquire_program(PKGCONFIG) + +# This may be set to ON by users in a custom triplet. +# The use of 'WXWIDGETS_USE_STD_CONTAINERS' (ON or OFF) is not API compatible +# which is why it must be set in a custom triplet rather than a port feature. +# For backwards compatibility, we also replace 'wxUSE_STL' (which no longer +# exists) with 'wxUSE_STD_STRING_CONV_IN_WXSTRING' which still exists and was +# set by `wxUSE_STL` previously. +if(NOT DEFINED WXWIDGETS_USE_STL) + set(WXWIDGETS_USE_STL OFF) +endif() + +if(NOT DEFINED WXWIDGETS_USE_STD_CONTAINERS) + set(WXWIDGETS_USE_STD_CONTAINERS OFF) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DwxUSE_REGEX=sys + -DwxUSE_ZLIB=sys + -DwxUSE_EXPAT=sys + -DwxUSE_LIBJPEG=sys + -DwxUSE_LIBPNG=sys + -DwxUSE_LIBTIFF=sys + -DwxUSE_NANOSVG=sys + -DwxUSE_LIBWEBP=sys + -DwxUSE_GLCANVAS=ON + -DwxUSE_LIBGNOMEVFS=OFF + -DwxUSE_LIBNOTIFY=OFF + -DwxUSE_STD_STRING_CONV_IN_WXSTRING=${WXWIDGETS_USE_STL} + -DwxUSE_STD_CONTAINERS=${WXWIDGETS_USE_STD_CONTAINERS} + -DwxUSE_UIACTIONSIMULATOR=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_GSPELL=ON + -DCMAKE_DISABLE_FIND_PACKAGE_MSPACK=ON + -DwxBUILD_INSTALL_RUNTIME_DIR:PATH=bin + ${OPTIONS} + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + # The minimum cmake version requirement for Cotire is 2.8.12. + # however, we need to declare that the minimum cmake version requirement is at least 3.1 to use CMAKE_PREFIX_PATH as the path to find .pc. + -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON + OPTIONS_RELEASE + ${OPTIONS_RELEASE} + MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_GSPELL + CMAKE_DISABLE_FIND_PACKAGE_MSPACK +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/wxWidgets) + +# The CMake export is not ready for use: It lacks a config file. +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/lib/cmake + ${CURRENT_PACKAGES_DIR}/debug/lib/cmake +) + +set(tools wxrc) +if(NOT VCPKG_TARGET_IS_WINDOWS) + list(APPEND tools wxrc-3.3) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/wx-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wx-config") + if(NOT VCPKG_BUILD_TYPE) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/wx-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/wx-config") + endif() +endif() +vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN) + +# do the copy pdbs now after the dlls got moved to the expected /bin folder above +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/msvc") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/mswu") +if(VCPKG_BUILD_TYPE STREQUAL "release") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/mswud") +endif() + +file(GLOB_RECURSE INCLUDES "${CURRENT_PACKAGES_DIR}/include/*.h") +if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h") + list(APPEND INCLUDES "${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h") +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h") + list(APPEND INCLUDES "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h") +endif() +foreach(INC IN LISTS INCLUDES) + file(READ "${INC}" _contents) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + string(REPLACE "defined(WXUSINGDLL)" "0" _contents "${_contents}") + else() + string(REPLACE "defined(WXUSINGDLL)" "1" _contents "${_contents}") + endif() + # Remove install prefix from setup.h to ensure package is relocatable + string(REGEX REPLACE "\n#define wxINSTALL_PREFIX [^\n]*" "\n#define wxINSTALL_PREFIX \"\"" _contents "${_contents}") + file(WRITE "${INC}" "${_contents}") +endforeach() + +if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/include/wx/setup.h") + file(GLOB_RECURSE WX_SETUP_H_FILES_DBG "${CURRENT_PACKAGES_DIR}/debug/lib/*.h") + file(GLOB_RECURSE WX_SETUP_H_FILES_REL "${CURRENT_PACKAGES_DIR}/lib/*.h") + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + vcpkg_replace_string("${WX_SETUP_H_FILES_REL}" "${CURRENT_PACKAGES_DIR}" "" IGNORE_UNCHANGED) + + string(REPLACE "${CURRENT_PACKAGES_DIR}/lib/" "" WX_SETUP_H_FILES_REL "${WX_SETUP_H_FILES_REL}") + string(REPLACE "/setup.h" "" WX_SETUP_H_REL_RELATIVE "${WX_SETUP_H_FILES_REL}") + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + vcpkg_replace_string("${WX_SETUP_H_FILES_DBG}" "${CURRENT_PACKAGES_DIR}" "" IGNORE_UNCHANGED) + + string(REPLACE "${CURRENT_PACKAGES_DIR}/debug/lib/" "" WX_SETUP_H_FILES_DBG "${WX_SETUP_H_FILES_DBG}") + string(REPLACE "/setup.h" "" WX_SETUP_H_DBG_RELATIVE "${WX_SETUP_H_FILES_DBG}") + endif() + + configure_file("${CMAKE_CURRENT_LIST_DIR}/setup.h.in" "${CURRENT_PACKAGES_DIR}/include/wx/setup.h" @ONLY) +endif() + +file(GLOB configs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/lib/wx/config/*" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wx-config") +foreach(config IN LISTS configs) + vcpkg_replace_string("${config}" "${CURRENT_INSTALLED_DIR}" [[${prefix}]]) +endforeach() +file(GLOB configs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/debug/lib/wx/config/*" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/wx-config") +foreach(config IN LISTS configs) + vcpkg_replace_string("${config}" "${CURRENT_INSTALLED_DIR}/debug" [[${prefix}]]) +endforeach() + +# For CMake multi-config in connection with wrapper +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h") + file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h" + DESTINATION "${CURRENT_PACKAGES_DIR}/lib/mswud/wx" + ) +endif() + +if(NOT "debug-support" IN_LIST FEATURES) + if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0") + else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx-3.3/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0") + endif() +endif() + +if("example" IN_LIST FEATURES) + file(INSTALL + "${CMAKE_CURRENT_LIST_DIR}/example/CMakeLists.txt" + "${SOURCE_PATH}/samples/popup/popup.cpp" + "${SOURCE_PATH}/samples/sample.xpm" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/example" + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/example/popup.cpp" "../sample.xpm" "sample.xpm") +endif() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) + +file(REMOVE "${CURRENT_PACKAGES_DIR}/wxwidgets.props") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/wxwidgets.props") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/build") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/build") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/docs/licence.txt") diff --git a/vcpkg/ports/wxwidgets/relocatable-wx-config.patch b/vcpkg/ports/wxwidgets/relocatable-wx-config.patch new file mode 100644 index 0000000..608c9c5 --- /dev/null +++ b/vcpkg/ports/wxwidgets/relocatable-wx-config.patch @@ -0,0 +1,40 @@ +diff --git a/wx-config.in b/wx-config.in +index 4df8571..a90db3d 100644 +--- a/wx-config.in ++++ b/wx-config.in +@@ -398,8 +398,23 @@ is_cross() { [ "x@cross_compiling@" = "xyes" ]; } + + + # Determine the base directories we require. +-prefix=${input_option_prefix-${this_prefix:-@prefix@}} +-exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-@exec_prefix@}}} ++vcpkg_prefix=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) ++case "$vcpkg_prefix" in ++ */lib/wx/config) ++ vcpkg_prefix=${vcpkg_prefix%/*/*/*} ++ ;; ++ */tools/wxwidgets/debug) ++ vcpkg_prefix=${vcpkg_prefix%/*/*/*}/debug ++ ;; ++ */tools/wxwidgets) ++ vcpkg_prefix=${vcpkg_prefix%/*/*} ++ ;; ++esac ++if [ -n "@MINGW@" -a -n "@CMAKE_HOST_WIN32@" ]; then ++ vcpkg_prefix=$(cygpath -m "$vcpkg_prefix") ++fi ++prefix=${input_option_prefix-${this_prefix:-$vcpkg_prefix}} ++exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-$prefix}}} + wxconfdir="@libdir@/wx/config" + + installed_configs=`cd "$wxconfdir" 2> /dev/null && ls | grep -v "^inplace-"` +@@ -936,6 +951,9 @@ prefix=${this_prefix-$prefix} + exec_prefix=${this_exec_prefix-$exec_prefix} + + includedir="@includedir@" ++if [ "@CMAKE_BUILD_TYPE@" = "Debug" ] ; then ++ includedir="${includedir%/debug/include}/include" ++fi + libdir="@libdir@" + bindir="@bindir@" + diff --git a/vcpkg/ports/wxwidgets/sdl2.patch b/vcpkg/ports/wxwidgets/sdl2.patch new file mode 100644 index 0000000..511775c --- /dev/null +++ b/vcpkg/ports/wxwidgets/sdl2.patch @@ -0,0 +1,29 @@ +diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake +index 5447d33..f5440b4 100644 +--- a/build/cmake/init.cmake ++++ b/build/cmake/init.cmake +@@ -530,7 +530,9 @@ if(wxUSE_GUI) + endif() + + if(wxUSE_SOUND AND wxUSE_LIBSDL AND UNIX AND NOT APPLE) +- find_package(SDL2) ++ find_package(SDL2 CONFIG REQUIRED) ++ set(SDL2_INCLUDE_DIR "" CACHE INTERNAL "") ++ set(SDL2_LIBRARY SDL2::SDL2 CACHE INTERNAL "") + if(NOT SDL2_FOUND) + find_package(SDL) + endif() +diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in +index 60cf762..202a8c3 100644 +--- a/build/cmake/wxWidgetsConfig.cmake.in ++++ b/build/cmake/wxWidgetsConfig.cmake.in +@@ -2,6 +2,9 @@ + + include(CMakeFindDependencyMacro) + find_dependency(NanoSVG CONFIG) ++if("@wxUSE_LIBSDL@") ++ find_dependency(SDL2 CONFIG) ++endif() + + cmake_policy(PUSH) + # Set policies to prevent warnings diff --git a/vcpkg/ports/wxwidgets/setup.h.in b/vcpkg/ports/wxwidgets/setup.h.in new file mode 100644 index 0000000..ad95797 --- /dev/null +++ b/vcpkg/ports/wxwidgets/setup.h.in @@ -0,0 +1,5 @@ +#ifdef _DEBUG
+#include "../../debug/lib/@WX_SETUP_H_DBG_RELATIVE@/setup.h"
+#else
+#include "../../lib/@WX_SETUP_H_REL_RELATIVE@/setup.h"
+#endif
diff --git a/vcpkg/ports/wxwidgets/usage b/vcpkg/ports/wxwidgets/usage new file mode 100644 index 0000000..209456e --- /dev/null +++ b/vcpkg/ports/wxwidgets/usage @@ -0,0 +1,4 @@ +The package wxwidgets provides CMake targets:
+
+ find_package(wxWidgets CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE wx::core wx::base)
diff --git a/vcpkg/ports/wxwidgets/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/wxwidgets/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000..f2a379a --- /dev/null +++ b/vcpkg/ports/wxwidgets/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,87 @@ +cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0054 NEW)
+cmake_policy(SET CMP0057 NEW)
+
+get_filename_component(_vcpkg_wx_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
+set(wxWidgets_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
+set(WX_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
+unset(_vcpkg_wx_root)
+
+if(WIN32)
+ # Find all libs with "33" infix which is unknown to FindwxWidgets.cmake
+ function(z_vcpkg_wxwidgets_find_base_library BASENAME)
+ find_library(WX_${BASENAME}d wx${BASENAME}33ud NAMES wx${BASENAME}d PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(WX_${BASENAME} wx${BASENAME}33u NAMES wx${BASENAME} PATHS "${wxWidgets_ROOT_DIR}/lib" NO_DEFAULT_PATH REQUIRED)
+ endfunction()
+ function(z_vcpkg_wxwidgets_find_suffix_library BASENAME)
+ foreach(lib IN LISTS ARGN)
+ find_library(WX_${lib}d NAMES wx${BASENAME}33ud_${lib} PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(WX_${lib} NAMES wx${BASENAME}33u_${lib} PATHS "${wxWidgets_ROOT_DIR}/lib" NO_DEFAULT_PATH)
+ endforeach()
+ endfunction()
+ z_vcpkg_wxwidgets_find_base_library(base)
+ z_vcpkg_wxwidgets_find_suffix_library(base net odbc xml)
+ z_vcpkg_wxwidgets_find_suffix_library(msw core adv aui html media xrc dbgrid gl qa richtext stc ribbon propgrid webview)
+ if(WX_stc AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ z_vcpkg_wxwidgets_find_base_library(scintilla)
+ endif()
+ # Force FindwxWidgets.cmake win32 mode for all windows targets built on windows
+ set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
+ set(CMAKE_CROSSCOMPILING 0)
+ set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
+else()
+ # FindwxWidgets.cmake unix mode, single-config
+ set(_vcpkg_wxconfig "")
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "Debug" IN_LIST MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE})
+ # Debug
+ set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/debug/lib" CACHE INTERNAL "")
+ file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
+ endif()
+ if(NOT _vcpkg_wxconfig)
+ # Release or fallback
+ set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
+ file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
+ endif()
+ set(wxWidgets_CONFIG_EXECUTABLE "${_vcpkg_wxconfig}" CACHE INTERNAL "")
+ unset(_vcpkg_wxconfig)
+endif()
+set(WX_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "")
+
+# https://gitlab.kitware.com/cmake/cmake/-/issues/26718
+# Instead of special-casing the `atomic` library, we skip the checks entirely.
+set(_wx_lib_found TRUE)
+
+_find_package(${ARGS})
+
+unset(_wx_lib_found)
+
+if(DEFINED _vcpkg_wxwidgets_backup_crosscompiling)
+ set(CMAKE_CROSSCOMPILING "${_vcpkg_wxwidgets_backup_crosscompiling}")
+ unset(_vcpkg_wxwidgets_backup_crosscompiling)
+endif()
+
+if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT "wx::core" IN_LIST wxWidgets_LIBRARIES)
+ find_package(NanoSVG CONFIG QUIET)
+ list(APPEND wxWidgets_LIBRARIES
+ NanoSVG::nanosvg NanoSVG::nanosvgrast
+ )
+endif()
+
+
+if(WIN32 AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT "wx::core" IN_LIST wxWidgets_LIBRARIES)
+ find_package(EXPAT QUIET)
+ find_package(JPEG QUIET)
+ find_package(PNG QUIET)
+ find_package(TIFF QUIET)
+ find_package(ZLIB QUIET)
+ list(APPEND wxWidgets_LIBRARIES
+ ${EXPAT_LIBRARIES}
+ ${JPEG_LIBRARIES}
+ ${PNG_LIBRARIES}
+ ${TIFF_LIBRARIES}
+ ${ZLIB_LIBRARIES}
+ )
+endif()
+
+cmake_policy(POP)
diff --git a/vcpkg/ports/wxwidgets/vcpkg.json b/vcpkg/ports/wxwidgets/vcpkg.json new file mode 100644 index 0000000..132f4fe --- /dev/null +++ b/vcpkg/ports/wxwidgets/vcpkg.json @@ -0,0 +1,109 @@ +{ + "name": "wxwidgets", + "version": "3.3.1", + "description": [ + "Widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. ", + "Set WXWIDGETS_USE_STL in a custom triplet to build with the wxUSE_STL build option.", + "Set WXWIDGETS_USE_STD_CONTAINERS in a custom triplet to build with the wxUSE_STD_CONTAINERS build option." + ], + "homepage": "https://github.com/wxWidgets/wxWidgets", + "license": "LGPL-2.0-or-later WITH WxWindows-exception-3.1", + "supports": "!uwp & !xbox", + "dependencies": [ + { + "name": "cairo", + "default-features": false, + "platform": "!windows & !osx & !ios" + }, + { + "name": "curl", + "default-features": false, + "platform": "!windows & !osx" + }, + "expat", + { + "name": "gtk3", + "platform": "!windows & !osx & !ios" + }, + { + "name": "libiconv", + "platform": "!windows" + }, + "libjpeg-turbo", + "libpng", + "libwebp", + "nanosvg", + "opengl", + { + "name": "pcre2", + "default-features": false + }, + { + "name": "tiff", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "default-features": [ + "debug-support", + "sound" + ], + "features": { + "debug-support": { + "description": "Enable wxWidgets debugging support hooks even for release builds (wxDEBUG_LEVEL 1)" + }, + "example": { + "description": "Example source code and CMake project" + }, + "fonts": { + "description": "Enable to use the font functionality of wxWidgets", + "dependencies": [ + { + "name": "fontconfig", + "platform": "!windows & !osx" + }, + { + "name": "pango", + "platform": "!windows & !osx" + } + ] + }, + "media": { + "description": "Build wxMediaCtrl support", + "dependencies": [ + { + "name": "gstreamer", + "default-features": false, + "platform": "!windows & !osx & !ios" + } + ] + }, + "secretstore": { + "description": "Use wxSecretStore class" + }, + "sound": { + "description": "Build wxSound support", + "dependencies": [ + { + "name": "sdl2", + "default-features": false, + "platform": "!windows & !osx & !ios" + } + ] + }, + "webview": { + "description": "The Edge backend uses Microsoft's Edge WebView2", + "dependencies": [ + "webview2" + ] + } + } +} |