CMake: Import install properties of static libraries When installing static libraries, the built-in libraries also need import mappings for MinSizeRel and RelWithDebInfo configurations. Otherwise they will default to using Debug libraries.
CMake: Allow to override wx_option_auto
CMake: Refactor applying toolkit properties Group them together in base and not-base.
CMake: Set the wx-config RESCOMP value
CMake: Get rid of macro to link sample libraries And check if widgets sample targets are valid before using it.
CMake: Install with relative symlinks Try to install using 'ln -s --relative' first, before falling back to 'ln -s' and 'cmake -E create_symlink'. If all fail, use 'cmake -E copy'. Also add an option to disable using symlinks and always copy. Correctly use and (not) escape DESTDIR and CMAKE_INSTALL_PREFIX in install and uninstall variables. Fixes #26247
CMake: Add wxbase_only target Can be used by console applications, it links with wx::base with wxUSE_GUI=0. Update wx_copy_target in wxWidgetsConfig.cmake to handle INTERFACE libraries correctly. See #26285
CMake: Don't install release PDBs when stripped releases is enabled See #26338
CMake: Show check_symbol_exists messages only once Same behaviour as the built-in check functions.
Remove unnecessary cast to wxButton in wxOSX wxWindow dtor This was harmless, but resulted in an UBSAN error about invalid cast whenever destroying a window, and was completely unnecessary, so just remove it.
Fix position of wxGLCanvas inside a wxPopupWindow under Wayland Use gdk_window_get_position() to get the Wayland subsurface position instead of gdk_window_get_origin() which didn't return the result in the right coordinate system (it happened to work for normal TLWs, but not for the popups). This amends code originally added in 800d6ed69b (Update subsurface position when a GL canvas is sized., 2022-09-18), see #22811. Closes #26250.
Merge branch 'cmake-improvements' of github.com:MaartenBent/wxWidgets CMake improvements, mostly installation-related (fixes for static libraries, use relative symlinks if possible and more), but also add wxbase_only target for console applications. See #26325.
| ... | ... | @@ -92,7 +92,7 @@ function(wx_write_config_inplace) |
| 92 | 92 | "wx-config-inplace.in"
|
| 93 | 93 | "inplace-${TOOLCHAIN_FULLNAME}"
|
| 94 | 94 | )
|
| 95 | - if(WIN32_MSVC_NAMING)
|
|
| 95 | + if(WIN32_MSVC_NAMING OR NOT wxBUILD_INSTALL_USE_SYMLINK)
|
|
| 96 | 96 | set(COPY_CMD copy)
|
| 97 | 97 | else()
|
| 98 | 98 | set(COPY_CMD create_symlink)
|
| ... | ... | @@ -200,7 +200,7 @@ function(wx_write_config) |
| 200 | 200 | set(WXCONFIG_RESFLAGS)
|
| 201 | 201 | set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir")
|
| 202 | 202 | set(LDFLAGS_GL)
|
| 203 | - set(RESCOMP)
|
|
| 203 | + get_filename_component(RESCOMP "${CMAKE_RC_COMPILER}" NAME_WE)
|
|
| 204 | 204 | |
| 205 | 205 | wx_configure_script(
|
| 206 | 206 | "wx-config.in"
|
| ... | ... | @@ -14,6 +14,8 @@ include(GNUInstallDirs) |
| 14 | 14 | |
| 15 | 15 | # List of libraries added via wx_add_library() to use for wx-config
|
| 16 | 16 | set(wxLIB_TARGETS)
|
| 17 | +# List of the (static) builtin libraries to use in wxWidgetsConfig.cmake
|
|
| 18 | +set(wxLIB_BUILTIN_TARGETS)
|
|
| 17 | 19 | # List of headers added via wx_append_sources() to use for install
|
| 18 | 20 | set(wxINSTALL_HEADERS)
|
| 19 | 21 | # List of files not included in the install manifest
|
| ... | ... | @@ -90,6 +92,42 @@ macro(wx_install) |
| 90 | 92 | endif()
|
| 91 | 93 | endmacro()
|
| 92 | 94 | |
| 95 | +# wx_install_symlink(...)
|
|
| 96 | +# Create symlink dst pointing to src
|
|
| 97 | +# try different symlink and copy methods until one succeeds
|
|
| 98 | +macro(wx_install_symlink src dst)
|
|
| 99 | + if(wxBUILD_INSTALL)
|
|
| 100 | + install(CODE "
|
|
| 101 | + set(SYMLINK_SRC \"${src}\")
|
|
| 102 | + set(SYMLINK_DST \"${dst}\")
|
|
| 103 | + message(STATUS \"Installing: \${SYMLINK_DST}\")
|
|
| 104 | + |
|
| 105 | + if(CMAKE_VERSION GREATER_EQUAL \"3.17\")
|
|
| 106 | + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E rm -f \"\${SYMLINK_DST}\")
|
|
| 107 | + else()
|
|
| 108 | + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E remove -f \"\${SYMLINK_DST}\")
|
|
| 109 | + endif()
|
|
| 110 | + |
|
| 111 | + set(SYMLINK_RES 1)
|
|
| 112 | + set(wxBUILD_INSTALL_USE_SYMLINK ${wxBUILD_INSTALL_USE_SYMLINK})
|
|
| 113 | + if(wxBUILD_INSTALL_USE_SYMLINK)
|
|
| 114 | + if(SYMLINK_RES)
|
|
| 115 | + execute_process(COMMAND ln -s --relative \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET)
|
|
| 116 | + endif()
|
|
| 117 | + if(SYMLINK_RES)
|
|
| 118 | + execute_process(COMMAND ln -s \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET)
|
|
| 119 | + endif()
|
|
| 120 | + if(SYMLINK_RES)
|
|
| 121 | + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES)
|
|
| 122 | + endif()
|
|
| 123 | + endif()
|
|
| 124 | + if(SYMLINK_RES)
|
|
| 125 | + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES)
|
|
| 126 | + endif()
|
|
| 127 | + ")
|
|
| 128 | + endif()
|
|
| 129 | +endmacro()
|
|
| 130 | + |
|
| 93 | 131 | # Get a valid flavour name with optional prefix
|
| 94 | 132 | macro(wx_get_flavour flavour prefix)
|
| 95 | 133 | if(wxBUILD_FLAVOUR)
|
| ... | ... | @@ -398,11 +436,6 @@ function(wx_set_target_properties target_name) |
| 398 | 436 | $<INSTALL_INTERFACE:${wxINSTALL_INCLUDE_DIR}>
|
| 399 | 437 | )
|
| 400 | 438 | |
| 401 | - if(wxTOOLKIT_INCLUDE_DIRS AND NOT wxTARGET_IS_BASE)
|
|
| 402 | - target_include_directories(${target_name}
|
|
| 403 | - PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
|
|
| 404 | - endif()
|
|
| 405 | - |
|
| 406 | 439 | if (WIN32)
|
| 407 | 440 | set(WIN32_LIBRARIES
|
| 408 | 441 | kernel32
|
| ... | ... | @@ -431,25 +464,27 @@ function(wx_set_target_properties target_name) |
| 431 | 464 | PUBLIC ${WIN32_LIBRARIES})
|
| 432 | 465 | endif()
|
| 433 | 466 | |
| 434 | - if(wxTOOLKIT_LIBRARY_DIRS AND NOT wxTARGET_IS_BASE)
|
|
| 435 | - target_link_directories(${target_name}
|
|
| 436 | - PUBLIC ${wxTOOLKIT_LIBRARY_DIRS})
|
|
| 437 | - endif()
|
|
| 438 | - if(wxTOOLKIT_LIBRARIES AND NOT wxTARGET_IS_BASE)
|
|
| 439 | - target_link_libraries(${target_name}
|
|
| 440 | - PUBLIC ${wxTOOLKIT_LIBRARIES})
|
|
| 441 | - endif()
|
|
| 442 | - |
|
| 443 | 467 | if(wxTARGET_IS_BASE)
|
| 444 | 468 | # Currently base libraries still use toolkit definitions internally.
|
| 445 | 469 | # This is wrong and should, ideally, be fixed, but for now keep
|
| 446 | 470 | # defining them. However we don't need to define this for the targets
|
| 447 | 471 | # using the base library.
|
| 448 | - target_compile_definitions(${target_name}
|
|
| 449 | - PRIVATE ${wxTOOLKIT_DEFINITIONS})
|
|
| 472 | + if(wxTOOLKIT_DEFINITIONS)
|
|
| 473 | + target_compile_definitions(${target_name} PRIVATE ${wxTOOLKIT_DEFINITIONS})
|
|
| 474 | + endif()
|
|
| 450 | 475 | else()
|
| 451 | - target_compile_definitions(${target_name}
|
|
| 452 | - PUBLIC ${wxTOOLKIT_DEFINITIONS})
|
|
| 476 | + if(wxTOOLKIT_INCLUDE_DIRS)
|
|
| 477 | + target_include_directories(${target_name} PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
|
|
| 478 | + endif()
|
|
| 479 | + if(wxTOOLKIT_LIBRARY_DIRS)
|
|
| 480 | + target_link_directories(${target_name} PUBLIC ${wxTOOLKIT_LIBRARY_DIRS})
|
|
| 481 | + endif()
|
|
| 482 | + if(wxTOOLKIT_LIBRARIES)
|
|
| 483 | + target_link_libraries(${target_name} PUBLIC ${wxTOOLKIT_LIBRARIES})
|
|
| 484 | + endif()
|
|
| 485 | + if(wxTOOLKIT_DEFINITIONS)
|
|
| 486 | + target_compile_definitions(${target_name} PUBLIC ${wxTOOLKIT_DEFINITIONS})
|
|
| 487 | + endif()
|
|
| 453 | 488 | endif()
|
| 454 | 489 | |
| 455 | 490 | if(wxBUILD_SHARED)
|
| ... | ... | @@ -553,7 +588,11 @@ macro(wx_add_library name) |
| 553 | 588 | )
|
| 554 | 589 | |
| 555 | 590 | if(wxBUILD_SHARED AND MSVC AND wxBUILD_INSTALL_PDB)
|
| 556 | - wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}")
|
|
| 591 | + if(wxBUILD_STRIPPED_RELEASE)
|
|
| 592 | + wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}" CONFIGURATIONS Debug RelWithDebInfo)
|
|
| 593 | + else()
|
|
| 594 | + wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}")
|
|
| 595 | + endif()
|
|
| 557 | 596 | endif()
|
| 558 | 597 | |
| 559 | 598 | wx_target_enable_precomp(${name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
| ... | ... | @@ -719,6 +758,9 @@ endfunction() |
| 719 | 758 | |
| 720 | 759 | # Add a third party builtin library
|
| 721 | 760 | function(wx_add_builtin_library name)
|
| 761 | + list(APPEND wxLIB_BUILTIN_TARGETS ${name})
|
|
| 762 | + set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE)
|
|
| 763 | + |
|
| 722 | 764 | wx_list_add_prefix(src_list "${wxSOURCE_DIR}/" ${ARGN})
|
| 723 | 765 | |
| 724 | 766 | list(GET src_list 0 src_file)
|
| ... | ... | @@ -970,17 +1012,16 @@ function(wx_add name group) |
| 970 | 1012 | endif()
|
| 971 | 1013 | |
| 972 | 1014 | # All applications use at least the base library other libraries
|
| 973 | - # will have to be added with wx_link_sample_libraries()
|
|
| 974 | - wx_exe_link_libraries(${target_name} wxbase)
|
|
| 975 | - if(NOT APP_CONSOLE)
|
|
| 976 | - # UI applications always require core
|
|
| 977 | - wx_exe_link_libraries(${target_name} wxcore)
|
|
| 1015 | + if(APP_CONSOLE)
|
|
| 1016 | + wx_exe_link_libraries(${target_name} wxbase_only)
|
|
| 978 | 1017 | else()
|
| 979 | - target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
|
| 1018 | + wx_exe_link_libraries(${target_name} wxcore)
|
|
| 980 | 1019 | endif()
|
| 1020 | + |
|
| 981 | 1021 | if(APP_LIBRARIES)
|
| 982 | 1022 | wx_exe_link_libraries(${target_name} ${APP_LIBRARIES})
|
| 983 | 1023 | endif()
|
| 1024 | + |
|
| 984 | 1025 | if(APP_DEFINITIONS)
|
| 985 | 1026 | target_compile_definitions(${target_name} PRIVATE ${APP_DEFINITIONS})
|
| 986 | 1027 | endif()
|
| ... | ... | @@ -1061,13 +1102,6 @@ function(wx_add name group) |
| 1061 | 1102 | endif()
|
| 1062 | 1103 | endfunction()
|
| 1063 | 1104 | |
| 1064 | -# Link libraries to a sample
|
|
| 1065 | -function(wx_link_sample_libraries name)
|
|
| 1066 | - if(TARGET ${name})
|
|
| 1067 | - target_link_libraries(${name} PUBLIC ${ARGN})
|
|
| 1068 | - endif()
|
|
| 1069 | -endfunction()
|
|
| 1070 | - |
|
| 1071 | 1105 | # Add a option and mark is as advanced if it starts with wxUSE_
|
| 1072 | 1106 | # wx_option(<name> <desc> [default] [STRINGS strings])
|
| 1073 | 1107 | # The default is ON if not third parameter is specified
|
| ... | ... | @@ -1114,7 +1148,13 @@ endfunction() |
| 1114 | 1148 | # just a warning otherwise, while ON means that an error is given if it can't
|
| 1115 | 1149 | # be enabled.
|
| 1116 | 1150 | function(wx_option_auto name desc)
|
| 1117 | - wx_option(${name} ${desc} AUTO STRINGS ON OFF AUTO)
|
|
| 1151 | + cmake_parse_arguments(OPTION "" "" "STRINGS" ${ARGN})
|
|
| 1152 | + if(ARGC EQUAL 2)
|
|
| 1153 | + set(default AUTO)
|
|
| 1154 | + else()
|
|
| 1155 | + set(default ${OPTION_UNPARSED_ARGUMENTS})
|
|
| 1156 | + endif()
|
|
| 1157 | + wx_option(${name} ${desc} ${default} STRINGS ON OFF AUTO)
|
|
| 1118 | 1158 | endfunction()
|
| 1119 | 1159 | |
| 1120 | 1160 | # Force a new value for an option created with wx_option
|
| ... | ... | @@ -67,13 +67,12 @@ else() |
| 67 | 67 | |
| 68 | 68 | wx_get_install_platform_dir(runtime)
|
| 69 | 69 | install(DIRECTORY DESTINATION "${runtime_dir}")
|
| 70 | - install(CODE "execute_process( \
|
|
| 71 | - COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
|
| 72 | - \"${CMAKE_INSTALL_PREFIX}/${library_dir}/wx/config/${wxBUILD_FILE_ID}\" \
|
|
| 73 | - \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config\" \
|
|
| 74 | - )"
|
|
| 75 | - )
|
|
| 76 | - list(APPEND WX_EXTRA_UNINSTALL_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config")
|
|
| 70 | + set(CONFIG_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}")
|
|
| 71 | + set(CONFIG_SRC "${CONFIG_DIR}/${library_dir}/wx/config/${wxBUILD_FILE_ID}")
|
|
| 72 | + set(CONFIG_DST "${CONFIG_DIR}/${runtime_dir}/wx-config")
|
|
| 73 | + wx_install_symlink(${CONFIG_SRC} ${CONFIG_DST})
|
|
| 74 | + |
|
| 75 | + list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config\"")
|
|
| 77 | 76 | endif()
|
| 78 | 77 | |
| 79 | 78 | wx_get_install_dir(library)
|
| ... | ... | @@ -122,4 +122,5 @@ endif() |
| 122 | 122 | |
| 123 | 123 | # Propagate variable(s) to parent scope
|
| 124 | 124 | set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE)
|
| 125 | +set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE)
|
|
| 125 | 126 | set(wxINSTALL_HEADERS ${wxINSTALL_HEADERS} PARENT_SCOPE) |
| ... | ... | @@ -82,3 +82,13 @@ if(APPLE) |
| 82 | 82 | elseif(UNIX)
|
| 83 | 83 | wx_lib_link_libraries(wxbase PRIVATE ${CMAKE_DL_LIBS})
|
| 84 | 84 | endif()
|
| 85 | + |
|
| 86 | + |
|
| 87 | +add_library(wxbase_only INTERFACE)
|
|
| 88 | +add_library(wx::base_only ALIAS wxbase_only)
|
|
| 89 | +add_library(wxWidgets::base_only ALIAS wxbase_only)
|
|
| 90 | +target_link_libraries(wxbase_only INTERFACE wxbase)
|
|
| 91 | +target_compile_definitions(wxbase_only INTERFACE wxUSE_GUI=0)
|
|
| 92 | +wx_install(TARGETS wxbase_only EXPORT wxWidgetsTargets)
|
|
| 93 | +list(APPEND wxLIB_TARGETS wxbase_only)
|
|
| 94 | +set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE) |
| ... | ... | @@ -71,6 +71,8 @@ if(wxUSE_LIBWEBP STREQUAL "builtin") |
| 71 | 71 | endforeach()
|
| 72 | 72 | |
| 73 | 73 | set(WebP_LIBRARIES webp webpdemux sharpyuv)
|
| 74 | + list(APPEND wxLIB_BUILTIN_TARGETS ${WebP_LIBRARIES})
|
|
| 75 | + |
|
| 74 | 76 | if(NOT wxBUILD_SHARED)
|
| 75 | 77 | wx_get_install_platform_dir(archive)
|
| 76 | 78 | wx_install(TARGETS ${WebP_LIBRARIES}
|
| ... | ... | @@ -92,6 +92,8 @@ wx_option(wxBUILD_INSTALL_PLATFORM_SUBDIR "use platform specific sub-directory ( |
| 92 | 92 | mark_as_advanced(wxBUILD_INSTALL_PLATFORM_SUBDIR)
|
| 93 | 93 | wx_option(wxBUILD_INSTALL_PDB "install pdb files in the runtime directory (MSVC-naming)" OFF)
|
| 94 | 94 | mark_as_advanced(wxBUILD_INSTALL_PDB)
|
| 95 | +wx_option(wxBUILD_INSTALL_USE_SYMLINK "use symlinks when possible, disable to always use copy" ON)
|
|
| 96 | +mark_as_advanced(wxBUILD_INSTALL_USE_SYMLINK)
|
|
| 95 | 97 | |
| 96 | 98 | # Use the MSVC/makefile naming convention, or the configure naming convention,
|
| 97 | 99 | # this is the same check as used in FindwxWidgets.
|
| ... | ... | @@ -216,7 +216,9 @@ wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC} |
| 216 | 216 | DATA ${WIDGETS_RC_FILES} textctrl.cpp ../image/toucan.png:toucan.png
|
| 217 | 217 | )
|
| 218 | 218 | # includes needed by the native widget (like gtk.h)
|
| 219 | -target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
|
|
| 219 | +if(TARGET widgets)
|
|
| 220 | + target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
|
|
| 221 | +endif()
|
|
| 220 | 222 | wx_add_sample(wizard DATA wiztest.svg wiztest2.svg DEPENDS wxUSE_WIZARDDLG)
|
| 221 | 223 | wx_add_sample(wrapsizer)
|
| 222 | 224 | |
| ... | ... | @@ -265,11 +267,15 @@ if(WIN32) |
| 265 | 267 | # this test only makes sense with statically built wx, otherwise
|
| 266 | 268 | # the same copy of wx would be used
|
| 267 | 269 | wx_add_sample(dll wx_exe.cpp my_dll.h NAME wx_exe FOLDER dll)
|
| 268 | - wx_link_sample_libraries(wx_exe my_dll)
|
|
| 270 | + if(TARGET wx_exe AND TARGET my_dll)
|
|
| 271 | + target_link_libraries(wx_exe PRIVATE my_dll)
|
|
| 272 | + endif()
|
|
| 269 | 273 | endif()
|
| 270 | 274 | |
| 271 | 275 | wx_add_sample(dll sdk_exe.cpp my_dll.h NAME sdk_exe FOLDER dll)
|
| 272 | - wx_link_sample_libraries(sdk_exe my_dll)
|
|
| 276 | + if(TARGET sdk_exe AND TARGET my_dll)
|
|
| 277 | + target_link_libraries(sdk_exe PRIVATE my_dll)
|
|
| 278 | + endif()
|
|
| 273 | 279 | endif()
|
| 274 | 280 | |
| 275 | 281 | wx_add_sample(regtest RES regtest.rc DEPENDS wxUSE_REGKEY)
|
| ... | ... | @@ -183,13 +183,17 @@ else() |
| 183 | 183 | function(wx_check_symbols_exist_if_not_linux header)
|
| 184 | 184 | foreach(func ${ARGN})
|
| 185 | 185 | string(TOUPPER "HAVE_${func}" var)
|
| 186 | - message(STATUS "Looking for ${func} in ${header}")
|
|
| 186 | + set(MSG_TYPE STATUS)
|
|
| 187 | + if(DEFINED ${var})
|
|
| 188 | + set(MSG_TYPE DEBUG)
|
|
| 189 | + endif()
|
|
| 190 | + message(${MSG_TYPE} "Looking for ${func} in ${header}")
|
|
| 187 | 191 | check_symbol_exists(${func} ${header} ${var})
|
| 188 | 192 | if(${var})
|
| 189 | - message(STATUS "Looking for ${func} in ${header} - found")
|
|
| 193 | + message(${MSG_TYPE} "Looking for ${func} in ${header} - found")
|
|
| 190 | 194 | set(${var} 1 PARENT_SCOPE)
|
| 191 | 195 | else()
|
| 192 | - message(STATUS "Looking for ${func} in ${header} - not found")
|
|
| 196 | + message(${MSG_TYPE} "Looking for ${func} in ${header} - not found")
|
|
| 193 | 197 | endif()
|
| 194 | 198 | endforeach()
|
| 195 | 199 | endfunction()
|
| ... | ... | @@ -38,14 +38,12 @@ if(wxUSE_XRC) |
| 38 | 38 | set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX})
|
| 39 | 39 | endif()
|
| 40 | 40 | |
| 41 | - # Don't use wx_install() here to preserve escaping.
|
|
| 42 | - install(CODE "execute_process( \
|
|
| 43 | - COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
|
| 44 | - \"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/${wxrc_output_name}${EXE_SUFFIX}\" \
|
|
| 45 | - \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}\" \
|
|
| 46 | - )"
|
|
| 47 | - )
|
|
| 48 | - list(APPEND WX_EXTRA_UNINSTALL_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}")
|
|
| 41 | + set(WXRC_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}")
|
|
| 42 | + set(WXRC_SRC "${WXRC_DIR}/${runtime_dir}/${wxrc_output_name}${EXE_SUFFIX}")
|
|
| 43 | + set(WXRC_DST "${WXRC_DIR}/${runtime_dir}/wxrc${EXE_SUFFIX}")
|
|
| 44 | + wx_install_symlink(${WXRC_SRC} ${WXRC_DST})
|
|
| 45 | + |
|
| 46 | + list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}\"")
|
|
| 49 | 47 | set(WX_EXTRA_UNINSTALL_FILES ${WX_EXTRA_UNINSTALL_FILES} PARENT_SCOPE)
|
| 50 | 48 | endif()
|
| 51 | 49 | endif()
|
| ... | ... | @@ -81,17 +81,41 @@ macro(wx_copy_target ns name libname) |
| 81 | 81 | get_target_property(target_type wx::${libname} TYPE)
|
| 82 | 82 | if(target_type STREQUAL STATIC_LIBRARY)
|
| 83 | 83 | add_library(${ns}::${name} STATIC IMPORTED)
|
| 84 | - else()
|
|
| 84 | + elseif(target_type STREQUAL SHARED_LIBRARY)
|
|
| 85 | 85 | add_library(${ns}::${name} SHARED IMPORTED)
|
| 86 | + elseif(target_type STREQUAL INTERFACE_LIBRARY)
|
|
| 87 | + add_library(${ns}::${name} INTERFACE IMPORTED)
|
|
| 88 | + else()
|
|
| 89 | + message(FATAL_ERROR "Unsupported library type: ${target_type}")
|
|
| 86 | 90 | endif()
|
| 87 | - wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_CONFIGURATIONS)
|
|
| 88 | 91 | wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_COMPILE_DEFINITIONS)
|
| 89 | 92 | wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_INCLUDE_DIRECTORIES)
|
| 90 | 93 | wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_LINK_LIBRARIES)
|
| 91 | - wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_INTERFACE_LANGUAGES)
|
|
| 92 | - wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LOCATION)
|
|
| 93 | - wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_IMPLIB)
|
|
| 94 | - wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES)
|
|
| 94 | + if(target_type STREQUAL STATIC_LIBRARY OR target_type STREQUAL SHARED_LIBRARY)
|
|
| 95 | + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_CONFIGURATIONS)
|
|
| 96 | + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_INTERFACE_LANGUAGES)
|
|
| 97 | + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LOCATION)
|
|
| 98 | + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_IMPLIB)
|
|
| 99 | + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES)
|
|
| 100 | + endif()
|
|
| 101 | +endmacro()
|
|
| 102 | + |
|
| 103 | +macro(wx_map_release libname)
|
|
| 104 | + # use the Release configuration for MinSizeRel and RelWithDebInfo configurations
|
|
| 105 | + # only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist
|
|
| 106 | + get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS)
|
|
| 107 | + if("RELEASE" IN_LIST configs)
|
|
| 108 | + if(NOT "MINSIZEREL" IN_LIST configs)
|
|
| 109 | + if("MinSizeRel" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
|
| 110 | + set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release")
|
|
| 111 | + endif()
|
|
| 112 | + endif()
|
|
| 113 | + if(NOT "RELWITHDEBINFO" IN_LIST configs)
|
|
| 114 | + if("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
|
| 115 | + set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release")
|
|
| 116 | + endif()
|
|
| 117 | + endif()
|
|
| 118 | + endif()
|
|
| 95 | 119 | endmacro()
|
| 96 | 120 | |
| 97 | 121 | # for compatibility with FindwxWidgets
|
| ... | ... | @@ -108,6 +132,8 @@ endif() |
| 108 | 132 | set(@PROJECT_NAME@_COMPONENTS)
|
| 109 | 133 | foreach(libname @wxLIB_TARGETS@)
|
| 110 | 134 | if(TARGET wx::${libname})
|
| 135 | + wx_map_release(${libname})
|
|
| 136 | + |
|
| 111 | 137 | # remove wx prefix from component name
|
| 112 | 138 | string(SUBSTRING ${libname} 2 -1 name)
|
| 113 | 139 | |
| ... | ... | @@ -116,23 +142,7 @@ foreach(libname @wxLIB_TARGETS@) |
| 116 | 142 | set(@PROJECT_NAME@_${name}_FOUND 1)
|
| 117 | 143 | set(@PROJECT_NAME@_FIND_REQUIRED_${name} 1)
|
| 118 | 144 | |
| 119 | - # use the Release configuration for MinSizeRel and RelWithDebInfo configurations
|
|
| 120 | - # only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist
|
|
| 121 | - get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS)
|
|
| 122 | - if("RELEASE" IN_LIST configs)
|
|
| 123 | - if(NOT "MINSIZEREL" IN_LIST configs)
|
|
| 124 | - if("MinSizeRel" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
|
| 125 | - set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release")
|
|
| 126 | - endif()
|
|
| 127 | - endif()
|
|
| 128 | - if(NOT "RELWITHDEBINFO" IN_LIST configs)
|
|
| 129 | - if("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
|
| 130 | - set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release")
|
|
| 131 | - endif()
|
|
| 132 | - endif()
|
|
| 133 | - endif()
|
|
| 134 | - |
|
| 135 | - # add an alias from wx::<lib> to wx::wx<lib>
|
|
| 145 | + # add aliases from wx::<lib> and wxWidgets::${lib} to wx::wx<lib>
|
|
| 136 | 146 | if(NOT TARGET wx::${name})
|
| 137 | 147 | if(CMAKE_VERSION VERSION_LESS "3.18")
|
| 138 | 148 | # CMake <3.18 does not support alias to non-global imported target, create a copy of the library
|
| ... | ... | @@ -144,6 +154,11 @@ foreach(libname @wxLIB_TARGETS@) |
| 144 | 154 | endif()
|
| 145 | 155 | endif()
|
| 146 | 156 | |
| 157 | + # don't include 'wxbase_only' in wxWidgets_LIBRARIES and wxWidgets::wxWidgets
|
|
| 158 | + if(${libname} STREQUAL "wxbase_only")
|
|
| 159 | + continue()
|
|
| 160 | + endif()
|
|
| 161 | + |
|
| 147 | 162 | # add to FindwxWidgets variable
|
| 148 | 163 | if(NOT @PROJECT_NAME@_FIND_COMPONENTS OR ${name} IN_LIST @PROJECT_NAME@_FIND_COMPONENTS)
|
| 149 | 164 | list(APPEND wxWidgets_LIBRARIES wx::${name})
|
| ... | ... | @@ -153,6 +168,11 @@ foreach(libname @wxLIB_TARGETS@) |
| 153 | 168 | endif()
|
| 154 | 169 | endif()
|
| 155 | 170 | endforeach()
|
| 171 | +foreach(libname @wxLIB_BUILTIN_TARGETS@)
|
|
| 172 | + if(TARGET wx::${libname})
|
|
| 173 | + wx_map_release(${libname})
|
|
| 174 | + endif()
|
|
| 175 | +endforeach()
|
|
| 156 | 176 | |
| 157 | 177 | include(CMakeFindDependencyMacro)
|
| 158 | 178 |
| ... | ... | @@ -20,7 +20,6 @@ |
| 20 | 20 | #include "wx/frame.h"
|
| 21 | 21 | #include "wx/dc.h"
|
| 22 | 22 | #include "wx/dcclient.h"
|
| 23 | - #include "wx/button.h"
|
|
| 24 | 23 | #include "wx/menu.h"
|
| 25 | 24 | #include "wx/dialog.h"
|
| 26 | 25 | #include "wx/settings.h"
|
| ... | ... | @@ -253,7 +252,7 @@ wxWindowMac::~wxWindowMac() |
| 253 | 252 | wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent((wxWindow*)this), wxTopLevelWindow);
|
| 254 | 253 | if ( tlw )
|
| 255 | 254 | {
|
| 256 | - if ( tlw->GetDefaultItem() == (wxButton*) this)
|
|
| 255 | + if ( tlw->GetDefaultItem() == this )
|
|
| 257 | 256 | tlw->SetDefaultItem(nullptr);
|
| 258 | 257 | }
|
| 259 | 258 |
| ... | ... | @@ -449,7 +449,7 @@ void wxGLCanvasEGL::UpdateSubsurfacePosition() |
| 449 | 449 | }
|
| 450 | 450 | |
| 451 | 451 | int x, y;
|
| 452 | - gdk_window_get_origin(m_canvas->GTKGetDrawingWindow(), &x, &y);
|
|
| 452 | + gdk_window_get_position(m_canvas->GTKGetDrawingWindow(), &x, &y);
|
|
| 453 | 453 | wl_subsurface_set_position(m_wlSubsurface, x, y);
|
| 454 | 454 | }
|
| 455 | 455 |
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help