mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 13:31:27 +08:00
[wxwidgets] Fix linux build (#23765)
* [wxwidgets] Fix linux build * clean up baseline * version * Fix --libs output * version * Use system pkg-config on linux (#6) * Use system pkg-config for linux * Update versions * Revert baseline changes * Add double quotes to paths * version * Fix incorrect double quotes place * version Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
parent
303eebf8af
commit
c2960201e3
49
ports/wxwidgets/fix-linux-configure.patch
Normal file
49
ports/wxwidgets/fix-linux-configure.patch
Normal file
@ -0,0 +1,49 @@
|
||||
diff --git a/build/cmake/modules/cotire.cmake b/build/cmake/modules/cotire.cmake
|
||||
index bb69643..09b52a6 100644
|
||||
--- a/build/cmake/modules/cotire.cmake
|
||||
+++ b/build/cmake/modules/cotire.cmake
|
||||
@@ -2316,6 +2316,10 @@ function (cotire_generate_target_script _language _configurations _target _targe
|
||||
"${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_DEFINITIONS_${_upperConfig})
|
||||
cotire_get_target_compiler_flags(
|
||||
"${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig})
|
||||
+ string(REPLACE
|
||||
+ "<COMPILE_LANG_AND_ID:CUDA,NVIDIA>" "<COMPILE_LANGUAGE:CUDA>"
|
||||
+ COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig} "${COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig}}"
|
||||
+ )
|
||||
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()
|
@ -7,6 +7,7 @@ vcpkg_from_github(
|
||||
PATCHES
|
||||
disable-platform-lib-dir.patch
|
||||
fix-build.patch
|
||||
fix-linux-configure.patch # Remove this patch in the next update
|
||||
)
|
||||
|
||||
set(OPTIONS)
|
||||
@ -21,6 +22,15 @@ if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64 OR VCPKG_TARGET_ARCHITECTURE STREQUA
|
||||
)
|
||||
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()
|
||||
endif()
|
||||
|
||||
# This may be set to ON by users in a custom triplet.
|
||||
# The use of 'wxUSE_STL' and 'WXWIDGETS_USE_STD_CONTAINERS' (ON or OFF) are not API compatible
|
||||
# which is why they must be set in a custom triplet rather than a port feature.
|
||||
@ -33,7 +43,7 @@ if(NOT DEFINED WXWIDGETS_USE_STD_CONTAINERS)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DwxUSE_REGEX=builtin
|
||||
-DwxUSE_ZLIB=sys
|
||||
@ -49,21 +59,23 @@ vcpkg_cmake_configure(
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll")
|
||||
if(DLLS)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
|
||||
foreach(DLL ${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 ${DLLS})
|
||||
get_filename_component(N "${DLL}" NAME)
|
||||
file(RENAME ${DLL} ${CURRENT_PACKAGES_DIR}/debug/bin/${N})
|
||||
endforeach()
|
||||
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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
@ -75,14 +87,14 @@ endif()
|
||||
# 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(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)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/msvc")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
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)
|
||||
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)
|
||||
@ -96,9 +108,9 @@ foreach(INC IN LISTS INCLUDES)
|
||||
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 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}" "")
|
||||
@ -113,8 +125,10 @@ if(NOT EXISTS ${CURRENT_PACKAGES_DIR}/include/wx/setup.h)
|
||||
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)
|
||||
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/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)
|
||||
|
||||
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(INSTALL "${SOURCE_PATH}/docs/licence.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1,13 +1,14 @@
|
||||
{
|
||||
"name": "wxwidgets",
|
||||
"version-semver": "3.1.5",
|
||||
"port-version": 7,
|
||||
"port-version": 8,
|
||||
"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",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
"expat",
|
||||
|
@ -7470,7 +7470,7 @@
|
||||
},
|
||||
"wxwidgets": {
|
||||
"baseline": "3.1.5",
|
||||
"port-version": 7
|
||||
"port-version": 8
|
||||
},
|
||||
"x-plane": {
|
||||
"baseline": "3.0.3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "dba058c37782edf771e7a62ae1bef98274c86b9f",
|
||||
"version-semver": "3.1.5",
|
||||
"port-version": 8
|
||||
},
|
||||
{
|
||||
"git-tree": "9184caa631070403a5fd8c177b56907a313ad197",
|
||||
"version-semver": "3.1.5",
|
||||
|
Loading…
Reference in New Issue
Block a user