Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions ports/wxwidgets/disable-platform-lib-dir.patch

This file was deleted.

21 changes: 21 additions & 0 deletions ports/wxwidgets/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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} "$<$<CONFIG:DEBUG>:${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()
36 changes: 36 additions & 0 deletions ports/wxwidgets/fix-libs-export.patch
Original file line number Diff line number Diff line change
@@ -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 $<$<CONFIG:DEBUG>:LIB_PATH>
+ # Or $<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>
+ 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}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might make it an error if there is something else than NOT, CONFIG:DEBUG, LINK_ONLY, to catch future changes.

+ 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()
34 changes: 0 additions & 34 deletions ports/wxwidgets/fix-linux-configure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<CONFIG:DEBUG>:LIB_PATH>
+ # Or $<$<NOT:$<CONFIG:DEBUG>>: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()
52 changes: 52 additions & 0 deletions ports/wxwidgets/install-layout.patch
Original file line number Diff line number Diff line change
@@ -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} \
)"
21 changes: 21 additions & 0 deletions ports/wxwidgets/mingw-output-name.patch
Original file line number Diff line number Diff line change
@@ -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
101 changes: 72 additions & 29 deletions ports/wxwidgets/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,60 @@ 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_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()

set(OPTIONS "")
if(VCPKG_TARGET_IS_OSX)
set(OPTIONS -DCOTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=9999)
list(APPEND OPTIONS -DCOTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=9999)
endif()

if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(OPTIONS
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})
find_program(system_pkg_config NAMES pkg-config)
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.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
49 changes: 49 additions & 0 deletions ports/wxwidgets/relocatable-wx-config.patch
Original file line number Diff line number Diff line change
@@ -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@"

1 change: 1 addition & 0 deletions ports/wxwidgets/usage
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The package wxwidgets provides CMake integration:

find_package(wxWidgets REQUIRED)
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})
Loading