Update the library naming convention document and make CMake build
system follow it.

See https://github.com/wxWidgets/wxWidgets/pull/2358
This commit is contained in:
Vadim Zeitlin
2021-06-24 14:46:01 +01:00
11 changed files with 423 additions and 175 deletions

View File

@@ -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")

39
build/cmake/build.cfg.in Normal file
View File

@@ -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@

View File

@@ -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})

View File

@@ -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)
@@ -73,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})
@@ -148,81 +167,97 @@ 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 "$<$<CONFIG:Debug>:${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})
wx_get_flavour(lib_flavour "_")
set(lib_suffix "${lib_flavour}${lib_suffix}")
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()
set(cross_target)
if (CMAKE_CROSSCOMPILING)
set(cross_target "-${CMAKE_SYSTEM_NAME}")
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()
# 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)
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()
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(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}$<$<CONFIG:Debug>:d>${dll_suffix}")
endif()
# 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()
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 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(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()
if(CYGWIN)
target_link_libraries(${target_name} PUBLIC -L/usr/lib/w32api)
endif()
@@ -325,6 +360,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()
@@ -371,10 +411,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 +519,29 @@ 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
)
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_flavour}${lib_version}"
OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_flavour}${lib_version}"
)
if(wxUSE_UNICODE)
if(WIN32)
target_compile_definitions(${target_name} PUBLIC UNICODE)
@@ -701,7 +750,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()

View File

@@ -122,16 +122,15 @@ 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)
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 +144,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 +164,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)
@@ -188,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 "$<$<CONFIG:Debug>:d>")

View File

@@ -12,21 +12,24 @@ 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_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
if(MSVC)
if(WIN32_MSVC_NAMING)
wx_install(
DIRECTORY "${wxSETUP_HEADER_PATH}"
DESTINATION "lib${wxPLATFORM_LIB_DIR}")
@@ -60,11 +63,20 @@ 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)
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${EXE_SUFFIX}"
)
endif()
configure_file(
"${wxSOURCE_DIR}/build/cmake/uninstall.cmake.in"

View File

@@ -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()

View File

@@ -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)

View File

@@ -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

View File

@@ -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
@@ -25,22 +33,16 @@ 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} \
${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} \
)"
)

View File

@@ -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* (configure, CMake on Linux/macOS/Cygwin):
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* (VS solution, makefile.gcc/vc, CMake on Windows/MinGW, shared libraries on Windows):
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