CMake: copy data files of test projects
Add headers to source files so they are included in IDE projects.
This commit is contained in:
@@ -753,8 +753,17 @@ macro(wx_dependent_option option doc default depends force)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# wx_add_test(<name> [src...])
|
# wx_add_test(<name> [src...])
|
||||||
|
# Optionally:
|
||||||
|
# DATA followed by required data files
|
||||||
|
# RES followed by WIN32 .rc files
|
||||||
function(wx_add_test name)
|
function(wx_add_test name)
|
||||||
wx_list_add_prefix(test_src "${wxSOURCE_DIR}/tests/" ${ARGN})
|
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()
|
||||||
if(wxBUILD_PRECOMP AND MSVC)
|
if(wxBUILD_PRECOMP AND MSVC)
|
||||||
# Add dummy source file to be used by cotire for PCH creation
|
# Add dummy source file to be used by cotire for PCH creation
|
||||||
list(INSERT test_src 0 "${wxSOURCE_DIR}/tests/dummy.cpp")
|
list(INSERT test_src 0 "${wxSOURCE_DIR}/tests/dummy.cpp")
|
||||||
@@ -765,6 +774,17 @@ function(wx_add_test name)
|
|||||||
if(wxBUILD_SHARED)
|
if(wxBUILD_SHARED)
|
||||||
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
||||||
endif()
|
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})
|
wx_set_common_target_properties(${name})
|
||||||
set_target_properties(${name} PROPERTIES FOLDER "Tests")
|
set_target_properties(${name} PROPERTIES FOLDER "Tests")
|
||||||
set_target_properties(${name} PROPERTIES
|
set_target_properties(${name} PROPERTIES
|
||||||
|
@@ -92,13 +92,33 @@ set(TEST_SRC
|
|||||||
weakref/evtconnection.cpp
|
weakref/evtconnection.cpp
|
||||||
weakref/weakref.cpp
|
weakref/weakref.cpp
|
||||||
xlocale/xlocale.cpp
|
xlocale/xlocale.cpp
|
||||||
|
|
||||||
|
testprec.h
|
||||||
|
testableframe.h
|
||||||
|
testdate.h
|
||||||
|
testfile.h
|
||||||
|
archive/archivetest.h
|
||||||
|
streams/bstream.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(wxUSE_XML)
|
if(wxUSE_XML)
|
||||||
list(APPEND TEST_SRC xml/xmltest.cpp)
|
list(APPEND TEST_SRC xml/xmltest.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
wx_add_test(test_base ${TEST_SRC})
|
set(TEST_DATA
|
||||||
|
intl/fr/internat.mo
|
||||||
|
intl/fr/internat.po
|
||||||
|
intl/ja/internat.mo
|
||||||
|
intl/ja/internat.po
|
||||||
|
horse.bmp
|
||||||
|
horse.png
|
||||||
|
horse.xpm
|
||||||
|
testdata.fc
|
||||||
|
)
|
||||||
|
|
||||||
|
wx_add_test(test_base ${TEST_SRC}
|
||||||
|
DATA ${TEST_DATA}
|
||||||
|
)
|
||||||
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
||||||
if(wxUSE_SOCKETS)
|
if(wxUSE_SOCKETS)
|
||||||
wx_exe_link_libraries(test_base net)
|
wx_exe_link_libraries(test_base net)
|
||||||
|
@@ -20,8 +20,25 @@ set(TEST_DRAWING_SRC
|
|||||||
drawing/plugindriver.cpp
|
drawing/plugindriver.cpp
|
||||||
drawing/basictest.cpp
|
drawing/basictest.cpp
|
||||||
drawing/fonttest.cpp
|
drawing/fonttest.cpp
|
||||||
|
|
||||||
|
testprec.h
|
||||||
|
testableframe.h
|
||||||
|
testimage.h
|
||||||
|
drawing/gcfactory.h
|
||||||
|
drawing/plugin.h
|
||||||
|
drawing/pluginsample.cpp
|
||||||
|
drawing/testimagefile.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(TEST_DRAWING_DATA
|
||||||
|
drawing/references/image_test_image_cairo-1.8_2_ref.png
|
||||||
|
drawing/references/image_test_image_cg-10.5_2_ref.png
|
||||||
|
drawing/references/image_test_image_gdiplus-6.1_2_ref.png
|
||||||
|
)
|
||||||
|
|
||||||
|
wx_add_test(test_drawing ${TEST_DRAWING_SRC}
|
||||||
|
DATA ${TEST_DRAWING_DATA}
|
||||||
)
|
)
|
||||||
wx_add_test(test_drawing ${TEST_DRAWING_SRC})
|
|
||||||
if(wxUSE_SOCKETS)
|
if(wxUSE_SOCKETS)
|
||||||
wx_exe_link_libraries(test_drawing net)
|
wx_exe_link_libraries(test_drawing net)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -109,8 +109,64 @@ set(TEST_GUI_SRC
|
|||||||
window/clientsize.cpp
|
window/clientsize.cpp
|
||||||
window/setsize.cpp
|
window/setsize.cpp
|
||||||
xml/xrctest.cpp
|
xml/xrctest.cpp
|
||||||
|
|
||||||
|
testprec.h
|
||||||
|
testableframe.h
|
||||||
|
asserthelper.h
|
||||||
|
testdate.h
|
||||||
|
testfile.h
|
||||||
|
testimage.h
|
||||||
|
controls/bookctrlbasetest.h
|
||||||
|
controls/itemcontainertest.h
|
||||||
|
controls/listbasetest.h
|
||||||
|
controls/pickerbasetest.h
|
||||||
|
controls/textentrytest.h
|
||||||
|
persistence/testpersistence.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(TEST_GUI_DATA
|
||||||
|
horse.ani
|
||||||
|
horse.bmp
|
||||||
|
horse.cur
|
||||||
|
horse.gif
|
||||||
|
horse.ico
|
||||||
|
horse.jpg
|
||||||
|
horse.pcx
|
||||||
|
horse.png
|
||||||
|
horse.pnm
|
||||||
|
horse.tga
|
||||||
|
horse.tif
|
||||||
|
horse.xpm
|
||||||
|
image/horse_grey.bmp
|
||||||
|
image/horse_grey_flipped.bmp
|
||||||
|
image/horse_rle4.bmp
|
||||||
|
image/horse_rle4_flipped.bmp
|
||||||
|
image/horse_rle8.bmp
|
||||||
|
image/horse_rle8_flipped.bmp
|
||||||
|
image/cross_bicubic_256x256.png
|
||||||
|
image/cross_bilinear_256x256.png
|
||||||
|
image/cross_box_average_256x256.png
|
||||||
|
image/cross_nearest_neighb_256x256.png
|
||||||
|
image/horse_bicubic_50x50.png
|
||||||
|
image/horse_bicubic_100x100.png
|
||||||
|
image/horse_bicubic_150x150.png
|
||||||
|
image/horse_bicubic_300x300.png
|
||||||
|
image/horse_bilinear_50x50.png
|
||||||
|
image/horse_bilinear_100x100.png
|
||||||
|
image/horse_bilinear_150x150.png
|
||||||
|
image/horse_bilinear_300x300.png
|
||||||
|
image/horse_box_average_50x50.png
|
||||||
|
image/horse_box_average_100x100.png
|
||||||
|
image/horse_box_average_150x150.png
|
||||||
|
image/horse_box_average_300x300.png
|
||||||
|
intl/ja/internat.mo
|
||||||
|
intl/ja/internat.po
|
||||||
|
)
|
||||||
|
|
||||||
|
wx_add_test(test_gui ${TEST_GUI_SRC}
|
||||||
|
DATA ${TEST_GUI_DATA}
|
||||||
|
RES ../samples/sample.rc
|
||||||
)
|
)
|
||||||
wx_add_test(test_gui ${TEST_GUI_SRC})
|
|
||||||
wx_exe_link_libraries(test_gui core)
|
wx_exe_link_libraries(test_gui core)
|
||||||
if(wxUSE_RICHTEXT)
|
if(wxUSE_RICHTEXT)
|
||||||
wx_exe_link_libraries(test_gui richtext)
|
wx_exe_link_libraries(test_gui richtext)
|
||||||
|
Reference in New Issue
Block a user