Add CMake-based build system.

Merge the original branch without any changes except for resolving the
conflict due to moving the contents of .travis.yml to a separate file by
propagating the changes done in this file since then to the new script
and rerunning ./build/update-setup-h and ./build/cmake/update_files.py
to update the file lists changed in the meanwhile.

Closes https://github.com/wxWidgets/wxWidgets/pull/330
This commit is contained in:
Vadim Zeitlin
2017-12-09 14:38:11 +01:00
66 changed files with 13755 additions and 24 deletions

View File

@@ -0,0 +1,96 @@
#############################################################################
# Name: build/cmake/tests/CMakeLists.txt
# Purpose: Build test executables
# Author: Tobias Taschner
# Created: 2016-09-24
# Copyright: (c) 2016 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
# Find CPPUnit
wx_add_thirdparty_library(wxUSE_CPPUNIT cppunit
"use cppunit (Used for unit tests)" DEFAULT sys)
if(wxUSE_CPPUNIT STREQUAL "builtin")
# Build our own private copy if it could not be found in the system
message(STATUS "Could not find cppunit. Downloading and building local copy")
set(CPPUNIT_URL http://dev-www.libreoffice.org/src/cppunit-1.13.2.tar.gz)
set(CPPUNIT_MD5 d1c6bdd5a76c66d2c38331e2d287bc01)
add_library(cppunit STATIC IMPORTED)
if(MSVC AND DEFINED CMAKE_VS_MSBUILD_COMMAND)
# Build with VS 2010+
if(CMAKE_VS_PLATFORM_TOOLSET)
set(build_param_toolset /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET})
if(MSVC_VERSION EQUAL 1700)
# VS11 requires an additional parameter to build VS10 project files
set(build_param_toolset ${build_param_toolset} /p:VisualStudioVersion=11.0)
endif()
else()
# Maybe empty with VS10, but that should be fine
# because the vcxproj is VS10
set(build_param_toolset)
endif()
ExternalProject_Add(cppunitlib
URL ${CPPUNIT_URL}
URL_MD5 ${CPPUNIT_MD5}
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND
${CMAKE_VS_MSBUILD_COMMAND}
src/cppunit/cppunit.vcxproj
/p:Configuration=$<CONFIGURATION>
/p:Platform=${CMAKE_VS_PLATFORM_NAME}
${build_param_toolset}
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy <SOURCE_DIR>/lib/cppunit$<$<CONFIG:Debug>:d>.lib <INSTALL_DIR>
COMMAND
${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
)
ExternalProject_Get_Property(cppunitlib INSTALL_DIR)
set_target_properties(cppunit PROPERTIES
IMPORTED_LOCATION "${INSTALL_DIR}/cppunit.lib"
IMPORTED_LOCATION_DEBUG "${INSTALL_DIR}/cppunitd.lib"
)
elseif(UNIX)
# TODO: forward CC and CCFLAGS
ExternalProject_Add(cppunitlib
URL ${CPPUNIT_URL}
URL_MD5 ${CPPUNIT_MD5}
CONFIGURE_COMMAND <SOURCE_DIR>/configure
--prefix=<INSTALL_DIR>
--disable-shared
--disable-doxygen
--disable-html-docs
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Get_Property(cppunitlib INSTALL_DIR)
set_target_properties(cppunit PROPERTIES IMPORTED_LOCATION
"${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}cppunit${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(wxUSE_CPPUNIT OFF)
endif()
set(CPPUNIT_INCLUDE_DIR "${INSTALL_DIR}/include")
set(CPPUNIT_LIBRARIES cppunit)
add_dependencies(cppunit cppunitlib)
elseif(wxUSE_CPPUNIT)
find_package(cppunit REQUIRED)
endif()
if(NOT wxUSE_CPPUNIT)
message(FATAL_ERROR "cppunit is required for tests. Please install cppunit or set wxBUILD_TESTS=OFF")
endif()
add_subdirectory(base)
# Build GUI tests
if(wxUSE_GUI AND wxBUILD_TESTS STREQUAL "ALL")
add_subdirectory(drawing)
add_subdirectory(gui)
endif()
# Propagate variable(s) to parent scope
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} PARENT_SCOPE)

View File

@@ -0,0 +1,105 @@
#############################################################################
# Name: build/cmake/tests/base/CMakeLists.txt
# Purpose: CMake file for base test
# Author: Tobias Taschner
# Created: 2016-10-31
# Copyright: (c) 2016 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
set(TEST_SRC
test.cpp
any/anytest.cpp
archive/archivetest.cpp
archive/ziptest.cpp
archive/tartest.cpp
arrays/arrays.cpp
base64/base64.cpp
cmdline/cmdlinetest.cpp
config/fileconf.cpp
config/regconf.cpp
datetime/datetimetest.cpp
events/evthandler.cpp
events/evtlooptest.cpp
events/evtsource.cpp
events/stopwatch.cpp
events/timertest.cpp
exec/exec.cpp
file/dir.cpp
file/filefn.cpp
file/filetest.cpp
filekind/filekind.cpp
filename/filenametest.cpp
filesys/filesystest.cpp
fontmap/fontmaptest.cpp
formatconverter/formatconvertertest.cpp
fswatcher/fswatchertest.cpp
hashes/hashes.cpp
interactive/output.cpp
interactive/input.cpp
intl/intltest.cpp
lists/lists.cpp
log/logtest.cpp
longlong/longlongtest.cpp
mbconv/convautotest.cpp
mbconv/mbconvtest.cpp
misc/dynamiclib.cpp
misc/environ.cpp
misc/metatest.cpp
misc/misctests.cpp
misc/module.cpp
misc/pathlist.cpp
misc/typeinfotest.cpp
net/ipc.cpp
net/socket.cpp
regex/regextest.cpp
regex/wxregextest.cpp
scopeguard/scopeguardtest.cpp
strings/iostream.cpp
strings/numformatter.cpp
strings/strings.cpp
strings/stdstrings.cpp
strings/tokenizer.cpp
strings/unichar.cpp
strings/unicode.cpp
strings/vararg.cpp
strings/crt.cpp
strings/vsnprintf.cpp
streams/bstream.cpp
streams/datastreamtest.cpp
streams/ffilestream.cpp
streams/fileback.cpp
streams/filestream.cpp
streams/iostreams.cpp
streams/largefile.cpp
streams/memstream.cpp
streams/socketstream.cpp
streams/sstream.cpp
streams/stdstream.cpp
streams/tempfile.cpp
streams/textstreamtest.cpp
streams/zlibstream.cpp
textfile/textfiletest.cpp
thread/atomic.cpp
thread/misc.cpp
thread/queue.cpp
thread/tls.cpp
uris/ftp.cpp
uris/uris.cpp
uris/url.cpp
vectors/vectors.cpp
weakref/evtconnection.cpp
weakref/weakref.cpp
xlocale/xlocale.cpp
)
if(wxUSE_XML)
list(APPEND TEST_SRC xml/xmltest.cpp)
endif()
wx_add_test(test_base ${TEST_SRC})
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
if(wxUSE_XML)
wx_exe_link_libraries(test_base xml)
endif()
wx_test_enable_precomp(test_base)

View File

@@ -0,0 +1,34 @@
#############################################################################
# Name: build/cmake/tests/base/CMakeLists.txt
# Purpose: CMake file for drawing test
# Author: Tobias Taschner
# Created: 2016-10-31
# Copyright: (c) 2016 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
# This test program is targeted to "headless GUI" tests, tests which are
# typically tied to the "core" component but that should run nicely in a
# console only program. This program should be executable from a console
# only Unix session (such as telnet or ssh) although it uses graphics
# contexts, so if you modify this project, please check that it can still
# be ran in such configuration and doesn't require an X server connection.
set(TEST_DRAWING_SRC
test.cpp
testableframe.cpp
drawing/drawing.cpp
drawing/plugindriver.cpp
drawing/basictest.cpp
drawing/fonttest.cpp
)
wx_add_test(test_drawing ${TEST_DRAWING_SRC})
wx_exe_link_libraries(test_drawing core)
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
# the WX_TEST_SUITE_GC_DRAWING_PLUGINS variable to specify the location of
# the produced DLL/so to get it loaded and tested. To make your own plugin,
# you can copy this sample and link toward your own implementation of
# wxGraphicsContext interface, building the appropriate DrawingTestGCFactory
# TODO: test_drawingplugin

View File

@@ -0,0 +1,111 @@
#############################################################################
# Name: build/cmake/tests/base/CMakeLists.txt
# Purpose: CMake file for gui test
# Author: Tobias Taschner
# Created: 2016-10-31
# Copyright: (c) 2016 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
set(TEST_GUI_SRC
asserthelper.cpp
test.cpp
testableframe.cpp
geometry/rect.cpp
geometry/size.cpp
geometry/point.cpp
geometry/region.cpp
graphics/bitmap.cpp
graphics/colour.cpp
graphics/ellipsization.cpp
graphics/measuring.cpp
graphics/affinematrix.cpp
graphics/boundingbox.cpp
graphics/clippingbox.cpp
graphics/graphmatrix.cpp
config/config.cpp
controls/bitmapcomboboxtest.cpp
controls/bitmaptogglebuttontest.cpp
controls/bookctrlbasetest.cpp
controls/buttontest.cpp
controls/checkboxtest.cpp
controls/checklistboxtest.cpp
controls/choicebooktest.cpp
controls/choicetest.cpp
controls/comboboxtest.cpp
controls/dataviewctrltest.cpp
controls/datepickerctrltest.cpp
controls/frametest.cpp
controls/gaugetest.cpp
controls/gridtest.cpp
controls/headerctrltest.cpp
controls/htmllboxtest.cpp
controls/hyperlinkctrltest.cpp
controls/itemcontainertest.cpp
controls/label.cpp
controls/listbasetest.cpp
controls/listbooktest.cpp
controls/listboxtest.cpp
controls/listctrltest.cpp
controls/listviewtest.cpp
controls/markuptest.cpp
controls/notebooktest.cpp
controls/ownerdrawncomboboxtest.cpp
controls/pickerbasetest.cpp
controls/pickertest.cpp
controls/radioboxtest.cpp
controls/radiobuttontest.cpp
controls/rearrangelisttest.cpp
controls/richtextctrltest.cpp
controls/searchctrltest.cpp
controls/simplebooktest.cpp
controls/slidertest.cpp
controls/spinctrldbltest.cpp
controls/spinctrltest.cpp
controls/textctrltest.cpp
controls/textentrytest.cpp
controls/togglebuttontest.cpp
controls/toolbooktest.cpp
controls/treebooktest.cpp
controls/treectrltest.cpp
controls/treelistctrltest.cpp
controls/virtlistctrltest.cpp
controls/webtest.cpp
controls/windowtest.cpp
controls/dialogtest.cpp
events/clone.cpp
# Duplicate this file here to test GUI event loops too.
events/evtlooptest.cpp
events/propagation.cpp
events/keyboard.cpp
# And duplicate this one too as wxExecute behaves differently in
# console and GUI applications.
exec/exec.cpp
font/fonttest.cpp
image/image.cpp
image/rawbmp.cpp
html/htmlparser.cpp
html/htmlwindow.cpp
menu/accelentry.cpp
menu/menu.cpp
misc/guifuncs.cpp
misc/selstoretest.cpp
misc/garbage.cpp
misc/safearrayconverttest.cpp
misc/settings.cpp
# This one is intentionally duplicated here (it is also part of
# non-GUI test) as sockets behave differently in console and GUI
# applications.
net/socket.cpp
sizers/boxsizer.cpp
sizers/gridsizer.cpp
sizers/wrapsizer.cpp
toplevel/toplevel.cpp
validators/valnum.cpp
window/clientsize.cpp
window/setsize.cpp
xml/xrctest.cpp
)
wx_add_test(test_gui ${TEST_GUI_SRC})
wx_exe_link_libraries(test_gui core richtext media xrc xml adv html net webview)
wx_test_enable_precomp(test_gui)