Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wxwidgets] Fix linux build #23765

Merged
merged 12 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
49 changes: 49 additions & 0 deletions ports/wxwidgets/fix-linux-configure.patch
Original file line number Diff line number Diff line change
@@ -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()
74 changes: 44 additions & 30 deletions ports/wxwidgets/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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}" "")
Expand All @@ -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)
3 changes: 2 additions & 1 deletion ports/wxwidgets/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7470,7 +7470,7 @@
},
"wxwidgets": {
"baseline": "3.1.5",
"port-version": 7
"port-version": 8
},
"x-plane": {
"baseline": "3.0.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/w-/wxwidgets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "33a87baa90f6ea142f649f688081a9406ca6a3d5",
"version-semver": "3.1.5",
"port-version": 8
},
{
"git-tree": "9184caa631070403a5fd8c177b56907a313ad197",
"version-semver": "3.1.5",
Expand Down