Skip to content

Commit

Permalink
[wxwidgets] Fix microsoft#4756
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0219-msft committed Sep 5, 2020
1 parent 2ea680f commit 3069c3f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ports/wxwidgets/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Source: wxwidgets
Version: 3.1.4
Port-Version: 3
Port-Version: 4
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
Expand Down
24 changes: 23 additions & 1 deletion ports/wxwidgets/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,27 @@ 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_PACKAGESDIR}/include/*)
foreach(INC IN LISTS INCLUDES)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${INC}" "defined(WXUSINGDLL)" "0")
else()
vcpkg_replace_string("${INC}" "defined(WXUSINGDLL)" "1")
endif()
endif()

file(GLOB RELEASE_LIBS LIST_DIRECTORIES false RELATIVE "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}/lib/*")
file(GLOB DEBUG_LIBS LIST_DIRECTORIES false RELATIVE "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}/debug/lib/*")

set(wxWidgets_LIBRARIES)
foreach(LIB IN LISTS RELEASE_LIBS)
list(APPEND wxWidgets_LIBRARIES optimized "\${CMAKE_CURRENT_LIST_DIR}/../../${LIB}")
endforeach()
foreach(LIB IN LISTS DEBUG_LIBS)
list(APPEND wxWidgets_LIBRARIES debug "\${CMAKE_CURRENT_LIST_DIR}/../../${LIB}")
endforeach()

file(INSTALL ${SOURCE_PATH}/docs/licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
configure_file(${CMAKE_CURRENT_LIST_DIR}/wxWidgets-config.cmake ${CURRENT_PACKAGES_DIR}/share/wxwidgets/wxWidgets-config.cmake @ONLY)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/wxwidgets)
file(WRITE "include_directories(\${wxWidgets_INCLUDE_DIRS})" ${CURRENT_PACKAGES_DIR}/share/wxwidgets/empty.cmake)
file(INSTALL ${SOURCE_PATH}/docs/licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
5 changes: 5 additions & 0 deletions ports/wxwidgets/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The package wxwidgets provides CMake integration:

find_package(wxWidgets REQUIRED)
target_link_libraries(foo PRIVATE ${wxWidgets_LIBRARIES})
target_include_directories(foo PRIVATE ${wxWidgets_INCLUDE_DIRS})
4 changes: 4 additions & 0 deletions ports/wxwidgets/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
list(REMOVE_ITEM ARGS "CONFIG")
list(REMOVE_ITEM ARGS "MODULE")

_find_package(${ARGS} CONFIG)
14 changes: 14 additions & 0 deletions ports/wxwidgets/wxWidgets-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include(CMakeFindDependencyMacro)
find_dependency(ZLIB)
find_dependency(libpng CONFIG)
find_dependency(TIFF)
find_dependency(expat CONFIG)

set(wxWidgets_FOUND TRUE)
set(wxWidgets_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
set(wxWidgets_LIBRARY_DIRS "")
set(wxWidgets_DEFINITIONS "")
set(wxWidgets_DEFINITIONS_DEBUG "")
set(wxWidgets_CXX_FLAGS "")
set(wxWidgets_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/empty.cmake")
set(wxWidgets_LIBRARIES "@wxWidgets_LIBRARIES@;png;expat::expat;ZLIB::ZLIB")

0 comments on commit 3069c3f

Please sign in to comment.