From 01edac992de4ba585ffab6143017b63f37cb9fe7 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 2 May 2021 21:29:00 +0200 Subject: [PATCH 1/9] Update library naming convention documentation --- ...bout-platform-toolkit-and-library-names.md | 122 ++++++++++++------ 1 file changed, 85 insertions(+), 37 deletions(-) diff --git a/docs/contributing/about-platform-toolkit-and-library-names.md b/docs/contributing/about-platform-toolkit-and-library-names.md index f27b4b5d84..dc7e407aea 100644 --- a/docs/contributing/about-platform-toolkit-and-library-names.md +++ b/docs/contributing/about-platform-toolkit-and-library-names.md @@ -1,5 +1,4 @@ -wxWidgets naming conventions -============================ +## wxWidgets naming conventions Being a cross platform development library, it is naturally desirable (at least to me ;) for wxWidgets to be exploited in a fully cross @@ -9,7 +8,7 @@ when desired. Since this is now in fact possible for at least the most commonly used platforms, wxWidgets has been structured to allow multiple, simultaneous -installations of the library. Common files are shared, platform and port +installations of the library. Common files are shared, platform and port specific files and libraries are arranged so as to be unambiguous when installed together. @@ -22,61 +21,99 @@ for wxWidgets, but is encompassing enough to maintain a relatively complete set of cross platform build tools on a single machine and to provide an obvious slot for new ports to slip into. +The libraries use the following naming convention. +When an item of the name is empty, `'_'` or `'-'` are omitted. -For UNIX libraries, the canonical library name shall be of the form: +*UNIX libraries* (using configure): - libwx_$(toolkit)$(widgetset)$(debug)-$(version)-$(host).$(lib_extension) + libwx_$(toolkit)$(widgetset)$(unicode)_$(flavour)_$(name)-$(version)-$(host).$(lib_extension) -For MSW (native hosted only) libraries the library name should be of -the form: +*Windows libraries* (using VS solution or makefile.gcc/vc): - wx$(toolkit)$(widgetset)$(version)$(unicode)$(debug).$(lib_extension) + wx$(toolkit)$(widgetset)$(version)$(unicode)$(debug)_$(flavour)_$(name)_$(compiler)_$(arch)_$(vendor).$(lib_extension) Where: -------------------------------------------------------------------- -`$toolkit` must currently be one of the following: +`$toolkit` can currently be one of the following: - msw - gtk - base - mac - motif + - `base` + - `msw` + - `gtk`, `gtk2`, `gtk3`, `gtk4` + - `osx_cocoa`, `osx_iphone` + - `motif` + - `x11` + - `dfb` + - `qt` -------------------------------------------------------------------- `$widgetset` may be one of: - univ + - `univ` or empty if the widget set is the same as the toolkit. -------------------------------------------------------------------- -`$version` is a string encoding the full version (major, minor, release) -for MSW, or just the major and minor number for UNIX. +`$version` is a string encoding the major and minor version number, +separated by a dot on UNIX and without separator on Windows. +Windows shared libraries of development versions (odd minor releases) +contain the full version (major, minor, release). +On UNIX, the `$so_version` contains the release number. -eg. for wxWidgets 2.3.2, `$version` = 232 for MSW or 2.3 for UNIX. +Eg. for wxWidgets 3.1.5, `$version` is `315` for Windows shared libraries, +`31` for Windows static libraries, and `3.1` for UNIX libraries. And the +`$so_version` for UNIX libraries is `.5` and `.5.0.0`. The rationale for this is that under UNIX-like systems it is desirable that differently 'minor numbered' releases can be installed together, meaning your old 2.2 apps can continue to work even if you migrate -development to the next stable or unstable release (eg. 2.3, 2.4), +development to the next stable or unstable release (eg. 2.3, 2.4), but binary compatibility is maintained between point releases (those -with the same major.minor number) +with the same major.minor number). A known break in binary compatibility should be addressed by updating -the library soname (see the notes in configure.in for details on this) - -I do not know why MSW should not also omit the release number from -`$version`. (maybe that will change by the time this document is ratified) +the library soname (see the notes in configure.in for details on this). -------------------------------------------------------------------- -`$unicode` and `$debug` are either empty or set to `'u'` and `'d'` -respectively when enabled. +`$unicode` is set to `'u'` when Unicode is enabled (default on), and is empty +when disabled. In the `setup.h` and `wx-config` names, the full `'unicode'` +name is used. + +-------------------------------------------------------------------- + +`$debug` is set to `'d'` for the libraries using debug version of CRT and is empty +for release libraries. It is only really useful for the libraries created with MSVC +projects and makefiles, as MSVC debug and release CRT are not ABI-compatible, +but is also used by `makefile.gcc` under MSW for consistency with `makefile.vc`. +When using configure under MSW or UNIX, it is always empty. + +-------------------------------------------------------------------- + +`$flavour` is an optional name to identify the build. It is empty by default. + +-------------------------------------------------------------------- + +`$name` is the name of the library. It is empty for the `'base'` library. + +-------------------------------------------------------------------- + +`$compiler` is the used compiler, for example `'vc'` or `'gcc'`. +It is only added to shared libraries on Windows. + +-------------------------------------------------------------------- + +`$arch` is used by MSVC solutions. It is empty for 32-bit builds and +`'x64'` for 64-bit builds. It is only added to shared libraries. + +-------------------------------------------------------------------- + +`$vendor` is an optional name appended to the library name. It is only +added to shared libraries on Windows. It defaults to `'custom'`. -------------------------------------------------------------------- @@ -87,29 +124,40 @@ that are cross compiled. -------------------------------------------------------------------- -`$lib_extension` is system specific and most usually set to `.a` for -a static library, `.dll` for a MSW shared library, or `.so.$so_version` -for a shared UNIX library. +`$lib_extension` is system specific and most usually set to `'.a'` for +a static UNIX library, `'.so.$so_version'` for a shared UNIX library, +`'.lib'` for a static MSVC library or `'.dll'` for a shared MSVC library. -==================================================================== +-------------------------------------------------------------------- +`type` is used to indicate a shared or static build. For MSVC, type is +`'lib'` for shared libraries and `'dll'` for static libraries. +On UNIX, type is empty for shared libraries and `'static'` for static libraries. + +-------------------------------------------------------------------- + +## setup.h The installed location of the library specific setup.h is also -determined by the values of these items. On UNIX systems they -will be found in: +determined by the values of these items. On UNIX they will be found in: - $(prefix)/lib/wx/include/$(toolkit)$(widgetset)$(debug)-$(version)-$(host)/wx/ + $(prefix)/lib/wx/include/$(host)-$(toolkit)$(widgetset)-$(unicode)-$(type)-$(version)-$(flavour)/wx/setup.h which will be in the include search path returned by the relevant -wx-config for that library. (or presumably set in the relevant -make/project files for platforms that do not use wx-config) +wx-config for that library (or presumably set in the relevant +make/project files for platforms that do not use wx-config). -==================================================================== +For MSVC and gcc/vc makefile, the file is found in: + $(prefix)/lib/$(compiler)_$(arch)_$(type)/$(toolkit)$(widgetset)$(unicode)$(debug)/wx/setup.h + +-------------------------------------------------------------------- + +## wx-config The port specific wx-config file for each library shall be named: - wx-$(toolkit)$(widgetset)$(debug)-$(version)-$(host)-config + $(prefix)/lib/wx/config/$(host)-$(toolkit)$(widgetset)-$(unicode)-$(type)-$(version)-$(flavour) ${prefix}/bin/wx-config shall exist as a link to (or copy of) one of these port specific files (on platforms which support it) and as such From f830bde25b5197dd0abafcb368b3809fac7ddb0c Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Mon, 24 May 2021 21:10:14 +0200 Subject: [PATCH 2/9] CMake: Improve library names Use the same output names as MSVC and makefile.gcc/vc on Windows, and the same as configure on other platforms. --- build/cmake/functions.cmake | 177 ++++++++++++++++++------------- build/cmake/init.cmake | 20 ++-- build/cmake/install.cmake | 23 ++-- build/cmake/utils/CMakeLists.txt | 12 +-- 4 files changed, 132 insertions(+), 100 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index f82ff941bb..83675f7ede 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -18,6 +18,14 @@ endif() include(cotire) # For precompiled header handling include(CMakePrintHelpers) +# Use the MSVC/makefile naming convention, or the configure naming convention, +# this is the same check as used in FindwxWidgets. +if(WIN32 AND NOT CYGWIN AND NOT MSYS) + set(WIN32_MSVC_NAMING 1) +else() + set(WIN32_MSVC_NAMING 0) +endif() + # This function adds a list of headers to a variable while prepending # include/ to the path macro(wx_add_headers src_var) @@ -148,81 +156,95 @@ function(wx_set_target_properties target_name is_base) else() set(lib_toolkit ${wxBUILD_TOOLKIT}${wxBUILD_WIDGETSET}) endif() - if(MSVC) + + if(WIN32_MSVC_NAMING) set(lib_version ${wxMAJOR_VERSION}${wxMINOR_VERSION}) else() set(lib_version ${wxMAJOR_VERSION}.${wxMINOR_VERSION}) endif() + set(dll_version ${wxMAJOR_VERSION}${wxMINOR_VERSION}) + if(wxVERSION_IS_DEV) + wx_string_append(dll_version ${wxRELEASE_NUMBER}) + endif() + + set(lib_unicode) if(wxUSE_UNICODE) - set(lib_unicode u) - else() - set(lib_unicode) + set(lib_unicode "u") endif() + + set(lib_rls) + set(lib_dbg) + set(lib_gen) + if(WIN32_MSVC_NAMING) + set(lib_dbg "d") + set(lib_gen "$<$:${lib_dbg}>") + endif() + + set(lib_suffix) if(NOT target_name_short STREQUAL "base" AND NOT target_name_short STREQUAL "mono") - # Do not append library name for base library - set(lib_suffix _${target_name_short}) - else() - set(lib_suffix) + # Do not append library name for base or mono library + set(lib_suffix "_${target_name_short}") endif() - set(lib_flavour "") if(wxBUILD_FLAVOUR) set(lib_flavour "_${wxBUILD_FLAVOUR}") string(REPLACE "-" "_" lib_flavour ${lib_flavour}) + set(lib_suffix "${lib_flavour}${lib_suffix}") endif() - if(WIN32) - if(MSVC) - # match visual studio name - set_target_properties(${target_name} - PROPERTIES - OUTPUT_NAME "wx${lib_toolkit}${lib_version}${lib_unicode}${lib_flavour}${lib_suffix}" - OUTPUT_NAME_DEBUG "wx${lib_toolkit}${lib_version}${lib_unicode}d${lib_flavour}${lib_suffix}" - PREFIX "" - ) - else() - # match configure name (mingw, cygwin) - 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() + set(dll_suffix "${lib_suffix}") + if(wxCOMPILER_PREFIX) + wx_string_append(dll_suffix "_${wxCOMPILER_PREFIX}") + endif() + if(wxBUILD_VENDOR AND wxVERSION_IS_DEV) + wx_string_append(dll_suffix "_${wxBUILD_VENDOR}") + endif() - if(wxBUILD_SHARED) - # Add compiler type and or vendor - set(dll_suffix "${lib_flavour}${lib_suffix}_${wxCOMPILER_PREFIX}") - if(wxBUILD_VENDOR) - wx_string_append(dll_suffix "_${wxBUILD_VENDOR}") - endif() + set(cross_target) + if (CMAKE_CROSSCOMPILING) + set(cross_target "-${CMAKE_SYSTEM_NAME}") + endif() - set(dll_version ${wxMAJOR_VERSION}${wxMINOR_VERSION}) - if(wxVERSION_IS_DEV) - wx_string_append(dll_version ${wxRELEASE_NUMBER}) - endif() - set_target_properties(${target_name} - PROPERTIES - RUNTIME_OUTPUT_NAME "wx${lib_toolkit}${dll_version}${lib_unicode}${dll_suffix}" - RUNTIME_OUTPUT_NAME_DEBUG "wx${lib_toolkit}${dll_version}${lib_unicode}d${dll_suffix}" - PREFIX "" - ) - target_compile_definitions(${target_name} PRIVATE - "-DWXDLLNAME=wx${lib_toolkit}${dll_version}${lib_unicode}$<$:d>${dll_suffix}") - endif() + set(lib_prefix "lib") + if(WIN32 AND wxBUILD_SHARED) + set(lib_prefix) + endif() + + # static (and import) library names + if(WIN32_MSVC_NAMING) + # match msvc/makefile output name + set(wxOUTPUT_NAME "wx${lib_toolkit}${lib_version}${lib_unicode}${lib_rls}${lib_suffix}") + set(wxOUTPUT_NAME_DEBUG "wx${lib_toolkit}${lib_version}${lib_unicode}${lib_dbg}${lib_suffix}") else() - set(cross_target "") - if (CMAKE_CROSSCOMPILING) - set(cross_target "-${CMAKE_SYSTEM_NAME}") - endif () - - set_target_properties(${target_name} - PROPERTIES - OUTPUT_NAME wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version}${cross_target} - # NOTE: wx-config can not be used to connect the libraries with the debug suffix. - #OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}d${lib_flavour}${lib_suffix}-${lib_version}${cross_target} - OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version}${cross_target} - ) + # match configure output name + set(wxOUTPUT_NAME "wx_${lib_toolkit}${lib_unicode}${lib_rls}${lib_suffix}-${lib_version}${cross_target}") + set(wxOUTPUT_NAME_DEBUG "wx_${lib_toolkit}${lib_unicode}${lib_dbg}${lib_suffix}-${lib_version}${cross_target}") endif() + + # shared library names + if(WIN32) + # msvc/makefile/configure use the same format on Windows + set(wxRUNTIME_OUTPUT_NAME "wx${lib_toolkit}${dll_version}${lib_unicode}${lib_rls}${dll_suffix}") + set(wxRUNTIME_OUTPUT_NAME_DEBUG "wx${lib_toolkit}${dll_version}${lib_unicode}${lib_dbg}${dll_suffix}") + set(wxDLLNAME "wx${lib_toolkit}${dll_version}${lib_unicode}${lib_gen}${dll_suffix}") + else() + # match configure on linux/mac + set(wxRUNTIME_OUTPUT_NAME "wx_${lib_toolkit}${lib_unicode}${lib_rls}${dll_suffix}-${lib_version}${cross_target}") + set(wxRUNTIME_OUTPUT_NAME_DEBUG "wx_${lib_toolkit}${lib_unicode}${lib_dbg}${dll_suffix}-${lib_version}${cross_target}") + set(wxDLLNAME "wx_${lib_toolkit}${lib_unicode}${lib_gen}${dll_suffix}-${lib_version}${cross_target}") + endif() + + set_target_properties(${target_name} PROPERTIES + OUTPUT_NAME "${wxOUTPUT_NAME}" + OUTPUT_NAME_DEBUG "${wxOUTPUT_NAME_DEBUG}" + RUNTIME_OUTPUT_NAME "${wxRUNTIME_OUTPUT_NAME}" + RUNTIME_OUTPUT_NAME_DEBUG "${wxRUNTIME_OUTPUT_NAME_DEBUG}" + PREFIX "${lib_prefix}" + ) + + if(wxBUILD_SHARED) + target_compile_definitions(${target_name} PRIVATE "WXDLLNAME=${wxDLLNAME}") + endif() + if(CYGWIN) target_link_libraries(${target_name} PUBLIC -L/usr/lib/w32api) endif() @@ -371,10 +393,15 @@ macro(wx_add_library name) set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) # Setup install + set(runtime_dir "lib") + if(WIN32 AND NOT WIN32_MSVC_NAMING) + # configure puts the .dll in the bin directory + set(runtime_dir "bin") + endif() wx_install(TARGETS ${name} LIBRARY DESTINATION "lib${wxPLATFORM_LIB_DIR}" ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}" - RUNTIME DESTINATION "lib${wxPLATFORM_LIB_DIR}" + RUNTIME DESTINATION "${runtime_dir}${wxPLATFORM_LIB_DIR}" BUNDLE DESTINATION Applications/wxWidgets ) endif() @@ -474,25 +501,27 @@ endmacro() # Set common properties for a builtin third party library function(wx_set_builtin_target_properties target_name) + set(lib_unicode) if(wxUSE_UNICODE AND target_name STREQUAL "wxregex") - set(lib_unicode u) - else() - set(lib_unicode) + set(lib_unicode "u") endif() - if(NOT WIN32) - set(postfix -${wxMAJOR_VERSION}.${wxMINOR_VERSION}) + + set(lib_rls) + set(lib_dbg) + if(WIN32_MSVC_NAMING) + set(lib_dbg "d") endif() - set_target_properties(${target_name} - PROPERTIES - OUTPUT_NAME ${target_name}${lib_unicode}${postfix} - ) - if(WIN32) - set_target_properties(${target_name} - PROPERTIES - OUTPUT_NAME_DEBUG ${target_name}${lib_unicode}d - ) + + set(lib_version) + if(NOT WIN32_MSVC_NAMING) + set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") endif() + set_target_properties(${target_name} PROPERTIES + OUTPUT_NAME "${target_name}${lib_unicode}${lib_rls}${lib_version}" + OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_version}" + ) + if(wxUSE_UNICODE) if(WIN32) target_compile_definitions(${target_name} PUBLIC UNICODE) @@ -701,7 +730,7 @@ function(wx_add name group) set(SUB_DIR "tests/benchmarks") set(DEFAULT_RC_FILE "samples/sample.rc") else() - message(WARNING "Unkown group \"${group}\"") + message(WARNING "Unknown group \"${group}\"") return() endif() diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 0bc4f934b9..0537f8ca1c 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -129,9 +129,11 @@ if(wxBUILD_FLAVOUR) endif() set(wxARCH_SUFFIX) +set(wxCOMPILER_PREFIX) +set(wxPLATFORM_LIB_DIR) -# TODO: include compiler version in wxCOMPILER_PREFIX ? if(WIN32) + # TODO: include compiler version in wxCOMPILER_PREFIX for official builds if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(wxCOMPILER_PREFIX "vc") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") @@ -145,21 +147,17 @@ if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(wxARCH_SUFFIX "_x64") endif() -else() - set(wxCOMPILER_PREFIX) endif() -if(MSVC) +if(WIN32_MSVC_NAMING) if(wxBUILD_SHARED) - set(lib_suffix "dll") + set(lib_suffix "_dll") else() - set(lib_suffix "lib") + set(lib_suffix "_lib") endif() # Include generator expression to suppress default Debug/Release pair - set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") -else() - set(wxPLATFORM_LIB_DIR) + set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}${lib_suffix}") endif() if(wxBUILD_CUSTOM_SETUP_HEADER_PATH) @@ -169,14 +167,14 @@ if(wxBUILD_CUSTOM_SETUP_HEADER_PATH) set(wxSETUP_HEADER_PATH ${wxBUILD_CUSTOM_SETUP_HEADER_PATH}) else() # Set path where setup.h will be created - if(MSVC) + if(WIN32_MSVC_NAMING) if(wxUSE_UNICODE) set(lib_unicode u) else() set(lib_unicode) endif() set(wxSETUP_HEADER_PATH - ${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}/${wxBUILD_TOOLKIT}${lib_unicode}) + ${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}${lib_suffix}/${wxBUILD_TOOLKIT}${lib_unicode}) file(MAKE_DIRECTORY ${wxSETUP_HEADER_PATH}/wx) file(MAKE_DIRECTORY ${wxSETUP_HEADER_PATH}d/wx) set(wxSETUP_HEADER_FILE_DEBUG ${wxSETUP_HEADER_PATH}d/wx/setup.h) diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 968dff859e..4ef1337713 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -12,13 +12,15 @@ if(NOT wxBUILD_INSTALL) endif() install(CODE "message(STATUS \"Installing: Headers...\")") -if(MSVC) +if(WIN32_MSVC_NAMING) wx_install( DIRECTORY "${wxSOURCE_DIR}/include/wx" DESTINATION "include") - wx_install( - DIRECTORY "${wxSOURCE_DIR}/include/msvc" - DESTINATION "include") + if(MSVC) + wx_install( + DIRECTORY "${wxSOURCE_DIR}/include/msvc" + DESTINATION "include") + endif() else() wx_install( DIRECTORY "${wxSOURCE_DIR}/include/wx" @@ -26,7 +28,7 @@ else() endif() # setup header and wx-config -if(MSVC) +if(WIN32_MSVC_NAMING) wx_install( DIRECTORY "${wxSETUP_HEADER_PATH}" DESTINATION "lib${wxPLATFORM_LIB_DIR}") @@ -60,11 +62,14 @@ else() endif() if(NOT TARGET ${UNINST_NAME}) - # these files are not added to the install manifest - set(WX_EXTRA_UNINSTALL_FILES - "${CMAKE_INSTALL_PREFIX}/bin/wx-config" - "${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + # these symlinks are not included in the install manifest + set(WX_EXTRA_UNINSTALL_FILES) + if(NOT WIN32_MSVC_NAMING) + set(WX_EXTRA_UNINSTALL_FILES + "${CMAKE_INSTALL_PREFIX}/bin/wx-config" + "${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" ) + endif() configure_file( "${wxSOURCE_DIR}/build/cmake/uninstall.cmake.in" diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index 4108d6a723..786b71beb9 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -25,13 +25,13 @@ if(wxUSE_XRC) BUNDLE DESTINATION "bin" ) - if(IPHONE) - set(EXE_SUFFIX ".app") - else() - set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) - endif() + if(NOT WIN32_MSVC_NAMING) + if(IPHONE) + set(EXE_SUFFIX ".app") + else() + set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) + endif() - if(NOT MSVC) install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E rename \ ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \ From 91884752c158b696b4529e89ab3b981745c2c9fe Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 27 May 2021 23:21:24 +0200 Subject: [PATCH 3/9] CMake: Create symlinks with so version --- CMakeLists.txt | 20 +++++++++++++++++++- build/cmake/functions.cmake | 5 +++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4063020552..d5147f1845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ set(wxBINARY_DIR ${CMAKE_BINARY_DIR}) set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib) # parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION -file(READ include/wx/version.h WX_VERSION_H_CONTENTS) +file(READ "${wxSOURCE_DIR}/include/wx/version.h" WX_VERSION_H_CONTENTS) string(REGEX MATCH "wxMAJOR_VERSION[ \t]+([0-9]+)" wxMAJOR_VERSION ${WX_VERSION_H_CONTENTS}) string (REGEX MATCH "([0-9]+)" @@ -59,6 +59,7 @@ string(REGEX MATCH "wxRELEASE_NUMBER[ \t]+([0-9]+)" wxRELEASE_NUMBER ${WX_VERSION_H_CONTENTS}) string (REGEX MATCH "([0-9]+)" wxRELEASE_NUMBER ${wxRELEASE_NUMBER}) + # Determine if current version is a "Development" release math(EXPR rel_dev "${wxMINOR_VERSION} % 2") if(rel_dev) @@ -67,6 +68,23 @@ else() set(wxVERSION_IS_DEV FALSE) endif() +# parse the .so version from build/bakefiles/version.bkl +file(READ "${wxSOURCE_DIR}/build/bakefiles/version.bkl" WX_VERSION_BKL_CONTENTS) +string(REGEX MATCH "WX_CURRENT.>([0-9]+)" + WX_CURRENT ${WX_VERSION_BKL_CONTENTS}) +string(REGEX MATCH "([0-9]+)" + WX_CURRENT ${WX_CURRENT}) +string(REGEX MATCH "WX_REVISION.>([0-9]+)" + WX_REVISION ${WX_VERSION_BKL_CONTENTS}) +string(REGEX MATCH "([0-9]+)" + WX_REVISION ${WX_REVISION}) +string(REGEX MATCH "WX_AGE.>([0-9]+)" + WX_AGE ${WX_VERSION_BKL_CONTENTS}) +string(REGEX MATCH "([0-9]+)" + WX_AGE ${WX_AGE}) +math(EXPR wxSOVERSION_MAJOR "${WX_CURRENT} - ${WX_AGE}") +set(wxSOVERSION ${wxSOVERSION_MAJOR}.${WX_AGE}.${WX_REVISION}) + set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}) set(wxCOPYRIGHT "1992-2021 wxWidgets") diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 83675f7ede..dcfcd7d261 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -347,6 +347,11 @@ function(wx_set_target_properties target_name is_base) set_target_properties(${target_name} PROPERTIES FOLDER Libraries) + set_target_properties(${target_name} PROPERTIES + SOVERSION ${wxSOVERSION_MAJOR} + VERSION ${wxSOVERSION} + ) + wx_set_common_target_properties(${target_name}) endfunction() From 3e0057757bba8fc09513171eb8069873da1e2e67 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 6 Jun 2021 22:48:27 +0200 Subject: [PATCH 4/9] CMake: Use a macro to get the flavour Also include the flavour in builtin target names and include path. --- build/cmake/functions.cmake | 24 +++++++++++++++++------- build/cmake/init.cmake | 7 ++----- build/cmake/install.cmake | 3 ++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index dcfcd7d261..5136309ba4 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -81,6 +81,17 @@ macro(wx_install) endif() endmacro() +# Get a valid flavour name with optional prefix +macro(wx_get_flavour flavour prefix) + if(wxBUILD_FLAVOUR) + set(flav ${wxBUILD_FLAVOUR}) + string(REPLACE "-" "_" flav ${flav}) + set(${flavour} "${prefix}${flav}") + else() + set(${flavour}) + endif() +endmacro() + # Set properties common to builtin third party libraries and wx libs function(wx_set_common_target_properties target_name) cmake_parse_arguments(wxCOMMON_TARGET_PROPS "DEFAULT_WARNINGS" "" "" ${ARGN}) @@ -185,11 +196,8 @@ function(wx_set_target_properties target_name is_base) # Do not append library name for base or mono library set(lib_suffix "_${target_name_short}") endif() - if(wxBUILD_FLAVOUR) - set(lib_flavour "_${wxBUILD_FLAVOUR}") - string(REPLACE "-" "_" lib_flavour ${lib_flavour}) - set(lib_suffix "${lib_flavour}${lib_suffix}") - endif() + wx_get_flavour(lib_flavour "_") + set(lib_suffix "${lib_flavour}${lib_suffix}") set(dll_suffix "${lib_suffix}") if(wxCOMPILER_PREFIX) @@ -517,14 +525,16 @@ function(wx_set_builtin_target_properties target_name) set(lib_dbg "d") endif() + wx_get_flavour(lib_flavour "_") + set(lib_version) if(NOT WIN32_MSVC_NAMING) set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") endif() set_target_properties(${target_name} PROPERTIES - OUTPUT_NAME "${target_name}${lib_unicode}${lib_rls}${lib_version}" - OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_version}" + OUTPUT_NAME "${target_name}${lib_unicode}${lib_rls}${lib_flavour}${lib_version}" + OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_flavour}${lib_version}" ) if(wxUSE_UNICODE) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 0537f8ca1c..41d3da4a81 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -122,11 +122,8 @@ if(NOT wxBUILD_SHARED) wx_string_append(wxBUILD_FILE_ID "-static") endif() wx_string_append(wxBUILD_FILE_ID "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") -if(wxBUILD_FLAVOUR) - set(lib_flavour ${wxBUILD_FLAVOUR}) - string(REPLACE "-" "_" lib_flavour ${lib_flavour}) - wx_string_append(wxBUILD_FILE_ID "-${lib_flavour}") -endif() +wx_get_flavour(lib_flavour "-") +wx_string_append(wxBUILD_FILE_ID "${lib_flavour}") set(wxARCH_SUFFIX) set(wxCOMPILER_PREFIX) diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 4ef1337713..5798384622 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -22,9 +22,10 @@ if(WIN32_MSVC_NAMING) DESTINATION "include") endif() else() + wx_get_flavour(lib_flavour "-") wx_install( DIRECTORY "${wxSOURCE_DIR}/include/wx" - DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") + DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${lib_flavour}") endif() # setup header and wx-config From 979a4b523790d8a3538c43ae1bb9182efaf50eb3 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 6 Jun 2021 23:14:22 +0200 Subject: [PATCH 5/9] CMake: Improve wxrc name Include the version and flavour in the target name, no need to rename anymore. Add the wxrc symlink to extra uninstall files, not the actual target name. --- build/cmake/install.cmake | 8 +++++++- build/cmake/utils/CMakeLists.txt | 16 +++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 5798384622..ef971c7285 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -66,9 +66,15 @@ if(NOT TARGET ${UNINST_NAME}) # these symlinks are not included in the install manifest set(WX_EXTRA_UNINSTALL_FILES) if(NOT WIN32_MSVC_NAMING) + if(IPHONE) + set(EXE_SUFFIX ".app") + else() + set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) + endif() + set(WX_EXTRA_UNINSTALL_FILES "${CMAKE_INSTALL_PREFIX}/bin/wx-config" - "${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + "${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}" ) endif() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index 786b71beb9..2b3a22834d 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -18,6 +18,14 @@ if(wxUSE_XRC) endif() wx_exe_link_libraries(wxrc wxbase) + set(wxrc_output_name "wxrc") + if(NOT WIN32_MSVC_NAMING) + wx_get_flavour(lib_flavour "-") + set(wxrc_output_name "wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${lib_flavour}") + endif() + + set_target_properties(wxrc PROPERTIES OUTPUT_NAME ${wxrc_output_name}) + set_target_properties(wxrc PROPERTIES FOLDER "Utilities") wx_install(TARGETS wxrc @@ -32,15 +40,9 @@ if(wxUSE_XRC) set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) endif() - install(CODE "execute_process( \ - COMMAND ${CMAKE_COMMAND} -E rename \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${EXE_SUFFIX} \ - )" - ) install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E create_symlink \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${EXE_SUFFIX} \ + ${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX} \ ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \ )" ) From 6f34937993cbd97c4fc327ad7b6a4b714c02bd07 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 6 Jun 2021 23:18:54 +0200 Subject: [PATCH 6/9] CMake: Improve webkit plugin name --- build/cmake/lib/webview/CMakeLists.txt | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index cc3298ff33..70e8dcdb79 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -43,14 +43,6 @@ endif() wx_add_library(wxwebview ${WEBVIEW_FILES}) -if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) - if(wxVERSION_IS_DEV) - set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}/web-extensions") - else() - set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") - endif() -endif() - if(APPLE) wx_lib_link_libraries(wxwebview PUBLIC "-framework WebKit") elseif(WXMSW) @@ -120,16 +112,31 @@ if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) wx_append_sources(WEBKIT2_EXT_FILES WEBVIEW_WEBKIT2_EXTENSION) add_library(wxwebkit2_ext SHARED ${WEBKIT2_EXT_FILES}) wx_set_target_properties(wxwebkit2_ext false) + set_target_properties(wxwebkit2_ext PROPERTIES NO_SONAME 1) # Change output name to match expected name in webview_webkit2.cpp: webkit2_ext* + set(lib_unicode) if(wxUSE_UNICODE) - set(lib_unicode u) + set(lib_unicode "u") endif() - set_target_properties(wxwebkit2_ext PROPERTIES PREFIX "") + + set(lib_rls) + set(lib_dbg) + if(WIN32_MSVC_NAMING) + set(lib_dbg "d") + endif() + + if(wxVERSION_IS_DEV) + set(WX_WEB_EXT_VERSION "${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}") + else() + set(WX_WEB_EXT_VERSION "${wxMAJOR_VERSION}.${wxMINOR_VERSION}") + endif() + set_target_properties(wxwebkit2_ext PROPERTIES - OUTPUT_NAME "webkit2_ext${lib_unicode}-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" - OUTPUT_NAME_DEBUG "webkit2_ext${lib_unicode}d-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" - ) + OUTPUT_NAME "webkit2_ext${lib_unicode}${lib_rls}-${WX_WEB_EXT_VERSION}" + OUTPUT_NAME_DEBUG "webkit2_ext${lib_unicode}${lib_dbg}-${WX_WEB_EXT_VERSION}" + PREFIX "" + ) target_include_directories(wxwebkit2_ext PUBLIC ${LIBSOUP_INCLUDE_DIRS} @@ -140,7 +147,7 @@ if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) ${WEBKIT2_LIBRARIES} ) - wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION ${WX_WEB_EXTENSIONS_DIRECTORY}) + wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION "lib/wx/${WX_WEB_EXT_VERSION}/web-extensions") add_dependencies(wxwebview wxwebkit2_ext) endif() From 980bba88aa735b1ac5c8395d39d2b753d87254fa Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 17 Jun 2021 23:16:03 +0200 Subject: [PATCH 7/9] CMake: Use .a suffix for import libraries So it will have the same extension as the libraries created by makefile.gcc. --- build/cmake/functions.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 5136309ba4..b3d4f371ec 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -249,6 +249,11 @@ function(wx_set_target_properties target_name is_base) PREFIX "${lib_prefix}" ) + if(WIN32_MSVC_NAMING AND NOT MSVC) + # match makefile.gcc, use .a instead of .dll.a for import libraries + set_target_properties(${target_name} PROPERTIES IMPORT_SUFFIX ".a") + endif() + if(wxBUILD_SHARED) target_compile_definitions(${target_name} PRIVATE "WXDLLNAME=${wxDLLNAME}") endif() From cd9a35b9977e3a4b676f8c1f78ba5c7d1d5f3336 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 17 Jun 2021 23:27:38 +0200 Subject: [PATCH 8/9] CMake: generate build.cfg --- build/cmake/build.cfg.in | 39 ++++++++++++++++++++ build/cmake/build_cfg.cmake | 71 +++++++++++++++++++++++++++++++++++++ build/cmake/init.cmake | 3 ++ build/cmake/main.cmake | 4 +++ build/cmake/toolkit.cmake | 12 +++---- 5 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 build/cmake/build.cfg.in create mode 100644 build/cmake/build_cfg.cmake diff --git a/build/cmake/build.cfg.in b/build/cmake/build.cfg.in new file mode 100644 index 0000000000..ccec3108fa --- /dev/null +++ b/build/cmake/build.cfg.in @@ -0,0 +1,39 @@ +WXVER_MAJOR=@wxMAJOR_VERSION@ +WXVER_MINOR=@wxMINOR_VERSION@ +WXVER_RELEASE=@wxRELEASE_NUMBER@ +BUILD=@wxBUILD@ +MONOLITHIC=@wxBUILD_MONOLITHIC_bf@ +SHARED=@wxBUILD_SHARED_bf@ +UNICODE=@wxUSE_UNICODE_bf@ +TOOLKIT=@wxBUILD_TOOLKIT_UPPER@ +TOOLKIT_VERSION=@wxTOOLKIT_VERSION@ +WXUNIV=@wxUNIV@ +CFG=@wxCFG@ +VENDOR=@wxBUILD_VENDOR@ +OFFICIAL_BUILD=@wxOFFICIAL_BUILD@ +DEBUG_FLAG=@wxDEBUG_FLAG@ +DEBUG_INFO=@wxDEBUG_INFO@ +RUNTIME_LIBS=@wxRUNTIME_LIBS@ +USE_EXCEPTIONS=@wxUSE_EXCEPTIONS_bf@ +USE_RTTI=@wxUSE_RTTI@ +USE_THREADS=@wxUSE_THREADS_bf@ +USE_AUI=@wxUSE_AUI_bf@ +USE_GUI=@wxUSE_GUI_bf@ +USE_HTML=@wxUSE_HTML_bf@ +USE_MEDIA=@wxUSE_MEDIA_bf@ +USE_OPENGL=@wxUSE_OPENGL_bf@ +USE_QA=@wxUSE_DEBUGREPORT_bf@ +USE_PROPGRID=@wxUSE_PROPGRID_bf@ +USE_RIBBON=@wxUSE_RIBBON_bf@ +USE_RICHTEXT=@wxUSE_RICHTEXT_bf@ +USE_STC=@wxUSE_STC_bf@ +USE_WEBVIEW=@wxUSE_WEBVIEW_bf@ +USE_XRC=@wxUSE_XRC_bf@ +COMPILER=@wxCOMPILER_PREFIX@ +COMPILER_VERSION=@wxCOMPILER_VERSION@ +CC=@wxCC@ +CXX=@wxCXX@ +CFLAGS=@wxCFLAGS@ +CPPFLAGS=@wxCPPFLAGS@ +CXXFLAGS=@wxCXXFLAGS@ +LDFLAGS=@wxLDFLAGS@ diff --git a/build/cmake/build_cfg.cmake b/build/cmake/build_cfg.cmake new file mode 100644 index 0000000000..9de219c29c --- /dev/null +++ b/build/cmake/build_cfg.cmake @@ -0,0 +1,71 @@ +############################################################################# +# Name: build/cmake/build_cfg.cmake +# Purpose: Create and configure build.cfg +# Author: Maarten Bent +# Created: 2021-06-17 +# Copyright: (c) 2021 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +macro(wx_buildfile_var var) + # convert TRUE/FALSE to 1/0, add _bf suffix for use in build.cfg + if(${var}) + set(${var}_bf 1) + else() + set(${var}_bf 0) + endif() +endmacro() + +wx_buildfile_var(wxBUILD_MONOLITHIC) +wx_buildfile_var(wxBUILD_SHARED) +wx_buildfile_var(wxUSE_UNICODE) +wx_buildfile_var(wxUSE_EXCEPTIONS) +wx_buildfile_var(wxUSE_THREADS) +wx_buildfile_var(wxUSE_AUI) +wx_buildfile_var(wxUSE_GUI) +wx_buildfile_var(wxUSE_HTML) +wx_buildfile_var(wxUSE_MEDIACTRL) +wx_buildfile_var(wxUSE_OPENGL) +wx_buildfile_var(wxUSE_DEBUGREPORT) +wx_buildfile_var(wxUSE_PROPGRID) +wx_buildfile_var(wxUSE_RIBBON) +wx_buildfile_var(wxUSE_RICHTEXT) +wx_buildfile_var(wxUSE_STC) +wx_buildfile_var(wxUSE_WEBVIEW) +wx_buildfile_var(wxUSE_XRC) + +if(wxUSE_NO_RTTI) + set(wxUSE_RTTI 0) +else() + set(wxUSE_RTTI 1) +endif() +if(wxBUILD_STRIPPED_RELEASE) + set(wxDEBUG_INFO 0) +else() + set(wxDEBUG_INFO 1) +endif() +if(wxBUILD_USE_STATIC_RUNTIME) + set(wxRUNTIME_LIBS "static") +else() + set(wxRUNTIME_LIBS "dynamic") +endif() + +set(wxDEBUG_FLAG ${wxBUILD_DEBUG_LEVEL}) +get_filename_component(wxCC ${CMAKE_C_COMPILER} NAME_WE) +get_filename_component(wxCXX ${CMAKE_CXX_COMPILER} NAME_WE) +set(wxCFLAGS ${CMAKE_C_FLAGS}) +set(wxCPPFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") +set(wxCXXFLAGS ${CMAKE_CXX_FLAGS}) +set(wxLDFLAGS ${CMAKE_EXE_LINKER_FLAGS}) + +# These are currently not used by CMake +set(wxCFG "") +set(wxUNIV 0) +set(wxOFFICIAL_BUILD 0) +set(wxCOMPILER_VERSION "") + +set(wxBUILD "release") +configure_file(build/cmake/build.cfg.in ${wxBUILD_FILE}) + +set(wxBUILD "debug") +configure_file(build/cmake/build.cfg.in ${wxBUILD_FILE_DEBUG}) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 41d3da4a81..e1426afd42 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -183,6 +183,9 @@ else() endif() set(wxSETUP_HEADER_FILE ${wxSETUP_HEADER_PATH}/wx/setup.h) +set(wxBUILD_FILE ${wxSETUP_HEADER_PATH}/build.cfg) +set(wxBUILD_FILE_DEBUG ${wxSETUP_HEADER_PATH}d/build.cfg) + if(DEFINED wxSETUP_HEADER_FILE_DEBUG) # Append configuration specific suffix to setup header path wx_string_append(wxSETUP_HEADER_PATH "$<$:d>") diff --git a/build/cmake/main.cmake b/build/cmake/main.cmake index 5707352874..4a871a7ed8 100644 --- a/build/cmake/main.cmake +++ b/build/cmake/main.cmake @@ -41,6 +41,10 @@ if(NOT wxBUILD_CUSTOM_SETUP_HEADER_PATH) include(build/cmake/setup.cmake) endif() +if(WIN32_MSVC_NAMING) + include(build/cmake/build_cfg.cmake) +endif() + if(NOT MSVC) # Write wx-config include(build/cmake/config.cmake) diff --git a/build/cmake/toolkit.cmake b/build/cmake/toolkit.cmake index bcbbd75491..d61a58e72e 100644 --- a/build/cmake/toolkit.cmake +++ b/build/cmake/toolkit.cmake @@ -44,8 +44,8 @@ wx_option(wxBUILD_TOOLKIT "Toolkit used by wxWidgets" ${wxDEFAULT_TOOLKIT} set(wxBUILD_WIDGETSET "") # Create shortcut variable for easy toolkit tests -string(TOUPPER ${wxBUILD_TOOLKIT} toolkit_upper) -set(WX${toolkit_upper} ON) +string(TOUPPER ${wxBUILD_TOOLKIT} wxBUILD_TOOLKIT_UPPER) +set(WX${wxBUILD_TOOLKIT_UPPER} ON) if(wxBUILD_TOOLKIT MATCHES "^gtk*") set(WXGTK ON) elseif(wxBUILD_TOOLKIT MATCHES "^osx*") @@ -54,13 +54,13 @@ elseif(wxBUILD_TOOLKIT MATCHES "qt") set(WXQT ON) endif() -set(wxTOOLKIT_DEFINITIONS __WX${toolkit_upper}__) +set(wxTOOLKIT_DEFINITIONS __WX${wxBUILD_TOOLKIT_UPPER}__) if(NOT wxUSE_GUI) set(wxBUILD_TOOLKIT "base") - string(TOUPPER ${wxBUILD_TOOLKIT} toolkit_upper) - set(WX${toolkit_upper} ON) - set(wxTOOLKIT_DEFINITIONS __WX${toolkit_upper}__) + string(TOUPPER ${wxBUILD_TOOLKIT} wxBUILD_TOOLKIT_UPPER) + set(WX${wxBUILD_TOOLKIT_UPPER} ON) + set(wxTOOLKIT_DEFINITIONS __WX${wxBUILD_TOOLKIT_UPPER}__) endif() # Initialize toolkit variables From c85a6bc4e4231789f6fc0aca0631c2cf039dcfaa Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 22 Jun 2021 21:42:03 +0200 Subject: [PATCH 9/9] Mention CMake in library naming convention documentation --- docs/contributing/about-platform-toolkit-and-library-names.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing/about-platform-toolkit-and-library-names.md b/docs/contributing/about-platform-toolkit-and-library-names.md index dc7e407aea..11d44a4727 100644 --- a/docs/contributing/about-platform-toolkit-and-library-names.md +++ b/docs/contributing/about-platform-toolkit-and-library-names.md @@ -24,11 +24,11 @@ obvious slot for new ports to slip into. The libraries use the following naming convention. When an item of the name is empty, `'_'` or `'-'` are omitted. -*UNIX libraries* (using configure): +*UNIX libraries* (configure, CMake on Linux/macOS/Cygwin): libwx_$(toolkit)$(widgetset)$(unicode)_$(flavour)_$(name)-$(version)-$(host).$(lib_extension) -*Windows libraries* (using VS solution or makefile.gcc/vc): +*Windows libraries* (VS solution, makefile.gcc/vc, CMake on Windows/MinGW, shared libraries on Windows): wx$(toolkit)$(widgetset)$(version)$(unicode)$(debug)_$(flavour)_$(name)_$(compiler)_$(arch)_$(vendor).$(lib_extension)