Merge branch 'cmake-test' of git://github.com/MaartenBent/wxWidgets
CMake: use a common function for adding samples, tests and demos. Also add wxUSE_WEBVIEW_EDGE support. See https://github.com/wxWidgets/wxWidgets/pull/2167
This commit is contained in:
@@ -27,14 +27,13 @@ environment:
|
|||||||
VS: '9.0'
|
VS: '9.0'
|
||||||
BUILD: release
|
BUILD: release
|
||||||
ARCH: x86
|
ARCH: x86
|
||||||
wxUSE_STL: 0
|
|
||||||
- TOOLSET: nmake
|
- TOOLSET: nmake
|
||||||
VS: '14.0'
|
VS: '14.0'
|
||||||
BUILD: debug
|
BUILD: debug
|
||||||
ARCH: amd64
|
ARCH: amd64
|
||||||
wxUSE_STL: 1
|
wxUSE_STL: 1
|
||||||
|
wxUSE_WEBVIEW_EDGE: 1
|
||||||
- TOOLSET: mingw
|
- TOOLSET: mingw
|
||||||
wxUSE_STL: 0
|
|
||||||
- TOOLSET: msys2
|
- TOOLSET: msys2
|
||||||
MSYSTEM: MINGW32
|
MSYSTEM: MINGW32
|
||||||
- TOOLSET: cygwin
|
- TOOLSET: cygwin
|
||||||
@@ -61,9 +60,12 @@ init:
|
|||||||
before_build:
|
before_build:
|
||||||
- ps: |
|
- ps: |
|
||||||
$env:PATH = $env:PATH -replace "C:\\Program Files\\Git\\usr\\bin",""
|
$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")) {
|
if (($env:compiler -ne "msys2") -and ($env:compiler -ne "cygwin")) {
|
||||||
gc include\wx\msw\setup0.h |
|
gc include\wx\msw\setup0.h |
|
||||||
%{$_ -replace "define wxUSE_STL 0", "define wxUSE_STL $env:wxUSE_STL"} |
|
%{$_ -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
|
sc include\wx\msw\setup.h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,63 +7,6 @@
|
|||||||
# Licence: wxWindows licence
|
# 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
|
wx_add_demo(bombs
|
||||||
bombs.cpp
|
bombs.cpp
|
||||||
bombs.h
|
bombs.h
|
||||||
|
@@ -367,17 +367,8 @@ macro(wx_target_enable_precomp target_name)
|
|||||||
cotire(${target_name})
|
cotire(${target_name})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Enable precompiled headers for tests
|
# Enable precompiled headers for applications
|
||||||
macro(wx_test_enable_precomp target_name)
|
macro(wx_app_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)
|
|
||||||
if(wxBUILD_PRECOMP)
|
if(wxBUILD_PRECOMP)
|
||||||
wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
@@ -414,11 +405,13 @@ endmacro()
|
|||||||
# wx_exe_link_libraries(target libs...)
|
# wx_exe_link_libraries(target libs...)
|
||||||
# Link wx libraries to executable
|
# Link wx libraries to executable
|
||||||
macro(wx_exe_link_libraries name)
|
macro(wx_exe_link_libraries name)
|
||||||
|
if(TARGET ${name})
|
||||||
if(wxBUILD_MONOLITHIC)
|
if(wxBUILD_MONOLITHIC)
|
||||||
target_link_libraries(${name} PUBLIC wxmono)
|
target_link_libraries(${name} PUBLIC wxmono)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${name};PRIVATE;${ARGN})
|
target_link_libraries(${name};PRIVATE;${ARGN})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# wx_lib_include_directories(name [])
|
# wx_lib_include_directories(name [])
|
||||||
@@ -612,82 +605,111 @@ function(wx_print_thirdparty_library_summary)
|
|||||||
message(STATUS ${message})
|
message(STATUS ${message})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Add executable for sample
|
# Add sample, test or demo
|
||||||
# wx_add_sample(<name> [CONSOLE|DLL] [IMPORTANT] [SRC_FILES...]
|
# wx_add(<name> <group> [CONSOLE|DLL] [IMPORTANT] [SRC_FILES...]
|
||||||
# [LIBRARIES ...] [NAME target_name] [FOLDER folder])
|
# [LIBRARIES ...] [NAME target_name] [FOLDER folder]
|
||||||
# first parameter may be CONSOLE to indicate a console application
|
# [DATA ...] [DEFINITIONS ...] [RES ...])
|
||||||
# all following parameters a src files for the executable
|
# name default target name
|
||||||
# source files are relative to samples/${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:
|
# Optionally:
|
||||||
# DATA followed by required data files. Use a colon to separate different source and dest paths
|
# IMPORTANT (samples only) does not require wxBUILD_SAMPLES=ALL
|
||||||
# DEFINITIONS list of definitions for the target
|
|
||||||
# FOLDER subfolder in IDE
|
|
||||||
# LIBRARIES followed by required libraries
|
# LIBRARIES followed by required libraries
|
||||||
# NAME alternative target_name
|
# NAME alternative target_name
|
||||||
# IMPORTANT does not require wxBUILD_SAMPLES=ALL
|
# 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
|
# RES followed by WIN32 .rc files
|
||||||
#
|
#
|
||||||
# Additionally the following variables may be set before calling wx_add_sample:
|
# Additionally the following variables may be set before calling wx_add_sample:
|
||||||
# wxSAMPLE_SUBDIR subdirectory in the samples/ folder to use as base
|
# wxSAMPLE_SUBDIR subdirectory in the samples/ folder to use as base
|
||||||
# wxSAMPLE_FOLDER IDE sub folder to be used for the samples
|
# wxSAMPLE_FOLDER IDE sub folder to be used for the samples
|
||||||
|
|
||||||
function(wx_add_sample name)
|
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"
|
"CONSOLE;DLL;IMPORTANT"
|
||||||
"NAME;FOLDER"
|
"NAME;FOLDER"
|
||||||
"DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES"
|
"DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES"
|
||||||
${ARGN}
|
${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()
|
endif()
|
||||||
|
|
||||||
# Only build important samples without wxBUILD_SAMPLES=ALL
|
if(group STREQUAL Samples)
|
||||||
if(NOT SAMPLE_IMPORTANT AND NOT wxBUILD_SAMPLES STREQUAL "ALL")
|
if(NOT APP_IMPORTANT AND NOT wxBUILD_SAMPLES STREQUAL "ALL")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
foreach(depend ${SAMPLE_DEPENDS})
|
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 ${APP_DEPENDS})
|
||||||
if(NOT ${depend})
|
if(NOT ${depend})
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Only build GUI samples with wxUSE_GUI=1
|
# Only build GUI applications with wxUSE_GUI=1
|
||||||
if(NOT wxUSE_GUI AND NOT SAMPLE_CONSOLE)
|
if(NOT wxUSE_GUI AND NOT APP_CONSOLE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SAMPLE_UNPARSED_ARGUMENTS)
|
if(APP_UNPARSED_ARGUMENTS)
|
||||||
wx_list_add_prefix(src_files
|
wx_list_add_prefix(src_files
|
||||||
"${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/"
|
"${wxSOURCE_DIR}/${SUB_DIR}/"
|
||||||
${SAMPLE_UNPARSED_ARGUMENTS})
|
${APP_UNPARSED_ARGUMENTS})
|
||||||
else()
|
else()
|
||||||
# If no source files have been specified use default src name
|
# 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()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(SAMPLE_RES)
|
if(APP_RES)
|
||||||
foreach(res ${SAMPLE_RES})
|
foreach(res ${APP_RES})
|
||||||
list(APPEND src_files ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${res})
|
list(APPEND src_files ${wxSOURCE_DIR}/${SUB_DIR}/${res})
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
# Include default sample.rc
|
# Include default resource file
|
||||||
list(APPEND src_files ${wxSOURCE_DIR}/samples/sample.rc)
|
list(APPEND src_files ${wxSOURCE_DIR}/${DEFAULT_RC_FILE})
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE AND NOT IPHONE)
|
elseif(APPLE AND NOT IPHONE)
|
||||||
list(APPEND src_files ${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns)
|
list(APPEND src_files ${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SAMPLE_NAME)
|
if(APP_DLL)
|
||||||
set(target_name ${SAMPLE_NAME})
|
|
||||||
else()
|
|
||||||
set(target_name ${name})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SAMPLE_DLL)
|
|
||||||
add_library(${target_name} SHARED ${src_files})
|
add_library(${target_name} SHARED ${src_files})
|
||||||
else()
|
else()
|
||||||
if(SAMPLE_CONSOLE)
|
if(APP_CONSOLE OR group STREQUAL Tests)
|
||||||
set(exe_type)
|
set(exe_type)
|
||||||
else()
|
else()
|
||||||
set(exe_type WIN32 MACOSX_BUNDLE)
|
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})
|
target_compile_definitions(${target_name} PRIVATE wxUSE_DPI_AWARE_MANIFEST=${wxUSE_DPI_AWARE_MANIFEST_VALUE})
|
||||||
endif()
|
endif()
|
||||||
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()
|
# will have to be added with wx_link_sample_libraries()
|
||||||
wx_exe_link_libraries(${target_name} wxbase)
|
wx_exe_link_libraries(${target_name} wxbase)
|
||||||
if(NOT SAMPLE_CONSOLE)
|
if(NOT APP_CONSOLE)
|
||||||
# UI samples always require core
|
# UI applications always require core
|
||||||
wx_exe_link_libraries(${target_name} wxcore)
|
wx_exe_link_libraries(${target_name} wxcore)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
||||||
endif()
|
endif()
|
||||||
if(SAMPLE_LIBRARIES)
|
if(APP_LIBRARIES)
|
||||||
wx_exe_link_libraries(${target_name} ${SAMPLE_LIBRARIES})
|
wx_exe_link_libraries(${target_name} ${APP_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(wxBUILD_SHARED)
|
if(wxBUILD_SHARED)
|
||||||
target_compile_definitions(${target_name} PRIVATE WXUSINGDLL)
|
target_compile_definitions(${target_name} PRIVATE WXUSINGDLL)
|
||||||
endif()
|
endif()
|
||||||
if(SAMPLE_DEFINITIONS)
|
if(APP_DEFINITIONS)
|
||||||
target_compile_definitions(${target_name} PRIVATE ${SAMPLE_DEFINITIONS})
|
target_compile_definitions(${target_name} PRIVATE ${APP_DEFINITIONS})
|
||||||
endif()
|
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
|
# TODO: handle data files differently for OS X bundles
|
||||||
# Copy data files to output directory
|
# Copy data files to output directory
|
||||||
foreach(data_src ${SAMPLE_DATA})
|
foreach(data_src ${APP_DATA})
|
||||||
string(FIND ${data_src} ":" HAS_COLON)
|
string(FIND ${data_src} ":" HAS_COLON)
|
||||||
if(${HAS_COLON} GREATER -1)
|
if(${HAS_COLON} GREATER -1)
|
||||||
MATH(EXPR DEST_INDEX "${HAS_COLON}+1")
|
MATH(EXPR DEST_INDEX "${HAS_COLON}+1")
|
||||||
@@ -746,17 +777,15 @@ function(wx_add_sample name)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND cmds COMMAND ${CMAKE_COMMAND}
|
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})
|
${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}/${data_dst})
|
||||||
endforeach()
|
endforeach()
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${target_name} ${cmds}
|
TARGET ${target_name} ${cmds}
|
||||||
COMMENT "Copying sample data files...")
|
COMMENT "Copying ${target_name} data files...")
|
||||||
endif()
|
endif()
|
||||||
if(WIN32)
|
|
||||||
# The resource compiler needs this include directory to find res files
|
if(APPLE)
|
||||||
target_include_directories(${target_name} PRIVATE ${wxSOURCE_DIR}/samples/)
|
|
||||||
elseif(APPLE)
|
|
||||||
if(NOT IPHONE)
|
if(NOT IPHONE)
|
||||||
set_target_properties(${target_name} PROPERTIES
|
set_target_properties(${target_name} PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST "${wxSOURCE_DIR}/samples/Info.plist.in"
|
MACOSX_BUNDLE_INFO_PLIST "${wxSOURCE_DIR}/samples/Info.plist.in"
|
||||||
@@ -772,18 +801,27 @@ function(wx_add_sample name)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(folder "Samples")
|
if(APP_FOLDER)
|
||||||
if(SAMPLE_FOLDER)
|
set(APP_FOLDER ${group}/${APP_FOLDER})
|
||||||
wx_string_append(folder "/${SAMPLE_FOLDER}")
|
elseif(wxSAMPLE_FOLDER)
|
||||||
|
set(APP_FOLDER ${group}/${wxSAMPLE_FOLDER})
|
||||||
|
else()
|
||||||
|
set(APP_FOLDER ${group})
|
||||||
endif()
|
endif()
|
||||||
wx_set_common_target_properties(${target_name})
|
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
|
set_target_properties(${target_name} PROPERTIES
|
||||||
FOLDER ${folder}
|
FOLDER ${APP_FOLDER}
|
||||||
)
|
)
|
||||||
set_target_properties(${target_name} PROPERTIES
|
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 "${wxOUTPUT_DIR}/${wxPLATFORM_LIB_DIR}")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Link libraries to a sample
|
# Link libraries to a sample
|
||||||
@@ -864,43 +902,3 @@ macro(wx_dependent_option option doc default depends force)
|
|||||||
set(${option} "${${option}_ISSET}")
|
set(${option} "${${option}_ISSET}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# wx_add_test(<name> [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()
|
|
||||||
|
@@ -453,6 +453,10 @@ if(wxUSE_GUI)
|
|||||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||||
endif()
|
endif()
|
||||||
elseif(WXMSW)
|
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)
|
if(NOT wxUSE_WEBVIEW_IE AND NOT wxUSE_WEBVIEW_EDGE)
|
||||||
message(WARNING "WebviewIE and WebviewEdge not found or enabled, wxWebview won't be available")
|
message(WARNING "WebviewIE and WebviewEdge not found or enabled, wxWebview won't be available")
|
||||||
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
wx_option_force_value(wxUSE_WEBVIEW OFF)
|
||||||
|
@@ -435,6 +435,18 @@ wx_option(wxUSE_ICO_CUR "use Windows ICO and CUR formats")
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
if(WIN32)
|
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_ACTIVEX " enable wxActiveXContainer class (Win32 only)")
|
||||||
wx_option(wxUSE_CRASHREPORT "enable wxCrashReport::Generate() to create mini dumps (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)")
|
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_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_TASKBARICON_BALLOONS "enable wxTaskBarIcon::ShowBalloon() method (Win32 only)")
|
||||||
wx_option(wxUSE_UXTHEME "enable support for Windows XP themed look (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_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_WINRT "enable WinRT support" ${wxUSE_WINRT_DEFAULT})
|
||||||
wx_option(wxUSE_ACCESSIBILITY "enable accessibility support")
|
wx_option(wxUSE_WXDIB "use wxDIB class (Win32 only)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# this one is not really MSW-specific but it exists mainly to be turned off
|
# this one is not really MSW-specific but it exists mainly to be turned off
|
||||||
|
@@ -8,12 +8,6 @@
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
add_subdirectory(base)
|
add_subdirectory(base)
|
||||||
|
|
||||||
# Build GUI tests
|
|
||||||
if(wxUSE_GUI AND wxBUILD_TESTS STREQUAL "ALL")
|
|
||||||
|
|
||||||
add_subdirectory(drawing)
|
add_subdirectory(drawing)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
add_subdirectory(headers)
|
add_subdirectory(headers)
|
||||||
|
|
||||||
endif()
|
|
||||||
|
@@ -117,14 +117,12 @@ set(TEST_DATA
|
|||||||
testdata.fc
|
testdata.fc
|
||||||
)
|
)
|
||||||
|
|
||||||
wx_add_test(test_base ${TEST_SRC}
|
wx_add_test(test_base CONSOLE ${TEST_SRC}
|
||||||
DATA ${TEST_DATA}
|
DATA ${TEST_DATA}
|
||||||
)
|
)
|
||||||
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
|
||||||
if(wxUSE_SOCKETS)
|
if(wxUSE_SOCKETS)
|
||||||
wx_exe_link_libraries(test_base wxnet)
|
wx_exe_link_libraries(test_base wxnet)
|
||||||
endif()
|
endif()
|
||||||
if(wxUSE_XML)
|
if(wxUSE_XML)
|
||||||
wx_exe_link_libraries(test_base wxxml)
|
wx_exe_link_libraries(test_base wxxml)
|
||||||
endif()
|
endif()
|
||||||
wx_test_enable_precomp(test_base)
|
|
||||||
|
@@ -43,8 +43,6 @@ wx_add_test(test_drawing ${TEST_DRAWING_SRC}
|
|||||||
if(wxUSE_SOCKETS)
|
if(wxUSE_SOCKETS)
|
||||||
wx_exe_link_libraries(test_drawing wxnet)
|
wx_exe_link_libraries(test_drawing wxnet)
|
||||||
endif()
|
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
|
# This is a sample plugin, it simply uses a wxImage based
|
||||||
# wxGraphicsContext. It should render the same as the built-in test. Use
|
# wxGraphicsContext. It should render the same as the built-in test. Use
|
||||||
|
@@ -182,9 +182,7 @@ set(TEST_GUI_DATA
|
|||||||
|
|
||||||
wx_add_test(test_gui ${TEST_GUI_SRC}
|
wx_add_test(test_gui ${TEST_GUI_SRC}
|
||||||
DATA ${TEST_GUI_DATA}
|
DATA ${TEST_GUI_DATA}
|
||||||
RES ../samples/sample.rc
|
|
||||||
)
|
)
|
||||||
wx_exe_link_libraries(test_gui wxcore)
|
|
||||||
if(wxUSE_AUI)
|
if(wxUSE_AUI)
|
||||||
wx_exe_link_libraries(test_gui wxaui)
|
wx_exe_link_libraries(test_gui wxaui)
|
||||||
endif()
|
endif()
|
||||||
@@ -212,4 +210,3 @@ endif()
|
|||||||
if(wxUSE_WEBVIEW)
|
if(wxUSE_WEBVIEW)
|
||||||
wx_exe_link_libraries(test_gui wxwebview)
|
wx_exe_link_libraries(test_gui wxwebview)
|
||||||
endif()
|
endif()
|
||||||
wx_test_enable_precomp(test_gui)
|
|
||||||
|
@@ -18,8 +18,6 @@ set(TEST_SRC
|
|||||||
)
|
)
|
||||||
|
|
||||||
wx_add_test(test_headers ${TEST_SRC})
|
wx_add_test(test_headers ${TEST_SRC})
|
||||||
wx_exe_link_libraries(test_headers wxcore)
|
|
||||||
if(wxUSE_SOCKETS)
|
if(wxUSE_SOCKETS)
|
||||||
wx_exe_link_libraries(test_headers wxnet)
|
wx_exe_link_libraries(test_headers wxnet)
|
||||||
endif()
|
endif()
|
||||||
wx_test_enable_precomp(test_headers)
|
|
||||||
|
@@ -44,14 +44,14 @@ echo.
|
|||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
:cmake_qt
|
:cmake_qt
|
||||||
set CMAKE_TEST_REGEX="test_base"
|
set CMAKE_TEST_REGEX="test_[drawing^|gui^|headers]"
|
||||||
goto :cmake
|
goto :cmake
|
||||||
|
|
||||||
:cmake
|
:cmake
|
||||||
if "%CONFIGURATION%"=="" set CONFIGURATION=Release
|
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
|
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
|
if %errorlevel% NEQ 0 goto :error
|
||||||
goto :eof
|
goto :eof
|
||||||
|
|
||||||
|
@@ -1,4 +1,10 @@
|
|||||||
set MSBUILD_LOGGER=/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
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%
|
goto %TOOLSET%
|
||||||
|
|
||||||
:msbuild
|
:msbuild
|
||||||
|
@@ -39,18 +39,18 @@ case $wxTOOLSET in
|
|||||||
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then echo -n 'Building and '; fi
|
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then echo -n 'Building and '; fi
|
||||||
echo 'Installing...'
|
echo 'Installing...'
|
||||||
sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS
|
sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS
|
||||||
popd
|
|
||||||
echo 'travis_fold:end:install'
|
echo 'travis_fold:end:install'
|
||||||
|
|
||||||
if [ "$wxCMAKE_TESTS" != "OFF" ]; then
|
if [ "$wxCMAKE_TESTS" != "OFF" ]; then
|
||||||
echo 'travis_fold:start:testing'
|
echo 'travis_fold:start:testing'
|
||||||
echo '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'
|
echo 'travis_fold:end:testing'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'travis_fold:start:testinstall'
|
echo 'travis_fold:start:testinstall'
|
||||||
echo 'Testing installation...'
|
echo 'Testing installation...'
|
||||||
|
popd
|
||||||
mkdir build_cmake_install_test
|
mkdir build_cmake_install_test
|
||||||
pushd build_cmake_install_test
|
pushd build_cmake_install_test
|
||||||
cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES ../samples/minimal
|
cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES ../samples/minimal
|
||||||
|
Reference in New Issue
Block a user