From 226a3de59688a6f84e47ec3071454f8d46f3611a Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 16 Jan 2021 01:33:55 +0100 Subject: [PATCH 1/6] CMake: Use common function for adding samples, tests and demos --- build/cmake/demos/CMakeLists.txt | 57 ------ build/cmake/functions.cmake | 224 +++++++++++------------ build/cmake/tests/CMakeLists.txt | 6 - build/cmake/tests/base/CMakeLists.txt | 4 +- build/cmake/tests/drawing/CMakeLists.txt | 2 - build/cmake/tests/gui/CMakeLists.txt | 3 - build/cmake/tests/headers/CMakeLists.txt | 2 - 7 files changed, 112 insertions(+), 186 deletions(-) diff --git a/build/cmake/demos/CMakeLists.txt b/build/cmake/demos/CMakeLists.txt index c8fe3a859e..0909eb9762 100644 --- a/build/cmake/demos/CMakeLists.txt +++ b/build/cmake/demos/CMakeLists.txt @@ -7,63 +7,6 @@ # Licence: wxWindows licence ############################################################################# -function(wx_add_demo name) - cmake_parse_arguments(DEMO "" "NAME" "DATA;LIBRARIES" ${ARGN}) - if(NOT DEMO_NAME) - set(DEMO_NAME ${name}) - endif() - wx_list_add_prefix(src_files - "${wxSOURCE_DIR}/demos/${name}/" - ${DEMO_UNPARSED_ARGUMENTS}) - if(WIN32) - list(APPEND src_files ${wxSOURCE_DIR}/demos/${name}/${DEMO_NAME}.rc) - endif() - - if (WXMSW AND DEFINED wxUSE_DPI_AWARE_MANIFEST) - set(wxDPI_MANIFEST_PRFIX "wx") - if (wxARCH_SUFFIX) - set(wxDPI_MANIFEST_PRFIX "amd64") - endif() - set(wxUSE_DPI_AWARE_MANIFEST_VALUE 0) - if (${wxUSE_DPI_AWARE_MANIFEST} MATCHES "system") - set(wxUSE_DPI_AWARE_MANIFEST_VALUE 1) - list(APPEND src_files "${wxSOURCE_DIR}/include/wx/msw/${wxDPI_MANIFEST_PRFIX}_dpi_aware.manifest") - elseif(${wxUSE_DPI_AWARE_MANIFEST} MATCHES "per-monitor") - set(wxUSE_DPI_AWARE_MANIFEST_VALUE 2) - list(APPEND src_files "${wxSOURCE_DIR}/include/wx/msw/${wxDPI_MANIFEST_PRFIX}_dpi_aware_pmv2.manifest") - endif() - endif() - - add_executable(${DEMO_NAME} WIN32 MACOSX_BUNDLE ${src_files}) - - if (DEFINED wxUSE_DPI_AWARE_MANIFEST_VALUE) - target_compile_definitions(${DEMO_NAME} PRIVATE wxUSE_DPI_AWARE_MANIFEST=${wxUSE_DPI_AWARE_MANIFEST_VALUE}) - endif() - - if(DEMO_DATA) - # TODO: unify with data handling for samples - # TODO: handle data files differently for OS X bundles - # Copy data files to output directory - foreach(data_file ${DEMO_DATA}) - list(APPEND cmds COMMAND ${CMAKE_COMMAND} - -E copy ${wxSOURCE_DIR}/demos/${name}/${data_file} - ${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}/${data_file}) - endforeach() - add_custom_command( - TARGET ${DEMO_NAME} ${cmds} - COMMENT "Copying demo data files...") - endif() - if(wxBUILD_SHARED) - target_compile_definitions(${DEMO_NAME} PRIVATE WXUSINGDLL) - endif() - wx_exe_link_libraries(${DEMO_NAME} wxcore ${DEMO_LIBRARIES}) - wx_set_common_target_properties(${DEMO_NAME}) - set_target_properties(${DEMO_NAME} PROPERTIES FOLDER "Demos") - set_target_properties(${DEMO_NAME} PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}" - ) -endfunction() - wx_add_demo(bombs bombs.cpp bombs.h diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 2c56b25f82..0efba28ba6 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -367,17 +367,8 @@ macro(wx_target_enable_precomp target_name) cotire(${target_name}) endmacro() -# Enable precompiled headers for tests -macro(wx_test_enable_precomp target_name) - if(wxBUILD_PRECOMP) - wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/tests/testprec.h") - elseif(MSVC) - target_compile_definitions(${target_name} PRIVATE NOPCH) - endif() -endmacro() - -# Enable precompiled headers for samples -macro(wx_sample_enable_precomp target_name) +# Enable precompiled headers for applications +macro(wx_app_enable_precomp target_name) if(wxBUILD_PRECOMP) wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/include/wx/wxprec.h") elseif(MSVC) @@ -414,10 +405,12 @@ endmacro() # wx_exe_link_libraries(target libs...) # Link wx libraries to executable macro(wx_exe_link_libraries name) - if(wxBUILD_MONOLITHIC) - target_link_libraries(${name} PUBLIC wxmono) - else() - target_link_libraries(${name};PRIVATE;${ARGN}) + if(TARGET ${name}) + if(wxBUILD_MONOLITHIC) + target_link_libraries(${name} PUBLIC wxmono) + else() + target_link_libraries(${name};PRIVATE;${ARGN}) + endif() endif() endmacro() @@ -612,82 +605,111 @@ function(wx_print_thirdparty_library_summary) message(STATUS ${message}) endfunction() -# Add executable for sample -# wx_add_sample( [CONSOLE|DLL] [IMPORTANT] [SRC_FILES...] -# [LIBRARIES ...] [NAME target_name] [FOLDER folder]) -# first parameter may be CONSOLE to indicate a console application -# all following parameters a src files for the executable -# source files are relative to samples/${name}/ +# Add sample, test or demo +# wx_add( [CONSOLE|DLL] [IMPORTANT] [SRC_FILES...] +# [LIBRARIES ...] [NAME target_name] [FOLDER folder] +# [DATA ...] [DEFINITIONS ...] [RES ...]) +# name default target name +# group can be Samples, Tests or Demos +# first parameter may be CONSOLE to indicate a console application or DLL to indicate a shared library +# all following parameters are src files for the executable +# # Optionally: -# DATA followed by required data files. Use a colon to separate different source and dest paths -# DEFINITIONS list of definitions for the target -# FOLDER subfolder in IDE -# LIBRARIES followed by required libraries -# NAME alternative target_name -# IMPORTANT does not require wxBUILD_SAMPLES=ALL -# RES followed by WIN32 .rc files +# 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 +# RES followed by WIN32 .rc files # # Additionally the following variables may be set before calling wx_add_sample: # wxSAMPLE_SUBDIR subdirectory in the samples/ folder to use as base # wxSAMPLE_FOLDER IDE sub folder to be used for the samples + function(wx_add_sample name) - cmake_parse_arguments(SAMPLE + wx_add(${name} "Samples" ${ARGN}) +endfunction() + +function(wx_add_test name) + wx_add(${name} "Tests" ${ARGN}) +endfunction() + +function(wx_add_demo name) + wx_add(${name} "Demos" ${ARGN}) +endfunction() + +function(wx_add name group) + cmake_parse_arguments(APP "CONSOLE;DLL;IMPORTANT" "NAME;FOLDER" "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES" ${ARGN} ) - if(NOT SAMPLE_FOLDER AND wxSAMPLE_FOLDER) - set(SAMPLE_FOLDER ${wxSAMPLE_FOLDER}) + + if(APP_NAME) + set(target_name ${APP_NAME}) + else() + set(target_name ${name}) endif() - # Only build important samples without wxBUILD_SAMPLES=ALL - if(NOT SAMPLE_IMPORTANT AND NOT wxBUILD_SAMPLES STREQUAL "ALL") + if(group STREQUAL Samples) + if(NOT APP_IMPORTANT AND NOT wxBUILD_SAMPLES STREQUAL "ALL") + return() + endif() + set(SUB_DIR "samples/${wxSAMPLE_SUBDIR}${name}") + set(DEFAULT_RC_FILE "samples/sample.rc") + elseif(group STREQUAL Tests) + if(NOT APP_CONSOLE AND NOT wxBUILD_TESTS STREQUAL "ALL") + return() + endif() + set(SUB_DIR "tests") + set(DEFAULT_RC_FILE "samples/sample.rc") + elseif(group STREQUAL Demos) + set(SUB_DIR "demos/${name}") + set(DEFAULT_RC_FILE "demos/${name}/${target_name}.rc") + else() + message(WARNING "Unkown group \"${group}\"") return() endif() - foreach(depend ${SAMPLE_DEPENDS}) + + foreach(depend ${APP_DEPENDS}) if(NOT ${depend}) return() endif() endforeach() - # Only build GUI samples with wxUSE_GUI=1 - if(NOT wxUSE_GUI AND NOT SAMPLE_CONSOLE) + # Only build GUI applications with wxUSE_GUI=1 + if(NOT wxUSE_GUI AND NOT APP_CONSOLE) return() endif() - if(SAMPLE_UNPARSED_ARGUMENTS) + if(APP_UNPARSED_ARGUMENTS) wx_list_add_prefix(src_files - "${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/" - ${SAMPLE_UNPARSED_ARGUMENTS}) + "${wxSOURCE_DIR}/${SUB_DIR}/" + ${APP_UNPARSED_ARGUMENTS}) else() # If no source files have been specified use default src name - set(src_files ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${name}.cpp) + set(src_files ${wxSOURCE_DIR}/${SUB_DIR}/${name}.cpp) endif() if(WIN32) - if(SAMPLE_RES) - foreach(res ${SAMPLE_RES}) - list(APPEND src_files ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${res}) + if(APP_RES) + foreach(res ${APP_RES}) + list(APPEND src_files ${wxSOURCE_DIR}/${SUB_DIR}/${res}) endforeach() else() - # Include default sample.rc - list(APPEND src_files ${wxSOURCE_DIR}/samples/sample.rc) + # Include default resource file + 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) endif() - if(SAMPLE_NAME) - set(target_name ${SAMPLE_NAME}) - else() - set(target_name ${name}) - endif() - - if(SAMPLE_DLL) + if(APP_DLL) add_library(${target_name} SHARED ${src_files}) else() - if(SAMPLE_CONSOLE) + if(APP_CONSOLE OR group STREQUAL Tests) set(exe_type) else() set(exe_type WIN32 MACOSX_BUNDLE) @@ -714,28 +736,37 @@ function(wx_add_sample name) target_compile_definitions(${target_name} PRIVATE wxUSE_DPI_AWARE_MANIFEST=${wxUSE_DPI_AWARE_MANIFEST_VALUE}) endif() endif() - # All samples use at least the base library other libraries + + # 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 SAMPLE_CONSOLE) - # UI samples always require core + if(NOT APP_CONSOLE) + # UI applications always require core wx_exe_link_libraries(${target_name} wxcore) else() target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1) endif() - if(SAMPLE_LIBRARIES) - wx_exe_link_libraries(${target_name} ${SAMPLE_LIBRARIES}) + if(APP_LIBRARIES) + wx_exe_link_libraries(${target_name} ${APP_LIBRARIES}) endif() if(wxBUILD_SHARED) target_compile_definitions(${target_name} PRIVATE WXUSINGDLL) endif() - if(SAMPLE_DEFINITIONS) - target_compile_definitions(${target_name} PRIVATE ${SAMPLE_DEFINITIONS}) + if(APP_DEFINITIONS) + target_compile_definitions(${target_name} PRIVATE ${APP_DEFINITIONS}) endif() - if(SAMPLE_DATA) + + if(group STREQUAL Samples) + target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/samples) + elseif(group STREQUAL Tests) + target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/tests) + target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/3rdparty/catch/include) + endif() + + if(APP_DATA) # TODO: handle data files differently for OS X bundles # Copy data files to output directory - foreach(data_src ${SAMPLE_DATA}) + foreach(data_src ${APP_DATA}) string(FIND ${data_src} ":" HAS_COLON) if(${HAS_COLON} GREATER -1) MATH(EXPR DEST_INDEX "${HAS_COLON}+1") @@ -746,17 +777,15 @@ function(wx_add_sample name) endif() list(APPEND cmds COMMAND ${CMAKE_COMMAND} - -E copy ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${data_src} + -E copy ${wxSOURCE_DIR}/${SUB_DIR}/${data_src} ${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}/${data_dst}) endforeach() add_custom_command( TARGET ${target_name} ${cmds} - COMMENT "Copying sample data files...") + COMMENT "Copying ${target_name} data files...") endif() - if(WIN32) - # The resource compiler needs this include directory to find res files - target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/samples/) - elseif(APPLE) + + if(APPLE) if(NOT IPHONE) set_target_properties(${target_name} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${wxSOURCE_DIR}/samples/Info.plist.in" @@ -772,18 +801,27 @@ function(wx_add_sample name) ) endif() - set(folder "Samples") - if(SAMPLE_FOLDER) - wx_string_append(folder "/${SAMPLE_FOLDER}") + if(APP_FOLDER) + set(APP_FOLDER ${group}/${APP_FOLDER}) + elseif(wxSAMPLE_FOLDER) + set(APP_FOLDER ${group}/${wxSAMPLE_FOLDER}) + else() + set(APP_FOLDER ${group}) endif() wx_set_common_target_properties(${target_name}) - wx_sample_enable_precomp(${target_name}) + wx_app_enable_precomp(${target_name}) set_target_properties(${target_name} PROPERTIES - FOLDER ${folder} + FOLDER ${APP_FOLDER} ) set_target_properties(${target_name} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}" ) + + if(group STREQUAL Tests) + add_test(NAME ${target_name} + COMMAND ${target_name} + WORKING_DIRECTORY ${wxSOURCE_DIR}/tests) + endif() endfunction() # Link libraries to a sample @@ -864,43 +902,3 @@ macro(wx_dependent_option option doc default depends force) set(${option} "${${option}_ISSET}") endif() endmacro() - -# wx_add_test( [src...]) -# Optionally: -# DATA followed by required data files -# RES followed by WIN32 .rc files -function(wx_add_test name) - cmake_parse_arguments(TEST "" "" "DATA;RES" ${ARGN}) - wx_list_add_prefix(test_src "${wxSOURCE_DIR}/tests/" ${TEST_UNPARSED_ARGUMENTS}) - if(WIN32 AND TEST_RES) - foreach(res ${TEST_RES}) - list(APPEND test_src ${wxSOURCE_DIR}/tests/${res}) - endforeach() - endif() - add_executable(${name} ${test_src}) - target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" "${wxSOURCE_DIR}/3rdparty/catch/include") - wx_exe_link_libraries(${name} wxbase) - if(wxBUILD_SHARED) - target_compile_definitions(${name} PRIVATE WXUSINGDLL) - endif() - if(TEST_DATA) - # Copy data files to output directory - foreach(data_file ${TEST_DATA}) - list(APPEND cmds COMMAND ${CMAKE_COMMAND} - -E copy ${wxSOURCE_DIR}/tests/${data_file} - ${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}/${data_file}) - endforeach() - add_custom_command( - TARGET ${name} ${cmds} - COMMENT "Copying test data files...") - endif() - wx_set_common_target_properties(${name}) - set_target_properties(${name} PROPERTIES FOLDER "Tests") - set_target_properties(${name} PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "${wxSOURCE_DIR}/tests" - ) - - add_test(NAME ${name} - COMMAND ${name} - WORKING_DIRECTORY ${wxSOURCE_DIR}/tests) -endfunction() diff --git a/build/cmake/tests/CMakeLists.txt b/build/cmake/tests/CMakeLists.txt index 9974184b21..edf8bbf719 100644 --- a/build/cmake/tests/CMakeLists.txt +++ b/build/cmake/tests/CMakeLists.txt @@ -8,12 +8,6 @@ ############################################################################# add_subdirectory(base) - -# Build GUI tests -if(wxUSE_GUI AND wxBUILD_TESTS STREQUAL "ALL") - add_subdirectory(drawing) add_subdirectory(gui) add_subdirectory(headers) - -endif() diff --git a/build/cmake/tests/base/CMakeLists.txt b/build/cmake/tests/base/CMakeLists.txt index cc490183ab..9a9ed4c11c 100644 --- a/build/cmake/tests/base/CMakeLists.txt +++ b/build/cmake/tests/base/CMakeLists.txt @@ -117,14 +117,12 @@ set(TEST_DATA testdata.fc ) -wx_add_test(test_base ${TEST_SRC} +wx_add_test(test_base CONSOLE ${TEST_SRC} DATA ${TEST_DATA} ) -target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1) if(wxUSE_SOCKETS) wx_exe_link_libraries(test_base wxnet) endif() if(wxUSE_XML) wx_exe_link_libraries(test_base wxxml) endif() -wx_test_enable_precomp(test_base) diff --git a/build/cmake/tests/drawing/CMakeLists.txt b/build/cmake/tests/drawing/CMakeLists.txt index ba6aeb480f..376e55e4b9 100644 --- a/build/cmake/tests/drawing/CMakeLists.txt +++ b/build/cmake/tests/drawing/CMakeLists.txt @@ -43,8 +43,6 @@ wx_add_test(test_drawing ${TEST_DRAWING_SRC} if(wxUSE_SOCKETS) wx_exe_link_libraries(test_drawing wxnet) endif() -wx_exe_link_libraries(test_drawing wxcore) -wx_test_enable_precomp(test_drawing) # This is a sample plugin, it simply uses a wxImage based # wxGraphicsContext. It should render the same as the built-in test. Use diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt index ed839a0aba..f165ad68c1 100644 --- a/build/cmake/tests/gui/CMakeLists.txt +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -182,9 +182,7 @@ set(TEST_GUI_DATA wx_add_test(test_gui ${TEST_GUI_SRC} DATA ${TEST_GUI_DATA} - RES ../samples/sample.rc ) -wx_exe_link_libraries(test_gui wxcore) if(wxUSE_AUI) wx_exe_link_libraries(test_gui wxaui) endif() @@ -212,4 +210,3 @@ endif() if(wxUSE_WEBVIEW) wx_exe_link_libraries(test_gui wxwebview) endif() -wx_test_enable_precomp(test_gui) diff --git a/build/cmake/tests/headers/CMakeLists.txt b/build/cmake/tests/headers/CMakeLists.txt index a04d219e47..fe535e242c 100644 --- a/build/cmake/tests/headers/CMakeLists.txt +++ b/build/cmake/tests/headers/CMakeLists.txt @@ -18,8 +18,6 @@ set(TEST_SRC ) wx_add_test(test_headers ${TEST_SRC}) -wx_exe_link_libraries(test_headers wxcore) if(wxUSE_SOCKETS) wx_exe_link_libraries(test_headers wxnet) endif() -wx_test_enable_precomp(test_headers) From 6dfb96c075536bf865a13245e624a3b3a9865d8a Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 16 Jan 2021 01:34:03 +0100 Subject: [PATCH 2/6] CMake: Use build directory as ctest working directory Use existing variable for VS working directory. --- build/cmake/functions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 0efba28ba6..828f0ad7d0 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -814,13 +814,13 @@ function(wx_add name group) FOLDER ${APP_FOLDER} ) set_target_properties(${target_name} PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}" + VS_DEBUGGER_WORKING_DIRECTORY "${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}" ) if(group STREQUAL Tests) add_test(NAME ${target_name} COMMAND ${target_name} - WORKING_DIRECTORY ${wxSOURCE_DIR}/tests) + WORKING_DIRECTORY "${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}") endif() endfunction() From b51d146adfef268815a268c4e56a04c96e873203 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 16 Jan 2021 01:34:10 +0100 Subject: [PATCH 3/6] Run ctest in correct directory on Travis CI --- build/tools/travis-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 27b3c948fa..435c81c704 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -39,7 +39,6 @@ case $wxTOOLSET in if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then echo -n 'Building and '; fi echo 'Installing...' sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS - popd echo 'travis_fold:end:install' if [ "$wxCMAKE_TESTS" != "OFF" ]; then @@ -51,6 +50,7 @@ case $wxTOOLSET in echo 'travis_fold:start:testinstall' echo 'Testing installation...' + popd mkdir build_cmake_install_test pushd build_cmake_install_test cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES ../samples/minimal From 564f9d6037d7c25ef17c54944036b4a1a7a6dfc0 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 16 Jan 2021 22:10:18 +0100 Subject: [PATCH 4/6] Specify tests to exclude in CI CMake builds Escape the | in AppVeyor bat file to prevent errors. --- build/tools/appveyor-test.bat | 6 +++--- build/tools/travis-ci.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/tools/appveyor-test.bat b/build/tools/appveyor-test.bat index 18b9b9da22..f0319c16ed 100755 --- a/build/tools/appveyor-test.bat +++ b/build/tools/appveyor-test.bat @@ -44,14 +44,14 @@ echo. exit /b 0 :cmake_qt -set CMAKE_TEST_REGEX="test_base" +set CMAKE_TEST_REGEX="test_[drawing^|gui^|headers]" goto :cmake :cmake if "%CONFIGURATION%"=="" set CONFIGURATION=Release -if "%CMAKE_TEST_REGEX%"=="" set CMAKE_TEST_REGEX="test_[base|gui]" +if "%CMAKE_TEST_REGEX%"=="" set CMAKE_TEST_REGEX="test_drawing" cd ..\build_cmake -ctest -V -C %CONFIGURATION% -R %CMAKE_TEST_REGEX% --output-on-failure --interactive-debug-mode 0 . +ctest -V -C %CONFIGURATION% -E %CMAKE_TEST_REGEX% --output-on-failure --interactive-debug-mode 0 . if %errorlevel% NEQ 0 goto :error goto :eof diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 435c81c704..6df3b2d8a3 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -44,7 +44,7 @@ case $wxTOOLSET in if [ "$wxCMAKE_TESTS" != "OFF" ]; then echo 'travis_fold:start:testing' echo 'Testing...' - ctest -V -C Debug -R "test_base" --output-on-failure --interactive-debug-mode 0 . + ctest -V -C Debug -E "test_drawing" --output-on-failure --interactive-debug-mode 0 . echo 'travis_fold:end:testing' fi From 71c4653b94755f22ea7f68462031d85dc9c91d9a Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 19 Jan 2021 01:20:02 +0100 Subject: [PATCH 5/6] Enable wxUSE_WEBVIEW_EDGE in an AppVeyor test --- appveyor.yml | 6 ++++-- build/tools/appveyor.bat | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0b43c6da5c..29a18ef625 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,14 +27,13 @@ environment: VS: '9.0' BUILD: release ARCH: x86 - wxUSE_STL: 0 - TOOLSET: nmake VS: '14.0' BUILD: debug ARCH: amd64 wxUSE_STL: 1 + wxUSE_WEBVIEW_EDGE: 1 - TOOLSET: mingw - wxUSE_STL: 0 - TOOLSET: msys2 MSYSTEM: MINGW32 - TOOLSET: cygwin @@ -61,9 +60,12 @@ init: before_build: - ps: | $env:PATH = $env:PATH -replace "C:\\Program Files\\Git\\usr\\bin","" + if (-not (Test-Path env:wxUSE_STL)) { $env:wxUSE_STL = '0' } + if (-not (Test-Path env:wxUSE_WEBVIEW_EDGE)) { $env:wxUSE_WEBVIEW_EDGE = '0' } if (($env:compiler -ne "msys2") -and ($env:compiler -ne "cygwin")) { gc include\wx\msw\setup0.h | %{$_ -replace "define wxUSE_STL 0", "define wxUSE_STL $env:wxUSE_STL"} | + %{$_ -replace "define wxUSE_WEBVIEW_EDGE 0", "define wxUSE_WEBVIEW_EDGE $env:wxUSE_WEBVIEW_EDGE"} | sc include\wx\msw\setup.h } diff --git a/build/tools/appveyor.bat b/build/tools/appveyor.bat index 8ad6a2c021..bddcd5d9c7 100644 --- a/build/tools/appveyor.bat +++ b/build/tools/appveyor.bat @@ -1,4 +1,10 @@ set MSBUILD_LOGGER=/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + +if "%wxUSE_WEBVIEW_EDGE%"=="1" ( + curl -L -o 3rdparty/webview2.zip https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2 + 7z x 3rdparty/webview2.zip -o3rdparty/webview2 -aoa +) + goto %TOOLSET% :msbuild From c8a71bc6318eb7d48f265fd14d6310cfaba2b854 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 19 Jan 2021 22:42:42 +0100 Subject: [PATCH 6/6] CMake: Enable wxUSE_WEBVIEW_EDGE when WebView2 SDK is detected Only for MSVC >1800 (Visual Studio 2017, vc140) and later. --- build/cmake/init.cmake | 4 ++++ build/cmake/options.cmake | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 6dca1cc869..a125c10979 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -453,6 +453,10 @@ if(wxUSE_GUI) wx_option_force_value(wxUSE_WEBVIEW OFF) endif() elseif(WXMSW) + if(wxUSE_WEBVIEW_EDGE AND NOT EXISTS "${wxSOURCE_DIR}/3rdparty/webview2") + message("WebView2 SDK not found, WebviewEdge won't be available") + wx_option_force_value(wxUSE_WEBVIEW_EDGE OFF) + endif() 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) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index e8b035ad7f..2a88f8c24e 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -435,6 +435,18 @@ wx_option(wxUSE_ICO_CUR "use Windows ICO and CUR formats") # --------------------------------------------------------------------------- if(WIN32) + if(MSVC_VERSION GREATER 1600 AND NOT CMAKE_VS_PLATFORM_TOOLSET MATCHES "_xp$") + set(wxUSE_WINRT_DEFAULT ON) + else() + set(wxUSE_WINRT_DEFAULT OFF) + endif() + if(MSVC_VERSION GREATER 1800 AND NOT CMAKE_VS_PLATFORM_TOOLSET MATCHES "_xp$") + set(wxUSE_WEBVIEW_EDGE_DEFAULT ON) + else() + set(wxUSE_WEBVIEW_EDGE_DEFAULT OFF) + endif() + + wx_option(wxUSE_ACCESSIBILITY "enable accessibility support") wx_option(wxUSE_ACTIVEX " enable wxActiveXContainer class (Win32 only)") wx_option(wxUSE_CRASHREPORT "enable wxCrashReport::Generate() to create mini dumps (Win32 only)") wx_option(wxUSE_DC_CACHEING "cache temporary wxDC objects (Win32 only)") @@ -444,16 +456,10 @@ if(WIN32) wx_option(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW "use PS printing in wxMSW (Win32 only)") wx_option(wxUSE_TASKBARICON_BALLOONS "enable wxTaskBarIcon::ShowBalloon() method (Win32 only)") wx_option(wxUSE_UXTHEME "enable support for Windows XP themed look (Win32 only)") + wx_option(wxUSE_WEBVIEW_EDGE "use wxWebView Edge (Chromium) backend (Windows 7+ only)" ${wxUSE_WEBVIEW_EDGE_DEFAULT}) wx_option(wxUSE_WEBVIEW_IE "use wxWebView IE backend (Win32 only)") - wx_option(wxUSE_WEBVIEW_EDGE "use wxWebView Edge (Chromium) backend (Windows 7+ only)" OFF) - wx_option(wxUSE_WXDIB "use wxDIB class (Win32 only)") - if(MSVC_VERSION GREATER 1600 AND NOT CMAKE_VS_PLATFORM_TOOLSET MATCHES "_xp$") - set(wxUSE_WINRT_DEFAULT ON) - else() - set(wxUSE_WINRT_DEFAULT OFF) - endif() wx_option(wxUSE_WINRT "enable WinRT support" ${wxUSE_WINRT_DEFAULT}) - wx_option(wxUSE_ACCESSIBILITY "enable accessibility support") + wx_option(wxUSE_WXDIB "use wxDIB class (Win32 only)") endif() # this one is not really MSW-specific but it exists mainly to be turned off