aboutsummaryrefslogtreecommitdiff
path: root/ports/wxwidgets
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2021-02-08 18:30:48 -0800
committerGitHub <noreply@github.com>2021-02-08 18:30:48 -0800
commitea11604579181b0ff790be223ee3ded3068142f9 (patch)
tree59029f22c2752728954c3301f715ba9e07d8d363 /ports/wxwidgets
parent5957dcb91255b962c484093e33bc9414b6f3e29c (diff)
downloadvcpkg-ea11604579181b0ff790be223ee3ded3068142f9.tar.gz
vcpkg-ea11604579181b0ff790be223ee3ded3068142f9.zip
[wxwidgets] Fix #4756 (#13361)
* [wxwidgets] Fix #4756 * [wxwidgets] Avoid replacing FindwxWidgets from CMake * [wxwidgets] Provide usage information * [gppanel] Use built-in CMake module * [wxchartdir] Use built-in CMake module * [wxwidgets] Fixup for applocal-ing * [wxwidgets] Fix osx builds * Update port_versions * [gppanel][wxchartdir][wxwidgets] Change versioning schemas Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
Diffstat (limited to 'ports/wxwidgets')
-rw-r--r--ports/wxwidgets/CONTROL7
-rw-r--r--ports/wxwidgets/portfile.cmake32
-rw-r--r--ports/wxwidgets/usage5
-rw-r--r--ports/wxwidgets/vcpkg-cmake-wrapper.cmake19
-rw-r--r--ports/wxwidgets/vcpkg.json14
5 files changed, 61 insertions, 16 deletions
diff --git a/ports/wxwidgets/CONTROL b/ports/wxwidgets/CONTROL
deleted file mode 100644
index 35d3b461e..000000000
--- a/ports/wxwidgets/CONTROL
+++ /dev/null
@@ -1,7 +0,0 @@
-Source: wxwidgets
-Version: 3.1.4
-Port-Version: 3
-Homepage: https://github.com/wxWidgets/wxWidgets
-Description: wxWidgets is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications.
-Build-Depends: zlib, libpng, tiff, expat
-Supports: !uwp
diff --git a/ports/wxwidgets/portfile.cmake b/ports/wxwidgets/portfile.cmake
index 13bbc9c40..8e13516e5 100644
--- a/ports/wxwidgets/portfile.cmake
+++ b/ports/wxwidgets/portfile.cmake
@@ -40,10 +40,6 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
-vcpkg_copy_tools(TOOL_NAMES wxrc AUTO_CLEAN)
-
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
-
file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll")
if(DLLS)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
@@ -61,16 +57,34 @@ if(DLLS)
endforeach()
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()
+
# do the copy pdbs now after the dlls got moved to the expected /bin folder above
vcpkg_copy_pdbs()
-if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h)
- file(RENAME ${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h ${CURRENT_PACKAGES_DIR}/include/wx/setup.h)
+if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/mswud)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/mswud ${CURRENT_PACKAGES_DIR}/lib/mswud)
endif()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/mswu)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/mswud)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/msvc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(GLOB_RECURSE INCLUDES ${CURRENT_PACKAGES_DIR}/include/*)
+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()
-file(INSTALL ${SOURCE_PATH}/docs/licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/wxwidgets)
+configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/wxwidgets/usage COPYONLY)
+file(INSTALL ${SOURCE_PATH}/docs/licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/wxwidgets/usage b/ports/wxwidgets/usage
new file mode 100644
index 000000000..e873e4ae3
--- /dev/null
+++ b/ports/wxwidgets/usage
@@ -0,0 +1,5 @@
+The package wxwidgets provides CMake integration:
+
+ find_package(wxWidgets REQUIRED)
+ 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
new file mode 100644
index 000000000..f2eb1bcc2
--- /dev/null
+++ b/ports/wxwidgets/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,19 @@
+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)
+
+if(wxWidgets_LIBRARIES AND NOT wxWidgets_LIBRARIES MATCHES "TIFF::TIFF;png;expat::expat;ZLIB::ZLIB")
+ list(APPEND wxWidgets_LIBRARIES "TIFF::TIFF;png;expat::expat;ZLIB::ZLIB")
+endif()
diff --git a/ports/wxwidgets/vcpkg.json b/ports/wxwidgets/vcpkg.json
new file mode 100644
index 000000000..49b2fab10
--- /dev/null
+++ b/ports/wxwidgets/vcpkg.json
@@ -0,0 +1,14 @@
+{
+ "name": "wxwidgets",
+ "version-semver": "3.1.4",
+ "port-version": 5,
+ "description": "a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications.",
+ "homepage": "https://github.com/wxWidgets/wxWidgets",
+ "supports": "!uwp",
+ "dependencies": [
+ "expat",
+ "libpng",
+ "tiff",
+ "zlib"
+ ]
+}