diff --git a/.circleci/config.yml b/.circleci/config.yml index e6fb9802c5f8..7865593e5c08 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: build-fedora: docker: - - image: fedora + - image: fedora:43 steps: - run: name: Install Git diff --git a/.cirrus.yml b/.cirrus.yml index 539f2a78be62..ef67dab71c43 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,7 @@ task: skip: "changesIncludeOnly('appveyor.yml','CMakeLists.txt','.circleci/**','.github/**','docs/**','interface/**','include/wx/{msw,osx,qt}/**','src/{msw,osx,qt}/**','build/{cmake,msw,osx}/**')" name: Cirrus CI / FreeBSD wxGTK 3 freebsd_instance: - image_family: freebsd-14-0 + image_family: freebsd-14-3 before_script: | echo LD_LIBRARY_PATH=`pwd`/lib >> $CIRRUS_ENV diff --git a/.github/workflows/abi_check.yml b/.github/workflows/abi_check.yml index c43bf0baa189..1cafdbf9a67e 100644 --- a/.github/workflows/abi_check.yml +++ b/.github/workflows/abi_check.yml @@ -55,12 +55,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: 'recursive' - name: Install CCache - uses: hendrikmuhs/ccache-action@v1.2.3 + uses: hendrikmuhs/ccache-action@v1.2.23 with: key: ubuntu-22.04-default diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67162ecf2a5f..075cae08192c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,16 +88,17 @@ jobs: use_xvfb: true build_out_of_tree_samples: true - name: Ubuntu 20.04 wxGTK 3 with clang - runner: ubuntu-20.04 + runner: ubuntu-latest + container: ubuntu:20.04 compiler: clang++-10 configure_flags: --disable-sys-libs use_xvfb: true - - name: Ubuntu 20.04 wxGTK ANSI - runner: ubuntu-20.04 + - name: Ubuntu 22.04 wxGTK ANSI + runner: ubuntu-22.04 configure_flags: --disable-unicode skip_samples: true - - name: Ubuntu 22.04 wxGTK with ASAN - runner: ubuntu-22.04 + - name: Ubuntu 24.04 wxGTK with ASAN + runner: ubuntu-24.04 configure_flags: --disable-compat30 --disable-sys-libs skip_samples: true use_asan: true @@ -149,16 +150,43 @@ jobs: fi compiler=${{ matrix.compiler }} + case "$compiler" in + clang++*) + compiler_packages='clang libc++-dev libc++abi-dev' + ;; + + g++*) + compiler_packages="${compiler}" + ;; + + '') + # Assume gcc. + compiler_packages='g++' + ;; + + *) + echo '::error ::Unknown compiler kind.' + exit 1 + esac # Explanation for installing some less obvious packages: # - coreutils contains nproc used in proc_count.sh called below. # - locales contains locale-gen also used below. - # - Python can't be installed using the action as usual because - # it installs an ABI-incompatible version, see (wrongly, IMO) - # closed https://github.com/actions/setup-python/issues/370 # - xvfb is used for running the GUI tests. apt-get update -qq - apt-get install -qq coreutils ${compiler-g++} git locales make pkg-config python3 python3-pip sudo xvfb + apt-get install -qq coreutils ${compiler_packages} git locales make pkg-config sudo xvfb + + # Checkout action doesn't work under Ubuntu 18.04 any more, so + # run checkout manually. + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global gc.auto 0 + git init $GITHUB_WORKSPACE + cd $GITHUB_WORKSPACE + git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY + git fetch --depth=1 origin $GITHUB_REF + git checkout FETCH_HEAD + git submodule update --init --depth=1 --recursive + git log -1 --format='%H' ;; '') @@ -170,12 +198,14 @@ jobs: esac - name: Checkout - uses: actions/checkout@v3 + if: matrix.container != 'ubuntu:18.04' + uses: actions/checkout@v6 with: submodules: 'recursive' - name: Install CCache - uses: hendrikmuhs/ccache-action@v1.2.3 + if: matrix.container != 'ubuntu:18.04' + uses: hendrikmuhs/ccache-action@v1.2.23 with: key: ${{ matrix.name }} @@ -188,6 +218,13 @@ jobs: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV + if [ '${{ matrix.container }}' = 'ubuntu:18.04' ]; then + # We can't easily install Go, so skip the tests requiring httpbin. + echo 'Disabling httpbin under Ubuntu 18.04' + echo WX_TEST_WEBREQUEST_URL=0 >> $GITHUB_ENV + export WX_TEST_WEBREQUEST_URL=0 + fi + # Setting this variable suppresses "Error retrieving accessibility bus address" # messages from WebKit tests that we're not interested in. echo NO_AT_BRIDGE=1 >> $GITHUB_ENV @@ -200,6 +237,8 @@ jobs: echo LD=$compiler >> $GITHUB_ENV allow_warn_opt="-Wno-error=#warnings" + + export WX_EXTRA_PACKAGES="libc++-dev" ;; g++*) @@ -245,7 +284,7 @@ jobs: echo echo "ccache version:" - ccache --version + ccache --version || echo "ccache not available" echo - name: Configuring @@ -294,11 +333,12 @@ jobs: make $wxBUILD_ARGS failtest make -k $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS" - - name: Setup Python - if: matrix.container == '' - uses: actions/setup-python@v4 + - name: Setup Go + if: matrix.container != 'ubuntu:18.04' + uses: actions/setup-go@v6 with: - python-version: '3.10' + go-version: '1' + cache: false - name: Testing working-directory: tests diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index 7c4839ea7e2c..210974817e18 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -59,12 +59,12 @@ jobs: runner: ubuntu-22.04 cmake_generator: Unix Makefiles cmake_samples: ALL - - name: macOS 12 wxOSX - runner: macos-12 + - name: macOS 14 wxOSX + runner: macos-14 cmake_generator: Xcode cmake_defines: -DCMAKE_CXX_STANDARD=11 - - name: macOS 12 wxIOS - runner: macos-12 + - name: macOS 14 wxIOS + runner: macos-14 cmake_generator: Xcode cmake_defines: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO cmake_samples: OFF @@ -87,7 +87,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: 'recursive' @@ -118,10 +118,11 @@ jobs: run: | ./build/tools/before_install.sh - # required for CMake to find Ninja - - name: "[Windows] Set up MSVC Developer Command Prompt" - if: runner.os == 'Windows' - uses: wxWidgets/gha-setup-vsdevenv@ac61ecb4b05909261f8f375601c0e15aabdd9f10 + # required for CMake to find Ninja but shouldn't be used when using + # MSYS2, or we'd end up using MSVC clang instead of its own. + - name: Setup MSVC Environment + if: ${{ runner.os == 'Windows' && matrix.cmake_generator != 'MinGW Makefiles' }} + uses: step-security/gha-setup-vsdevenv@v6 - name: Configuring run: | @@ -144,10 +145,12 @@ jobs: cmake --build . --target install fi - - name: Setup Python - uses: actions/setup-python@v4 + - name: Setup Go + if: matrix.cmake_tests != 'OFF' + uses: actions/setup-go@v6 with: - python-version: '3.10' + go-version: '1' + cache: false - name: Testing if: matrix.cmake_tests != 'OFF' diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml index 5f2e444119c1..2e7d6d502f26 100644 --- a/.github/workflows/ci_mac.yml +++ b/.github/workflows/ci_mac.yml @@ -99,12 +99,12 @@ jobs: runner: self-hosted arch: arm64 configure_flags: --with-cxx=14 --enable-universal_binary=arm64,x86_64 --disable-shared --disable-debug --enable-optimise - - name: wxMac macOS 12 - runner: macos-12 + - name: wxMac macOS 14 + runner: macos-14 arch: x86_64 configure_flags: --disable-sys-libs - name: wxiOS - runner: macos-12 + runner: macos-14 arch: x86_64 configure_flags: --with-osx_iphone --enable-monolithic --disable-sys-libs --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 xcode_sdk: iphonesimulator @@ -120,7 +120,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: recursive @@ -207,12 +207,12 @@ jobs: make -C tests $wxBUILD_ARGS failtest make -k -C tests $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS" - - name: Setup Python - # actions/setup-python broken on self-hosted https://github.com/actions/setup-python/issues/108 - if: matrix.runner != 'self-hosted' - uses: actions/setup-python@v4 + - name: Setup Go + if: matrix.skip_testing != true + uses: actions/setup-go@v6 with: - python-version: '3.10' + go-version: '1' + cache: false - name: Testing if: matrix.skip_testing != true diff --git a/.github/workflows/ci_mac_xcode.yml b/.github/workflows/ci_mac_xcode.yml index e69f0741110f..3fffb18711c4 100644 --- a/.github/workflows/ci_mac_xcode.yml +++ b/.github/workflows/ci_mac_xcode.yml @@ -114,7 +114,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: recursive diff --git a/.github/workflows/ci_msw.yml b/.github/workflows/ci_msw.yml index 88db37cf25ab..994031834437 100644 --- a/.github/workflows/ci_msw.yml +++ b/.github/workflows/ci_msw.yml @@ -56,26 +56,24 @@ permissions: jobs: msw-msvs: - runs-on: windows-${{ matrix.vsversion }} - name: wxMSW vs${{ matrix.vsversion }} ${{ matrix.configuration }} ${{ matrix.platform }} + runs-on: windows-2022 + name: wxMSW vs2022 ${{ matrix.configuration }} ${{ matrix.platform }} strategy: fail-fast: false matrix: include: - configuration: 'DLL Debug' platform: 'x64' - vsversion: 2022 + use_utf8: true - configuration: 'Debug' platform: 'Win32' - vsversion: 2019 - configuration: 'DLL Release' platform: 'x64' - vsversion: 2019 use_stl: true steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: 'recursive' @@ -89,7 +87,7 @@ jobs: Set-Content setup.h - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.1.3 + uses: microsoft/setup-msbuild@v3 with: vs-prerelease: true @@ -113,6 +111,21 @@ jobs: - name: Run tests working-directory: tests run: | + go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2 + $gopath = $(go env GOPATH) + $env:PATH += ";$gopath\bin" + Start-Job -Name wx_httpbin { go-httpbin -host 127.0.0.1 -port 8081 2>&1 > httpbin.log } + Start-Sleep -Seconds 5 + curl.exe --silent --show-error http://127.0.0.1:8081/ip > $null + if ($lastExitCode -eq "0") { + $env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081" + } + else { + Write-Error "Disabling wxWebRequest tests as launching httpbin failed, log follows:" + Get-Content httpbin.log + $env:WX_TEST_WEBREQUEST_URL="0" + } + .\vc*msw*\test.exe - name: Build GUI tests diff --git a/.github/workflows/ci_msw_cross.yml b/.github/workflows/ci_msw_cross.yml index 7b3925a9a1ef..16625604a558 100644 --- a/.github/workflows/ci_msw_cross.yml +++ b/.github/workflows/ci_msw_cross.yml @@ -71,7 +71,7 @@ jobs: matrix: include: - name: wxMSW 64 bits - debian_release: testing + debian_release: stable configure_flags: --enable-stl --disable-compat30 - name: wxMSW 32 bits # Testing doesn't have 32 bit support any more. @@ -137,12 +137,12 @@ jobs: echo "wxTEST_RUNNER=wine" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: 'recursive' - name: Install CCache - uses: hendrikmuhs/ccache-action@v1.2.3 + uses: hendrikmuhs/ccache-action@v1.2.23 with: key: ${{ matrix.name }} diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index dbdca67622f5..cd6a129e9140 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -14,12 +14,12 @@ permissions: jobs: check-unix: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: Check Spelling steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install codespell run: | @@ -31,12 +31,12 @@ jobs: check-whitespace: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: Check Whitespace steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Check for trailing whitespace and TABs run: | @@ -50,6 +50,7 @@ jobs: ':!configure' \ ':!descrip.mms' \ ':!install-sh' \ + ':!build/cmake/modules/cotire.cmake' \ ':!docs/doxygen/doxygen-awesome-css/*' \ ':!samples/widgets/widgets.bkl' \ ':!**/*akefile*' \ @@ -61,12 +62,12 @@ jobs: check-mixed-eol: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: Check Mixed EOL steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install dos2unix run: | @@ -77,12 +78,12 @@ jobs: ./misc/scripts/check_mixed_eol.sh check-cxx-style: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: Check C++ Style steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Check for C++11 keywords run: | diff --git a/.github/workflows/docs_update.yml b/.github/workflows/docs_update.yml index 64a8d899cb69..9d9662005e94 100644 --- a/.github/workflows/docs_update.yml +++ b/.github/workflows/docs_update.yml @@ -16,7 +16,9 @@ on: - 'docs/**' - 'interface/**' workflow_dispatch: - + inputs: + version: + description: 'Version to generate docs for' permissions: contents: read @@ -28,7 +30,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Install doxygen run: | @@ -53,15 +55,36 @@ jobs: fi - name: Upload - if: github.ref == 'refs/heads/3.2' working-directory: docs/doxygen env: DOCS_WEBSITE_KEY: ${{secrets.DOCS_WEBSITE_KEY}} DOCS_WEBSITE_SSH_CONFIG: ${{secrets.DOCS_WEBSITE_SSH_CONFIG}} run: | + dst=${{ inputs.version }} + if [[ -z "$dst" ]]; then + ref="${{github.ref}}" + case "$ref" in + refs/heads/3.2) + dst=3.2 + ;; + + refs/tags/v*) + dst=${ref#refs/tags/v} + ;; + + refs/pull/*/merge) + echo "Skipping docs upload for pull request" + exit 0 + ;; + + *) + echo "Skipping docs upload for $ref of unknown type" + exit 2 + esac + fi mkdir "$HOME/.ssh" echo "$DOCS_WEBSITE_KEY" > "$HOME/.ssh/docs_website_key" chmod 600 "$HOME/.ssh/docs_website_key" echo "$DOCS_WEBSITE_SSH_CONFIG" > "$HOME/.ssh/config" - rsync --checksum --compress --delete --out-format='%n' --recursive out/html/ wxdocs:public_html/3.2/ \ + rsync --checksum --compress --delete --out-format='%n' --recursive out/html/ wxdocs:public_html/$dst/ \ 2> >(grep -v "Warning: Permanently added" 1>&2) diff --git a/.github/workflows/make_release.yml b/.github/workflows/make_release.yml index 25ad3d791361..a9242dd95da1 100644 --- a/.github/workflows/make_release.yml +++ b/.github/workflows/make_release.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: submodules: 'recursive' @@ -39,11 +39,7 @@ jobs: sha1sum * | tee -a ../../../docs/release.md - name: Create Draft Release - # Note: use a fork of softprops/action-gh-release which includes - # https://github.com/softprops/action-gh-release/pull/255 fixing - # updating the body of the draft releases. We should replace the SHA-1 - # with a tag when an upstream release including this fix is made. - uses: vadz/action-gh-release@4c1f6af6e1a4dbfc4691427d2822c34374d558a2 + uses: softprops/action-gh-release@v2.2.2 id: create_release with: name: wxWidgets ${{ inputs.version }} @@ -62,7 +58,7 @@ jobs: # because it can't be downloaded from a draft release without # impersonating the same user and I don't know how to do it. - name: Upload Release Archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: wxWidgets-${{ inputs.version }}-source-archive path: distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}.zip @@ -75,10 +71,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Download Release Archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: wxWidgets-${{ inputs.version }}-source-archive @@ -110,7 +106,7 @@ jobs: type ..\..\..\checksums - name: Add Files to the Release - uses: vadz/action-gh-release@4c1f6af6e1a4dbfc4691427d2822c34374d558a2 + uses: softprops/action-gh-release@v2.2.2 with: name: wxWidgets ${{ inputs.version }} body_path: checksums diff --git a/.mailmap b/.mailmap index 30f2ee46442c..12f6ba457979 100644 --- a/.mailmap +++ b/.mailmap @@ -68,6 +68,8 @@ Václav Slavík Václav Slavík Vadim Zeitlin +Włodzimierz Skiba +Wlodzimierz Skiba <57067108+Wlodzimierz-ABX-Skiba@users.noreply.github.com> Wolfgang Stöggl Xlord2 Iwbnwif Yiw diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ae7f6210c0..442cc6f07cd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,23 +7,26 @@ # Licence: wxWindows licence ############################################################################# -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5...4.1) if(NOT CMAKE_CONFIGURATION_TYPES) get_property(HAVE_MULTI_CONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) # Set default configuration types for multi-config generators if(HAVE_MULTI_CONFIG_GENERATOR) - set(CMAKE_CONFIGURATION_TYPES "Debug;Release") + string(CONCAT config_hint "Semicolon separated list of supported " + "configuration types, only supports Debug, Release, MinSizeRel, " + "and RelWithDebInfo, anything else will be ignored.") + set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING ${config_hint}) endif() endif() -file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) - # https://blog.kitware.com/cmake-and-the-default-build-type/ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(default_build_type "Debug") message(STATUS "Setting build type to '${default_build_type}' as none was specified.") - set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" + ) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") endif() @@ -49,18 +52,18 @@ set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib) # parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION 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]+)" - wxMAJOR_VERSION ${wxMAJOR_VERSION}) -string(REGEX MATCH "wxMINOR_VERSION[ \t]+([0-9]+)" - wxMINOR_VERSION ${WX_VERSION_H_CONTENTS}) -string (REGEX MATCH "([0-9]+)" - wxMINOR_VERSION ${wxMINOR_VERSION}) -string(REGEX MATCH "wxRELEASE_NUMBER[ \t]+([0-9]+)" - wxRELEASE_NUMBER ${WX_VERSION_H_CONTENTS}) -string (REGEX MATCH "([0-9]+)" - wxRELEASE_NUMBER ${wxRELEASE_NUMBER}) + +macro(wx_extract_version_component name) + string(REGEX MATCH "# *define +${name} +([0-9]+)" _dummy ${WX_VERSION_H_CONTENTS}) + if("${CMAKE_MATCH_1}" STREQUAL "") + message(FATAL_ERROR "Failed to extract ${name} from wx/version.h") + endif() + set(${name} ${CMAKE_MATCH_1}) +endmacro() + +wx_extract_version_component(wxMAJOR_VERSION) +wx_extract_version_component(wxMINOR_VERSION) +wx_extract_version_component(wxRELEASE_NUMBER) # Determine if current version is a "Development" release math(EXPR rel_dev "${wxMINOR_VERSION} % 2") @@ -87,8 +90,8 @@ string(REGEX MATCH "([0-9]+)" 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 "2002-2024 wxWidgets") +set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER} CACHE INTERNAL "wxWidgets version") +set(wxCOPYRIGHT "2002-2026 wxWidgets" CACHE INTERNAL "wxWidgets copyright") set(wxLANGUAGES C CXX) if(APPLE AND NOT CMAKE_VERSION VERSION_LESS "3.16") diff --git a/Makefile.in b/Makefile.in index 0fcf1f01b7f6..10084dd6a02d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -82,7 +82,7 @@ wxCFLAGS_C99 = @wxCFLAGS_C99@ DESTDIR = WX_RELEASE = 3.2 WX_RELEASE_NODOT = 32 -WX_VERSION = $(WX_RELEASE).6 +WX_VERSION = $(WX_RELEASE).11 LIBDIRNAME = $(wx_top_builddir)/lib WXREGEX_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG \ -I$(wx_top_builddir)/3rdparty/pcre/src -D__WX__ -DHAVE_CONFIG_H \ @@ -2205,7 +2205,8 @@ WEBKIT2_EXT_CXXFLAGS = $(WX_CPPFLAGS) -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) \ $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) WEBKIT2_EXT_OBJECTS = \ webkit2_ext_webview_webkit2_extension.o -LOCALE_LINGUAS = ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk zh zh_CN zh_TW +LOCALE_LINGUAS = af an ar ca ca@valencia co cs da de el es eu fa_IR fi fr gl_ES hi hr hu id it ja \ + ka ko_KR lt lv ms nb ne nl pl pt pt_BR ro ru sk sl sq sr sv ta tr uk vi zh_CN zh_TW ### Conditionally set variables: ### @@ -2215,7 +2216,7 @@ LOCALE_LINGUAS = ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk zh zh_ @COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX) @COND_USE_PLUGINS_0@PLUGIN_ADV_EXTRALIBS = $(EXTRALIBS_SDL) @COND_PLATFORM_MACOSX_1@WXMACVERSION_CMD = \ -@COND_PLATFORM_MACOSX_1@ -compatibility_version 4.0 -current_version 4.0 +@COND_PLATFORM_MACOSX_1@ -compatibility_version 5.0 -current_version 5.3 @COND_USE_GUI_0@PORTNAME = base @COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION) @COND_TOOLKIT_MAC@WXBASEPORT = _carbon @@ -2369,6 +2370,7 @@ COND_TOOLKIT_MSW_WEBVIEW_HDR_PLATFORM = \ @COND_TOOLKIT_MOTIF@OPENGL_HDR_PLATFORM = wx/x11/glcanvas.h wx/unix/glx11.h @COND_TOOLKIT_MSW@OPENGL_HDR_PLATFORM = wx/msw/glcanvas.h @COND_TOOLKIT_OSX_COCOA@OPENGL_HDR_PLATFORM = wx/osx/glcanvas.h +@COND_TOOLKIT_OSX_IPHONE@OPENGL_HDR_PLATFORM = wx/osx/glcanvas.h @COND_TOOLKIT_QT@OPENGL_HDR_PLATFORM = wx/qt/glcanvas.h @COND_TOOLKIT_WASM@OPENGL_HDR_PLATFORM = wx/wasm/glcanvas.h @COND_TOOLKIT_X11@OPENGL_HDR_PLATFORM = wx/x11/glcanvas.h wx/unix/glx11.h @@ -3419,6 +3421,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/datectrl.h \ wx/msw/calctrl.h \ wx/generic/activityindicator.h \ + wx/msw/mfc.h \ wx/msw/checklst.h \ wx/msw/fdrepdlg.h \ wx/msw/fontdlg.h \ @@ -14552,9 +14555,9 @@ COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1___htmldll_library_link_LIBR_0 \ @COND_USE_SOVERSION_0@dll___targetsuf2 = .$(SO_SUFFIX) @COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@dll___targetsuf3 \ @COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ = \ -@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ .$(SO_SUFFIX).0.3.0 +@COND_PLATFORM_MACOSX_0_USE_SOVERCYGWIN_0_USE_SOVERSION_1@ .$(SO_SUFFIX).0.4.3 @COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@dll___targetsuf3 \ -@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .0.3.0.$(SO_SUFFIX) +@COND_PLATFORM_MACOSX_1_USE_SOVERSION_1@ = .0.4.3.$(SO_SUFFIX) @COND_USE_SOVERCYGWIN_1_USE_SOVERSION_1@dll___targetsuf3 = -0.$(SO_SUFFIX) @COND_USE_SOVERSION_0@dll___targetsuf3 = .$(SO_SUFFIX) @COND_USE_SOVERSION_1_USE_SOVERSOLARIS_1@dll___targetsuf3 = .$(SO_SUFFIX).0 diff --git a/README.md b/README.md index 194cc780e709..295e802be843 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,73 @@ wxWidgets main: master pcbjam main: wasm-port atopile main: atopile/main + +Platforms +--------- + +[![AppVeyor](https://img.shields.io/appveyor/build/wxWidgets/wxWidgets/master?label=AppVeyor&logo=appveyor)](https://ci.appveyor.com/project/wxWidgets/wxwidgets) +[![Unix (make)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci.yml/badge.svg)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci.yml) +[![Unix (CMake)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_cmake.yml/badge.svg)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_cmake.yml) +[![MSW (MSVC)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_msw.yml/badge.svg)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_msw.yml) +[![MSW (gcc)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_msw_cross.yml/badge.svg)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_msw_cross.yml) +[![Mac](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_mac.yml/badge.svg)](https://github.com/wxWidgets/wxWidgets/actions/workflows/ci_mac.yml) +[![OSS-Fuzz](https://oss-fuzz-build-logs.storage.googleapis.com/badges/wxwidgets.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:wxwidgets) + +This version of wxWidgets supports the following primary platforms: + +- Windows XP, Vista, 7, 8, 10 and 11 (32/64 bits). +- Most Unix variants using the GTK+ toolkit (version 2.6 or newer or 3.x). +- macOS (10.10 or newer) using Cocoa under both amd64 and ARM platforms. + +Most popular C++ compilers are supported including but not limited to: + +- Microsoft Visual C++ 2005 or later (up to 2026). +- g++ 4 or later (up to 14), including MinGW/MinGW-64/TDM under Windows. +- Clang (up to 19). +- Intel icc compiler. +- Oracle (ex-Sun) CC. + + +Licence +------- + +[wxWidgets licence](https://github.com/wxWidgets/wxWidgets/blob/master/docs/licence.txt) +is a modified version of LGPL explicitly allowing not distributing the sources +of an application using the library even in the case of static linking. + + +Building +-------- + +For building the library, please see platform-specific documentation under +`docs/` directory, e.g. here are the instructions for +[wxGTK](docs/gtk/install.md), [wxMSW](docs/msw/install.md) and +[wxOSX](docs/osx/install.md). + +If you're building the sources checked out from Git, and not from a released +version, please see these additional [Git-specific notes](README-GIT.md). + + +Further information +------------------- + +If you are looking for community support, you can get it from + +- [Mailing Lists](https://www.wxwidgets.org/support/mailing-lists/) +- [Discussion Forums](https://forums.wxwidgets.org/) +- [#wxwidgets IRC channel](https://www.wxwidgets.org/support/irc/) +- [Stack Overflow](https://stackoverflow.com/questions/tagged/wxwidgets) + (tag your questions with `wxwidgets`) +- And you can report bugs at [GitHub](https://github.com/wxWidgets/wxWidgets/issues/new/choose) + +[Commercial support](https://www.wxwidgets.org/support/commercial/) is also +available. + +Finally, keep in mind that wxWidgets is an open source project collaboratively +developed by its users and your contributions to it are always welcome. Please +check [our guidelines](.github/CONTRIBUTING.md) if you'd like to do it. + + +Have fun! + +The wxWidgets Team. diff --git a/acinclude.m4 b/acinclude.m4 index 97b4b26d1b81..66f91107430c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -269,7 +269,8 @@ AC_TRY_COMPILE([#include not big endian #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) if test $ac_cv_c_bigendian = unknown; then -AC_TRY_RUN([main () { +AC_TRY_RUN([#include +main () { /* Are we little or big endian? From Harbison&Steele. */ union { @@ -494,6 +495,23 @@ AC_DEFUN([WX_VERSIONED_SYMBOLS], wx_cv_version_script=no fi + dnl We also check for --undefined-version support, as we need + dnl it with our current approach of using the same version + dnl script for all libraries. This should ideally be changed... + if test $wx_cv_version_script = yes ; then + if AC_TRY_COMMAND([ + $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp + -Wl,--version-script,conftest.sym -Wl,--undefined-version >/dev/null 2>conftest.stderr]) ; then + if test -s conftest.stderr ; then + wx_cv_undefined_version=no + else + wx_cv_undefined_version=yes + fi + else + wx_cv_undefined_version=no + fi + fi + dnl There's a problem in some old linkers with --version-script that dnl can cause linking to fail when you have objects with vtables in dnl libs 3 deep. This is known to happen in netbsd and openbsd with @@ -535,6 +553,9 @@ AC_DEFUN([WX_VERSIONED_SYMBOLS], if test $wx_cv_version_script = yes ; then LDFLAGS_VERSIONING="-Wl,--version-script,$1" + if test $wx_cv_undefined_version = yes ; then + LDFLAGS_VERSIONING="$LDFLAGS_VERSIONING -Wl,--undefined-version" + fi fi ;; esac diff --git a/appveyor.yml b/appveyor.yml index 4b8b50b28811..baf21ebd81c3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,6 +35,8 @@ skip_commits: - build/tools/httpbin.sh environment: + GOVERSION: "1.22.1" + GOPATH: c:\gopath matrix: - TOOLSET: msbuild CONFIGURATION: DLL Release @@ -62,7 +64,10 @@ environment: SHARED: ON CONFIGURATION: Release -clone_depth: 50 +cache: + - '%USERPROFILE%\go%GOVERSION%.windows-amd64.msi' + +clone_depth: 1 install: git submodule update --init @@ -89,15 +94,23 @@ before_build: build_script: c:\projects\wxwidgets\build\tools\appveyor.bat before_test: +- cmd: | + echo Getting and launching httpbin. + rmdir %GOROOT% /s /q + mkdir %GOROOT% + cd %USERPROFILE% + set go_exe=go%GOVERSION%.windows-amd64.msi + if not exist "%go_exe%" appveyor DownloadFile https://go.dev/dl/%go_exe% + msiexec /i %go_exe% INSTALLDIR="%GOROOT%" /q + go version + go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2.20.0 + set PATH=%PATH%;%GOPATH%\bin - ps: | - Write-Output "Getting and launching httpbin." - $env:PATH = "C:\Python35;C:\Python35\Scripts;" + $env:PATH - pip.exe --disable-pip-version-check install httpbin - Start-Job -Name wx_httpbin { python.exe -m httpbin.core 2>&1 > c:\projects\wxwidgets\httpbin.log } + Start-Job -Name wx_httpbin { go-httpbin -host 127.0.0.1 -port 8081 2>&1 > c:\projects\wxwidgets\httpbin.log } Start-Sleep -Seconds 5 - curl.exe -s http://127.0.0.1:5000/ip > $null + curl.exe --silent --show-error http://127.0.0.1:8081/ip > $null if ($lastExitCode -eq "0") { - $env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:5000" + $env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081" } else { Write-Error "Disabling wxWebRequest tests as launching httpbin failed." diff --git a/build/bakefiles/common.bkl b/build/bakefiles/common.bkl index 8590aaddad5d..f5a28d9489c3 100644 --- a/build/bakefiles/common.bkl +++ b/build/bakefiles/common.bkl @@ -348,11 +348,13 @@ /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware.manifest + /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware_pmv2.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware_pmv2.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware_pmv2.manifest /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware_pmv2.manifest + /MANIFEST:EMBED /MANIFESTINPUT:$(TOP_SRCDIR)include/wx/msw/wx_dpi_aware_pmv2.manifest diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 39cdcb210cf1..1d72ea60e45a 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2444,6 +2444,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/msw/datectrl.h wx/msw/calctrl.h wx/generic/activityindicator.h + wx/msw/mfc.h @@ -3404,6 +3405,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/osx/glcanvas.h + wx/osx/glcanvas.h wx/cocoa/glcanvas.h wx/gtk/glcanvas.h diff --git a/build/bakefiles/mac_bundles.bkl b/build/bakefiles/mac_bundles.bkl index 16817ca96d53..17332aa31693 100644 --- a/build/bakefiles/mac_bundles.bkl +++ b/build/bakefiles/mac_bundles.bkl @@ -49,10 +49,10 @@ sed -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.$(id)/" \ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_EXECUTABLE_NAME}/$(id)/" \ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_NAME}/$(id)/" \ - -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2024 wxWidgets/" \ + -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2026 wxWidgets/" \ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_VERSION}/$(WX_VERSION)/" \ - -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_INFO_STRING}/$(id) version $(WX_VERSION), (c) 2002-2024 wxWidgets/" \ - -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2024 wxWidgets/" \ + -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_INFO_STRING}/$(id) version $(WX_VERSION), (c) 2002-2026 wxWidgets/" \ + -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2026 wxWidgets/" \ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(WX_RELEASE)/" \ $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist diff --git a/build/bakefiles/version.bkl b/build/bakefiles/version.bkl index d53c0f6115c4..c2eba67482a1 100644 --- a/build/bakefiles/version.bkl +++ b/build/bakefiles/version.bkl @@ -22,9 +22,9 @@ 3. Else, i.e. if there were no changes at all to API but only internal changes, change C:R:A to C:R+1:A --> - 3 - 0 - 3 + 4 + 3 + 4 diff --git a/build/bakefiles/wx.bkl b/build/bakefiles/wx.bkl index 0054360d3fbf..5ef067dc423c 100644 --- a/build/bakefiles/wx.bkl +++ b/build/bakefiles/wx.bkl @@ -139,8 +139,9 @@ $(SRCDIR)/locale wxstd-$(WX_RELEASE) - ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk - zh zh_CN zh_TW + af an ar ca ca@valencia co cs da de el es eu fa_IR fi fr + gl_ES hi hr hu id it ja ka ko_KR lt lv ms nb ne nl pl pt + pt_BR ro ru sk sl sq sr sv ta tr uk vi zh_CN zh_TW $(LOCALEDIR) diff --git a/build/cmake/README.md b/build/cmake/README.md index 552dba343a41..31dfafe5ba0b 100644 --- a/build/cmake/README.md +++ b/build/cmake/README.md @@ -36,7 +36,7 @@ Files * Includes all other cmake files * options.cmake * All user selectable build options should be defined in this file via - calls to `wx_option()` + calls to `wx_option()` or `wx_option_auto()` * policies.cmake * [CMake policies][2] for wxWidgets should be defined in this file * setup.cmake diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index addd8d6b8139..624e2fceb038 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -92,7 +92,7 @@ function(wx_write_config_inplace) "wx-config-inplace.in" "inplace-${TOOLCHAIN_FULLNAME}" ) - if(WIN32_MSVC_NAMING) + if(WIN32_MSVC_NAMING OR NOT wxBUILD_INSTALL_USE_SYMLINK) set(COPY_CMD copy) else() set(COPY_CMD create_symlink) @@ -100,18 +100,21 @@ function(wx_write_config_inplace) execute_process( COMMAND "${CMAKE_COMMAND}" -E ${COPY_CMD} - "${wxBINARY_DIR}/lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}" + "${wxCONFIG_DIR}/inplace-${TOOLCHAIN_FULLNAME}" "${wxBINARY_DIR}/wx-config" ) endfunction() function(wx_write_config) + wx_get_install_dir(include) + wx_get_install_platform_dir(library) + wx_get_install_platform_dir(runtime) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}") - set(includedir "\${prefix}/include") - set(libdir "\${exec_prefix}/lib") - set(bindir "\${exec_prefix}/bin") + set(includedir "\${prefix}/${include_dir}") + set(libdir "\${exec_prefix}/${library_dir}") + set(bindir "\${exec_prefix}/${runtime_dir}") if(wxBUILD_MONOLITHIC) set(MONOLITHIC 1) @@ -143,15 +146,12 @@ function(wx_write_config) set(STD_BASE_LIBS_ALL xml net base) set(STD_GUI_LIBS_ALL xrc html qa adv core) foreach(lib IN ITEMS xrc webview stc richtext ribbon propgrid aui gl media html qa adv core xml net base) - list(FIND wxLIB_TARGETS wx${lib} hasLib) - if (hasLib GREATER -1) + if (wx${lib} IN_LIST wxLIB_TARGETS) wx_string_append(BUILT_WX_LIBS "${lib} ") - list(FIND STD_BASE_LIBS_ALL ${lib} index) - if (index GREATER -1) + if (${lib} IN_LIST STD_BASE_LIBS_ALL) wx_string_append(STD_BASE_LIBS "${lib} ") endif() - list(FIND STD_GUI_LIBS_ALL ${lib} index) - if (index GREATER -1) + if (${lib} IN_LIST STD_GUI_LIBS_ALL) wx_string_append(STD_GUI_LIBS "${lib} ") endif() endif() @@ -163,13 +163,14 @@ function(wx_write_config) set(WX_RELEASE ${wxMAJOR_VERSION}.${wxMINOR_VERSION}) set(WX_VERSION ${wxVERSION}) set(WX_SUBVERSION ${wxVERSION}.0) - set(WX_FLAVOUR) + wx_get_flavour(WX_FLAVOUR "-") + wx_get_flavour(lib_flavour "_") set(TOOLKIT_DIR ${wxBUILD_TOOLKIT}) set(TOOLKIT_VERSION) set(WIDGET_SET ${wxBUILD_WIDGETSET}) set(TOOLCHAIN_NAME "${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}-${WX_RELEASE}") - set(WX_LIBRARY_BASENAME_GUI "wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}") - set(WX_LIBRARY_BASENAME_NOGUI "wx_base${lib_unicode_suffix}") + set(WX_LIBRARY_BASENAME_GUI "wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_flavour}") + set(WX_LIBRARY_BASENAME_NOGUI "wx_base${lib_unicode_suffix}${lib_flavour}") wx_get_dependencies(WXCONFIG_LIBS base) wx_get_dependencies(EXTRALIBS_GUI core) @@ -205,7 +206,7 @@ function(wx_write_config) set(WXCONFIG_RESFLAGS) set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir") set(LDFLAGS_GL) - set(RESCOMP) + get_filename_component(RESCOMP "${CMAKE_RC_COMPILER}" NAME_WE) wx_configure_script( "wx-config.in" diff --git a/build/cmake/demos/CMakeLists.txt b/build/cmake/demos/CMakeLists.txt index 0909eb976245..4c487839d888 100644 --- a/build/cmake/demos/CMakeLists.txt +++ b/build/cmake/demos/CMakeLists.txt @@ -36,6 +36,8 @@ wx_add_demo(forty about.htm LIBRARIES wxhtml wxxml + DEPENDS + wxUSE_HTML ) wx_add_demo(fractal @@ -62,6 +64,8 @@ wx_add_demo(poem wxpoem.txt wxpoem.dat wxpoem.idx LIBRARIES wxhtml + DEPENDS + wxUSE_HTML NAME wxpoem ) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index b71799f9bc0c..a416e6956f45 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2172,6 +2172,7 @@ set(MSW_HDR wx/msw/datetimectrl.h wx/msw/timectrl.h wx/generic/activityindicator.h + wx/msw/mfc.h ) set(MSW_RSC @@ -2874,9 +2875,6 @@ set(WEBVIEW_GTK_HDR set(WEBVIEW_GTK_SRC src/gtk/webview_webkit.cpp -) - -set(WEBVIEW2_GTK_SRC src/gtk/webview_webkit2.cpp ) @@ -3071,11 +3069,19 @@ set(OPENGL_OSX_COCOA_SRC src/osx/glcanvas_osx.cpp ) +set(OPENGL_OSX_COCOA_HDR + wx/osx/glcanvas.h +) + set(OPENGL_OSX_IPHONE_SRC src/osx/iphone/glcanvas.mm src/osx/glcanvas_osx.cpp ) +set(OPENGL_OSX_IPHONE_HDR + wx/osx/glcanvas.h +) + set(UNIX_SOUND_SDL_SRC src/unix/sound_sdl.cpp ) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 72a34f0b4f04..36b94bcef32f 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -8,19 +8,27 @@ ############################################################################# include(CMakeDependentOption) -include(CMakeParseArguments) # For compatibility with CMake < 3.4 include(ExternalProject) include(CMakePrintHelpers) +include(GNUInstallDirs) -# 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) +# List of libraries added via wx_add_library() to use for wx-config +set(wxLIB_TARGETS) +# List of the (static) builtin libraries to use in wxWidgetsConfig.cmake +set(wxLIB_BUILTIN_TARGETS) +# List of headers added via wx_append_sources() to use for install +set(wxINSTALL_HEADERS) +# List of files not included in the install manifest +set(WX_EXTRA_UNINSTALL_FILES) + +# create one target with all libraries, same as FindwxWidgets +set(CREATE_WX_TARGET OFF) +if(NOT TARGET wxWidgets AND NOT TARGET wxWidgets::wxWidgets) + set(CREATE_WX_TARGET ON) + add_library(wxWidgets INTERFACE) + add_library(wxWidgets::wxWidgets ALIAS wxWidgets) endif() - # This function adds a list of headers to a variable while prepending # include/ to the path macro(wx_add_headers src_var) @@ -52,9 +60,20 @@ macro(wx_append_sources src_var source_base_name) endif() if(DEFINED ${source_base_name}_HDR) wx_add_headers(${src_var} ${${source_base_name}_HDR}) + wx_append_install_headers(${source_base_name}_HDR) + endif() + + if(DEFINED ${source_base_name}_RSC) + wx_append_install_headers(${source_base_name}_RSC) endif() endmacro() +# Add headers from a variable to the list of headers to install +macro(wx_append_install_headers header_base_name) + list(APPEND wxINSTALL_HEADERS ${${header_base_name}}) + set(wxINSTALL_HEADERS ${wxINSTALL_HEADERS} PARENT_SCOPE) +endmacro() + # Add prefix to list of items # wx_list_add_prefix( ) macro(wx_list_add_prefix out_var prefix) @@ -76,6 +95,42 @@ macro(wx_install) endif() endmacro() +# wx_install_symlink(...) +# Create symlink dst pointing to src +# try different symlink and copy methods until one succeeds +macro(wx_install_symlink src dst) + if(wxBUILD_INSTALL) + install(CODE " + set(SYMLINK_SRC \"${src}\") + set(SYMLINK_DST \"${dst}\") + message(STATUS \"Installing: \${SYMLINK_DST}\") + + if(CMAKE_VERSION GREATER_EQUAL \"3.17\") + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E rm -f \"\${SYMLINK_DST}\") + else() + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E remove -f \"\${SYMLINK_DST}\") + endif() + + set(SYMLINK_RES 1) + set(wxBUILD_INSTALL_USE_SYMLINK ${wxBUILD_INSTALL_USE_SYMLINK}) + if(wxBUILD_INSTALL_USE_SYMLINK) + if(SYMLINK_RES) + execute_process(COMMAND ln -s --relative \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET) + endif() + if(SYMLINK_RES) + execute_process(COMMAND ln -s \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET) + endif() + if(SYMLINK_RES) + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES) + endif() + endif() + if(SYMLINK_RES) + execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES) + endif() + ") + endif() +endmacro() + # Get a valid flavour name with optional prefix macro(wx_get_flavour flavour prefix) if(wxBUILD_FLAVOUR) @@ -87,30 +142,71 @@ macro(wx_get_flavour flavour prefix) endif() endmacro() -if(WIN32_MSVC_NAMING) - # Generator expression to not create different Debug and Release directories - set(GEN_EXPR_DIR "$<1:/>") - set(wxINSTALL_INCLUDE_DIR "include") -else() - set(GEN_EXPR_DIR "/") - wx_get_flavour(lib_flavour "-") - set(wxINSTALL_INCLUDE_DIR "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${lib_flavour}") -endif() +# Get the library/runtime/archive directory +macro(wx_get_install_dir artifact) + string(TOUPPER ${artifact} artifact_upper) + + if("${artifact_upper}" STREQUAL "RUNTIME") + set(${artifact}_dir "${CMAKE_INSTALL_BINDIR}") + elseif("${artifact_upper}" STREQUAL "LIBRARY") + set(${artifact}_dir "${CMAKE_INSTALL_LIBDIR}") + elseif("${artifact_upper}" STREQUAL "ARCHIVE") + set(${artifact}_dir "${CMAKE_INSTALL_LIBDIR}") + elseif("${artifact_upper}" STREQUAL "INCLUDE") + set(${artifact}_dir "${CMAKE_INSTALL_INCLUDEDIR}") + else() + message(FATAL_ERROR "Unknown install artifact: ${artifact}") + endif() + + if(wxBUILD_INSTALL_${artifact_upper}_DIR) + set(${artifact}_dir "${wxBUILD_INSTALL_${artifact_upper}_DIR}") + endif() +endmacro() + +# Get the library/runtime/archive directory including platform specific sub-directory +macro(wx_get_install_platform_dir artifact) + wx_get_install_dir(${artifact}) + if(wxBUILD_INSTALL_PLATFORM_SUBDIR AND wxPLATFORM_LIB_DIR) + wx_string_append(${artifact}_dir "/${wxPLATFORM_LIB_DIR}") + 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}) + if(WIN32_MSVC_NAMING) + # Generator expression to not create different Debug and Release directories + set(GEN_EXPR_DIR "$<1:/>") + else() + set(GEN_EXPR_DIR "/") + endif() + set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" ARCHIVE_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" RUNTIME_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" ) + if(wxUSE_UNICODE) + if(WIN32) + target_compile_definitions(${target_name} PUBLIC UNICODE) + endif() + target_compile_definitions(${target_name} PUBLIC _UNICODE) + endif() + if(wxBUILD_PIC) set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) endif() + if(NOT WIN32 AND wxUSE_VISIBILITY) + set_target_properties(${target_name} PROPERTIES + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN TRUE + ) + endif() + if(MSVC) if(wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS) set(MSVC_WARNING_LEVEL "/W3") @@ -118,6 +214,15 @@ function(wx_set_common_target_properties target_name) set(MSVC_WARNING_LEVEL "/W4") endif() target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_LEVEL}) + + if(CMAKE_VERSION GREATER_EQUAL "3.15") + set(msvc_runtime "MultiThreaded$<$:Debug>DLL") + if(wxBUILD_USE_STATIC_RUNTIME) + set(msvc_runtime "MultiThreaded$<$:Debug>") + endif() + set_target_properties(${target_name} PROPERTIES MSVC_RUNTIME_LIBRARY ${msvc_runtime}) + endif() + elseif(NOT wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS) set(common_gcc_clang_compile_options -Wall @@ -154,10 +259,14 @@ function(wx_set_common_target_properties target_name) ) endif() - target_compile_options(${target_name} PRIVATE - ${common_gcc_clang_compile_options} - $<$:${common_gcc_clang_cpp_compile_options}> - ) + # Using $ breaks cotire: + # Evaluation file to be written multiple times with different content. + if(NOT USE_COTIRE) + target_compile_options(${target_name} PRIVATE + ${common_gcc_clang_compile_options} + $<$:${common_gcc_clang_cpp_compile_options}> + ) + endif() endif() if(wxUSE_NO_RTTI) @@ -173,10 +282,10 @@ function(wx_set_common_target_properties target_name) target_compile_definitions(${target_name} PUBLIC "-D_FILE_OFFSET_BITS=64") endif() - if(CMAKE_THREAD_LIBS_INIT) - target_compile_options(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - target_link_libraries(${target_name} PUBLIC ${CMAKE_THREAD_LIBS_INIT}) + if(wxUSE_THREADS) + target_link_libraries(${target_name} PRIVATE Threads::Threads) endif() + wx_set_source_groups() endfunction() @@ -234,7 +343,7 @@ function(wx_set_target_properties target_name) endif() # For compatibility with MSVS project files and makefile.vc, use arch # suffix for non-x86 (including x86_64) DLLs. - if(MSVC AND wxARCH_SUFFIX) + if(WIN32_MSVC_NAMING AND wxARCH_SUFFIX) # This one already includes the leading underscore, so don't add another one. wx_string_append(dll_suffix "${wxARCH_SUFFIX}") endif() @@ -248,7 +357,7 @@ function(wx_set_target_properties target_name) endif() set(lib_prefix "lib") - if(MSVC OR (WIN32 AND wxBUILD_SHARED)) + if(WIN32_MSVC_NAMING OR (WIN32 AND wxBUILD_SHARED)) set(lib_prefix) elseif (CYGWIN AND wxBUILD_SHARED) set(lib_prefix "cyg") @@ -311,14 +420,7 @@ function(wx_set_target_properties target_name) target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=1 wxUSE_BASE=0) endif() - if(wxUSE_UNICODE) - if(WIN32) - target_compile_definitions(${target_name} PUBLIC UNICODE) - endif() - target_compile_definitions(${target_name} PUBLIC _UNICODE) - endif() - - if(WIN32 AND MSVC) + if(MSVC) # Suppress deprecation warnings for standard library calls target_compile_definitions(${target_name} PRIVATE _CRT_SECURE_NO_DEPRECATE=1 @@ -328,21 +430,17 @@ function(wx_set_target_properties target_name) ) endif() + wx_get_install_dir(library) file(RELATIVE_PATH wxSETUP_HEADER_REL ${wxOUTPUT_DIR} ${wxSETUP_HEADER_PATH}) target_include_directories(${target_name} BEFORE PUBLIC $ $ - $ + $ $ ) - if(wxTOOLKIT_INCLUDE_DIRS AND NOT wxTARGET_IS_BASE) - target_include_directories(${target_name} - PRIVATE ${wxTOOLKIT_INCLUDE_DIRS}) - endif() - if (WIN32) set(WIN32_LIBRARIES kernel32 @@ -369,12 +467,20 @@ function(wx_set_target_properties target_name) PUBLIC ${WIN32_LIBRARIES}) endif() - if(wxTOOLKIT_LIBRARIES AND NOT wxTARGET_IS_BASE) - target_link_libraries(${target_name} - PUBLIC ${wxTOOLKIT_LIBRARIES}) + if(NOT wxTARGET_IS_BASE) + if(wxTOOLKIT_INCLUDE_DIRS) + target_include_directories(${target_name} PRIVATE ${wxTOOLKIT_INCLUDE_DIRS}) + endif() + if(wxTOOLKIT_LIBRARY_DIRS) + target_link_directories(${target_name} PUBLIC ${wxTOOLKIT_LIBRARY_DIRS}) + endif() + if(wxTOOLKIT_LIBRARIES) + target_link_libraries(${target_name} PUBLIC ${wxTOOLKIT_LIBRARIES}) + endif() + endif() + if(wxTOOLKIT_DEFINITIONS) + target_compile_definitions(${target_name} PUBLIC ${wxTOOLKIT_DEFINITIONS}) endif() - target_compile_definitions(${target_name} - PUBLIC ${wxTOOLKIT_DEFINITIONS}) if(wxBUILD_SHARED) string(TOUPPER ${target_name_short} target_name_upper) @@ -411,8 +517,6 @@ function(wx_set_target_properties target_name) wx_set_common_target_properties(${target_name}) endfunction() -# List of libraries added via wx_add_library() to use for wx-config -set(wxLIB_TARGETS) # Add a wxWidgets library # wx_add_library( [IS_BASE;IS_PLUGIN;IS_MONO] ...) @@ -450,23 +554,42 @@ macro(wx_add_library name) add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files}) add_library(wx::${name_short} ALIAS ${name}) + add_library(wxWidgets::${name_short} ALIAS ${name}) + if(CREATE_WX_TARGET) + target_link_libraries(wxWidgets INTERFACE ${name}) + endif() + wx_set_target_properties(${name} ${ARGN}) set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) - # Setup install - if(MSYS OR CYGWIN) - # configure puts the .dll in the bin directory - set(runtime_dir "bin") - else() + wx_get_install_platform_dir(library) + wx_get_install_platform_dir(archive) + wx_get_install_platform_dir(runtime) + + if(WIN32_MSVC_NAMING AND NOT wxBUILD_INSTALL_RUNTIME_DIR) + # override the default 'bin' to match MSVC solution set(runtime_dir "lib") + if(wxBUILD_INSTALL_PLATFORM_SUBDIR AND wxPLATFORM_LIB_DIR) + wx_string_append(runtime_dir "/${wxPLATFORM_LIB_DIR}") + endif() endif() + wx_install(TARGETS ${name} EXPORT wxWidgetsTargets - LIBRARY DESTINATION "lib${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" - ARCHIVE DESTINATION "lib${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" - RUNTIME DESTINATION "${runtime_dir}${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}" + LIBRARY DESTINATION "${library_dir}" + ARCHIVE DESTINATION "${archive_dir}" + RUNTIME DESTINATION "${runtime_dir}" BUNDLE DESTINATION Applications/wxWidgets - ) + ) + + if(wxBUILD_SHARED AND MSVC AND wxBUILD_INSTALL_PDB) + if(wxBUILD_STRIPPED_RELEASE) + wx_install(FILES $ DESTINATION "${runtime_dir}" CONFIGURATIONS Debug RelWithDebInfo) + else() + wx_install(FILES $ DESTINATION "${runtime_dir}") + endif() + endif() + wx_target_enable_precomp(${name} "${wxSOURCE_DIR}/include/wx/wxprec.h") endif() endmacro() @@ -486,6 +609,21 @@ macro(wx_lib_link_libraries name) endif() endmacro() +# wx_lib_link_directories(name []) +# Forwards everything to target_link_directories() except for monolithic +# build where it collects all directories for linking with the mono lib +macro(wx_lib_link_directories name) + if(wxBUILD_MONOLITHIC) + cmake_parse_arguments(_DIR_LINK "" "" "PUBLIC;PRIVATE" ${ARGN}) + list(APPEND wxMONO_DIRS_PUBLIC ${_DIR_LINK_PUBLIC}) + list(APPEND wxMONO_DIRS_PRIVATE ${_DIR_LINK_PRIVATE}) + set(wxMONO_DIRS_PUBLIC ${wxMONO_DIRS_PUBLIC} PARENT_SCOPE) + set(wxMONO_DIRS_PRIVATE ${wxMONO_DIRS_PRIVATE} PARENT_SCOPE) + else() + target_link_directories(${name};${ARGN}) + endif() +endmacro() + # wx_exe_link_libraries(target libs...) # Link wx libraries to executable macro(wx_exe_link_libraries name) @@ -505,6 +643,17 @@ macro(wx_lib_include_directories name) if(wxBUILD_MONOLITHIC) list(APPEND wxMONO_INCLUDE_DIRS ${ARGN}) set(wxMONO_INCLUDE_DIRS ${wxMONO_INCLUDE_DIRS} PARENT_SCOPE) + else() + target_include_directories(${name} PRIVATE ${ARGN}) + endif() +endmacro() + +# Same as wx_lib_include_directories() but prepends the given directories to +# the include path instead of appending them. +macro(wx_lib_include_directories_before name) + if(wxBUILD_MONOLITHIC) + list(PREPEND wxMONO_INCLUDE_DIRS ${ARGN}) + set(wxMONO_INCLUDE_DIRS ${wxMONO_INCLUDE_DIRS} PARENT_SCOPE) else() target_include_directories(${name} BEFORE PRIVATE ${ARGN}) endif() @@ -534,8 +683,8 @@ macro(wx_add_dependencies name) endif() endmacro() -# Set common properties for a builtin third party library -function(wx_set_builtin_target_properties target_name) +# Set output name for a builtin third party library +macro(wx_set_builtin_target_ouput_name target target_name) set(lib_unicode) if(wxUSE_UNICODE AND target_name STREQUAL "wxregex") set(lib_unicode "u") @@ -554,18 +703,42 @@ function(wx_set_builtin_target_properties target_name) set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") endif() - set_target_properties(${target_name} PROPERTIES + set(lib_prefix "lib") + if(WIN32_MSVC_NAMING OR (WIN32 AND wxBUILD_SHARED)) + set(lib_prefix) + elseif (CYGWIN AND wxBUILD_SHARED) + set(lib_prefix "cyg") + endif() + + set_target_properties(${target} 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}" + PREFIX "${lib_prefix}" ) +endmacro() - if(wxUSE_UNICODE) - if(WIN32) - target_compile_definitions(${target_name} PUBLIC UNICODE) - endif() - target_compile_definitions(${target_name} PUBLIC _UNICODE) +# Add a third party builtin library +function(wx_add_builtin_library target_name) + wx_list_add_prefix(src_list "${wxSOURCE_DIR}/" ${ARGN}) + + list(GET src_list 0 src_file) + if(NOT EXISTS "${src_file}") + message(FATAL_ERROR "${target_name} file does not exist: \"${src_file}\".\ + Make sure you checkout the git submodules.") + endif() + + add_library(${target_name} STATIC ${src_list}) + + if(${target_name} MATCHES "wx.*") + string(SUBSTRING ${target_name} 2 -1 name_short) + set(name_long ${target_name}) + else() + set(name_short ${target_name}) + set(name_long "wx${target_name}") endif() + wx_set_builtin_target_ouput_name(${target_name} ${name_long}) + if(MSVC) # we're not interested in deprecation warnings about the use of # standard C functions in the 3rd party libraries (these warnings @@ -579,38 +752,29 @@ function(wx_set_builtin_target_properties target_name) target_include_directories(${target_name} BEFORE PRIVATE ${wxSETUP_HEADER_PATH}) - set_target_properties(${target_name} PROPERTIES FOLDER "Third Party Libraries") - + set_target_properties(${target_name} PROPERTIES + PROJECT_LABEL ${name_short} + FOLDER "Third Party Libraries" + ) if(wxBUILD_SHARED OR wxBUILD_PIC) set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) endif() wx_set_common_target_properties(${target_name} DEFAULT_WARNINGS) - if(NOT wxBUILD_SHARED) - wx_install(TARGETS ${name} EXPORT wxWidgetsTargets ARCHIVE DESTINATION "lib${GEN_EXPR_DIR}${wxPLATFORM_LIB_DIR}") - endif() -endfunction() -# Add a third party builtin library -function(wx_add_builtin_library name) - wx_list_add_prefix(src_list "${wxSOURCE_DIR}/" ${ARGN}) - - list(GET src_list 0 src_file) - if(NOT EXISTS "${src_file}") - message(FATAL_ERROR "${name} file does not exist: \"${src_file}\".\ - Make sure you checkout the git submodules.") + add_library(wx::${name_short} ALIAS ${target_name}) + add_library(wxWidgets::${name_short} ALIAS ${target_name}) + if(CREATE_WX_TARGET) + target_link_libraries(wxWidgets INTERFACE ${target_name}) endif() - if(${name} MATCHES "wx.*") - string(SUBSTRING ${name} 2 -1 name_short) - else() - set(name_short ${name}) - endif() + list(APPEND wxLIB_BUILTIN_TARGETS ${target_name}) + set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE) - add_library(${name} STATIC ${src_list}) - add_library(wx::${name_short} ALIAS ${name}) - wx_set_builtin_target_properties(${name}) - set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) + if(NOT wxBUILD_SHARED) + wx_get_install_platform_dir(archive) + wx_install(TARGETS ${target_name} EXPORT wxWidgetsTargets ARCHIVE DESTINATION "${archive_dir}") + endif() endfunction() # List of third party libraries added via wx_add_thirdparty_library() @@ -621,7 +785,11 @@ set(wxTHIRD_PARTY_LIBRARIES) function(wx_add_thirdparty_library var_name lib_name help_str) cmake_parse_arguments(THIRDPARTY "" "DEFAULT;DEFAULT_APPLE;DEFAULT_WIN32" "" ${ARGN}) - if(THIRDPARTY_DEFAULT) + if(NOT wxUSE_SYS_LIBS) + set(thirdparty_lib_default builtin) + elseif(THIRDPARTY_DEFAULT STREQUAL "OFF") + set(thirdparty_lib_default OFF) + elseif(THIRDPARTY_DEFAULT) set(thirdparty_lib_default ${THIRDPARTY_DEFAULT}) elseif(THIRDPARTY_DEFAULT_APPLE AND APPLE) set(thirdparty_lib_default ${THIRDPARTY_DEFAULT_APPLE}) @@ -640,14 +808,6 @@ function(wx_add_thirdparty_library var_name lib_name help_str) wx_option(${var_name} ${help_str} ${thirdparty_lib_default} STRINGS builtin sys OFF) - if(${var_name} STREQUAL "sys") - # If the sys library can not be found use builtin - find_package(${lib_name}) - if(NOT ${lib_name}_FOUND) - wx_option_force_value(${var_name} builtin) - endif() - endif() - set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} ${var_name} "${help_str}" PARENT_SCOPE) endfunction() @@ -658,6 +818,7 @@ function(wx_print_thirdparty_library_summary) foreach(entry IN LISTS wxTHIRD_PARTY_LIBRARIES) if(NOT var_name) set(var_name ${entry}) + string(APPEND wxTHIRD_PARTY_SUMMARY_NOW "${var_name}=${${var_name}}-") else() string(LENGTH ${var_name} len) if(len GREATER nameLength) @@ -670,6 +831,15 @@ function(wx_print_thirdparty_library_summary) set(var_name) endif() endforeach() + + # Avoid printing out the message if we're being reconfigured and nothing + # has changed since the previous run, so check if the current summary + # differs from the cached value. + if("${wxTHIRD_PARTY_SUMMARY_NOW}" STREQUAL "${wxTHIRD_PARTY_SUMMARY}") + return() + endif() + set(wxTHIRD_PARTY_SUMMARY ${wxTHIRD_PARTY_SUMMARY_NOW} CACHE INTERNAL "internal summary of 3rd party libraries used by wxWidgets") + math(EXPR nameLength "${nameLength}+1") # account for : set(message "Which libraries should wxWidgets use?\n") @@ -690,8 +860,9 @@ endfunction() # Add sample, test, demo or benchmark # wx_add( [CONSOLE|CONSOLE_GUI|DLL] [IMPORTANT] [SRC_FILES...] -# [LIBRARIES ...] [NAME target_name] [FOLDER folder] -# [DATA ...] [DEFINITIONS ...] [RES ...] [PLIST ...) +# [NAME target_name] [FOLDER folder] +# [DATA ...] [DEFINITIONS ...] [DEPENDS ...] [LIBRARIES ...] +# [RES ...] [RES_BUNDLE ...] [PLIST ...]) # name default target name # group can be Samples, Tests, Demos or Benchmarks # first parameter may be CONSOLE to indicate a console application or DLL to indicate a shared library @@ -700,12 +871,14 @@ endfunction() # # Optionally: # IMPORTANT (samples only) does not require wxBUILD_SAMPLES=ALL -# LIBRARIES followed by required libraries # NAME alternative target_name # FOLDER subfolder in IDE # DATA followed by required data files. Use a colon to separate different source and dest paths # DEFINITIONS list of definitions for the target +# DEPENDS build options the target depends on +# LIBRARIES followed by required libraries # RES followed by WIN32 .rc files +# RES_BUNDLE followed by macOS bundle resource files # PLIST followed by macOS Info.plist.in file # # Additionally the following variables may be set before calling wx_add_sample: @@ -732,7 +905,7 @@ function(wx_add name group) cmake_parse_arguments(APP "CONSOLE;CONSOLE_GUI;DLL;IMPORTANT" "NAME;FOLDER" - "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES;PLIST" + "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES;RES_BUNDLE;PLIST" ${ARGN} ) @@ -795,7 +968,13 @@ function(wx_add name group) list(APPEND src_files ${wxSOURCE_DIR}/${DEFAULT_RC_FILE}) endif() elseif(APPLE AND NOT IPHONE) - list(APPEND src_files ${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns) + set(bundle_files "${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns") + if(APP_RES_BUNDLE) + foreach(res ${APP_RES_BUNDLE}) + list(APPEND bundle_files "${wxSOURCE_DIR}/${SUB_DIR}/${res}") + endforeach() + endif() + list(APPEND src_files ${bundle_files}) endif() if(APP_DLL) @@ -826,17 +1005,16 @@ function(wx_add name group) endif() # All applications use at least the base library other libraries - # will have to be added with wx_link_sample_libraries() - wx_exe_link_libraries(${target_name} wxbase) - if(NOT APP_CONSOLE) - # UI applications always require core - wx_exe_link_libraries(${target_name} wxcore) + if(APP_CONSOLE) + wx_exe_link_libraries(${target_name} wxbase_only) else() - target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1) + wx_exe_link_libraries(${target_name} wxcore) endif() + if(APP_LIBRARIES) wx_exe_link_libraries(${target_name} ${APP_LIBRARIES}) endif() + if(APP_DEFINITIONS) target_compile_definitions(${target_name} PRIVATE ${APP_DEFINITIONS}) endif() @@ -846,11 +1024,9 @@ function(wx_add name group) elseif(group STREQUAL Tests) target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/tests) target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/3rdparty/catch/include) - target_include_directories(${target_name} PRIVATE ${wxTOOLKIT_INCLUDE_DIRS}) endif() if(APP_DATA) - # TODO: handle data files differently for OS X bundles # Copy data files to output directory foreach(data_src ${APP_DATA}) string(FIND ${data_src} ":" HAS_COLON) @@ -867,7 +1043,7 @@ function(wx_add name group) ${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}/${data_dst}) endforeach() add_custom_command( - TARGET ${target_name} ${cmds} + TARGET ${target_name} POST_BUILD ${cmds} COMMENT "Copying ${target_name} data files...") endif() @@ -879,7 +1055,7 @@ function(wx_add name group) endif() set_target_properties(${target_name} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PLIST_FILE}" - RESOURCE "${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns") + RESOURCE "${bundle_files}") endif() set_target_properties(${target_name} PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.wxwidgets.${target_name}" @@ -917,13 +1093,6 @@ function(wx_add name group) endif() endfunction() -# Link libraries to a sample -function(wx_link_sample_libraries name) - if(TARGET ${name}) - target_link_libraries(${name} PUBLIC ${ARGN}) - endif() -endfunction() - # Add a option and mark is as advanced if it starts with wxUSE_ # wx_option( [default] [STRINGS strings]) # The default is ON if not third parameter is specified @@ -964,6 +1133,21 @@ function(wx_option name desc) endif() endfunction() +# A convenient wrapper for wx_option() for an option set to AUTO by default but +# also allowing ON and OFF values, with AUTO meaning that the option is set to +# ON if possible (e.g. required support for it is detected) and turned OFF with +# just a warning otherwise, while ON means that an error is given if it can't +# be enabled. +function(wx_option_auto name desc) + cmake_parse_arguments(OPTION "" "" "STRINGS" ${ARGN}) + if(ARGC EQUAL 2) + set(default AUTO) + else() + set(default ${OPTION_UNPARSED_ARGUMENTS}) + endif() + wx_option(${name} ${desc} ${default} STRINGS ON OFF AUTO) +endfunction() + # Force a new value for an option created with wx_option function(wx_option_force_value name value) get_property(helpstring CACHE ${name} PROPERTY HELPSTRING) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 0584ecaeb5ff..efaa73ffc7a1 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -19,6 +19,8 @@ else() endif() if(MSVC) + if(CMAKE_VERSION VERSION_LESS "3.15") + # CMake 3.15 and later use MSVC_RUNTIME_LIBRARY property, see functions.cmake # Determine MSVC runtime library flag set(MSVC_LIB_USE "/MD") set(MSVC_LIB_REPLACE "/MT") @@ -46,6 +48,15 @@ if(MSVC) "Flags used by the CXX compiler during ${cfg_upper} builds." FORCE) endif() endforeach() + endif() + + if(wxBUILD_SHARED AND wxBUILD_USE_STATIC_RUNTIME AND wxUSE_STD_IOSTREAM) + # Objects like std::cout are defined as extern in and implemented in libcpmt. + # This is statically linked into wxbase (stdstream.cpp). + # When building an application with both wxbase and libcpmt, + # the linker gives 'multiply defined symbols' error. + message(WARNING "wxUSE_STD_IOSTREAM combined with wxBUILD_USE_STATIC_RUNTIME will fail to link when using std::cout or similar functions") + endif() if(wxBUILD_OPTIMISE) set(MSVC_LINKER_RELEASE_FLAGS " /LTCG /OPT:REF /OPT:ICF") @@ -63,7 +74,7 @@ if(MSVC) wx_string_append(CMAKE_EXE_LINKER_FLAGS_RELEASE "${MSVC_PDB_FLAG}") wx_string_append(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${MSVC_PDB_FLAG}") - if(wxBUILD_MSVC_MULTIPROC) + if(wxBUILD_MSVC_MULTIPROC AND ${CMAKE_GENERATOR} MATCHES "Visual Studio") wx_string_append(CMAKE_C_FLAGS " /MP") wx_string_append(CMAKE_CXX_FLAGS " /MP") endif() @@ -100,11 +111,11 @@ elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID} endif() endif() -if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0) - set(WXWIN_COMPATIBILITY_2_8 ON) -endif() -if(wxBUILD_COMPATIBILITY VERSION_LESS 3.1) +if(NOT wxBUILD_COMPATIBILITY STREQUAL "NONE") set(WXWIN_COMPATIBILITY_3_0 ON) + if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0) + set(WXWIN_COMPATIBILITY_2_8 ON) + endif() endif() # Build wxBUILD_FILE_ID used for config and setup path @@ -158,14 +169,18 @@ if(WIN32) endif() endif() +wx_get_install_dir(include) if(WIN32_MSVC_NAMING) if(wxBUILD_SHARED) set(lib_suffix "_dll") else() set(lib_suffix "_lib") endif() - set(wxPLATFORM_LIB_DIR "${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}${lib_suffix}") + set(wxINSTALL_INCLUDE_DIR "${include_dir}") +else() + wx_get_flavour(lib_flavour "-") + set(wxINSTALL_INCLUDE_DIR "${include_dir}/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${lib_flavour}") endif() if(wxBUILD_CUSTOM_SETUP_HEADER_PATH) @@ -210,8 +225,8 @@ endif() set(wxUSE_STD_DEFAULT ON) if(NOT wxUSE_EXPAT) set(wxUSE_XRC OFF) + set(wxUSE_XML OFF) endif() -set(wxUSE_XML ${wxUSE_XRC}) if(DEFINED wxUSE_OLE AND wxUSE_OLE) set(wxUSE_OLE_AUTOMATION ON) @@ -296,7 +311,11 @@ if(wxUSE_CONFIG) message(WARNING "wxConfig requires wxTextFile... disabled") wx_option_force_value(wxUSE_CONFIG OFF) else() - set(wxUSE_CONFIG_NATIVE ON) + if(WIN32 AND NOT wxUSE_REGKEY) + set(wxUSE_CONFIG_NATIVE OFF) + else() + set(wxUSE_CONFIG_NATIVE ON) + endif() endif() endif() @@ -306,7 +325,14 @@ if(wxUSE_INTL AND NOT wxUSE_FILE) endif() if(wxUSE_THREADS) - find_package(Threads REQUIRED) + if(ANDROID) + # Android has pthreads but FindThreads fails due to missing pthread_cancel + set(CMAKE_USE_PTHREADS_INIT 1) + set(CMAKE_THREAD_LIBS_INIT "") + set(Threads_FOUND TRUE) + else() + find_package(Threads REQUIRED) + endif() endif() if(wxUSE_LIBLZMA) @@ -350,6 +376,11 @@ if(UNIX) # have GNOME libsecret under Unix to be able to compile this class. find_package(LIBSECRET) if(NOT LIBSECRET_FOUND) + if(wxUSE_SECRETSTORE STREQUAL ON) + message(FATAL_ERROR "wxSecretStore support requested, but libsecret was not found: either install it or don't set wxUSE_SECRETSTORE to ON") + endif() + + # wxUSE_SECRETSTORE must be AUTO, continue with a warning. message(WARNING "libsecret not found, wxSecretStore won't be available") wx_option_force_value(wxUSE_SECRETSTORE OFF) endif() @@ -422,6 +453,7 @@ if(wxUSE_GUI) if(wxUSE_OPENGL) if(WXOSX_IPHONE) set(OPENGL_FOUND TRUE) + set(OPENGL_INCLUDE_DIR "") set(OPENGL_LIBRARIES "-framework OpenGLES" "-framework QuartzCore" "-framework GLKit") else() find_package(OpenGL) @@ -447,9 +479,12 @@ if(wxUSE_GUI) list(APPEND OPENGL_LIBRARIES ${WAYLANDEGL_LIBRARIES}) endif() endif() + if(WXGTK3 AND APPLE AND (NOT wxHAVE_GDK_X11 OR NOT wxHAVE_GDK_WAYLAND)) + set(OPENGL_FOUND OFF) + endif() endif() if(NOT OPENGL_FOUND) - message(WARNING "opengl not found, wxGLCanvas won't be available") + message(WARNING "OpenGL not found, wxGLCanvas won't be available") wx_option_force_value(wxUSE_OPENGL OFF) endif() if(UNIX AND (NOT WXGTK3 OR NOT OpenGL_EGL_FOUND)) @@ -486,18 +521,43 @@ if(wxUSE_GUI) message(WARNING "webkit not found or enabled, wxWebview won't be available") wx_option_force_value(wxUSE_WEBVIEW OFF) endif() - elseif(WXMSW) - if(NOT wxUSE_WEBVIEW_IE AND NOT wxUSE_WEBVIEW_EDGE) - message(WARNING "WebviewIE and WebviewEdge not found or enabled, wxWebview won't be available") - wx_option_force_value(wxUSE_WEBVIEW OFF) - endif() elseif(APPLE) if(NOT wxUSE_WEBVIEW_WEBKIT) message(WARNING "webkit not found or enabled, wxWebview won't be available") wx_option_force_value(wxUSE_WEBVIEW OFF) endif() + else() + set(wxUSE_WEBVIEW_WEBKIT OFF) + endif() + + if(WXMSW AND NOT wxUSE_WEBVIEW_IE AND NOT wxUSE_WEBVIEW_EDGE) + message(WARNING "WebviewIE and WebviewEdge not found or enabled, wxWebview won't be available") + wx_option_force_value(wxUSE_WEBVIEW OFF) + endif() + endif() + + set(wxWebviewInfo "enable wxWebview") + if(wxUSE_WEBVIEW) + if(wxUSE_WEBVIEW_WEBKIT) + list(APPEND webviewBackends "WebKit") + endif() + if(wxUSE_WEBVIEW_WEBKIT2) + list(APPEND webviewBackends "WebKit2") + endif() + if(wxUSE_WEBVIEW_EDGE) + if(wxUSE_WEBVIEW_EDGE_STATIC) + list(APPEND webviewBackends "Edge (static)") + else() + list(APPEND webviewBackends "Edge") + endif() + endif() + if(wxUSE_WEBVIEW_IE) + list(APPEND webviewBackends "IE") endif() + string(REPLACE ";" ", " webviewBackends "${webviewBackends}") + set(wxWebviewInfo "${wxWebviewInfo} with ${webviewBackends}") endif() + set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_WEBVIEW ${wxWebviewInfo}) if(wxUSE_PRIVATE_FONTS AND WXGTK) find_package(FONTCONFIG) @@ -508,7 +568,7 @@ if(wxUSE_GUI) endif() endif() - if(wxUSE_MEDIACTRL AND WXGTK AND NOT APPLE AND NOT WIN32) + if(wxUSE_MEDIACTRL AND WXGTK AND NOT WIN32) find_package(GSTREAMER 1.0 COMPONENTS video) if(NOT GSTREAMER_FOUND) find_package(GSTREAMER 0.10 COMPONENTS interfaces) @@ -533,6 +593,7 @@ if(wxUSE_GUI) find_package(SDL2) if(NOT SDL2_FOUND) find_package(SDL) + mark_as_advanced(SDL_INCLUDE_DIR SDLMAIN_LIBRARY) endif() if(NOT SDL2_FOUND AND NOT SDL_FOUND) message(WARNING "SDL not found, SDL Audio back-end won't be available") @@ -558,7 +619,7 @@ if(wxUSE_GUI) endif() if(wxUSE_UIACTIONSIMULATOR AND UNIX AND WXGTK) - if(wxUSE_XTEST) + if(wxHAVE_GDK_X11 AND wxUSE_XTEST) find_package(XTEST) if(XTEST_FOUND) list(APPEND wxTOOLKIT_INCLUDE_DIRS ${XTEST_INCLUDE_DIRS}) @@ -634,6 +695,11 @@ if(wxUSE_GUI) if(NOT CAIRO_FOUND) message(WARNING "Cairo not found, Cairo renderer won't be available") wx_option_force_value(wxUSE_CAIRO OFF) + if(WXQT AND NOT WIN32) + # Cairo is the only renderer for wxGraphicsContext + message(WARNING "No graphics renderer found, wxGraphicsContext won't be available") + wx_option_force_value(wxUSE_GRAPHICS_CONTEXT OFF) + endif() endif() endif() @@ -648,6 +714,18 @@ if(wxUSE_GUI) endif() endif() + if(wxUSE_DETECT_SM) + if(APPLE OR WIN32) + wx_option_force_value(wxUSE_DETECT_SM OFF) + else() + find_package(PkgConfig) + pkg_check_modules(SM sm) + if(NOT SM_FOUND) + message(WARNING "libSM not found; disabling session management detection") + wx_option_force_value(wxUSE_DETECT_SM OFF) + endif() + endif() + endif() endif(wxUSE_GUI) # test if precompiled headers are supported using the cotire test project @@ -687,5 +765,7 @@ if((wxBUILD_PRECOMP STREQUAL "ON" AND CMAKE_VERSION VERSION_LESS "3.16") OR (wxB if(NOT RESULT_VAR) message(WARNING "precompiled header (PCH) test failed, it will be turned off") wx_option_force_value(wxBUILD_PRECOMP OFF) + else() + set(USE_COTIRE ON) endif() endif() diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 384c6837b814..4447b1b6d8fb 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -12,43 +12,72 @@ if(NOT wxBUILD_INSTALL) endif() install(CODE "message(STATUS \"Installing: Headers...\")") -install( - DIRECTORY "${wxSOURCE_DIR}/include/wx" - DESTINATION "${wxINSTALL_INCLUDE_DIR}") + +foreach(header ${wxINSTALL_HEADERS}) + get_filename_component(path "${header}" PATH) + install( + FILES "${wxSOURCE_DIR}/include/${header}" + DESTINATION "${wxINSTALL_INCLUDE_DIR}/${path}" + ) +endforeach() + if(MSVC) install( DIRECTORY "${wxSOURCE_DIR}/include/msvc" - DESTINATION "${wxINSTALL_INCLUDE_DIR}") + DESTINATION "${wxINSTALL_INCLUDE_DIR}" + ) + install( + FILES "${wxSOURCE_DIR}/wxwidgets.props" + DESTINATION "." + ) + install( + FILES "${wxSOURCE_DIR}/build/msw/wx_setup.props" + DESTINATION "build/msw" + ) endif() +wx_get_install_platform_dir(library) + # setup header and wx-config if(WIN32_MSVC_NAMING) + # create both Debug and Release directories, so CMake doesn't complain about + # non-existent path when only Release or Debug build has been installed + set(lib_unicode "u") + install(DIRECTORY + DESTINATION "${library_dir}/${wxBUILD_TOOLKIT}${lib_unicode}") + install(DIRECTORY + DESTINATION "${library_dir}/${wxBUILD_TOOLKIT}${lib_unicode}d") install( DIRECTORY "${wxSETUP_HEADER_PATH}" - DESTINATION "lib/${wxPLATFORM_LIB_DIR}") + DESTINATION "${library_dir}") else() install( DIRECTORY "${wxSETUP_HEADER_PATH}" - DESTINATION "lib/wx/include") + DESTINATION "${library_dir}/wx/include" + ) install( FILES "${wxOUTPUT_DIR}/wx/config/${wxBUILD_FILE_ID}" - DESTINATION "lib/wx/config" + DESTINATION "${library_dir}/wx/config" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ ) - install(DIRECTORY DESTINATION "bin") - install(CODE "execute_process( \ - COMMAND ${CMAKE_COMMAND} -E create_symlink \ - \"${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID}\" \ - \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \ - )" - ) + wx_get_install_platform_dir(runtime) + install(DIRECTORY DESTINATION "${runtime_dir}") + set(CONFIG_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}") + set(CONFIG_SRC "${CONFIG_DIR}/${library_dir}/wx/config/${wxBUILD_FILE_ID}") + set(CONFIG_DST "${CONFIG_DIR}/${runtime_dir}/wx-config") + wx_install_symlink(${CONFIG_SRC} ${CONFIG_DST}) + + list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config\"") endif() -install(EXPORT wxWidgetsTargets NAMESPACE wx:: DESTINATION "lib/cmake/wxWidgets/${wxPLATFORM_LIB_DIR}") +wx_get_install_dir(library) +set(wx_cmake_dir "${library_dir}/cmake/wxWidgets-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") + +install(EXPORT wxWidgetsTargets NAMESPACE wx:: DESTINATION "${wx_cmake_dir}/${wxPLATFORM_LIB_DIR}") # find_package config file include(CMakePackageConfigHelpers) @@ -71,11 +100,11 @@ write_basic_package_version_file( configure_package_config_file( "${wxSOURCE_DIR}/build/cmake/wxWidgetsConfig.cmake.in" "${projectConfig}" - INSTALL_DESTINATION "lib/cmake/wxWidgets" + INSTALL_DESTINATION "${wx_cmake_dir}" ) install( FILES "${projectConfig}" "${versionConfig}" - DESTINATION "lib/cmake/wxWidgets" + DESTINATION "${wx_cmake_dir}" ) # uninstall target @@ -86,21 +115,6 @@ else() endif() 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${EXE_SUFFIX}" - ) - endif() - configure_file( "${wxSOURCE_DIR}/build/cmake/uninstall.cmake.in" "${wxBINARY_DIR}/uninstall.cmake" diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index 4b40d7652e58..83eb675635d4 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -12,6 +12,8 @@ if(wxBUILD_MONOLITHIC) set(wxMONO_SRC_FILES) set(wxMONO_LIBS_PRIVATE) set(wxMONO_LIBS_PUBLIC) + set(wxMONO_DIRS_PRIVATE) + set(wxMONO_DIRS_PUBLIC) set(wxMONO_INCLUDE_DIRS) set(wxMONO_DEFINITIONS) set(wxMONO_NONCOMPILED_CPP_FILES) @@ -27,44 +29,33 @@ foreach(LIB IN LISTS LIBS_THIRDPARTY) include(${LIB}.cmake) endforeach() -# add_opt_lib() -# Add library which may have been disabled by wxUSE_... -macro(add_opt_lib name var_name) - if(${var_name}) - list(APPEND LIBS ${name}) - endif() -endmacro() - # Define base libraries -set(LIBS base) -add_opt_lib(net wxUSE_SOCKETS) +set(LIBS base net) # Define UI libraries if(wxUSE_GUI) - list(APPEND LIBS core adv) - foreach(lib + list(APPEND LIBS + core + adv aui + gl html + media propgrid + qa ribbon richtext - webview stc + webview xrc - ) - string(TOUPPER ${lib} _name_upper) - add_opt_lib(${lib} wxUSE_${_name_upper}) - endforeach() - add_opt_lib(media wxUSE_MEDIACTRL) - add_opt_lib(gl wxUSE_OPENGL) - add_opt_lib(qa wxUSE_DEBUGREPORT) + ) endif() # wxUSE_GUI # Include XML library last # In the monolithic build, where all target properties (include dirs) from different targets are concatenated, # wxml might include system expat, which might use Mono, which has it's own copy of png. # Thus to ensure wx's core library includes the right png class, core must be processed first before xml -add_opt_lib(xml wxUSE_XML) +list(APPEND LIBS xml) # Include cmake file for every library foreach(LIB ${LIBS}) @@ -83,6 +74,9 @@ if(wxBUILD_MONOLITHIC) target_link_libraries(wxmono ${vis} ${wxMONO_LIBS_${vis}}) endif() + if(wxMONO_DIRS_${vis}) + target_link_directories(wxmono ${vis} ${wxMONO_DIRS_${vis}}) + endif() endforeach() if(wxMONO_INCLUDE_DIRS) target_include_directories(wxmono BEFORE PRIVATE ${wxMONO_INCLUDE_DIRS}) @@ -103,3 +97,5 @@ endif() # Propagate variable(s) to parent scope set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE) +set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE) +set(wxINSTALL_HEADERS ${wxINSTALL_HEADERS} PARENT_SCOPE) diff --git a/build/cmake/lib/aui/CMakeLists.txt b/build/cmake/lib/aui/CMakeLists.txt index 10828136cdbb..7ae4e6c87265 100644 --- a/build/cmake/lib/aui/CMakeLists.txt +++ b/build/cmake/lib/aui/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_AUI) + wx_append_install_headers(AUI_CMN_HDR) + return() +endif() + wx_append_sources(AUI_FILES AUI_CMN) if(WXMSW) diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index d8c587994bbd..4689fc486651 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -14,9 +14,13 @@ if(WIN32) wx_append_sources(BASE_FILES BASE_WIN32) wx_append_sources(BASE_FILES BASE_AND_GUI_WIN32) elseif(APPLE) - wx_append_sources(BASE_FILES BASE_OSX_SHARED) - if(WXOSX_COCOA) - wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA) + if(WXOSX_COCOA OR WXOSX_IPHONE) + wx_append_sources(BASE_FILES BASE_OSX_SHARED) + if(WXOSX_COCOA) + wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA) + endif() + else() + wx_append_sources(BASE_FILES BASE_OSX_NOTWXMAC) endif() elseif(UNIX) wx_append_sources(BASE_FILES BASE_UNIX) @@ -24,12 +28,15 @@ endif() wx_add_library(wxbase IS_BASE ${BASE_FILES}) +# Note that when using built-in versions of the libraries, their include +# directories must come before the system ones which could be used by some +# other dependency. if(wxUSE_ZLIB) - wx_lib_include_directories(wxbase ${ZLIB_INCLUDE_DIRS}) + wx_lib_include_directories_before(wxbase ${ZLIB_INCLUDE_DIRS}) wx_lib_link_libraries(wxbase PRIVATE ${ZLIB_LIBRARIES}) endif() if(wxUSE_REGEX) - wx_lib_include_directories(wxbase ${REGEX_INCLUDE_DIRS}) + wx_lib_include_directories_before(wxbase ${REGEX_INCLUDE_DIRS}) wx_lib_link_libraries(wxbase PRIVATE ${REGEX_LIBRARIES}) endif() if(wxUSE_LIBLZMA) @@ -44,19 +51,27 @@ if(wxUSE_LIBICONV) wx_lib_include_directories(wxbase ${ICONV_INCLUDE_DIR}) wx_lib_link_libraries(wxbase PRIVATE ${ICONV_LIBRARIES}) endif() -if(wxUSE_THREADS AND CMAKE_THREAD_LIBS_INIT) - wx_lib_link_libraries(wxbase PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -endif() if(APPLE) wx_lib_link_libraries(wxbase + PRIVATE + "-framework Security" PUBLIC "-framework CoreFoundation" ) + if(WXOSX_IPHONE) + wx_lib_link_libraries(wxbase + PUBLIC + "-framework UIKit" + ) + else() + wx_lib_link_libraries(wxbase + PUBLIC + "-framework AppKit" + ) + endif() if(WXOSX_COCOA) wx_lib_link_libraries(wxbase - PRIVATE - "-framework Security" PUBLIC "-framework Carbon" "-framework Cocoa" @@ -66,4 +81,17 @@ if(APPLE) endif() elseif(UNIX) wx_lib_link_libraries(wxbase PRIVATE ${CMAKE_DL_LIBS}) + if(ANDROID) + wx_lib_link_libraries(wxbase PUBLIC log) + endif() endif() + + +add_library(wxbase_only INTERFACE) +add_library(wx::base_only ALIAS wxbase_only) +add_library(wxWidgets::base_only ALIAS wxbase_only) +target_link_libraries(wxbase_only INTERFACE wxbase) +target_compile_definitions(wxbase_only INTERFACE wxUSE_GUI=0) +wx_install(TARGETS wxbase_only EXPORT wxWidgetsTargets) +list(APPEND wxLIB_TARGETS wxbase_only) +set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 8031cc37309b..b68dbc563071 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -28,6 +28,7 @@ if(WXMSW) endif() elseif(WXGTK) if(WXGTK2) + set(GTK2_LOWLEVEL_HDR ${GTK_LOWLEVEL_HDR}) wx_append_sources(CORE_SRC GTK2_LOWLEVEL) wx_append_sources(CORE_SRC GTK2) else() @@ -47,12 +48,17 @@ elseif(WXOSX_COCOA) wx_append_sources(CORE_SRC OSX_COCOA) elseif(WXOSX_IPHONE) wx_append_sources(CORE_SRC OSX_LOWLEVEL) + wx_append_sources(CORE_SRC OSX_SHARED) wx_append_sources(CORE_SRC OSX_IPHONE) elseif(WXQT) wx_append_sources(CORE_SRC QT) - if(WIN32) + if(UNIX) + wx_append_sources(CORE_SRC QT_UNIX) + elseif(WIN32) wx_append_sources(CORE_SRC QT_WIN32) endif() +elseif(WXX11) + wx_append_sources(CORE_SRC X11_LOWLEVEL) endif() wx_add_library(wxcore ${CORE_SRC}) @@ -60,10 +66,12 @@ foreach(lib JPEG PNG TIFF NANOSVG) if(${lib}_LIBRARIES) wx_lib_link_libraries(wxcore PRIVATE ${${lib}_LIBRARIES}) endif() + # When using built-in versions of the libraries, their include directories + # must come before the system ones which could be used by the toolkit. if(${lib}_INCLUDE_DIRS) - wx_lib_include_directories(wxcore ${${lib}_INCLUDE_DIRS}) + wx_lib_include_directories_before(wxcore ${${lib}_INCLUDE_DIRS}) elseif(${lib}_INCLUDE_DIR) - wx_lib_include_directories(wxcore ${${lib}_INCLUDE_DIR}) + wx_lib_include_directories_before(wxcore ${${lib}_INCLUDE_DIR}) endif() endforeach() if(wxUSE_NANOSVG STREQUAL "sys" AND wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL) diff --git a/build/cmake/lib/expat.cmake b/build/cmake/lib/expat.cmake index 7200dd5dab6c..9a366b8c0688 100644 --- a/build/cmake/lib/expat.cmake +++ b/build/cmake/lib/expat.cmake @@ -7,16 +7,56 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_EXPAT STREQUAL "sys") + find_package(EXPAT) + if(NOT EXPAT_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_EXPAT builtin) + endif() +endif() + if(wxUSE_EXPAT STREQUAL "builtin") + set(wxEXPAT_DIR ${wxSOURCE_DIR}/src/expat/expat) + # TODO: implement building expat via its CMake file, using # add_subdirectory or ExternalProject_Add + # + # Until this is done, at least use Expat's own CMake file to check for the + # features it needs, so that we can produce the appropriate expat_config.h. + # + # This only makes sense under Unix, however, as almost all checks there are + # Unix-specific and just always fail under Windows. + if(WIN32) + include(TestBigEndian) + test_big_endian(WORDS_BIGENDIAN) + if(WORDS_BIGENDIAN) + set(BYTEORDER 4321) + else(WORDS_BIGENDIAN) + set(BYTEORDER 1234) + endif(WORDS_BIGENDIAN) + else() + include(${wxEXPAT_DIR}/ConfigureChecks.cmake) + endif() + + # Also define some options normally set by Expat's CMakeLists.txt. + set(XML_DTD 1) + set(XML_GE 1) + set(XML_NS 1) + set(XML_CONTEXT_BYTES 1024) + + configure_file(${wxEXPAT_DIR}/expat_config.h.cmake + ${wxBINARY_DIR}/libs/expat/expat_config.h + ) + wx_add_builtin_library(wxexpat src/expat/expat/lib/xmlparse.c src/expat/expat/lib/xmlrole.c src/expat/expat/lib/xmltok.c ) + + target_include_directories(wxexpat PRIVATE ${wxBINARY_DIR}/libs/expat) + target_compile_definitions(wxexpat PRIVATE HAVE_EXPAT_CONFIG_H) + set(EXPAT_LIBRARIES wxexpat) - set(EXPAT_INCLUDE_DIRS ${wxSOURCE_DIR}/src/expat/expat/lib) -elseif(wxUSE_EXPAT) - find_package(EXPAT REQUIRED) + set(EXPAT_INCLUDE_DIRS ${wxEXPAT_DIR}/lib) endif() diff --git a/build/cmake/lib/gl/CMakeLists.txt b/build/cmake/lib/gl/CMakeLists.txt index dc49b18345ce..177b12e126d1 100644 --- a/build/cmake/lib/gl/CMakeLists.txt +++ b/build/cmake/lib/gl/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_OPENGL) + wx_append_install_headers(OPENGL_CMN_HDR) + return() +endif() + wx_append_sources(GL_FILES OPENGL_CMN) if(WXMSW) @@ -19,6 +24,8 @@ elseif(WXOSX_IPHONE) wx_append_sources(GL_FILES OPENGL_OSX_IPHONE) elseif(WXQT) wx_append_sources(GL_FILES OPENGL_QT) +elseif(WXX11) + wx_append_sources(GL_FILES OPENGL_X11) endif() wx_add_library(wxgl ${GL_FILES}) diff --git a/build/cmake/lib/html/CMakeLists.txt b/build/cmake/lib/html/CMakeLists.txt index 3fd0ebd0413c..ea445c18db97 100644 --- a/build/cmake/lib/html/CMakeLists.txt +++ b/build/cmake/lib/html/CMakeLists.txt @@ -7,9 +7,14 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_HTML) + wx_append_install_headers(HTML_CMN_HDR) + return() +endif() + wx_append_sources(HTML_FILES HTML_CMN) -if(WIN32 OR wxUSE_LIBMSPACK) +if(WXMSW OR wxUSE_LIBMSPACK) wx_append_sources(HTML_FILES HTML_MSW) endif() diff --git a/build/cmake/lib/jpeg.cmake b/build/cmake/lib/jpeg.cmake index 77014944a739..5146788673a5 100644 --- a/build/cmake/lib/jpeg.cmake +++ b/build/cmake/lib/jpeg.cmake @@ -7,6 +7,14 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_LIBJPEG STREQUAL "sys") + find_package(JPEG) + if(NOT JPEG_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_LIBJPEG builtin) + endif() +endif() + if(wxUSE_LIBJPEG STREQUAL "builtin") wx_add_builtin_library(wxjpeg src/jpeg/jaricom.c @@ -62,6 +70,4 @@ if(wxUSE_LIBJPEG STREQUAL "builtin") ) set(JPEG_LIBRARIES wxjpeg) set(JPEG_INCLUDE_DIR ${wxSOURCE_DIR}/src/jpeg) -elseif(wxUSE_LIBJPEG) - find_package(JPEG REQUIRED) endif() diff --git a/build/cmake/lib/media/CMakeLists.txt b/build/cmake/lib/media/CMakeLists.txt index 0c5e59184afa..3fbe4b12ed77 100644 --- a/build/cmake/lib/media/CMakeLists.txt +++ b/build/cmake/lib/media/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_MEDIACTRL) + wx_append_install_headers(MEDIA_CMN_HDR) + return() +endif() + wx_append_sources(MEDIA_FILES MEDIA_CMN) if(WXMSW) @@ -17,8 +22,11 @@ elseif(WXOSX_IPHONE) wx_append_sources(MEDIA_FILES MEDIA_OSX_IPHONE) elseif(WXGTK) wx_append_sources(MEDIA_FILES MEDIA_UNIX) + wx_append_sources(MEDIA_FILES MEDIA_GTK) elseif(WXQT) wx_append_sources(MEDIA_FILES MEDIA_QT) +elseif(WXX11) + wx_append_sources(MEDIA_FILES MEDIA_UNIX) endif() wx_add_library(wxmedia ${MEDIA_FILES}) diff --git a/build/cmake/lib/nanosvg.cmake b/build/cmake/lib/nanosvg.cmake index 401bf48fcf15..2135799a3ed7 100644 --- a/build/cmake/lib/nanosvg.cmake +++ b/build/cmake/lib/nanosvg.cmake @@ -7,6 +7,14 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_NANOSVG STREQUAL "sys") + find_package(NanoSVG) + if(NOT NanoSVG_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_NANOSVG builtin) + endif() +endif() + if(wxUSE_NANOSVG STREQUAL "builtin") set(wxUSE_NANOSVG_EXTERNAL 0 PARENT_SCOPE) elseif(wxUSE_NANOSVG) @@ -16,8 +24,6 @@ elseif(wxUSE_NANOSVG) set(NANOSVG_INCLUDE_DIRS ) set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL TRUE) - find_package(NanoSVG REQUIRED) - foreach(TARGETNAME NanoSVG::nanosvg NanoSVG::nanosvgrast unofficial::nanosvg) if(NOT TARGET ${TARGETNAME}) continue() diff --git a/build/cmake/lib/net/CMakeLists.txt b/build/cmake/lib/net/CMakeLists.txt index 169c46b8adaa..8d97c960009a 100644 --- a/build/cmake/lib/net/CMakeLists.txt +++ b/build/cmake/lib/net/CMakeLists.txt @@ -7,6 +7,12 @@ # Licence: wxWindows licence ############################################################################# +# wxNet should be built if either wxUSE_SOCKETS or wxUSE_WEBREQUEST is on. +if(NOT wxUSE_SOCKETS AND NOT wxUSE_WEBREQUEST) + wx_append_install_headers(NET_CMN_HDR) + return() +endif() + wx_append_sources(NET_FILES NET_CMN) if(WIN32) @@ -31,5 +37,5 @@ endif() if (wxUSE_WEBREQUEST_CURL) wx_lib_include_directories(wxnet ${CURL_INCLUDE_DIRS}) - wx_lib_link_libraries(wxnet PRIVATE ${CURL_LIBRARIES}) + wx_lib_link_libraries(wxnet PUBLIC ${CURL_LIBRARIES}) endif() diff --git a/build/cmake/lib/png.cmake b/build/cmake/lib/png.cmake index 13ddab58e06b..8f64bf4a2e3d 100644 --- a/build/cmake/lib/png.cmake +++ b/build/cmake/lib/png.cmake @@ -7,6 +7,14 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_LIBPNG STREQUAL "sys") + find_package(PNG) + if(NOT PNG_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_LIBPNG builtin) + endif() +endif() + if(wxUSE_LIBPNG STREQUAL "builtin") # TODO: implement building libpng via its CMake file, using # add_subdirectory or ExternalProject_Add @@ -53,6 +61,4 @@ if(wxUSE_LIBPNG STREQUAL "builtin") target_link_libraries(wxpng PRIVATE ${ZLIB_LIBRARIES}) set(PNG_LIBRARIES wxpng) set(PNG_INCLUDE_DIRS ${wxSOURCE_DIR}/src/png) -elseif(wxUSE_LIBPNG) - find_package(PNG REQUIRED) endif() diff --git a/build/cmake/lib/propgrid/CMakeLists.txt b/build/cmake/lib/propgrid/CMakeLists.txt index 71f2690d6bda..b41c7ea8cfdf 100644 --- a/build/cmake/lib/propgrid/CMakeLists.txt +++ b/build/cmake/lib/propgrid/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_PROPGRID) + wx_append_install_headers(PROPGRID_HDR) + return() +endif() + wx_append_sources(PROPGRID_FILES PROPGRID) wx_add_library(wxpropgrid ${PROPGRID_FILES}) diff --git a/build/cmake/lib/qa/CMakeLists.txt b/build/cmake/lib/qa/CMakeLists.txt index 1efa85e25542..3876fa1f4946 100644 --- a/build/cmake/lib/qa/CMakeLists.txt +++ b/build/cmake/lib/qa/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_DEBUGREPORT) + wx_append_install_headers(QA_HDR) + return() +endif() + wx_append_sources(QA_FILES QA) wx_add_library(wxqa ${QA_FILES}) diff --git a/build/cmake/lib/regex.cmake b/build/cmake/lib/regex.cmake index 41eadda877cb..136b5499a54c 100644 --- a/build/cmake/lib/regex.cmake +++ b/build/cmake/lib/regex.cmake @@ -7,6 +7,17 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_REGEX STREQUAL "sys") + find_package(PCRE2) + if(NOT PCRE2_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_REGEX builtin) + else() + set(REGEX_LIBRARIES ${PCRE2_LIBRARIES}) + set(REGEX_INCLUDE_DIRS ${PCRE2_INCLUDE_DIRS}) + endif() +endif() + if(wxUSE_REGEX STREQUAL "builtin") # TODO: implement building PCRE2 via its CMake file, using # add_subdirectory or ExternalProject_Add @@ -43,8 +54,4 @@ if(wxUSE_REGEX STREQUAL "builtin") set(REGEX_INCLUDE_DIRS ${wxSOURCE_DIR}/3rdparty/pcre/src/wx) target_compile_definitions(wxregex PRIVATE __WX__ HAVE_CONFIG_H) target_include_directories(wxregex PRIVATE ${wxSETUP_HEADER_PATH} ${wxSOURCE_DIR}/include ${REGEX_INCLUDE_DIRS}) -elseif(wxUSE_REGEX) - find_package(PCRE2 REQUIRED) - set(REGEX_LIBRARIES ${PCRE2_LIBRARIES}) - set(REGEX_INCLUDE_DIRS ${PCRE2_INCLUDE_DIRS}) endif() diff --git a/build/cmake/lib/ribbon/CMakeLists.txt b/build/cmake/lib/ribbon/CMakeLists.txt index a35e55161470..5a9ef8f57d9d 100644 --- a/build/cmake/lib/ribbon/CMakeLists.txt +++ b/build/cmake/lib/ribbon/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_RIBBON) + wx_append_install_headers(RIBBON_HDR) + return() +endif() + wx_append_sources(RIBBON_FILES RIBBON) wx_add_library(wxribbon ${RIBBON_FILES}) diff --git a/build/cmake/lib/richtext/CMakeLists.txt b/build/cmake/lib/richtext/CMakeLists.txt index 89c618fd6986..013806c0c4b6 100644 --- a/build/cmake/lib/richtext/CMakeLists.txt +++ b/build/cmake/lib/richtext/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_RICHTEXT) + wx_append_install_headers(RICHTEXT_HDR) + return() +endif() + wx_append_sources(RICHTEXT_FILES RICHTEXT) wx_add_library(wxrichtext ${RICHTEXT_FILES}) diff --git a/build/cmake/lib/stc/CMakeLists.txt b/build/cmake/lib/stc/CMakeLists.txt index 1116186833b0..6d68fa1a4cf3 100644 --- a/build/cmake/lib/stc/CMakeLists.txt +++ b/build/cmake/lib/stc/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_STC) + wx_append_install_headers(STC_CMN_HDR) + return() +endif() + wx_append_sources(STC_FILES STC_CMN) if(WXOSX_COCOA) diff --git a/build/cmake/lib/tiff.cmake b/build/cmake/lib/tiff.cmake index f77e5283de33..8ef1eb966f94 100644 --- a/build/cmake/lib/tiff.cmake +++ b/build/cmake/lib/tiff.cmake @@ -7,6 +7,15 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_LIBTIFF STREQUAL "sys") + find_package(TIFF) + mark_as_advanced(Tiff_DIR) + if(NOT TIFF_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_LIBTIFF builtin) + endif() +endif() + if(wxUSE_LIBTIFF STREQUAL "builtin") # TODO: implement building libtiff via its CMake file, using # add_subdirectory or ExternalProject_Add @@ -74,6 +83,4 @@ if(wxUSE_LIBTIFF STREQUAL "builtin") target_link_libraries(wxtiff PRIVATE ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES}) set(TIFF_LIBRARIES wxtiff) set(TIFF_INCLUDE_DIRS ${wxSOURCE_DIR}/src/tiff/libtiff) -elseif(wxUSE_LIBTIFF) - find_package(TIFF REQUIRED) endif() diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index d8bf88459826..607dc3bd7453 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -7,17 +7,25 @@ # Licence: wxWindows licence ############################################################################# -function(wx_webview_copy_webview2_loader target) - if(NOT WXMSW OR NOT wxUSE_WEBVIEW_EDGE OR NOT TARGET ${target}) - return() - endif() +if(NOT wxUSE_WEBVIEW) + wx_append_install_headers(WEBVIEW_CMN_HDR) + return() +endif() +macro(wx_set_webview2_arch) if(wxPLATFORM_ARCH) set(WEBVIEW2_ARCH ${wxPLATFORM_ARCH}) else() set(WEBVIEW2_ARCH x86) endif() +endmacro() + +function(wx_webview_copy_webview2_loader target) + if(NOT WXMSW OR NOT wxUSE_WEBVIEW_EDGE OR NOT TARGET ${target}) + return() + endif() + wx_set_webview2_arch() add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${WEBVIEW2_PACKAGE_DIR}/build/native/${WEBVIEW2_ARCH}/WebView2Loader.dll" @@ -26,15 +34,10 @@ endfunction() wx_append_sources(WEBVIEW_FILES WEBVIEW_CMN) - if(WXMSW) wx_append_sources(WEBVIEW_FILES WEBVIEW_MSW) elseif(WXGTK) - if(wxUSE_WEBVIEW_WEBKIT2) - wx_append_sources(WEBVIEW_FILES WEBVIEW2_GTK) - elseif(wxUSE_WEBVIEW_WEBKIT) - wx_append_sources(WEBVIEW_FILES WEBVIEW_GTK) - endif() + wx_append_sources(WEBVIEW_FILES WEBVIEW_GTK) elseif(APPLE) wx_append_sources(WEBVIEW_FILES WEBVIEW_OSX_SHARED) endif() @@ -46,9 +49,14 @@ if(APPLE) elseif(WXMSW) if(wxUSE_WEBVIEW_EDGE) # Update the following variables if updating WebView2 SDK - set(WEBVIEW2_VERSION "1.0.705.50") + # Also update this version and the _INTERFACE_DEFINED_ check in + # include/wx/msw/private/webview_edge.h and interface/wx/webview.h + set(WEBVIEW2_VERSION "1.0.3485.44") set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}") - set(WEBVIEW2_SHA256 "6a34bb553e18cfac7297b4031f3eac2558e439f8d16a45945c22945ac404105d") + # When updating the above version of WebView2, download the nupkg from the above URL. + # Then, from a PowerShell session, call Get-FileHash on the downloaded nupkg file to get its SHA256 + # to update here. + set(WEBVIEW2_SHA256 "BC09150B179246AC90189649B13BE8E6B11B3AC200E817E18DF106E1F3CF489E") set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}") @@ -62,13 +70,34 @@ elseif(WXMSW) ${WEBVIEW2_DEFAULT_PACKAGE_DIR} ) + if (WEBVIEW2_PACKAGE_DIR) + get_filename_component(currentDir ${WEBVIEW2_PACKAGE_DIR} DIRECTORY) + get_filename_component(targetDir ${WEBVIEW2_DEFAULT_PACKAGE_DIR} DIRECTORY) + if (currentDir STREQUAL targetDir) + get_filename_component(currentVersion ${WEBVIEW2_PACKAGE_DIR} NAME) + string(SUBSTRING ${currentVersion} 23 -1 currentVersion) + if(${currentVersion} VERSION_LESS ${WEBVIEW2_VERSION}) + message(STATUS "Found outdated WebView2 SDK, downloading...") + unset(WEBVIEW2_PACKAGE_DIR CACHE) + endif() + endif() + else() + message(STATUS "WebView2 SDK not found, downloading...") + endif() + if (NOT WEBVIEW2_PACKAGE_DIR) - message(STATUS "WebView2 SDK not found locally, downloading...") set(WEBVIEW2_PACKAGE_DIR ${WEBVIEW2_DEFAULT_PACKAGE_DIR} CACHE PATH "WebView2 SDK PATH" FORCE) file(DOWNLOAD ${WEBVIEW2_URL} ${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget - EXPECTED_HASH SHA256=${WEBVIEW2_SHA256}) + EXPECTED_HASH SHA256=${WEBVIEW2_SHA256} + STATUS DOWNLOAD_RESULT) + # Check that the download was successful. + list(GET DOWNLOAD_RESULT 0 DOWNLOAD_RESULT_NUM) + if(NOT ${DOWNLOAD_RESULT_NUM} EQUAL 0) + list(GET DOWNLOAD_RESULT 1 DOWNLOAD_RESULT_STR) + message(FATAL_ERROR "Error ${DOWNLOAD_RESULT_NUM} downloading WebView2 SDK: ${DOWNLOAD_RESULT_STR}.") + endif() file(MAKE_DIRECTORY ${WEBVIEW2_PACKAGE_DIR}) execute_process(COMMAND "${CMAKE_COMMAND}" -E tar x "${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget" @@ -86,8 +115,9 @@ elseif(WXMSW) endif() if (wxUSE_WEBVIEW_EDGE_STATIC) - target_link_directories(wxwebview PUBLIC - $ + wx_set_webview2_arch() + wx_lib_link_directories(wxwebview PUBLIC + $ ) else() wx_webview_copy_webview2_loader(wxwebview) @@ -110,7 +140,7 @@ endif() # webkit extension plugin # we can't use (all of the) macros and functions because this library should -# always be build as a shared libary, and not included in the monolithic build. +# always be built as a shared library, and not included in the monolithic build. if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) wx_append_sources(WEBKIT2_EXT_FILES WEBVIEW_WEBKIT2_EXTENSION) add_library(wxwebkit2_ext SHARED ${WEBKIT2_EXT_FILES}) @@ -150,7 +180,9 @@ if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) ${WEBKIT2_LIBRARIES} ) - wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION "lib/wx/${WX_WEB_EXT_VERSION}/web-extensions") + wx_get_install_platform_dir(library) + + wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION "${library_dir}/wx/${WX_WEB_EXT_VERSION}/web-extensions") wx_add_dependencies(wxwebview wxwebkit2_ext) endif() diff --git a/build/cmake/lib/xml/CMakeLists.txt b/build/cmake/lib/xml/CMakeLists.txt index d4690a0afb5d..623e06c5ad21 100644 --- a/build/cmake/lib/xml/CMakeLists.txt +++ b/build/cmake/lib/xml/CMakeLists.txt @@ -7,6 +7,11 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_XML) + wx_append_install_headers(XML_HDR) + return() +endif() + wx_append_sources(XML_FILES XML) wx_add_library(wxxml IS_BASE ${XML_FILES}) wx_lib_link_libraries(wxxml PRIVATE ${EXPAT_LIBRARIES}) diff --git a/build/cmake/lib/xrc/CMakeLists.txt b/build/cmake/lib/xrc/CMakeLists.txt index 453525eab551..ce1ba8630976 100644 --- a/build/cmake/lib/xrc/CMakeLists.txt +++ b/build/cmake/lib/xrc/CMakeLists.txt @@ -7,7 +7,17 @@ # Licence: wxWindows licence ############################################################################# +if(NOT wxUSE_XRC) + wx_append_install_headers(XRC_HDR) + return() +endif() + wx_append_sources(XRC_FILES XRC) wx_add_library(wxxrc ${XRC_FILES}) -wx_lib_link_libraries(wxxrc PRIVATE wxhtml wxxml) +if(wxUSE_XML) + wx_lib_link_libraries(wxxrc PRIVATE wxxml) +endif() +if(wxUSE_HTML) + wx_lib_link_libraries(wxxrc PRIVATE wxhtml) +endif() diff --git a/build/cmake/lib/zlib.cmake b/build/cmake/lib/zlib.cmake index 8814adbf28a5..b3c9f552db43 100644 --- a/build/cmake/lib/zlib.cmake +++ b/build/cmake/lib/zlib.cmake @@ -7,6 +7,14 @@ # Licence: wxWindows licence ############################################################################# +if(wxUSE_ZLIB STREQUAL "sys") + find_package(ZLIB) + if(NOT ZLIB_FOUND) + # If the sys library can not be found use builtin + wx_option_force_value(wxUSE_ZLIB builtin) + endif() +endif() + if(wxUSE_ZLIB STREQUAL "builtin") # TODO: implement building zlib via its CMake file, using # add_subdirectory or ExternalProject_Add @@ -27,17 +35,17 @@ if(wxUSE_ZLIB STREQUAL "builtin") src/zlib/uncompr.c src/zlib/zutil.c ) - if(WIN32) + if(MSVC) # Define this to get rid of many warnings about using open(), # read() and other POSIX functions in zlib code. This is much # more convenient than having to modify it to avoid them. target_compile_definitions(wxzlib PRIVATE _CRT_NONSTDC_NO_WARNINGS) endif() + # Tell our modified zconf.h to include wx/setup.h. + target_compile_definitions(wxzlib PRIVATE wxHAVE_SETUP_H=1) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") target_compile_options(wxzlib PRIVATE -Wno-deprecated-non-prototype) endif() set(ZLIB_LIBRARIES wxzlib) set(ZLIB_INCLUDE_DIRS ${wxSOURCE_DIR}/src/zlib) -elseif(wxUSE_ZLIB) - find_package(ZLIB REQUIRED) endif() diff --git a/build/cmake/locale/CMakeLists.txt b/build/cmake/locale/CMakeLists.txt new file mode 100644 index 000000000000..0d14533c6ff0 --- /dev/null +++ b/build/cmake/locale/CMakeLists.txt @@ -0,0 +1,43 @@ +if(wxBUILD_LOCALES) + if(wxBUILD_LOCALES STREQUAL "ON") + find_package(Gettext) + else() # wxBUILD_LOCALES is AUTO, don't give any messages if Gettext is not available + find_package(Gettext QUIET) + endif() + if(NOT GETTEXT_FOUND) + if(wxBUILD_LOCALES STREQUAL "ON") + message(FATAL_ERROR "Translations can't be built without gettext: either install it or don't set wxBUILD_LOCALES to ON") + endif() + wx_option_force_value(wxBUILD_LOCALES OFF) + endif() +endif() + +mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) + +if(NOT wxBUILD_LOCALES) + return() +endif() + +# list and process the po files +file(GLOB _po_files "${wxSOURCE_DIR}/locale/*.po") +foreach(_po_file ${_po_files}) + get_filename_component(name "${_po_file}" NAME) + string(REGEX REPLACE "\\.[^.]*$" "" lang ${name}) + + gettext_process_po_files(${lang} ALL PO_FILES "${_po_file}") + + wx_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo" + DESTINATION "share/locale/${lang}/LC_MESSAGES" + RENAME "wxstd-${wxMAJOR_VERSION}.${wxMINOR_VERSION}.mo" + ) +endforeach() + +# put all pofiles targets in a group to not clutter visual studio +set(base_name "pofiles") +set(target_index 0) +set(target_name ${base_name}) +while(TARGET ${target_name}) + set_target_properties(${target_name} PROPERTIES FOLDER "Locales") + math(EXPR target_index "${target_index}+1") + set(target_name "${base_name}_${target_index}") +endwhile() diff --git a/build/cmake/main.cmake b/build/cmake/main.cmake index 9783d4563c0c..85dd228802e7 100644 --- a/build/cmake/main.cmake +++ b/build/cmake/main.cmake @@ -9,6 +9,8 @@ list(APPEND CMAKE_MODULE_PATH "${wxSOURCE_DIR}/build/cmake/modules") +file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) + include(build/cmake/files.cmake) # Files list include(build/cmake/source_groups.cmake) # Source group definitions include(build/cmake/functions.cmake) # wxWidgets functions @@ -17,6 +19,7 @@ include(build/cmake/options.cmake) # User options include(build/cmake/init.cmake) # Init various global build vars include(build/cmake/pch.cmake) # Precompiled header support +add_subdirectory(build/cmake/locale locale) add_subdirectory(build/cmake/lib libs) add_subdirectory(build/cmake/utils utils) @@ -44,9 +47,7 @@ endif() if(WIN32_MSVC_NAMING) include(build/cmake/build_cfg.cmake) -endif() - -if(NOT MSVC) +else() # Write wx-config include(build/cmake/config.cmake) endif() @@ -77,6 +78,20 @@ endif() # Print configuration summary wx_print_thirdparty_library_summary() +# Avoid printing out the message if we're being reconfigured and nothing has +# changed since the previous run, so check if the current summary differs from +# the cached value. +set(wxSUMMARY_NOW + "${CMAKE_SYSTEM_NAME}-${wxVERSION}-${wxREQUIRED_OS_DESC}-" + "${wxBUILD_TOOLKIT}-${wxTOOLKIT_VERSION}-${wxTOOLKIT_EXTRA}-" + "${wxBUILD_MONOLITHIC}-${wxBUILD_SHARED}-${wxBUILD_COMPATIBILITY}-" +) +if("${wxSUMMARY_NOW}" STREQUAL "${wxSUMMARY}") + return() +endif() + +set(wxSUMMARY ${wxSUMMARY_NOW} CACHE INTERNAL "internal summary of wxWidgets build options") + if(wxTOOLKIT_EXTRA) string(REPLACE ";" ", " wxTOOLKIT_DESC "${wxTOOLKIT_EXTRA}") set(wxTOOLKIT_DESC "with support for: ${wxTOOLKIT_DESC}") @@ -88,5 +103,5 @@ message(STATUS "Configured wxWidgets ${wxVERSION} for ${CMAKE_SYSTEM_NAME} Should wxWidgets be compiled into single library? ${wxBUILD_MONOLITHIC} Should wxWidgets be linked as a shared library? ${wxBUILD_SHARED} Should wxWidgets support Unicode? ${wxUSE_UNICODE} - What wxWidgets compatibility level should be used? ${wxBUILD_COMPATIBILITY}" + Which wxWidgets API compatibility should be used? ${wxBUILD_COMPATIBILITY}" ) diff --git a/build/cmake/modules/FindGTK2.cmake b/build/cmake/modules/FindGTK2.cmake new file mode 100644 index 000000000000..266056baad8b --- /dev/null +++ b/build/cmake/modules/FindGTK2.cmake @@ -0,0 +1,63 @@ +# - Try to find GTK+ 2 +# Once done, this will define +# +# GTK2_FOUND - system has GTK+ 2. +# GTK2_INCLUDE_DIRS - the GTK+ 2. include directories +# GTK2_LIBRARIES - link these to use GTK+ 2. +# +# Copyright (C) 2012 Raphael Kubo da Costa +# Copyright (C) 2013 Igalia S.L. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +find_package(PkgConfig) +pkg_check_modules(GTK2 QUIET gtk+-2.0) +set(VERSION_OK TRUE) +if (GTK2_VERSION) +if (GTK2_FIND_VERSION_EXACT) +if (NOT("${GTK2_FIND_VERSION}" VERSION_EQUAL "${GTK2_VERSION}")) +set(VERSION_OK FALSE) +endif () +else () +if ("${GTK2_VERSION}" VERSION_LESS "${GTK2_FIND_VERSION}") +set(VERSION_OK FALSE) +endif () +endif () +endif () + +# silence output +set(GTK2_FIND_QUIETLY_TEMP ${GTK2_FIND_QUIETLY}) +set(GTK2_FIND_QUIETLY TRUE) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2 DEFAULT_MSG GTK2_INCLUDE_DIRS GTK2_LIBRARIES VERSION_OK) + +set(GTK2_FIND_QUIETLY ${GTK2_FIND_QUIETLY_TEMP}) + +mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES) + +# not found using PkgConfig, use CMake's FindGTK2 +if(NOT GTK2_FOUND) + set(CMAKE_MODULE_PATH_TEMP ${CMAKE_MODULE_PATH}) + set(CMAKE_MODULE_PATH "") + find_package(GTK2) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_TEMP}) +endif() diff --git a/build/cmake/modules/FindSDL2.cmake b/build/cmake/modules/FindSDL2.cmake index 3878427d8c79..79c42b0d7d5d 100644 --- a/build/cmake/modules/FindSDL2.cmake +++ b/build/cmake/modules/FindSDL2.cmake @@ -172,4 +172,4 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) -MARK_AS_ADVANCED(SDL2MAIN_LIBRARY SDL2_LIBRARY SDL2_INCLUDE_DIR) +MARK_AS_ADVANCED(SDL2MAIN_LIBRARY SDL2_LIBRARY SDL2_INCLUDE_DIR SDL2_LIBRARY_TEMP) diff --git a/build/cmake/modules/cotire.cmake b/build/cmake/modules/cotire.cmake index 09b52a629c85..076150aa1888 100644 --- a/build/cmake/modules/cotire.cmake +++ b/build/cmake/modules/cotire.cmake @@ -37,13 +37,13 @@ set(__COTIRE_INCLUDED TRUE) if (NOT CMAKE_SCRIPT_MODE_FILE) cmake_policy(PUSH) endif() -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5...4.1) if (NOT CMAKE_SCRIPT_MODE_FILE) cmake_policy(POP) endif() set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") -set (COTIRE_CMAKE_MODULE_VERSION "1.8.0") +set (COTIRE_CMAKE_MODULE_VERSION "1.8.1") # activate select policies if (POLICY CMP0025) @@ -111,7 +111,6 @@ if (POLICY CMP0055) cmake_policy(SET CMP0055 NEW) endif() -include(CMakeParseArguments) include(ProcessorCount) function (cotire_get_configuration_types _configsVar) @@ -1068,10 +1067,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar) set (${_headerIsIgnoredVar} TRUE) elseif (IS_DIRECTORY "${_headerFile}") set (${_headerIsIgnoredVar} TRUE) - elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$") - # heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path + elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed") + # heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path # these often stem from using GCC #include_next tricks, which may break the precompiled header compilation - # with the error message "error: no include path in which to search for header.h" + # with the error message "error: no include path in which to search for header" set (${_headerIsIgnoredVar} TRUE) else() set (${_headerIsIgnoredVar} FALSE) @@ -1695,6 +1694,9 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio endif() endif() else() + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) + file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative) # Clang-cl.exe options used # /Yc creates a precompiled header file # /Fp specifies precompiled header binary file name @@ -1707,10 +1709,10 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio if (_flags) # append to list list (APPEND _flags "${_sourceFileType${_language}}" - "/Yc${_prefixFile}" "/Fp${_pchFile}" "/FI${_prefixFile}" /Zs "${_hostFile}") + "/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}") else() # return as a flag string - set (_flags "/Yc\"${_prefixFile}\" /Fp\"${_pchFile}\" /FI\"${_prefixFile}\"") + set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") endif() endif() elseif (_compilerID MATCHES "Intel") @@ -1845,26 +1847,28 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV set (_flags "-include \"${_prefixFile}\"") endif() else() + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) # Clang-cl.exe options used # /Yu uses a precompiled header file during build # /Fp specifies precompiled header binary file name # /FI forces inclusion of file if (_pchFile) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) if (_flags) # append to list - list (APPEND _flags "/Yu${_prefixFile}" "/Fp${_pchFile}" "/FI${_prefixFile}") + list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}") else() # return as a flag string - set (_flags "/Yu\"${_prefixFile}\" /Fp\"${_pchFile}\" /FI\"${_prefixFile}\"") + set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") endif() else() # no precompiled header, force inclusion of prefix header if (_flags) # append to list - list (APPEND _flags "/FI${_prefixFile}") + list (APPEND _flags "/FI${_prefixFileNative}") else() # return as a flag string - set (_flags "/FI\"${_prefixFile}\"") + set (_flags "/FI\"${_prefixFileNative}\"") endif() endif() endif() @@ -2046,8 +2050,10 @@ function (cotire_check_precompiled_header_support _language _target _msgVar) else() set (_ccacheExe "${_launcher}") endif() + # ccache 3.7.0 replaced --print-config with --show-config + # use -p instead, which seems to work for all version for now, sigh execute_process( - COMMAND "${_ccacheExe}" "--print-config" + COMMAND "${_ccacheExe}" "-p" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" RESULT_VARIABLE _result OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE @@ -2396,6 +2402,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags) set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + if (COTIRE_DEBUG) + message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}") + endif() set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}") # make object file generated from host file depend on prefix header set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}") @@ -2448,6 +2457,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + if (COTIRE_DEBUG) + message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}") + endif() # make object files generated from source files depend on precompiled header set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") endif() @@ -2461,6 +2473,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + if (COTIRE_DEBUG) + message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}") + endif() # mark sources as cotired to prevent them from being used in another cotired target set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") endif() @@ -2478,6 +2493,9 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile) "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + if (COTIRE_DEBUG) + message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}") + endif() # mark sources as cotired to prevent them from being used in another cotired target set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") # make object files generated from source files depend on prefix header @@ -2595,6 +2613,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget) "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _options) set_property(TARGET ${_target} APPEND PROPERTY ${_options}) + if (COTIRE_DEBUG) + message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}") + endif() endif() endif() endif() diff --git a/build/cmake/modules/cotire_test/CMakeLists.txt b/build/cmake/modules/cotire_test/CMakeLists.txt index dd1426208f2d..c649767096ee 100644 --- a/build/cmake/modules/cotire_test/CMakeLists.txt +++ b/build/cmake/modules/cotire_test/CMakeLists.txt @@ -1,6 +1,6 @@ # cotire example project -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5...4.1) if (POLICY CMP0058) # Ninja requires custom command byproducts to be explicit @@ -10,11 +10,8 @@ endif() project (CotireExample) set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/..") - -if (NOT CMAKE_VERSION VERSION_LESS "3.1.0") - set (CMAKE_CXX_STANDARD "98") - set (CMAKE_CXX_EXTENSIONS OFF) -endif() +set (CMAKE_CXX_STANDARD "98") +set (CMAKE_CXX_EXTENSIONS OFF) include(cotire) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 84a12331c481..b2d893a9d2ef 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -16,11 +16,13 @@ wx_option(wxBUILD_TESTS "Build console tests (CONSOLE_ONLY) or ALL" OFF STRINGS CONSOLE_ONLY ALL OFF) wx_option(wxBUILD_DEMOS "Build demos" OFF) wx_option(wxBUILD_BENCHMARKS "Build benchmarks" OFF) +wx_option_auto(wxBUILD_LOCALES "Build locales") +mark_as_advanced(wxBUILD_LOCALES) wx_option(wxBUILD_PRECOMP "Use precompiled headers" ON STRINGS ON OFF COTIRE) mark_as_advanced(wxBUILD_PRECOMP) wx_option(wxBUILD_INSTALL "Create install/uninstall target for wxWidgets") wx_option(wxBUILD_COMPATIBILITY - "enable compatibilty with earlier wxWidgets versions" 3.0 STRINGS 2.8 3.0 3.1) + "enable compatibilty with earlier wxWidgets versions" 3.0 STRINGS 2.8 3.0 3.1 NONE) mark_as_advanced(wxBUILD_COMPATIBILITY) # Allow user specified setup.h folder set(wxBUILD_CUSTOM_SETUP_HEADER_PATH "" CACHE PATH "Include path containing custom wx/setup.h") @@ -34,7 +36,11 @@ wx_option(wxBUILD_DEBUG_LEVEL "Debug Level" Default STRINGS Default 0 1 2) mark_as_advanced(wxBUILD_DEBUG_LEVEL) if(NOT APPLE) - wx_option(wxBUILD_USE_STATIC_RUNTIME "Link using the static runtime library" OFF) + set(wxBUILD_USE_STATIC_RUNTIME_DEFAULT OFF) + if(MSVC AND CMAKE_MSVC_RUNTIME_LIBRARY AND NOT CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL") + set(wxBUILD_USE_STATIC_RUNTIME_DEFAULT ON) + endif() + wx_option(wxBUILD_USE_STATIC_RUNTIME "Link using the static runtime library" ${wxBUILD_USE_STATIC_RUNTIME_DEFAULT}) mark_as_advanced(wxBUILD_USE_STATIC_RUNTIME) endif() @@ -51,7 +57,7 @@ if(NOT MSVC OR MSVC_VERSION GREATER 1800) set(wxCXX_STANDARD_DEFAULT COMPILER_DEFAULT) endif() wx_option(wxBUILD_CXX_STANDARD "C++ standard used to build wxWidgets targets" - ${wxCXX_STANDARD_DEFAULT} STRINGS COMPILER_DEFAULT 98 11 14 17 20) + ${wxCXX_STANDARD_DEFAULT} STRINGS COMPILER_DEFAULT 98 11 14 17 20 23 26) endif() if(UNIX) @@ -78,6 +84,35 @@ wx_option(wxBUILD_PIC "Enable position independent code (PIC)." ON) mark_as_advanced(wxBUILD_PIC) wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF) +set(wxBUILD_INSTALL_RUNTIME_DIR "" CACHE STRING "override default sub-directory to install runtime files") +mark_as_advanced(wxBUILD_INSTALL_RUNTIME_DIR) +set(wxBUILD_INSTALL_LIBRARY_DIR "" CACHE STRING "override default sub-directory to install library files") +mark_as_advanced(wxBUILD_INSTALL_LIBRARY_DIR) +set(wxBUILD_INSTALL_ARCHIVE_DIR "" CACHE STRING "override default sub-directory to install archive files") +mark_as_advanced(wxBUILD_INSTALL_ARCHIVE_DIR) +wx_option(wxBUILD_INSTALL_PLATFORM_SUBDIR "use platform specific sub-directory (MSVC-naming)" ON) +mark_as_advanced(wxBUILD_INSTALL_PLATFORM_SUBDIR) +wx_option(wxBUILD_INSTALL_PDB "install pdb files in the runtime directory (MSVC-naming)" OFF) +mark_as_advanced(wxBUILD_INSTALL_PDB) +wx_option(wxBUILD_INSTALL_USE_SYMLINK "use symlinks when possible, disable to always use copy" ON) +mark_as_advanced(wxBUILD_INSTALL_USE_SYMLINK) + +# Use the MSVC/makefile naming convention, or the configure naming convention, +# this is the same check as used in FindwxWidgets. +wx_option_auto(wxBUILD_WIN32_MSVC_NAMING "Force the MSVC / makefile.[gcc/vc] naming convention") +mark_as_advanced(wxBUILD_WIN32_MSVC_NAMING) +if(wxBUILD_WIN32_MSVC_NAMING STREQUAL "AUTO") + if(MSVC) + set(WIN32_MSVC_NAMING 1) + elseif(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING) + set(WIN32_MSVC_NAMING 1) + else() + set(WIN32_MSVC_NAMING 0) + endif() +else() + set(WIN32_MSVC_NAMING ${wxBUILD_WIN32_MSVC_NAMING}) +endif() + # STL options wx_option(wxUSE_STL "use standard C++ classes for everything" OFF) set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes") @@ -94,7 +129,7 @@ if(NOT WIN32) wx_option(wxUSE_VISIBILITY "use of ELF symbols visibility") endif() wx_option(wxUSE_UNSAFE_WXSTRING_CONV "provide unsafe implicit conversions in wxString to const char* or std::string") -wx_option(wxUSE_REPRODUCIBLE_BUILD "enable reproducable build" OFF) +wx_option(wxUSE_REPRODUCIBLE_BUILD "enable reproducible build" OFF) # --------------------------------------------------------------------------- # external libraries @@ -111,6 +146,7 @@ if(wxUSE_UNICODE AND (NOT DEFINED wxUSE_UNICODE_UTF8 OR NOT wxUSE_UNICODE_UTF8)) endif() endif() +wx_option(wxUSE_SYS_LIBS "disable to force using all built-in libraries") wx_add_thirdparty_library(wxUSE_REGEX PCRE2 "enable support for wxRegEx class") wx_add_thirdparty_library(wxUSE_ZLIB ZLIB "use zlib for LZW compression" DEFAULT_APPLE sys) wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" DEFAULT_APPLE sys) @@ -185,14 +221,16 @@ wx_option(wxUSE_FONTMAP "use font encodings conversion classes") wx_option(wxUSE_FS_ARCHIVE "use virtual archive filesystems") wx_option(wxUSE_FS_INET "use virtual HTTP/FTP filesystems") wx_option(wxUSE_FS_ZIP "now replaced by fs_archive") -wx_option(wxUSE_FSVOLUME "use wxFSVolume class") +if(WIN32 OR APPLE) + wx_option(wxUSE_FSVOLUME "use wxFSVolume class") +endif() wx_option(wxUSE_FSWATCHER "use wxFileSystemWatcher class") wx_option(wxUSE_GEOMETRY "use geometry class") wx_option(wxUSE_LOG "use logging system") wx_option(wxUSE_LONGLONG "use wxLongLong class") wx_option(wxUSE_MIMETYPE "use wxMimeTypesManager") wx_option(wxUSE_PRINTF_POS_PARAMS "use wxVsnprintf() which supports positional parameters") -wx_option(wxUSE_SECRETSTORE "use wxSecretStore class") +wx_option_auto(wxUSE_SECRETSTORE "use wxSecretStore class") wx_option(wxUSE_SNGLINST_CHECKER "use wxSingleInstanceChecker class") wx_option(wxUSE_SOUND "use wxSound class") wx_option(wxUSE_SPELLCHECK "enable spell checking in wxTextCtrl") @@ -232,6 +270,8 @@ wx_option(wxUSE_PROTOCOL_FILE "FILE support in wxProtocol") wx_option(wxUSE_THREADS "use threads") +wx_option(wxUSE_XML "use the XML library") + if(WIN32) if(MINGW) #TODO: version check, as newer versions have no problem enabling this @@ -257,7 +297,6 @@ wx_option(wxUSE_MS_HTML_HELP "use MS HTML Help (win32)") wx_option(wxUSE_HTML "use wxHTML sub-library") wx_option(wxUSE_WXHTML_HELP "use wxHTML-based help") wx_option(wxUSE_XRC "use XRC resources sub-library") -wx_option(wxUSE_XML "use the xml library (overruled by wxUSE_XRC)") wx_option(wxUSE_AUI "use AUI docking library") wx_option(wxUSE_PROPGRID "use wxPropertyGrid library") wx_option(wxUSE_RIBBON "use wxRibbon library") @@ -287,7 +326,7 @@ else() endif() endif() -if(WXGTK) +if(WXGTK OR (WXQT AND NOT WIN32)) set(wxUSE_CAIRO_DEFAULT ON) else() set(wxUSE_CAIRO_DEFAULT OFF) @@ -336,7 +375,7 @@ wx_option(wxUSE_COMMANDLINKBUTTON "use wxCommmandLinkButton class") wx_option(wxUSE_DATAVIEWCTRL "use wxDataViewCtrl class") wx_option(wxUSE_NATIVE_DATAVIEWCTRL "use the native wxDataViewCtrl if available") wx_option(wxUSE_DATEPICKCTRL "use wxDatePickerCtrl class") -wx_option(wxUSE_DETECT_SM "use code to detect X11 session manager" OFF) +wx_option(wxUSE_DETECT_SM "use code to detect X11 session manager") wx_option(wxUSE_DIRPICKERCTRL "use wxDirPickerCtrl class") wx_option(wxUSE_DISPLAY "use wxDisplay class") wx_option(wxUSE_EDITABLELISTBOX "use wxEditableListBox class") @@ -426,7 +465,12 @@ wx_option(wxUSE_SPLINES "use spline drawing code") wx_option(wxUSE_MOUSEWHEEL "use mousewheel") wx_option(wxUSE_VALIDATORS "use wxValidator and derived classes") wx_option(wxUSE_BUSYINFO "use wxBusyInfo") -wx_option(wxUSE_HOTKEY "use wxWindow::RegisterHotKey()") +if(WXMSW OR WXOSX_COCOA) + set(wxUSE_HOTKEY_DEFAULT ON) +else() + set(wxUSE_HOTKEY_DEFAULT OFF) +endif() +wx_option(wxUSE_HOTKEY "use wxWindow::RegisterHotKey()" ${wxUSE_HOTKEY_DEFAULT}) if(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") set(wxUSE_JOYSTICK_DEFAULT OFF) else() diff --git a/build/cmake/pch.cmake b/build/cmake/pch.cmake index a7bc14aed733..7c9c7824f888 100644 --- a/build/cmake/pch.cmake +++ b/build/cmake/pch.cmake @@ -20,7 +20,7 @@ endif() macro(wx_target_enable_precomp target_name prec_header) if(wxBUILD_PRECOMP) target_compile_definitions(${target_name} PRIVATE WX_PRECOMP) - if(CMAKE_VERSION VERSION_LESS "3.16" OR wxBUILD_PRECOMP STREQUAL "COTIRE") + if(USE_COTIRE) set_target_properties(${target_name} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT ${prec_header}) set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) cotire(${target_name}) diff --git a/build/cmake/policies.cmake b/build/cmake/policies.cmake index e72c02f2f4c0..bd09ee0ca71d 100644 --- a/build/cmake/policies.cmake +++ b/build/cmake/policies.cmake @@ -59,6 +59,11 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() +if(POLICY CMP0057) + # Support new if() IN_LIST operator. + cmake_policy(SET CMP0057 NEW) +endif() + if(POLICY CMP0060) # Link libraries by full path even in implicit directories. cmake_policy(SET CMP0060 NEW) @@ -74,6 +79,16 @@ if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) endif() +if(POLICY CMP0079) + # target_link_libraries() allows use with targets in other directories. + cmake_policy(SET CMP0079 NEW) +endif() + +if(POLICY CMP0091) + # MSVC runtime library flags are selected by an abstraction. + cmake_policy(SET CMP0091 NEW) +endif() + if(POLICY CMP0092) # MSVC warning flags are not in CMAKE__FLAGS by default. cmake_policy(SET CMP0092 NEW) diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 6816caa5d7bf..4d683e164cd5 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -11,7 +11,7 @@ wx_add_sample(access accesstest.cpp DEPENDS wxUSE_ACCESSIBILITY) wx_add_sample(animate anitest.cpp anitest.h DATA throbber.gif hourglass.ani DEPENDS wxUSE_ANIMATIONCTRL) wx_add_sample(archive CONSOLE) wx_add_sample(artprov arttest.cpp artbrows.cpp artbrows.h) -wx_add_sample(aui auidemo.cpp LIBRARIES wxaui wxhtml NAME auidemo DEPENDS wxUSE_AUI) +wx_add_sample(aui auidemo.cpp LIBRARIES wxaui wxhtml wxxml NAME auidemo DEPENDS wxUSE_AUI wxUSE_XML wxUSE_HTML) wx_add_sample(calendar DEPENDS wxUSE_CALENDARCTRL) wx_add_sample(caret DEPENDS wxUSE_CARET) wx_add_sample(clipboard DEPENDS wxUSE_CLIPBOARD) @@ -34,11 +34,11 @@ if(WXGTK2) wx_list_add_prefix(SAMPLE_DIALOGS_SRC ../../src/generic/ filedlgg.cpp) endif() wx_add_sample(dialogs ${SAMPLE_DIALOGS_SRC} DATA tips.txt) -wx_add_sample(dialup nettest.cpp LIBRARIES wxnet DEPENDS wxUSE_DIALUP_MANAGER) +wx_add_sample(dialup nettest.cpp LIBRARIES wxnet DEPENDS wxUSE_DIALUP_MANAGER wxUSE_SOCKETS) wx_add_sample(display) wx_add_sample(dnd dnd.cpp RES dnd.rc DATA wxwin.png DEPENDS wxUSE_DRAG_AND_DROP) wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h - RES docview.rc PLIST Info.plist.in LIBRARIES wxaui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE) + RES docview.rc PLIST Info.plist.in LIBRARIES wxaui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE wxUSE_AUI) wx_add_sample(dragimag dragimag.cpp dragimag.h RES dragimag.rc DATA backgrnd.png shape01.png shape02.png shape03.png DEPENDS wxUSE_DRAGIMAGE) @@ -61,13 +61,13 @@ wx_add_sample(help demo.cpp LIBRARIES wxhtml doc.hhk doc.hhp doc.hlp doc.hpj doc.zip forward.gif up.gif ${HELP_DOC_FILES} NAME helpdemo - DEPENDS wxUSE_HELP + DEPENDS wxUSE_HELP wxUSE_HTML ) wx_add_sample(htlbox LIBRARIES wxhtml DEPENDS wxUSE_HTML) if(wxUSE_HTML) include(html.cmake) endif() -wx_add_sample(image image.cpp canvas.cpp canvas.h cursor_png.c RES image.rc +wx_add_sample(image image.cpp canvas.cpp canvas.h RES image.rc DATA horse.png horse.jpg horse.bmp horse.gif horse.pcx horse.pnm horse_ag.pnm horse_rg.pnm horse.tif horse.tga horse.xpm horse.cur horse.ico horse3.ani horse.svg smile.xbm toucan.png cmyk.jpg cursor.png @@ -78,10 +78,10 @@ endforeach() wx_add_sample(internat DATA ${INTERNAT_DATA_FILES} PLIST Info.plist.in DEPENDS wxUSE_INTL) # IPC samples set(wxSAMPLE_FOLDER ipc) -wx_add_sample(ipc client.cpp client.h connection.h ipcsetup.h NAME ipcclient LIBRARIES wxnet DEPENDS wxUSE_IPC) -wx_add_sample(ipc server.cpp server.h connection.h ipcsetup.h NAME ipcserver LIBRARIES wxnet DEPENDS wxUSE_IPC) -wx_add_sample(ipc CONSOLE baseclient.cpp connection.h ipcsetup.h NAME baseipcclient LIBRARIES wxnet DEPENDS wxUSE_IPC) -wx_add_sample(ipc CONSOLE baseserver.cpp connection.h ipcsetup.h NAME baseipcserver LIBRARIES wxnet DEPENDS wxUSE_IPC) +wx_add_sample(ipc client.cpp client.h connection.h ipcsetup.h NAME ipcclient LIBRARIES wxnet DEPENDS wxUSE_IPC wxUSE_SOCKETS) +wx_add_sample(ipc server.cpp server.h connection.h ipcsetup.h NAME ipcserver LIBRARIES wxnet DEPENDS wxUSE_IPC wxUSE_SOCKETS) +wx_add_sample(ipc CONSOLE baseclient.cpp connection.h ipcsetup.h NAME baseipcclient LIBRARIES wxnet DEPENDS wxUSE_IPC wxUSE_SOCKETS) +wx_add_sample(ipc CONSOLE baseserver.cpp connection.h ipcsetup.h NAME baseipcserver LIBRARIES wxnet DEPENDS wxUSE_IPC wxUSE_SOCKETS) set(wxSAMPLE_FOLDER) wx_add_sample(joytest joytest.cpp joytest.h DATA buttonpress.wav DEPENDS wxUSE_JOYSTICK) wx_add_sample(keyboard) @@ -94,7 +94,7 @@ if(wxBUILD_DEBUG_LEVEL STREQUAL "Default" OR wxBUILD_DEBUG_LEVEL GREATER 0) endif() wx_add_sample(menu DEPENDS wxUSE_MENUS wxUSE_MENUBAR) wx_add_sample(minimal IMPORTANT) -wx_add_sample(notebook notebook.cpp notebook.h LIBRARIES wxaui DEPENDS wxUSE_NOTEBOOK) +wx_add_sample(notebook notebook.cpp notebook.h LIBRARIES wxaui DEPENDS wxUSE_NOTEBOOK wxUSE_AUI) if(wxUSE_OPENGL) set(wxSAMPLE_SUBDIR opengl/) set(wxSAMPLE_FOLDER OpenGL) @@ -118,7 +118,7 @@ wx_add_sample(power) wx_add_sample(preferences DEPENDS wxUSE_PREFERENCES_EDITOR) wx_add_sample(printing printing.cpp printing.h DEPENDS wxUSE_PRINTING_ARCHITECTURE) wx_add_sample(propgrid propgrid.cpp propgrid_minimal.cpp sampleprops.cpp - tests.cpp sampleprops.h propgrid.h LIBRARIES wxpropgrid NAME propgriddemo DEPENDS wxUSE_PROPGRID) + tests.cpp sampleprops.h propgrid.h LIBRARIES wxpropgrid wxxrc NAME propgriddemo DEPENDS wxUSE_PROPGRID) wx_add_sample(render FOLDER render) wx_add_sample(render DLL renddll.cpp NAME renddll FOLDER render) wx_add_sample(ribbon ribbondemo.cpp LIBRARIES wxribbon NAME ribbondemo DEPENDS wxUSE_RIBBON) @@ -221,7 +221,9 @@ wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC} DATA ${WIDGETS_RC_FILES} textctrl.cpp ../image/toucan.png:toucan.png ) # includes needed by the native widget (like gtk.h) -target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS}) +if(TARGET widgets) + target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS}) +endif() wx_add_sample(wizard DATA wiztest.svg wiztest2.svg DEPENDS wxUSE_WIZARDDLG) wx_add_sample(wrapsizer) @@ -253,7 +255,7 @@ wx_add_sample(xrc DATA ${XRC_RC_FILES} LIBRARIES wxaui wxribbon wxxrc wxhtml NAME xrcdemo - DEPENDS wxUSE_XML wxUSE_XRC + DEPENDS wxUSE_XML wxUSE_XRC wxUSE_AUI ) wx_add_sample(xti xti.cpp classlist.cpp codereadercallback.cpp classlist.h codereadercallback.h LIBRARIES wxxml @@ -270,11 +272,15 @@ if(WIN32) # this test only makes sense with statically built wx, otherwise # the same copy of wx would be used wx_add_sample(dll wx_exe.cpp my_dll.h NAME wx_exe FOLDER dll) - wx_link_sample_libraries(wx_exe my_dll) + if(TARGET wx_exe AND TARGET my_dll) + target_link_libraries(wx_exe PRIVATE my_dll) + endif() endif() wx_add_sample(dll sdk_exe.cpp my_dll.h NAME sdk_exe FOLDER dll) - wx_link_sample_libraries(sdk_exe my_dll) + if(TARGET sdk_exe AND TARGET my_dll) + target_link_libraries(sdk_exe PRIVATE my_dll) + endif() endif() wx_add_sample(regtest RES regtest.rc DEPENDS wxUSE_REGKEY) @@ -282,8 +288,14 @@ if(WIN32) if(WXMSW) wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc) - #TODO: reenable when sample is fixed - #wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) wx_add_sample(taskbarbutton DEPENDS wxUSE_TASKBARBUTTON) + + # only check if MFC is available when the mfc sample is enabled + if(wxBUILD_SAMPLES STREQUAL "ALL") + find_package(MFC QUIET) + if(MFC_FOUND) + wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) + endif() + endif() endif() endif() diff --git a/build/cmake/samples/html.cmake b/build/cmake/samples/html.cmake index af782aa59357..7e51f1ff86c6 100644 --- a/build/cmake/samples/html.cmake +++ b/build/cmake/samples/html.cmake @@ -32,7 +32,7 @@ wx_add_sample(test imagemap.png pic.png pic2.bmp i18n.gif imagemap.htm tables.htm test.htm listtest.htm 8859_2.htm cp1250.htm regres.htm foo.png subsup.html - LIBRARIES wxnet wxhtml NAME htmltest) + LIBRARIES wxnet wxhtml NAME htmltest DEPENDS wxUSE_SOCKETS) wx_add_sample(virtual DATA start.htm LIBRARIES wxhtml) wx_add_sample(widget DATA start.htm LIBRARIES wxhtml) wx_add_sample(zip DATA pages.zip start.htm LIBRARIES wxhtml DEPENDS wxUSE_FS_ZIP) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 97b33aee4a64..997b1b5302f2 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -76,11 +76,11 @@ set(wxINSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) -if(wxBUILD_SHARED) - if(wxUSE_VISIBILITY) - check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY) - endif() -endif() # wxBUILD_SHARED +if(NOT WIN32 AND wxUSE_VISIBILITY) + check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY) +else() + set(HAVE_VISIBILITY 0) +endif() if(MSVC) set(DISABLE_ALL_WARNINGS "/w") @@ -461,7 +461,7 @@ if(UNIX) check_symbol_exists(inet_addr arpa/inet.h HAVE_INET_ADDR) endif(wxUSE_SOCKETS) - if(wxUSE_JOYSTICK AND NOT APPLE) + if(wxUSE_JOYSTICK AND WXGTK) check_include_files("linux/joystick.h" HAVE_JOYSTICK_H) if(NOT HAVE_JOYSTICK_H) message(WARNING "wxJoystick is not available") @@ -629,7 +629,7 @@ check_include_file(wcstr.h HAVE_WCSTR_H) if(wxUSE_DATETIME) # check for timezone variable # doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead - foreach(timezone_def timezone _timezone __timezone) + foreach(timezone_def _timezone __timezone timezone) wx_check_cxx_source_compiles(" int tz; tz = ${timezone_def};" @@ -672,13 +672,20 @@ if(wxUSE_FSWATCHER) endif() if(wxUSE_XLOCALE) + list(APPEND xlocale_headers locale.h stdlib.h) check_include_file(xlocale.h HAVE_XLOCALE_H) - set(CMAKE_EXTRA_INCLUDE_FILES locale.h) if(HAVE_XLOCALE_H) - list(APPEND CMAKE_EXTRA_INCLUDE_FILES xlocale.h) + list(APPEND xlocale_headers xlocale.h) endif() - check_type_size(locale_t LOCALE_T) - set(CMAKE_EXTRA_INCLUDE_FILES) + wx_check_c_source_compiles(" + locale_t t; + strtod_l(NULL, NULL, t); + strtol_l(NULL, NULL, 0, t); + strtoul_l(NULL, NULL, 0, t); +" + HAVE_LOCALE_T + ${xlocale_headers} + ) endif() # Check sizes of various types diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt index 698d3a10866d..0974d8ab3d52 100644 --- a/build/cmake/tests/gui/CMakeLists.txt +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -146,8 +146,17 @@ set(TEST_GUI_DATA horse.tif horse.xpm image/bitfields.bmp + image/bitfields-alpha.bmp image/8bpp-colorsused-large.bmp image/8bpp-colorsused-negative.bmp + image/32bpp_rgb.bmp + image/32bpp_rgb.ico + image/32bpp_rgb_a0.ico + image/badrle4.bmp + image/rgb16-3103.bmp + image/rgb32-7187.bmp + image/rgb32bf.bmp + image/rgba32.bmp image/rle4-delta-320x240.bmp image/rle8-delta-320x240-expected.bmp image/rle8-delta-320x240.bmp @@ -194,12 +203,26 @@ set(TEST_GUI_DATA image/toucan_mono_255_255_255.png image/width-times-height-overflow.bmp image/width_height_32_bit_overflow.pgm + image/bad_truncated.gif intl/ja/internat.mo intl/ja/internat.po ) -wx_add_test(test_gui CONSOLE_GUI ${TEST_GUI_SRC} +set(TEST_GUI_RES_BUNDLE + horse.png + ../include/wx/msw/bullseye.cur + ) + +# On macOS create an .app bundle so the resources can be added. +# On other platforms, just use a console app with gui libraries. +set(APP_TYPE) +if(NOT APPLE) + set(APP_TYPE CONSOLE_GUI) +endif() + +wx_add_test(test_gui ${APP_TYPE} ${TEST_GUI_SRC} DATA ${TEST_GUI_DATA} + RES_BUNDLE ${TEST_GUI_RES_BUNDLE} ) if(wxUSE_AUI) wx_exe_link_libraries(test_gui wxaui) diff --git a/build/cmake/toolkit.cmake b/build/cmake/toolkit.cmake index c5febca32c00..365f055572c6 100644 --- a/build/cmake/toolkit.cmake +++ b/build/cmake/toolkit.cmake @@ -67,6 +67,7 @@ endif() if(wxUSE_GUI) set(wxTOOLKIT_INCLUDE_DIRS) set(wxTOOLKIT_LIBRARIES) +set(wxTOOLKIT_LIBRARY_DIRS) set(wxTOOLKIT_VERSION) if(WXGTK) @@ -81,6 +82,7 @@ if(WXGTK) find_package(${gtk_lib} REQUIRED) list(APPEND wxTOOLKIT_INCLUDE_DIRS ${${gtk_lib}_INCLUDE_DIRS}) list(APPEND wxTOOLKIT_LIBRARIES ${${gtk_lib}_LIBRARIES}) + list(APPEND wxTOOLKIT_LIBRARY_DIRS ${${gtk_lib}_LIBRARY_DIRS}) list(APPEND wxTOOLKIT_DEFINITIONS ${${gtk_lib}_DEFINITIONS}) list(APPEND wxTOOLKIT_DEFINITIONS __WXGTK__) set(wxTOOLKIT_VERSION ${${gtk_lib}_VERSION}) @@ -119,24 +121,39 @@ endif() # support, but not for Wayland-only GTK (necessarily 3 or later), which is why # we have to do this after find_package(GTKx) above, as this is what sets # wxHAVE_GDK_X11. -if(UNIX AND NOT APPLE AND NOT WIN32 AND (WXX11 OR WXMOTIF OR WXGTK2 OR (WXGTK AND wxHAVE_GDK_X11))) +if(UNIX AND NOT WIN32 AND (WXX11 OR WXMOTIF OR WXGTK2 OR (WXGTK AND wxHAVE_GDK_X11))) find_package(X11 REQUIRED) list(APPEND wxTOOLKIT_INCLUDE_DIRS ${X11_INCLUDE_DIR}) list(APPEND wxTOOLKIT_LIBRARIES ${X11_LIBRARIES}) + mark_as_advanced(X11_xcb_xkb_INCLUDE_PATH) endif() if(WXQT) - set(QT_COMPONENTS Core Widgets Gui OpenGL Test) + find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) + + if(QT_VERSION_MAJOR EQUAL 5) + set(QT_COMPONENTS Core Widgets Gui OpenGL OpenGL Test) + elseif(QT_VERSION_MAJOR EQUAL 6) + set(QT_COMPONENTS Core Widgets Gui OpenGL OpenGLWidgets Test) + endif() + foreach(QT_COMPONENT ${QT_COMPONENTS}) - find_package(Qt5 COMPONENTS ${QT_COMPONENT} REQUIRED) - list(APPEND wxTOOLKIT_INCLUDE_DIRS ${Qt5${QT_COMPONENT}_INCLUDE_DIRS}) - list(APPEND wxTOOLKIT_LIBRARIES ${Qt5${QT_COMPONENT}_LIBRARIES}) - list(APPEND wxTOOLKIT_DEFINITIONS ${Qt5${QT_COMPONENT}_COMPILE_DEFINITIONS}) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENT} REQUIRED) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${Qt${QT_VERSION_MAJOR}${QT_COMPONENT}_INCLUDE_DIRS}) + list(APPEND wxTOOLKIT_LIBRARIES ${Qt${QT_VERSION_MAJOR}${QT_COMPONENT}_LIBRARIES}) + list(APPEND wxTOOLKIT_DEFINITIONS ${Qt${QT_VERSION_MAJOR}${QT_COMPONENT}_COMPILE_DEFINITIONS}) endforeach() - set(wxTOOLKIT_VERSION ${Qt5Core_VERSION}) + set(wxTOOLKIT_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION}) + + if(ANDROID) + # A hack to remove _${ANDROID_ABI} that Qt5AndroidSupport.cmake added + # which breaks wx-config. + set(CMAKE_SHARED_LIBRARY_SUFFIX_C ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(CMAKE_SHARED_LIBRARY_SUFFIX_CXX ${CMAKE_SHARED_LIBRARY_SUFFIX}) + endif() endif() -if(APPLE) +if(wxBUILD_TOOLKIT MATCHES "osx_cocoa") list(APPEND wxTOOLKIT_DEFINITIONS __WXMAC__ __WXOSX__) endif() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index dbed8cc9b3bb..dd2d82beb0b8 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -25,9 +25,10 @@ if(wxUSE_XRC) set_target_properties(wxrc PROPERTIES FOLDER "Utilities") + wx_get_install_dir(runtime) wx_install(TARGETS wxrc - RUNTIME DESTINATION "bin" - BUNDLE DESTINATION "bin" + RUNTIME DESTINATION "${runtime_dir}" + BUNDLE DESTINATION "${runtime_dir}" ) if(NOT WIN32_MSVC_NAMING AND wxBUILD_INSTALL) @@ -37,13 +38,13 @@ if(wxUSE_XRC) set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) endif() - # Don't use wx_install() here to preserve escaping. - install(CODE "execute_process( \ - COMMAND ${CMAKE_COMMAND} -E create_symlink \ - \"${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \ - \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \ - )" - ) + set(WXRC_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}") + set(WXRC_SRC "${WXRC_DIR}/${runtime_dir}/${wxrc_output_name}${EXE_SUFFIX}") + set(WXRC_DST "${WXRC_DIR}/${runtime_dir}/wxrc${EXE_SUFFIX}") + wx_install_symlink(${WXRC_SRC} ${WXRC_DST}) + + list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}\"") + set(WX_EXTRA_UNINSTALL_FILES ${WX_EXTRA_UNINSTALL_FILES} PARENT_SCOPE) endif() endif() diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in index b25110982898..7b19e746c167 100644 --- a/build/cmake/wxWidgetsConfig.cmake.in +++ b/build/cmake/wxWidgetsConfig.cmake.in @@ -2,6 +2,10 @@ cmake_policy(PUSH) # Set policies to prevent warnings +if(POLICY CMP0057) + # Support new if() IN_LIST operator. + cmake_policy(SET CMP0057 NEW) +endif() if(POLICY CMP0072) # FindOpenGL prefers GLVND by default when available. cmake_policy(GET CMP0072 _OpenGL_GL_POLICY) @@ -11,7 +15,14 @@ if(POLICY CMP0072) endif() # determine target from compiler, platform and library type -if(WIN32 AND NOT CYGWIN AND NOT MSYS) +if(MSVC) + set(WIN32_MSVC_NAMING 1) +elseif(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING) + set(WIN32_MSVC_NAMING 1) +else() + set(WIN32_MSVC_NAMING 0) +endif() +if(WIN32_MSVC_NAMING) if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) set(wxCOMPILER_PREFIX "vc") elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) @@ -66,6 +77,47 @@ macro(wx_inherit_property source dest name) endforeach() endmacro() +macro(wx_copy_target ns name libname) + get_target_property(target_type wx::${libname} TYPE) + if(target_type STREQUAL STATIC_LIBRARY) + add_library(${ns}::${name} STATIC IMPORTED) + elseif(target_type STREQUAL SHARED_LIBRARY) + add_library(${ns}::${name} SHARED IMPORTED) + elseif(target_type STREQUAL INTERFACE_LIBRARY) + add_library(${ns}::${name} INTERFACE IMPORTED) + else() + message(FATAL_ERROR "Unsupported library type: ${target_type}") + endif() + wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_COMPILE_DEFINITIONS) + wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_INCLUDE_DIRECTORIES) + wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_LINK_LIBRARIES) + if(target_type STREQUAL STATIC_LIBRARY OR target_type STREQUAL SHARED_LIBRARY) + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_CONFIGURATIONS) + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_INTERFACE_LANGUAGES) + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LOCATION) + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_IMPLIB) + wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES) + endif() +endmacro() + +macro(wx_map_release libname) + # use the Release configuration for MinSizeRel and RelWithDebInfo configurations + # only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist + get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS) + if("RELEASE" IN_LIST configs) + if(NOT "MINSIZEREL" IN_LIST configs) + if("MinSizeRel" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") + set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release") + endif() + endif() + if(NOT "RELWITHDEBINFO" IN_LIST configs) + if("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release") + endif() + endif() + endif() +endmacro() + # for compatibility with FindwxWidgets set(wxWidgets_LIBRARIES) @@ -80,6 +132,8 @@ endif() set(@PROJECT_NAME@_COMPONENTS) foreach(libname @wxLIB_TARGETS@) if(TARGET wx::${libname}) + wx_map_release(${libname}) + # remove wx prefix from component name string(SUBSTRING ${libname} 2 -1 name) @@ -88,47 +142,25 @@ foreach(libname @wxLIB_TARGETS@) set(@PROJECT_NAME@_${name}_FOUND 1) set(@PROJECT_NAME@_FIND_REQUIRED_${name} 1) - # use the Release configuration for MinSizeRel and RelWithDebInfo configurations - # only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist - get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS) - list(FIND configs "RELEASE" idxSrc) - if(idxSrc GREATER -1) - list(FIND configs "MINSIZEREL" idxSrc) - list(FIND CMAKE_CONFIGURATION_TYPES "MinSizeRel" idxDst) - if(idxSrc EQUAL -1 AND (idxDst GREATER -1 OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")) - set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release") - endif() - list(FIND configs "RELWITHDEBINFO" idxSrc) - list(FIND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" idxDst) - if(idxSrc EQUAL -1 AND (idxDst GREATER -1 OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) - set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release") + # add aliases from wx:: and wxWidgets::${lib} to wx::wx + if(NOT TARGET wx::${name}) + if(CMAKE_VERSION VERSION_LESS "3.18") + # CMake <3.18 does not support alias to non-global imported target, create a copy of the library + wx_copy_target(wx ${name} ${libname}) + wx_copy_target(wxWidgets ${name} ${libname}) + else() + add_library(wx::${name} ALIAS wx::${libname}) + add_library(wxWidgets::${name} ALIAS wx::${libname}) endif() endif() - # add an alias from wx:: to wx::wx - if(CMAKE_VERSION VERSION_LESS "3.18") - # CMake <3.18 does not support alias to non-global imported target, create a copy of the library - get_target_property(target_type wx::${libname} TYPE) - if(target_type STREQUAL STATIC_LIBRARY) - add_library(wx::${name} STATIC IMPORTED) - else() - add_library(wx::${name} SHARED IMPORTED) - endif() - wx_inherit_property(wx::${libname} wx::${name} IMPORTED_CONFIGURATIONS) - wx_inherit_property(wx::${libname} wx::${name} INTERFACE_COMPILE_DEFINITIONS) - wx_inherit_property(wx::${libname} wx::${name} INTERFACE_INCLUDE_DIRECTORIES) - wx_inherit_property(wx::${libname} wx::${name} INTERFACE_LINK_LIBRARIES) - wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LINK_INTERFACE_LANGUAGES) - wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LOCATION) - wx_inherit_property(wx::${libname} wx::${name} IMPORTED_IMPLIB) - wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES) - else() - add_library(wx::${name} ALIAS wx::${libname}) + # don't include 'wxbase_only' in wxWidgets_LIBRARIES and wxWidgets::wxWidgets + if(${libname} STREQUAL "wxbase_only") + continue() endif() # add to FindwxWidgets variable - list(FIND @PROJECT_NAME@_FIND_COMPONENTS ${name} idx) - if(NOT @PROJECT_NAME@_FIND_COMPONENTS OR idx GREATER -1) + if(NOT @PROJECT_NAME@_FIND_COMPONENTS OR ${name} IN_LIST @PROJECT_NAME@_FIND_COMPONENTS) list(APPEND wxWidgets_LIBRARIES wx::${name}) if(CREATE_WX_TARGET) target_link_libraries(wxWidgets::wxWidgets INTERFACE wx::${name}) @@ -137,12 +169,30 @@ foreach(libname @wxLIB_TARGETS@) endif() endforeach() -if(TARGET wx::wxgl) +# list all built-in libraries +foreach(libname @wxLIB_BUILTIN_TARGETS@) + if(TARGET wx::${libname}) + wx_map_release(${libname}) + endif() +endforeach() + +include(CMakeFindDependencyMacro) + +if(TARGET wx::wxnet AND @wxUSE_WEBREQUEST_CURL@) + # make sure CURL targets are available: + # The link interface of target "wx::wxnet" contains: CURL::libcurl_shared + find_dependency(CURL) +endif() + +if(TARGET wx::wxgl AND NOT (APPLE AND IOS)) # make sure OpenGL targets are available: # The link interface of target "wx::wxgl" contains: OpenGL::GLU - find_package(OpenGL QUIET) + find_dependency(OpenGL) endif() +# make sure Threads targets are available +find_dependency(Threads) + # if no components are specified in find_package, check all of them if(NOT @PROJECT_NAME@_FIND_COMPONENTS) set(@PROJECT_NAME@_FIND_COMPONENTS ${@PROJECT_NAME@_COMPONENTS}) diff --git a/build/files b/build/files index 77ada584edd5..e92a5d743207 100644 --- a/build/files +++ b/build/files @@ -2113,6 +2113,7 @@ MSW_HDR = wx/msw/menu.h wx/msw/menuitem.h wx/msw/metafile.h + wx/msw/mfc.h wx/msw/minifram.h wx/msw/missing.h wx/msw/msgdlg.h @@ -2818,8 +2819,6 @@ WEBVIEW_GTK_HDR = WEBVIEW_GTK_SRC = src/gtk/webview_webkit.cpp - -WEBVIEW2_GTK_SRC = src/gtk/webview_webkit2.cpp WEBVIEW_WEBKIT2_EXTENSION_SRC = @@ -3009,10 +3008,16 @@ OPENGL_OSX_COCOA_SRC = src/osx/cocoa/glcanvas.mm src/osx/glcanvas_osx.cpp +OPENGL_OSX_COCOA_HDR = + wx/osx/glcanvas.h + OPENGL_OSX_IPHONE_SRC = src/osx/iphone/glcanvas.mm src/osx/glcanvas_osx.cpp +OPENGL_OSX_IPHONE_HDR = + wx/osx/glcanvas.h + # Misc plugin sources: UNIX_SOUND_SDL_SRC = diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 11e6c26aab4e..2d9c55eae34e 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -5989,7 +5989,7 @@ $(SETUPHDIR)\wx\msw\rcdefs.h: $(SETUPHDIR)\wx\msw ..\..\include\wx\msw\genrcdefs build_cfg_file: $(SETUPHDIR) @echo WXVER_MAJOR=3 >$(BUILD_CFG_FILE) @echo WXVER_MINOR=2 >>$(BUILD_CFG_FILE) - @echo WXVER_RELEASE=6 >>$(BUILD_CFG_FILE) + @echo WXVER_RELEASE=11 >>$(BUILD_CFG_FILE) @echo BUILD=$(BUILD) >>$(BUILD_CFG_FILE) @echo MONOLITHIC=$(MONOLITHIC) >>$(BUILD_CFG_FILE) @echo SHARED=$(SHARED) >>$(BUILD_CFG_FILE) diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index cbfeed7290bc..03a2413836d6 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -6456,7 +6456,7 @@ $(SETUPHDIR)\wx\msw\rcdefs.h: $(SETUPHDIR)\wx\msw ..\..\include\wx\msw\genrcdefs build_cfg_file: $(SETUPHDIR) @echo WXVER_MAJOR=3 >$(BUILD_CFG_FILE) @echo WXVER_MINOR=2 >>$(BUILD_CFG_FILE) - @echo WXVER_RELEASE=6 >>$(BUILD_CFG_FILE) + @echo WXVER_RELEASE=11 >>$(BUILD_CFG_FILE) @echo BUILD=$(BUILD) >>$(BUILD_CFG_FILE) @echo MONOLITHIC=$(MONOLITHIC) >>$(BUILD_CFG_FILE) @echo SHARED=$(SHARED) >>$(BUILD_CFG_FILE) diff --git a/build/msw/wx_config.props b/build/msw/wx_config.props index 58cff743118b..797a81aa786c 100644 --- a/build/msw/wx_config.props +++ b/build/msw/wx_config.props @@ -11,6 +11,7 @@ v141 v142 v143 + v145 diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj index 73142c396d71..5ee2e30c206b 100644 --- a/build/msw/wx_core.vcxproj +++ b/build/msw/wx_core.vcxproj @@ -1520,6 +1520,7 @@ + diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters index ec2c6e6ab4b7..c3e806a5d0aa 100644 --- a/build/msw/wx_core.vcxproj.filters +++ b/build/msw/wx_core.vcxproj.filters @@ -1849,6 +1849,9 @@ MSW Headers + + MSW Headers + MSW Headers diff --git a/build/msw/wx_setup.props b/build/msw/wx_setup.props index 2e1b97dfe13d..5e7a13b2f435 100644 --- a/build/msw/wx_setup.props +++ b/build/msw/wx_setup.props @@ -5,7 +5,7 @@ - 326 + 3211 32 msw vc diff --git a/build/msw/wx_vc18.slnx b/build/msw/wx_vc18.slnx new file mode 100644 index 000000000000..a874eb3b37e5 --- /dev/null +++ b/build/msw/wx_vc18.slnx @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj index 62fce37d6848..0a47944c6822 100644 --- a/build/msw/wx_vc8_core.vcproj +++ b/build/msw/wx_vc8_core.vcproj @@ -2857,6 +2857,10 @@ RelativePath="..\..\include\wx\msw\metafile.h" > + + diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index f6b40887b4de..2493577809dc 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -2853,6 +2853,10 @@ RelativePath="..\..\include\wx\msw\metafile.h" > + + diff --git a/build/osx/wxvers.xcconfig b/build/osx/wxvers.xcconfig index 81e48c660d61..8cd157938551 100644 --- a/build/osx/wxvers.xcconfig +++ b/build/osx/wxvers.xcconfig @@ -1,4 +1,4 @@ // update this file with new version numbers DYLIB_COMPATIBILITY_VERSION = 3.2 -DYLIB_CURRENT_VERSION = 3.2.6 +DYLIB_CURRENT_VERSION = 3.2.11 diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 0570d42c81c1..830b543a5ce7 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -32,7 +32,13 @@ case $(uname -s) in return $rc } - codename=$(lsb_release --codename --short) + # We could install lsb-release package if the command is missing, + # but we currently only actually use codename on the systems where + # it's guaranteed to be installed, so don't bother doing it for now. + if command -v lsb_release > /dev/null; then + codename=$(lsb_release --codename --short) + fi + if [ "$wxUSE_ASAN" = 1 ]; then # Enable the `-dbgsym` repositories. echo "deb http://ddebs.ubuntu.com ${codename} main restricted universe multiverse @@ -85,7 +91,7 @@ case $(uname -s) in libglu1-mesa-dev" esac - pkg_install="$pkg_install $libtoolkit_dev gdb ${WX_EXTRA_PACKAGES}" + pkg_install="$pkg_install $libtoolkit_dev gawk gdb ${WX_EXTRA_PACKAGES}" extra_deps="$extra_deps libcurl4-openssl-dev libsecret-1-dev libnotify-dev" for pkg in $extra_deps; do @@ -113,12 +119,12 @@ case $(uname -s) in fi if [ -f /etc/redhat-release ]; then - dnf install -y ${WX_EXTRA_PACKAGES} expat-devel findutils g++ git-core gspell-devel gstreamer1-plugins-base-devel gtk3-devel make libcurl-devel libGLU-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel + dnf install -y ${WX_EXTRA_PACKAGES} gawk expat-devel findutils g++ git-core gspell-devel gstreamer1-plugins-base-devel gtk3-devel make libcurl-devel libGLU-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel fi ;; FreeBSD) - pkg install -q -y ${WX_EXTRA_PACKAGES} gspell gstreamer1 gtk3 jpeg-turbo libnotify libsecret mesa-libs pkgconf png tiff webkit2-gtk3 + pkg install -q -y ${WX_EXTRA_PACKAGES} gawk gspell gstreamer1 gtk3 jpeg-turbo libnotify libsecret mesa-libs pkgconf png tiff webkit2-gtk_41 ;; Darwin) diff --git a/build/tools/httpbin.sh b/build/tools/httpbin.sh index b34a03779294..ed830281142e 100644 --- a/build/tools/httpbin.sh +++ b/build/tools/httpbin.sh @@ -3,19 +3,18 @@ # Do not run it directly. httpbin_launch() { - WX_TEST_WEBREQUEST_URL=0 - export WX_TEST_WEBREQUEST_URL - - echo 'Launching httpbin...' + # If the tests are already disabled, don't do anything. + if [ "$WX_TEST_WEBREQUEST_URL" != "0" ]; then + WX_TEST_WEBREQUEST_URL=0 + export WX_TEST_WEBREQUEST_URL - # Installing Flask 2.1.0 and its dependency Werkzeug 2.1.0 results - # in failures when trying to run httpbin, so stick to an older but - # working version. - pip_explicit_deps='Flask==2.0.3 Werkzeug==2.0.3' + go version + go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2 - python3 -m pip install $pip_explicit_deps 'httpbin==0.7.0' --user - python3 -m httpbin.core --port 50500 2>&1 >httpbin.log & - WX_TEST_WEBREQUEST_URL="http://localhost:50500" + echo 'Launching httpbin...' + go-httpbin -host 127.0.0.1 -port 8081 2>&1 >httpbin.log & + WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081" + fi } httpbin_show_log() { diff --git a/build/tools/msvs/getversion.bat b/build/tools/msvs/getversion.bat index 185165b530ba..3c8952cf59fd 100644 --- a/build/tools/msvs/getversion.bat +++ b/build/tools/msvs/getversion.bat @@ -1,3 +1,3 @@ set wxMAJOR_VERSION=3 set wxMINOR_VERSION=2 -set wxRELEASE_NUMBER=6 +set wxRELEASE_NUMBER=11 diff --git a/build/tools/proc_count.sh b/build/tools/proc_count.sh index 16660df2c1fe..5fe00968a14b 100755 --- a/build/tools/proc_count.sh +++ b/build/tools/proc_count.sh @@ -14,5 +14,4 @@ case `uname` in ;; esac -((wxPROC_COUNT++)) -echo $wxPROC_COUNT +echo $((wxPROC_COUNT+1)) diff --git a/build/wasm/wx-dom.js b/build/wasm/wx-dom.js index f32fa4dcbc2e..697e44e05842 100644 --- a/build/wasm/wx-dom.js +++ b/build/wasm/wx-dom.js @@ -21,6 +21,52 @@ var inputs = new Map(); // domId -> value-bearing element (if != root) var labels = new Map(); // domId -> label text target (if != root) + // wxSystemColour indices (include/wx/settings.h). C++ reads the same + // globalThis.wxSystemColors array in src/wasm/settings.cpp; CSS variables + // keep DOM-backed controls on that exact palette instead of a second, + // hard-coded classic-light theme. + var SYS = { + SCROLLBAR: 0, MENU: 4, WINDOW: 5, MENUTEXT: 7, WINDOWTEXT: 8, + ACTIVEBORDER: 10, HIGHLIGHT: 13, HIGHLIGHTTEXT: 14, BTNFACE: 15, + BTNSHADOW: 16, GRAYTEXT: 17, BTNTEXT: 18, BTNHIGHLIGHT: 20, + INFOTEXT: 23, INFOBK: 24, LISTBOX: 25, MENUBAR: 30, + LISTBOXTEXT: 31 + }; + + function paletteColor(index, fallback) { + var palette = globalThis.wxSystemColors; + var value = Array.isArray(palette) ? palette[index] : -1; + if (!Number.isInteger(value) || value < 0 || value > 0xffffff) + return fallback; + return '#' + value.toString(16).padStart(6, '0'); + } + + window.wxDomRefreshSystemColors = function () { + var style = document.documentElement.style; + var put = function (name, index, fallback) { + style.setProperty(name, paletteColor(index, fallback)); + }; + put('--wx-scrollbar', SYS.SCROLLBAR, '#d4d0c8'); + put('--wx-menu', SYS.MENU, '#d4d0c8'); + put('--wx-window', SYS.WINDOW, '#ffffff'); + put('--wx-menu-text', SYS.MENUTEXT, '#000000'); + put('--wx-window-text', SYS.WINDOWTEXT, '#000000'); + put('--wx-border', SYS.ACTIVEBORDER, '#808080'); + put('--wx-highlight', SYS.HIGHLIGHT, '#000080'); + put('--wx-highlight-text', SYS.HIGHLIGHTTEXT, '#ffffff'); + put('--wx-button-face', SYS.BTNFACE, '#d4d0c8'); + put('--wx-button-shadow', SYS.BTNSHADOW, '#808080'); + put('--wx-gray-text', SYS.GRAYTEXT, '#808080'); + put('--wx-button-text', SYS.BTNTEXT, '#000000'); + put('--wx-button-highlight', SYS.BTNHIGHLIGHT, '#ffffff'); + put('--wx-info-text', SYS.INFOTEXT, '#000000'); + put('--wx-info-bg', SYS.INFOBK, '#ffffe1'); + put('--wx-listbox', SYS.LISTBOX, '#ffffff'); + put('--wx-menubar', SYS.MENUBAR, '#d4d0c8'); + put('--wx-listbox-text', SYS.LISTBOXTEXT, '#000000'); + }; + window.wxDomRefreshSystemColors(); + // Flag read by the C++ keyboard callback (src/wasm/app.cpp): while a DOM // editable owns browser focus, wx must not swallow/preventDefault keys. window.wxDomEditableFocused = 0; @@ -94,7 +140,7 @@ // Visual chrome only: the wx children of a wxStaticBox are SIBLING // DOM controls, so the fieldset must never intercept their input. root = document.createElement('fieldset'); - root.style.border = '1px solid #b5b2aa'; + root.style.border = '1px solid var(--wx-button-shadow)'; root.style.borderRadius = '2px'; label = document.createElement('legend'); label.className = 'wx-label'; @@ -105,7 +151,7 @@ } case 'statline': { root = document.createElement('div'); - root.style.background = '#909090'; + root.style.background = 'var(--wx-button-shadow)'; root.dataset.wxChrome = '1'; break; } @@ -128,7 +174,7 @@ root = document.createElement('div'); root.dataset.wxScrollbar = '1'; var sbVertical = (typeAttr === 'v'); - root.style.background = '#e8e8e8'; + root.style.background = 'var(--wx-scrollbar)'; root.style.userSelect = 'none'; var sbTrack = document.createElement('div'); sbTrack.className = 'wx-sb-track'; @@ -136,7 +182,8 @@ var sbThumb = document.createElement('div'); sbThumb.className = 'wx-sb-thumb'; sbThumb.style.cssText = - 'position:absolute;background:#a0a0a0;border:1px solid #808080;' + + 'position:absolute;background:var(--wx-button-shadow);' + + 'border:1px solid var(--wx-border);' + 'border-radius:2px;box-sizing:border-box;touch-action:none;' + 'display:none;' + (sbVertical ? 'left:0;right:0;top:0;height:0;' @@ -182,7 +229,7 @@ // one per item, // filled by wxDomSetItems. root = document.createElement('fieldset'); - root.style.border = '1px solid #b5b2aa'; + root.style.border = '1px solid var(--wx-button-shadow)'; root.style.borderRadius = '2px'; label = document.createElement('legend'); label.className = 'wx-label'; @@ -214,8 +261,9 @@ root = document.createElement('div'); root.dataset.wxCheckList = '1'; root.style.overflowY = 'auto'; - root.style.background = '#ffffff'; - root.style.border = '1px solid #b5b2aa'; + root.style.background = 'var(--wx-listbox)'; + root.style.color = 'var(--wx-listbox-text)'; + root.style.border = '1px solid var(--wx-button-shadow)'; break; } case 'menubar': { @@ -223,7 +271,8 @@ // (built by wxDomMenuSetStructure). root = document.createElement('div'); root.dataset.wxMenuBar = '1'; - root.style.background = '#d4d0c8'; + root.style.background = 'var(--wx-menubar)'; + root.style.color = 'var(--wx-menu-text)'; flexCenter(root); break; } @@ -231,7 +280,8 @@ // Horizontal strip of tool buttons (built by wxDomToolbarSetTools). root = document.createElement('div'); root.dataset.wxToolBar = '1'; - root.style.background = '#d4d0c8'; + root.style.background = 'var(--wx-button-face)'; + root.style.color = 'var(--wx-button-text)'; flexCenter(root); break; } @@ -248,8 +298,9 @@ strip.setAttribute('role', 'tablist'); strip.style.cssText = 'position:absolute;left:0;top:0;right:0;display:flex;' + - 'align-items:flex-end;background:#d4d0c8;' + - 'border-bottom:1px solid #808080;pointer-events:auto;' + + 'align-items:flex-end;background:var(--wx-button-face);' + + 'color:var(--wx-button-text);' + + 'border-bottom:1px solid var(--wx-border);pointer-events:auto;' + 'overflow:hidden;'; root.appendChild(strip); break; @@ -292,6 +343,7 @@ el.style.left = '0px'; el.style.top = '0px'; el.style.boxSizing = 'border-box'; + if (!el.style.color) el.style.color = 'var(--wx-button-text)'; el.style.margin = '0'; if (!el.style.padding) el.style.padding = '0'; el.style.overflow = type === 'statbox' ? 'visible' : 'hidden'; @@ -310,6 +362,11 @@ el.style.pointerEvents = el.dataset.wxChrome ? 'none' : 'auto'; var valueEl = built.input || el; + if (valueEl.tagName === 'SELECT' || valueEl.tagName === 'TEXTAREA' || + (valueEl.tagName === 'INPUT' && isEditable(valueEl))) { + valueEl.style.color = 'var(--wx-window-text)'; + valueEl.style.backgroundColor = 'var(--wx-window)'; + } if (built.input) inputs.set(domId, built.input); if (built.label) labels.set(domId, built.label); @@ -343,9 +400,23 @@ }); valueEl.addEventListener('input', function () { - dispatch(domId, EVT.INPUT); + if (valueEl.tagName === 'SELECT') { + // Native select popups commit the picked option through `input` + // before `change`. Dispatch immediately: relayout or control + // destruction in the wx handler can otherwise make the later + // `change` disappear and leave the old selection active. + valueEl._wxSelectionDispatched = valueEl.selectedIndex; + dispatch(domId, EVT.CHANGE); + } else { + dispatch(domId, EVT.INPUT); + } }); valueEl.addEventListener('change', function () { + if (valueEl.tagName === 'SELECT' && + valueEl._wxSelectionDispatched === valueEl.selectedIndex) { + delete valueEl._wxSelectionDispatched; + return; + } dispatch(domId, EVT.CHANGE); }); if (isEditable(valueEl)) { @@ -444,7 +515,8 @@ el.checked = !!on; } else { el.setAttribute('aria-pressed', on ? 'true' : 'false'); - el.style.background = on ? '#b0c4de' : ''; + el.style.background = on ? 'var(--wx-highlight)' : 'var(--wx-button-face)'; + el.style.color = on ? 'var(--wx-highlight-text)' : 'var(--wx-button-text)'; } }; @@ -775,6 +847,33 @@ } }; + window.wxDomIsItemSelected = function (domId, index) { + var el = controls.get(domId); + if (!el) return false; + if (el.dataset.wxCheckList) { + var boxes = el.querySelectorAll('input[type=checkbox]'); + return !!(boxes[index] && boxes[index].checked); + } + return !!(el.tagName === 'SELECT' && el.options[index] && + el.options[index].selected); + }; + + // Map wx client coordinates to the native