diff --git a/ports/wxwidgets/disable-platform-lib-dir.patch b/ports/wxwidgets/disable-platform-lib-dir.patch deleted file mode 100644 index 930477c010..0000000000 --- a/ports/wxwidgets/disable-platform-lib-dir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake -index d013e92..c03135d 100644 ---- a/build/cmake/init.cmake -+++ b/build/cmake/init.cmake -@@ -149,7 +149,7 @@ else() - set(wxCOMPILER_PREFIX) - endif() - --if(MSVC) -+if(MSVC AND NOT wxBUILD_DISABLE_PLATFORM_LIB_DIR) - if(wxBUILD_SHARED) - set(lib_suffix "dll") - else() diff --git a/ports/wxwidgets/example/CMakeLists.txt b/ports/wxwidgets/example/CMakeLists.txt new file mode 100644 index 0000000000..b9fc010314 --- /dev/null +++ b/ports/wxwidgets/example/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.7) + +project(wxwidgets-example) + +add_executable(main WIN32 popup.cpp) + +find_package(wxWidgets REQUIRED) +target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$:${wxWidgets_DEFINITIONS_DEBUG}>") +target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS}) +target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES}) + +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() diff --git a/ports/wxwidgets/fix-libs-export.patch b/ports/wxwidgets/fix-libs-export.patch new file mode 100644 index 0000000000..35e1379ff0 --- /dev/null +++ b/ports/wxwidgets/fix-libs-export.patch @@ -0,0 +1,36 @@ +diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake +index 91d11ac..2791466 100644 +--- a/build/cmake/config.cmake ++++ b/build/cmake/config.cmake +@@ -41,7 +41,30 @@ macro(wx_get_dependencies var lib) + endif() + set(dep_name "-l${dep_name}") + else() +- get_filename_component(dep_name ${dep} NAME) ++ # For the value like $<$:LIB_PATH> ++ # Or $<$>:LIB_PATH> ++ if(dep MATCHES "^(.+>):(.+)>$") ++ if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_MATCH_1 STREQUAL [[$<$>]]) ++ continue() ++ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_MATCH_1 STREQUAL [[$<$]]) ++ continue() ++ endif() ++ set(dep_name "${CMAKE_MATCH_2}") ++ else() ++ set(dep_name ${dep}) ++ endif() ++ endif() ++ if(dep_name STREQUAL "libc.so") ++ continue() # don't include this library ++ elseif(dep_name MATCHES "^-") # -l, -framework, -weak_framework ++ # ok ++ elseif(dep_name MATCHES "^lib(.*)(.so|.dylib|.tbd|.a)$") ++ set(dep_name "-l${CMAKE_MATCH_1} ") ++ elseif(dep_name) ++ get_filename_component(abs_path ${dep_name} PATH) ++ if (NOT abs_path) ++ set(dep_name "-l${dep_name} ") ++ endif() + endif() + wx_string_append(${var} "${dep_name} ") + endforeach() diff --git a/ports/wxwidgets/fix-linux-configure.patch b/ports/wxwidgets/fix-linux-configure.patch index 059bb42b7b..0fc85bf080 100644 --- a/ports/wxwidgets/fix-linux-configure.patch +++ b/ports/wxwidgets/fix-linux-configure.patch @@ -13,37 +13,3 @@ index bb69643..09b52a6 100644 cotire_get_source_files_compile_definitions( "${_config}" "${_language}" COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig} ${_targetSources}) endforeach() -diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake -index 91d11ac..2791466 100644 ---- a/build/cmake/config.cmake -+++ b/build/cmake/config.cmake -@@ -41,9 +41,27 @@ macro(wx_get_dependencies var lib) - endif() - set(dep_name "-l${dep_name}") - else() -- get_filename_component(dep_name ${dep} NAME) -+ # For the value like $<$:LIB_PATH> -+ # Or $<$>:LIB_PATH> -+ string(REGEX REPLACE "^.+>:(.+)>$" "\\1" dep_name ${dep}) -+ if (NOT dep_name) -+ set(dep_name ${dep}) -+ endif() -+ endif() -+ if(dep_name STREQUAL "libc.so") -+ # don't include this library -+ elseif(dep_name MATCHES "^-(.*)$") # -l, -framework, -weak_framework -+ wx_string_append(${var} "${dep_name} ") -+ elseif(dep_name MATCHES "^lib(.*)(.so|.dylib|.tbd|.a)$") -+ wx_string_append(${var} "-l${CMAKE_MATCH_1} ") -+ elseif(dep_name) -+ get_filename_component(abs_path ${dep_name} PATH) -+ if (abs_path) # value contains path -+ wx_string_append(${var} "${dep_name} ") -+ else() -+ wx_string_append(${var} "-l${dep_name} ") -+ endif() - endif() -- wx_string_append(${var} "${dep_name} ") - endforeach() - string(STRIP ${${var}} ${var}) - endif() diff --git a/ports/wxwidgets/install-layout.patch b/ports/wxwidgets/install-layout.patch new file mode 100644 index 0000000000..bb99dd0071 --- /dev/null +++ b/ports/wxwidgets/install-layout.patch @@ -0,0 +1,52 @@ +diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake +index 902b7c5..dba3d07 100644 +--- a/build/cmake/functions.cmake ++++ b/build/cmake/functions.cmake +@@ -374,7 +374,7 @@ macro(wx_add_library name) + wx_install(TARGETS ${name} + LIBRARY DESTINATION "lib${wxPLATFORM_LIB_DIR}" + ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}" +- RUNTIME DESTINATION "lib${wxPLATFORM_LIB_DIR}" ++ RUNTIME DESTINATION "bin" + BUNDLE DESTINATION Applications/wxWidgets + ) + endif() +diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake +index 0bc4f93..65fe3b8 100644 +--- a/build/cmake/init.cmake ++++ b/build/cmake/init.cmake +@@ -149,7 +149,7 @@ else() + set(wxCOMPILER_PREFIX) + endif() + +-if(MSVC) ++if(MSVC AND NOT wxBUILD_DISABLE_PLATFORM_LIB_DIR) + if(wxBUILD_SHARED) + set(lib_suffix "dll") + else() +diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake +index 968dff8..5b4fda9 100644 +--- a/build/cmake/install.cmake ++++ b/build/cmake/install.cmake +@@ -45,7 +45,7 @@ else() + + install(DIRECTORY DESTINATION "bin") + install(CODE "execute_process( \ +- COMMAND ${CMAKE_COMMAND} -E create_symlink \ ++ COMMAND ${CMAKE_COMMAND} -E copy \ + ${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID} \ + ${CMAKE_INSTALL_PREFIX}/bin/wx-config \ + )" +diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt +index 4108d6a..19d730e 100644 +--- a/build/cmake/utils/CMakeLists.txt ++++ b/build/cmake/utils/CMakeLists.txt +@@ -39,7 +39,7 @@ if(wxUSE_XRC) + )" + ) + install(CODE "execute_process( \ +- COMMAND ${CMAKE_COMMAND} -E create_symlink \ ++ COMMAND ${CMAKE_COMMAND} -E copy \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${EXE_SUFFIX} \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \ + )" diff --git a/ports/wxwidgets/mingw-output-name.patch b/ports/wxwidgets/mingw-output-name.patch new file mode 100644 index 0000000000..772ac0743d --- /dev/null +++ b/ports/wxwidgets/mingw-output-name.patch @@ -0,0 +1,21 @@ +diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake +index 902b7c5..ad8d1c4 100644 +--- a/build/cmake/functions.cmake ++++ b/build/cmake/functions.cmake +@@ -184,7 +184,6 @@ function(wx_set_target_properties target_name is_base) + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME "wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version}" +- OUTPUT_NAME_DEBUG "wx_${lib_toolkit}${lib_unicode}d${lib_flavour}${lib_suffix}-${lib_version}" + PREFIX "lib" + ) + endif() +@@ -486,7 +485,7 @@ function(wx_set_builtin_target_properties target_name) + PROPERTIES + OUTPUT_NAME ${target_name}${lib_unicode}${postfix} + ) +- if(WIN32) ++ if(WIN32 AND NOT MINGW) + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME_DEBUG ${target_name}${lib_unicode}d diff --git a/ports/wxwidgets/portfile.cmake b/ports/wxwidgets/portfile.cmake index 441943a4a1..2bf7be2680 100644 --- a/ports/wxwidgets/portfile.cmake +++ b/ports/wxwidgets/portfile.cmake @@ -5,23 +5,50 @@ vcpkg_from_github( SHA512 33817f766b36d24e5e6f4eb7666f2e4c1ec305063cb26190001e0fc82ce73decc18697e8005da990a1c99dc1ccdac9b45bb2bbe5ba73e6e2aa860c768583314c HEAD_REF master PATCHES - disable-platform-lib-dir.patch + install-layout.patch + mingw-output-name.patch fix-build.patch fix-linux-configure.patch # Remove this patch in the next update + fix-libs-export.patch + relocatable-wx-config.patch ) -set(OPTIONS) -if(VCPKG_TARGET_IS_OSX) - set(OPTIONS -DCOTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=9999) +if(VCPKG_TARGET_IS_LINUX) + message(WARNING [[ +Port wxwidgets currently requires the following packages from the system package manager: + pkg-config + GTK 3 + libsecret + libgcrypt + libsystemd +These development packages can be installed on Ubuntu systems via + sudo apt-get install pkg-config libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev +]]) + foreach(conflicting_port IN ITEMS freetype glib) + if(EXISTS "${CURRENT_INSTALLED_DIR}/share/${conflicting_port}/copyright") + message(FATAL_ERROR "Port ${conflicting_port} must not be installed when building ${PORT}:${TARGET_TRIPLET}.") + endif() + endforeach() endif() -if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm) - set(OPTIONS +set(OPTIONS "") +if(VCPKG_TARGET_IS_OSX) + list(APPEND OPTIONS -DCOTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=9999) +endif() + +if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")) + list(APPEND OPTIONS -DwxUSE_OPENGL=OFF -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() + # wxWidgets on Linux currently needs to find the system's `gtk+-3.0.pc`. # vcpkg's port pkgconf would prevent this lookup. if(VCPKG_TARGET_IS_LINUX AND NOT VCPKG_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG}) @@ -29,6 +56,9 @@ if(VCPKG_TARGET_IS_LINUX AND NOT VCPKG_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CO if(system_pkg_config) set(ENV{PKG_CONFIG} "${system_pkg_config}") endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + list(APPEND OPTIONS -DPKG_CONFIG_ARGN=--static) + endif() endif() # This may be set to ON by users in a custom triplet. @@ -59,30 +89,17 @@ vcpkg_cmake_configure( vcpkg_cmake_install() -if (VCPKG_TARGET_IS_WINDOWS) - file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll") - if(DLLS) - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") - foreach(DLL IN LISTS DLLS) - get_filename_component(N "${DLL}" NAME) - file(RENAME "${DLL}" "${CURRENT_PACKAGES_DIR}/bin/${N}") - endforeach() - endif() - file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") - if(DLLS) - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") - foreach(DLL IN LISTS DLLS) - get_filename_component(N "${DLL}" NAME) - file(RENAME "${DLL}" "${CURRENT_PACKAGES_DIR}/debug/bin/${N}") - endforeach() +set(tools wxrc) +if(VCPKG_TARGET_IS_MINGW OR NOT VCPKG_TARGET_IS_WINDOWS) + list(APPEND tools wxrc-3.1) + 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() - -if(VCPKG_TARGET_IS_WINDOWS) - vcpkg_copy_tools(TOOL_NAMES wxrc AUTO_CLEAN) -else() - vcpkg_copy_tools(TOOL_NAMES wxrc wx-config wxrc-3.1 AUTO_CLEAN) -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() @@ -128,7 +145,33 @@ if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/include/wx/setup.h") configure_file("${CMAKE_CURRENT_LIST_DIR}/setup.h.in" "${CURRENT_PACKAGES_DIR}/include/wx/setup.h" @ONLY) endif() -file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) +file(GLOB configs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/lib/wx/config/*" "${CURRENT_PACKAGES_DIR}/tools/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/*") +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("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(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(INSTALL "${SOURCE_PATH}/docs/licence.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/wxwidgets/relocatable-wx-config.patch b/ports/wxwidgets/relocatable-wx-config.patch new file mode 100644 index 0000000000..8a5e7c4d5b --- /dev/null +++ b/ports/wxwidgets/relocatable-wx-config.patch @@ -0,0 +1,49 @@ +diff --git a/wx-config.in b/wx-config.in +index 441f88c..b326867 100755 +--- a/wx-config.in ++++ b/wx-config.in +@@ -91,7 +91,7 @@ EOF + + + # Contentious tools determined by configure. +-EGREP="@EGREP@" ++EGREP="grep -E" # no absolute path from host + + + # For the people who know what they want, or think they do: +@@ -402,8 +402,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-"` +@@ -940,6 +949,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/ports/wxwidgets/usage b/ports/wxwidgets/usage index e873e4ae34..f86b406196 100644 --- a/ports/wxwidgets/usage +++ b/ports/wxwidgets/usage @@ -1,5 +1,6 @@ The package wxwidgets provides CMake integration: find_package(wxWidgets REQUIRED) + target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$:${wxWidgets_DEFINITIONS_DEBUG}>") target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS}) target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES}) diff --git a/ports/wxwidgets/vcpkg-cmake-wrapper.cmake b/ports/wxwidgets/vcpkg-cmake-wrapper.cmake index 55557b3609..a7563f68de 100644 --- a/ports/wxwidgets/vcpkg-cmake-wrapper.cmake +++ b/ports/wxwidgets/vcpkg-cmake-wrapper.cmake @@ -1,25 +1,70 @@ -set(wxWidgets_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." CACHE INTERNAL "" FORCE) -set(WX_ROOT_DIR "${wxWidgets_ROOT_DIR}") -set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "" FORCE) -set(WX_LIB_DIR "${wxWidgets_LIB_DIR}") -find_library(WX_based NAMES wxbase31ud PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH) -file(GLOB WX_DEBUG_LIBS "${wxWidgets_ROOT_DIR}/debug/lib/wx*d_*.lib") -foreach(WX_DEBUG_LIB ${WX_DEBUG_LIBS}) - string(REGEX REPLACE ".*wx([^/]*)d_([^/\\.]*)\\.[^/\\.]*\$" "WX_\\2d" varname "${WX_DEBUG_LIB}") - set(${varname} "${WX_DEBUG_LIB}" CACHE INTERNAL "" FORCE) -endforeach() -_find_package(${ARGS}) -find_package(ZLIB QUIET) -find_package(libpng CONFIG QUIET) -find_package(TIFF QUIET) -find_package(expat CONFIG QUIET) +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) -if(wxWidgets_LIBRARIES AND NOT wxWidgets_LIBRARIES MATCHES "TIFF::TIFF;png;expat::expat;ZLIB::ZLIB") - list(APPEND wxWidgets_LIBRARIES "TIFF::TIFF;expat::expat;ZLIB::ZLIB") +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 (TARGET png) - list(APPEND wxWidgets_LIBRARIES "png") - elseif(TARGET png_static) - list(APPEND wxWidgets_LIBRARIES "png_static") - endif() +if(MINGW) + # Force FindwxWidgets.cmake unix mode, matching mingw install layout + set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}") + set(CMAKE_CROSSCOMPILING 1) +elseif(WIN32) + # Force FindwxWidgets.cmake win32 mode, matching win32 install layout + set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}") + set(CMAKE_CROSSCOMPILING 0) endif() + +if(WIN32 AND NOT CMAKE_CROSSCOMPILING) + # FindwxWidgets.cmake win32 mode, multi-config + # Get cache variables for debug libs + set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/debug/lib" CACHE INTERNAL "") + set(WX_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "") + _find_package(${ARGS}) + # Reset for regular lookup + unset(wxWidgets_CONFIGURATION CACHE) + set(WX_CONFIGURATION_LIST "") + 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 "") + +_find_package(${ARGS}) + +if(DEFINED _vcpkg_wxwidgets_backup_crosscompiling) + set(CMAKE_CROSSCOMPILING "${_vcpkg_wxwidgets_backup_crosscompiling}") + unset(_vcpkg_wxwidgets_backup_crosscompiling) +endif() + +if(WIN32 AND NOT MINGW AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + 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/ports/wxwidgets/vcpkg.json b/ports/wxwidgets/vcpkg.json index 9a4cdf2a8f..5f504972e2 100644 --- a/ports/wxwidgets/vcpkg.json +++ b/ports/wxwidgets/vcpkg.json @@ -1,17 +1,23 @@ { "name": "wxwidgets", "version-semver": "3.1.5", - "port-version": 8, + "port-version": 9, "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": "wxWindows", + "license": "LGPL-2.0-or-later WITH WxWindows-exception-3.1", "supports": "!uwp", "dependencies": [ + { + "name": "curl", + "default-features": false, + "platform": "!windows & !osx" + }, "expat", + "libjpeg-turbo", "libpng", "tiff", { @@ -23,5 +29,10 @@ "host": true }, "zlib" - ] + ], + "features": { + "example": { + "description": "Example source code and CMake project" + } + } } diff --git a/scripts/test_ports/cmake-user/vcpkg.json b/scripts/test_ports/cmake-user/vcpkg.json index 73907dfdcd..459086f246 100644 --- a/scripts/test_ports/cmake-user/vcpkg.json +++ b/scripts/test_ports/cmake-user/vcpkg.json @@ -72,6 +72,10 @@ "$package": "TIFF", "name": "tiff" }, + { + "$package": "wxWidgets", + "name": "wxwidgets" + }, { "$package": "ZLIB", "name": "zlib" diff --git a/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake b/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake new file mode 100644 index 0000000000..e69c2351ae --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake @@ -0,0 +1,13 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS + FEATURES + wxrc USE_WXRC +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_INSTALLED_DIR}/share/wxwidgets/example" + OPTIONS + ${OPTIONS} +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json b/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json new file mode 100644 index 0000000000..188d1069db --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json @@ -0,0 +1,38 @@ +{ + "name": "vcpkg-ci-wxwidgets", + "version-date": "2022-04-05", + "description": "Builds a GUI app in order to validate the wxwidgets port.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "wxwidgets", + "features": [ + "example" + ] + } + ], + "default-features": [ + "default-features" + ], + "features": { + "default-features": { + "description": "Default features depending on system", + "dependencies": [ + { + "name": "vcpkg-ci-wxwidgets", + "default-features": false, + "features": [ + "wxrc" + ], + "platform": "native" + } + ] + }, + "wxrc": { + "description": "Test wxrc" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 5740f5e857..ef98739095 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7510,7 +7510,7 @@ }, "wxwidgets": { "baseline": "3.1.5", - "port-version": 8 + "port-version": 9 }, "x-plane": { "baseline": "3.0.3", diff --git a/versions/w-/wxwidgets.json b/versions/w-/wxwidgets.json index ec84429384..392562d237 100644 --- a/versions/w-/wxwidgets.json +++ b/versions/w-/wxwidgets.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "26ad66271632adb4d00a270a90ad18514025859e", + "version-semver": "3.1.5", + "port-version": 9 + }, { "git-tree": "dba058c37782edf771e7a62ae1bef98274c86b9f", "version-semver": "3.1.5",