From ee197fd9130b9595755c5435b2b56fd749c853c5 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Mon, 10 Oct 2016 13:28:07 +0200 Subject: [PATCH 1/9] Add missing files to build/files OSX_SHARED, GTK AUI and WebView --- build/files | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build/files b/build/files index af994ad48a..811af455c6 100644 --- a/build/files +++ b/build/files @@ -2821,6 +2821,20 @@ WEBVIEW_CMN_HDR = wx/webviewarchivehandler.h wx/webviewfshandler.h +WEBVIEW_OSX_SHARED_HDR = + wx/osx/webviewhistoryitem_webkit.h + wx/osx/webview_webkit.h + +WEBVIEW_OSX_SHARED_SRC = + src/osx/webview_webkit.mm + +WEBVIEW_GTK_HDR = + wx/gtk/webviewhistoryitem_webkit.h + wx/gtk/webview_webkit.h + +WEBVIEW_GTK_SRC = + src/gtk/webview_webkit.cpp + # wxXRC XRC_SRC = @@ -2986,6 +3000,9 @@ OPENGL_MSW_SRC = OPENGL_MSW_HDR = wx/msw/glcanvas.h +OPENGL_OSX_SHARED_SRC = + src/osx/cocoa/glcanvas.mm + src/osx/glcanvas_osx.cpp # Misc plugin sources: @@ -3023,6 +3040,12 @@ AUI_MSW_SRC = src/aui/tabartmsw.cpp src/aui/barartmsw.cpp +AUI_GTK_SRC = + src/aui/tabartgtk.cpp + +AUI_GTK_HDR = + wx/aui/tabartgtk.h + # wxRibbon RIBBON_SRC = From da2b8ea8123cf8177ec3c0db3c7a3ae2eca88087 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Sun, 25 Sep 2016 22:19:39 +0200 Subject: [PATCH 2/9] Add CMake build system Add CMake build system for libraries, tests and samples update_files.py converts build/files into CMake format. build/update-setup-h has been modified to update build/cmake/setup.h.in. --- CMakeLists.txt | 57 + build/cmake/README.md | 85 + build/cmake/config.cmake | 121 + build/cmake/demos/CMakeLists.txt | 78 + build/cmake/files.cmake | 3242 +++++++++++++++++ build/cmake/functions.cmake | 710 ++++ build/cmake/init.cmake | 181 + build/cmake/install.cmake | 49 + build/cmake/lib/CMakeLists.txt | 94 + build/cmake/lib/adv/CMakeLists.txt | 41 + build/cmake/lib/aui/CMakeLists.txt | 22 + build/cmake/lib/base/CMakeLists.txt | 92 + build/cmake/lib/core/CMakeLists.txt | 52 + build/cmake/lib/gl/CMakeLists.txt | 24 + build/cmake/lib/html/CMakeLists.txt | 20 + build/cmake/lib/jpeg.cmake | 69 + build/cmake/lib/media/CMakeLists.txt | 36 + build/cmake/lib/net/CMakeLists.txt | 30 + build/cmake/lib/png.cmake | 43 + build/cmake/lib/propgrid/CMakeLists.txt | 17 + build/cmake/lib/qa/CMakeLists.txt | 17 + build/cmake/lib/regex.cmake | 26 + build/cmake/lib/ribbon/CMakeLists.txt | 16 + build/cmake/lib/richtext/CMakeLists.txt | 17 + build/cmake/lib/stc/CMakeLists.txt | 180 + build/cmake/lib/tiff.cmake | 84 + build/cmake/lib/webview/CMakeLists.txt | 38 + build/cmake/lib/xml/CMakeLists.txt | 57 + build/cmake/lib/xrc/CMakeLists.txt | 17 + build/cmake/lib/zlib.cmake | 41 + build/cmake/main.cmake | 75 + build/cmake/modules/FindGStreamer.cmake | 132 + build/cmake/modules/FindGTK3.cmake | 46 + build/cmake/modules/FindIconv.cmake | 59 + build/cmake/modules/FindLibSoup.cmake | 54 + build/cmake/modules/FindLibsecret.cmake | 49 + build/cmake/modules/FindWebkit.cmake | 38 + build/cmake/modules/Findcppunit.cmake | 77 + build/cmake/modules/cotire.cmake | 4008 ++++++++++++++++++++++ build/cmake/options.cmake | 371 ++ build/cmake/policies.cmake | 48 + build/cmake/samples/CMakeLists.txt | 240 ++ build/cmake/samples/html.cmake | 42 + build/cmake/setup.cmake | 682 ++++ build/cmake/setup.h.in | 1293 +++++++ build/cmake/source_groups.cmake | 28 + build/cmake/tests/CMakeLists.txt | 96 + build/cmake/tests/base/CMakeLists.txt | 105 + build/cmake/tests/drawing/CMakeLists.txt | 34 + build/cmake/tests/gui/CMakeLists.txt | 111 + build/cmake/toolkit.cmake | 97 + build/cmake/uninstall.cmake.in | 30 + build/cmake/update_files.py | 77 + build/cmake/utils/CMakeLists.txt | 21 + build/update-setup-h | 7 + 55 files changed, 13376 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 build/cmake/README.md create mode 100644 build/cmake/config.cmake create mode 100644 build/cmake/demos/CMakeLists.txt create mode 100644 build/cmake/files.cmake create mode 100644 build/cmake/functions.cmake create mode 100644 build/cmake/init.cmake create mode 100644 build/cmake/install.cmake create mode 100644 build/cmake/lib/CMakeLists.txt create mode 100644 build/cmake/lib/adv/CMakeLists.txt create mode 100644 build/cmake/lib/aui/CMakeLists.txt create mode 100644 build/cmake/lib/base/CMakeLists.txt create mode 100644 build/cmake/lib/core/CMakeLists.txt create mode 100644 build/cmake/lib/gl/CMakeLists.txt create mode 100644 build/cmake/lib/html/CMakeLists.txt create mode 100644 build/cmake/lib/jpeg.cmake create mode 100644 build/cmake/lib/media/CMakeLists.txt create mode 100644 build/cmake/lib/net/CMakeLists.txt create mode 100644 build/cmake/lib/png.cmake create mode 100644 build/cmake/lib/propgrid/CMakeLists.txt create mode 100644 build/cmake/lib/qa/CMakeLists.txt create mode 100644 build/cmake/lib/regex.cmake create mode 100644 build/cmake/lib/ribbon/CMakeLists.txt create mode 100644 build/cmake/lib/richtext/CMakeLists.txt create mode 100644 build/cmake/lib/stc/CMakeLists.txt create mode 100644 build/cmake/lib/tiff.cmake create mode 100644 build/cmake/lib/webview/CMakeLists.txt create mode 100644 build/cmake/lib/xml/CMakeLists.txt create mode 100644 build/cmake/lib/xrc/CMakeLists.txt create mode 100644 build/cmake/lib/zlib.cmake create mode 100644 build/cmake/main.cmake create mode 100644 build/cmake/modules/FindGStreamer.cmake create mode 100644 build/cmake/modules/FindGTK3.cmake create mode 100644 build/cmake/modules/FindIconv.cmake create mode 100644 build/cmake/modules/FindLibSoup.cmake create mode 100644 build/cmake/modules/FindLibsecret.cmake create mode 100644 build/cmake/modules/FindWebkit.cmake create mode 100644 build/cmake/modules/Findcppunit.cmake create mode 100644 build/cmake/modules/cotire.cmake create mode 100644 build/cmake/options.cmake create mode 100644 build/cmake/policies.cmake create mode 100644 build/cmake/samples/CMakeLists.txt create mode 100644 build/cmake/samples/html.cmake create mode 100644 build/cmake/setup.cmake create mode 100644 build/cmake/setup.h.in create mode 100644 build/cmake/source_groups.cmake create mode 100644 build/cmake/tests/CMakeLists.txt create mode 100644 build/cmake/tests/base/CMakeLists.txt create mode 100644 build/cmake/tests/drawing/CMakeLists.txt create mode 100644 build/cmake/tests/gui/CMakeLists.txt create mode 100644 build/cmake/toolkit.cmake create mode 100644 build/cmake/uninstall.cmake.in create mode 100755 build/cmake/update_files.py create mode 100644 build/cmake/utils/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..38c6092b6c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,57 @@ +############################################################################# +# Name: CMakeLists.txt +# Purpose: Primary CMake for wxWidgets +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +cmake_minimum_required(VERSION 2.8.12) + +if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) + # If no deployment target has been set default to the minimum supported + # OS X version (this has to be set before the first project() call) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7 CACHE STRING "OS X Deployment Target") +endif() + +project(wxWidgets) + +include(build/cmake/policies.cmake NO_POLICY_SCOPE) + +# Initialize variables for quick access to wx root dir in sub dirs +set(wxSOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(wxBINARY_DIR ${CMAKE_BINARY_DIR}) +set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib) + +# parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION +file(READ 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}) +# Determine if current version is a "Development" release +math(EXPR rel_dev "${wxMINOR_VERSION} % 2") +if(rel_dev) + set(wxVERSION_IS_DEV TRUE) +else() + set(wxVERSION_IS_DEV FALSE) +endif() + +set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}) +set(wxCOPYRIGHT "1992-2016 wxWidgets") + +include(build/cmake/main.cmake) + +# Set the default startup project for Visual Studio +if(wxBUILD_SAMPLES AND wxUSE_GUI) + set_directory_properties(PROPERTIES VS_STARTUP_PROJECT minimal) +endif() diff --git a/build/cmake/README.md b/build/cmake/README.md new file mode 100644 index 0000000000..b8431a6c73 --- /dev/null +++ b/build/cmake/README.md @@ -0,0 +1,85 @@ +This directory contains [CMake][1] files needed to build +native build files for wxWidgets. + +For building wxWidgets or using wxWidgets in your CMake project please see +the [CMake overview](../../docs/doxygen/overviews/cmake.md) in the wxWidgets +documentation. + +CMake files organization +======================== +All CMake files are located in $(wx)/build/cmake additionally there is a +_CMakeLists.txt_ in the root directory. + +Files +----- +* $(wx)/CMakeLists.txt + * This should only contain commands and definitions which need to be + contained in the top level and includes _main.cmake_ +* config.cmake + * Generates config files used to find wxWidgets by other build systems + * Creates wx-config +* files.cmake + * List of source files generated by _update_files.py_ from _$(wx)/build/files_ + * This file should **never** be edited manually +* functions.cmake + * contains various wxWidgets specific functions and macros used throughout + the CMake files + * Every function should contain a short description of it's parameters as + a comment before the function/macro +* install.cmake + * Handles defintions for the ´install` and `uninstall` target +* init.cmake + * Intializes various variables used during the build process and for + generation of setup.h and configuration files +* main.cmake + * Includes all other cmake files +* options.cmake + * All user selectable build options should be defined in this file via + calls to `wx_option()` +* policies.cmake + * [CMake policies][2] for wxWidgets should be defined in this file +* setup.cmake + * Handles all tests required to create the _setup.h_ header based + platform and user settings +* setup.h.in + * Template for _setup.h_ updated automatically by _$(wx)/build/update-setup-h_ +* source_groups.cmake + * Define source groups used in supported IDEs +* toolkit.cmake + * Define toolkit specific options and detection to this file +* uninstall.cmake.in + * Used by _install.cmake_ when creating the `uninstall` target +* update_files.py + * Creates _files.cmake_ from _$(wx)/build/files_ + +Sub directories +--------------- +Each sub directory contains a _CMakeLists.txt_ and might contain various other +_.cmake_ files. + +* demos + * Defines build targets for demos via `wx_add_demo()` +* lib + * Defines build targets for all libraries and bundle third party libraries + * Each library is contained in a seperate directory and uses + `wx_add_library()` to define the library target + * Bundled third party library without upstream CMake support are defined in + a _.cmake_ file using `wx_add_builtin_library()` to define static library + targets +* modules + * Includes CMake modules used to find third party packages via [find_package()][3] + * Includes the [cotire module][4] used to for precompiled header generation +* samples + * Defines build targets for all samples via `wx_add_sample()` + * Defintions for trivial samples are included in _CMakeLists.txt_ more + complex samples might have a seperate .cmake file +* tests + * Defines build targets for all tests +* utils + * Defines build targets for all utilities + + +[1]: https://cmake.org +[2]: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html +[3]: https://cmake.org/cmake/help/latest/command/find_package.html +[4]: https://github.com/sakra/cotire/ diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake new file mode 100644 index 0000000000..bdb7ea8e04 --- /dev/null +++ b/build/cmake/config.cmake @@ -0,0 +1,121 @@ +############################################################################# +# Name: build/cmake/config.cmake +# Purpose: Build wx-config script in build folder +# Author: Tobias Taschner +# Created: 2016-10-13 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +set(wxCONFIG_DIR ${wxOUTPUT_DIR}/wx/config) +file(MAKE_DIRECTORY ${wxCONFIG_DIR}) +set(TOOLCHAIN_FULLNAME ${wxBUILD_FILE_ID}) + +macro(wx_configure_script input output) + set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) + set(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR}) + + configure_file( + ${input} + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} + ESCAPE_QUOTES @ONLY NEWLINE_STYLE UNIX) + file(COPY + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} + DESTINATION ${wxCONFIG_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +endmacro() + +function(wx_write_config_inplace) + wx_configure_script( + "${CMAKE_CURRENT_SOURCE_DIR}/wx-config-inplace.in" + "inplace-${TOOLCHAIN_FULLNAME}" + ) + execute_process( + COMMAND + ${CMAKE_COMMAND} -E create_symlink + "lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}" + "${CMAKE_CURRENT_BINARY_DIR}/wx-config" + ) +endfunction() + +function(wx_write_config) + + # TODO: set variables + set(includedir "$") + wx_string_append(libdir "{prefix}/include") + set(libdir "$") + wx_string_append(libdir "{exec_prefix}/lib") + set(bindir "$") + wx_string_append(bindir "{exec_prefix}/bin") + if(CMAKE_CROSSCOMPILING) + set(cross_compiling yes) + else() + set(cross_compiling no) + endif() + set(prefix ${CMAKE_INSTALL_PREFIX}) + set(exec_prefix $) + wx_string_append(exec_prefix "{prefix}") + set(BUILT_WX_LIBS) + foreach(lib IN LISTS wxLIB_TARGETS) + wx_string_append(BUILT_WX_LIBS " ${lib}") + endforeach() + set(CC ${CMAKE_C_COMPILER}) + set(CXX ${CMAKE_CXX_COMPILER}) + set(DMALLOC_LIBS) + find_program(EGREP egrep) + set(EXTRALIBS_GUI) + set(EXTRALIBS_HTML) + set(EXTRALIBS_SDL) + set(EXTRALIBS_STC) + set(EXTRALIBS_WEBVIEW) + set(EXTRALIBS_XML) + set(LDFLAGS_GL) + if(wxBUILD_MONOLITHIC) + set(MONOLITHIC 1) + else() + set(MONOLITHIC 0) + endif() + set(OPENGL_LIBS) + set(RESCOMP) + if(wxBUILD_SHARED) + set(SHARED 1) + else() + set(SHARED 0) + endif() + set(STD_BASE_LIBS) + set(STD_GUI_LIBS) + #TODO: setting TOOLCHAIN_NAME produces change results in config folder +# set(TOOLCHAIN_NAME) + set(TOOLKIT_DIR ${wxBUILD_TOOLKIT}) + set(TOOLKIT_VERSION) + set(WIDGET_SET ${wxBUILD_WIDGETSET}) + if(wxUSE_UNICODE) + set(WX_CHARTYPE unicode) + else() + set(WX_CHARTYPE ansi) + endif() + set(WX_FLAVOUR) + set(WX_LIBRARY_BASENAME_GUI) + set(WX_LIBRARY_BASENAME_NOGUI) + set(WX_RELEASE ${wxMAJOR_VERSION}.${wxMINOR_VERSION}) + set(WX_SUBVERSION ${wxVERSION}.0) + set(WX_VERSION ${wxVERSION}) + set(WXCONFIG_CFLAGS) + set(WXCONFIG_CPPFLAGS) + set(WXCONFIG_CXXFLAGS) + set(WXCONFIG_LDFLAGS) + set(WXCONFIG_LDFLAGS_GUI) + set(WXCONFIG_LIBS) + set(WXCONFIG_RESFLAGS) + set(WXCONFIG_RPATH) + + wx_configure_script( + "${CMAKE_CURRENT_SOURCE_DIR}/wx-config.in" + "${TOOLCHAIN_FULLNAME}" + ) +endfunction() + +wx_write_config_inplace() +wx_write_config() diff --git a/build/cmake/demos/CMakeLists.txt b/build/cmake/demos/CMakeLists.txt new file mode 100644 index 0000000000..9e79ecb0a3 --- /dev/null +++ b/build/cmake/demos/CMakeLists.txt @@ -0,0 +1,78 @@ +############################################################################# +# Name: build/cmake/demos/CMakeLists.txt +# Purpose: CMake script for demos +# Author: Tobias Taschner +# Created: 2016-10-21 +# Copyright: (c) 2016 wxWidgets development team +# 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() + add_executable(${DEMO_NAME} WIN32 MACOSX_BUNDLE ${src_files}) + 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}/${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() + target_link_libraries(${DEMO_NAME} core ${DEMO_LIBRARIES}) + wx_set_common_target_properties(${DEMO_NAME}) + set_target_properties(${DEMO_NAME} PROPERTIES FOLDER "Demos") +endfunction() + +wx_add_demo(bombs + bombs.cpp + bombs1.cpp + game.cpp + ) +wx_add_demo(forty + forty.cpp + canvas.cpp + card.cpp + game.cpp + pile.cpp + playerdg.cpp + scoredg.cpp + scorefil.cpp + DATA + about.htm + LIBRARIES + html adv xml + ) +wx_add_demo(fractal fractal.cpp) +wx_add_demo(life + life.cpp + dialogs.cpp + game.cpp + reader.cpp + DATA + breeder.lif + ) +wx_add_demo(poem wxpoem.cpp + DATA + wxpoem.txt wxpoem.dat wxpoem.idx + LIBRARIES + html + NAME + wxpoem + ) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake new file mode 100644 index 0000000000..02d4eb1fc0 --- /dev/null +++ b/build/cmake/files.cmake @@ -0,0 +1,3242 @@ +# Automatically generated from build/files by update_files.py +# DO NOT MODIFY MANUALLY ! + +set(BASE_UNIX_AND_DARWIN_SRC + src/common/fdiodispatcher.cpp + src/common/selectdispatcher.cpp + src/unix/appunix.cpp + src/unix/dir.cpp + src/unix/dlunix.cpp + src/unix/epolldispatcher.cpp + src/unix/evtloopunix.cpp + src/unix/fdiounix.cpp + src/unix/snglinst.cpp + src/unix/stackwalk.cpp + src/unix/timerunx.cpp + src/unix/threadpsx.cpp + src/unix/utilsunx.cpp + src/unix/wakeuppipe.cpp + src/unix/fswatcher_kqueue.cpp +) + +set(BASE_UNIX_AND_DARWIN_HDR + wx/unix/app.h + wx/unix/apptbase.h + wx/unix/apptrait.h + wx/unix/chkconf.h + wx/unix/evtloop.h + wx/unix/evtloopsrc.h + wx/unix/pipe.h + wx/unix/stackwalk.h + wx/unix/tls.h + wx/unix/fswatcher_kqueue.h +) + +set(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC + ${BASE_UNIX_AND_DARWIN_SRC} + src/unix/mimetype.cpp +) + +set(BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR + ${BASE_UNIX_AND_DARWIN_HDR} + wx/unix/mimetype.h +) + +set(BASE_UNIX_SRC + ${BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC} + src/unix/fswatcher_inotify.cpp + src/unix/secretstore.cpp + src/unix/stdpaths.cpp +) + +set(BASE_UNIX_HDR + ${BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR} + wx/unix/fswatcher_inotify.h + wx/unix/stdpaths.h +) + +set(BASE_WIN32_SRC + src/msw/basemsw.cpp + src/msw/crashrpt.cpp + src/msw/debughlp.cpp + src/msw/dde.cpp + src/msw/dir.cpp + src/msw/dlmsw.cpp + src/msw/evtloopconsole.cpp + src/msw/mimetype.cpp + src/msw/power.cpp + src/msw/regconf.cpp + src/msw/registry.cpp + src/msw/secretstore.cpp + src/msw/snglinst.cpp + src/msw/stackwalk.cpp + src/msw/stdpaths.cpp + src/msw/thread.cpp + src/msw/timer.cpp + src/msw/utils.cpp + src/msw/utilsexc.cpp + src/msw/fswatcher.cpp +) + +set(BASE_AND_GUI_WIN32_SRC + src/msw/main.cpp + src/msw/volume.cpp +) + +set(BASE_WIN32_HDR + wx/msw/apptrait.h + wx/msw/apptbase.h + wx/msw/chkconf.h + wx/msw/crashrpt.h + wx/msw/dde.h + wx/msw/debughlp.h + wx/msw/evtloopconsole.h + wx/msw/gccpriv.h + wx/msw/libraries.h + wx/msw/mimetype.h + wx/msw/private.h + wx/msw/regconf.h + wx/msw/registry.h + wx/msw/seh.h + wx/msw/stackwalk.h + wx/msw/stdpaths.h + wx/msw/winundef.h + wx/msw/wrapcctl.h + wx/msw/wrapcdlg.h + wx/msw/wrapwin.h + wx/msw/fswatcher.h +) + +set(BASE_COREFOUNDATION_SRC + src/osx/core/cfstring.cpp + src/osx/core/evtloop_cf.cpp + src/osx/core/secretstore.cpp + src/osx/core/strconv_cf.cpp + src/osx/core/utilsexc_base.cpp + src/osx/cocoa/utils_base.mm +) + +set(BASE_COREFOUNDATION_HDR + wx/osx/carbon/region.h + wx/osx/core/cfdataref.h + wx/osx/core/cfref.h + wx/osx/core/cfstring.h + wx/osx/core/colour.h + wx/osx/core/hid.h + wx/osx/core/evtloop.h + wx/osx/core/objcid.h + wx/osx/core/private.h +) + +set(BASE_OSX_SHARED_SRC + src/osx/core/mimetype.cpp + src/osx/fswatcher_fsevents.cpp + src/osx/cocoa/stdpaths.mm + ${BASE_COREFOUNDATION_SRC} + ${BASE_UNIX_AND_DARWIN_SRC} +) + +set(BASE_OSX_SHARED_HDR + wx/osx/fswatcher_fsevents.h + ${BASE_COREFOUNDATION_HDR} + ${BASE_UNIX_AND_DARWIN_HDR} +) + +set(BASE_AND_GUI_OSX_COCOA_SRC + src/osx/cocoa/utils.mm + src/osx/cocoa/power.mm +) + +set(BASE_AND_GUI_OSX_IPHONE_SRC + src/osx/iphone/utils.mm +) + +set(BASE_OSX_NOTWXMAC_SRC + ${BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC} + ${BASE_COREFOUNDATION_SRC} +) + +set(BASE_OSX_NOTWXMAC_HDR + ${BASE_UNIX_AND_DARWIN_NOTWXMAC_HDR} + ${BASE_COREFOUNDATION_HDR} +) + +set(QT_LOWLEVEL_HDR + wx/qt/accel.h + wx/qt/app.h + wx/qt/apptbase.h + wx/qt/apptrait.h + wx/qt/bitmap.h + wx/qt/bmpbuttn.h + wx/qt/brush.h + wx/qt/anybutton.h + wx/qt/button.h + wx/qt/checkbox.h + wx/qt/checklst.h + wx/qt/choice.h + wx/qt/clipbrd.h + wx/qt/clrpicker.h + wx/qt/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/qt/colordlg.h + wx/qt/colour.h + wx/qt/combobox.h + wx/qt/control.h + wx/qt/converter.h + wx/qt/ctrlsub.h + wx/qt/cursor.h + wx/qt/dataform.h + wx/qt/dataobj2.h + wx/qt/dataobj.h + wx/qt/dcclient.h + wx/qt/dc.h + wx/qt/dcmemory.h + wx/qt/dcprint.h + wx/qt/dcscreen.h + wx/qt/defs.h + wx/qt/dialog.h + wx/qt/dirdlg.h + wx/qt/dnd.h + wx/qt/evtloop.h + wx/qt/filedlg.h + wx/qt/font.h + wx/qt/fontdlg.h + wx/qt/frame.h + wx/qt/gauge.h + wx/generic/icon.h + wx/generic/imaglist.h + wx/qt/listbox.h + wx/qt/listctrl.h + wx/qt/mdi.h + wx/qt/menu.h + wx/qt/menuitem.h + wx/qt/minifram.h + wx/qt/msgdlg.h + wx/qt/notebook.h + wx/qt/palette.h + wx/qt/pen.h + wx/qt/popupwin.h + wx/qt/printdlg.h + wx/generic/prntdlgg.h + wx/qt/printqt.h + wx/qt/radiobox.h + wx/qt/radiobut.h + wx/qt/region.h + wx/qt/scrolbar.h + wx/qt/slider.h + wx/qt/spinbutt.h + wx/qt/spinctrl.h + wx/qt/statbmp.h + wx/qt/statbox.h + wx/qt/statline.h + wx/qt/statusbar.h + wx/qt/stattext.h + wx/qt/textctrl.h + wx/qt/textdlg.h + wx/qt/textentry.h + wx/qt/tglbtn.h + wx/qt/timer.h + wx/qt/toolbar.h + wx/qt/tooltip.h + wx/qt/toplevel.h + wx/qt/utils.h + wx/qt/window.h + wx/qt/private/winevent.h +) + +set(QT_LOWLEVEL_SRC + src/qt/accel.cpp + src/qt/app.cpp + src/qt/apptraits.cpp + src/qt/bitmap.cpp + src/qt/bmpbuttn.cpp + src/qt/brush.cpp + src/qt/anybutton.cpp + src/qt/button.cpp + src/generic/caret.cpp + src/qt/checkbox.cpp + src/qt/checklst.cpp + src/qt/choice.cpp + src/qt/clipbrd.cpp + src/qt/clrpicker.cpp + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/qt/colordlg.cpp + src/qt/colour.cpp + src/qt/combobox.cpp + src/qt/control.cpp + src/qt/converter.cpp + src/qt/ctrlsub.cpp + src/qt/cursor.cpp + src/qt/dataobj.cpp + src/qt/dcclient.cpp + src/qt/dc.cpp + src/qt/dcmemory.cpp + src/qt/dcprint.cpp + src/qt/dcscreen.cpp + src/qt/defs.cpp + src/qt/dialog.cpp + src/unix/dialup.cpp + src/qt/display.cpp + src/qt/dnd.cpp + src/qt/evtloop.cpp + src/generic/fdrepdlg.cpp + src/qt/filedlg.cpp + src/generic/filepickerg.cpp + src/qt/font.cpp + src/qt/fontdlg.cpp + src/qt/fontutil.cpp + src/qt/fontenum.cpp + src/generic/fontpickerg.cpp + src/qt/frame.cpp + src/qt/gauge.cpp + src/generic/icon.cpp + src/generic/imaglist.cpp + src/qt/listbox.cpp + src/qt/listctrl.cpp + src/qt/mdi.cpp + src/qt/menu.cpp + src/qt/menuitem.cpp + src/qt/minifram.cpp + src/qt/msgdlg.cpp + src/qt/notebook.cpp + src/qt/palette.cpp + src/qt/pen.cpp + src/qt/popupwin.cpp + src/qt/printdlg.cpp + src/generic/prntdlgg.cpp + src/qt/printqt.cpp + src/qt/radiobox.cpp + src/qt/radiobut.cpp + src/qt/region.cpp + src/qt/scrolbar.cpp + src/qt/settings.cpp + src/qt/sockqt.cpp + src/qt/slider.cpp + src/qt/spinbutt.cpp + src/qt/spinctrl.cpp + src/qt/statbmp.cpp + src/qt/statbox.cpp + src/qt/statline.cpp + src/qt/stattext.cpp + src/qt/statusbar.cpp + src/qt/textctrl.cpp + src/qt/textentry.cpp + src/generic/textmeasure.cpp + src/qt/tglbtn.cpp + src/qt/timer.cpp + src/qt/toolbar.cpp + src/qt/tooltip.cpp + src/qt/toplevel.cpp + src/qt/uiaction.cpp + src/qt/utils.cpp + src/qt/window.cpp +) + +set(ADVANCED_QT_HDR + wx/generic/activityindicator.h + wx/generic/animate.h + wx/qt/calctrl.h + wx/qt/dataview.h + wx/qt/dvrenderer.h + wx/qt/dvrenderers.h + wx/qt/taskbar.h +) + +set(ADVANCED_QT_SRC + src/generic/activityindicator.cpp + src/generic/animateg.cpp + src/qt/calctrl.cpp + src/qt/converter.cpp + src/qt/dataview.cpp + src/qt/dvrenderer.cpp + src/qt/dvrenderers.cpp + src/unix/joystick.cpp + src/unix/sound.cpp + src/qt/taskbar.cpp + src/common/taskbarcmn.cpp + src/qt/utils.cpp +) + +set(MEDIA_QT_SRC + src/qt/mediactrl.cpp +) + +set(BASE_CMN_SRC + src/common/any.cpp + src/common/appbase.cpp + src/common/arcall.cpp + src/common/arcfind.cpp + src/common/archive.cpp + src/common/arrstr.cpp + src/common/base64.cpp + src/common/clntdata.cpp + src/common/cmdline.cpp + src/common/config.cpp + src/common/convauto.cpp + src/common/datetime.cpp + src/common/datetimefmt.cpp + src/common/datstrm.cpp + src/common/dircmn.cpp + src/common/dynarray.cpp + src/common/dynlib.cpp + src/common/dynload.cpp + src/common/encconv.cpp + src/common/evtloopcmn.cpp + src/common/extended.c + src/common/ffile.cpp + src/common/file.cpp + src/common/fileback.cpp + src/common/fileconf.cpp + src/common/filefn.cpp + src/common/filename.cpp + src/common/filesys.cpp + src/common/filtall.cpp + src/common/filtfind.cpp + src/common/fmapbase.cpp + src/common/fs_arc.cpp + src/common/fs_filter.cpp + src/common/hash.cpp + src/common/hashmap.cpp + src/common/init.cpp + src/common/intl.cpp + src/common/ipcbase.cpp + src/common/languageinfo.cpp + src/common/list.cpp + src/common/log.cpp + src/common/longlong.cpp + src/common/memory.cpp + src/common/mimecmn.cpp + src/common/module.cpp + src/common/mstream.cpp + src/common/numformatter.cpp + src/common/object.cpp + src/common/platinfo.cpp + src/common/powercmn.cpp + src/common/process.cpp + src/common/regex.cpp + src/common/secretstore.cpp + src/common/stdpbase.cpp + src/common/sstream.cpp + src/common/stdstream.cpp + src/common/stopwatch.cpp + src/common/strconv.cpp + src/common/stream.cpp + src/common/string.cpp + src/common/stringimpl.cpp + src/common/stringops.cpp + src/common/strvararg.cpp + src/common/sysopt.cpp + src/common/tarstrm.cpp + src/common/textbuf.cpp + src/common/textfile.cpp + src/common/threadinfo.cpp + src/common/time.cpp + src/common/timercmn.cpp + src/common/timerimpl.cpp + src/common/tokenzr.cpp + src/common/translation.cpp + src/common/txtstrm.cpp + src/common/unichar.cpp + src/common/uri.cpp + src/common/ustring.cpp + src/common/variant.cpp + src/common/wfstream.cpp + src/common/wxcrt.cpp + src/common/wxprintf.cpp + src/common/xlocale.cpp + src/common/xti.cpp + src/common/xtistrm.cpp + src/common/zipstrm.cpp + src/common/zstream.cpp + src/common/fswatchercmn.cpp + src/generic/fswatcherg.cpp +) + +set(BASE_AND_GUI_CMN_SRC + src/common/event.cpp + src/common/fs_mem.cpp + src/common/msgout.cpp + src/common/utilscmn.cpp +) + +set(BASE_CMN_HDR + wx/afterstd.h + wx/any.h + wx/anystr.h + wx/app.h + wx/apptrait.h + wx/archive.h + wx/arrimpl.cpp + wx/arrstr.h + wx/atomic.h + wx/base64.h + wx/beforestd.h + wx/buffer.h + wx/build.h + wx/chartype.h + wx/checkeddelete.h + wx/chkconf.h + wx/clntdata.h + wx/cmdargs.h + wx/cmdline.h + wx/compiler.h + wx/confbase.h + wx/config.h + wx/convauto.h + wx/containr.h + wx/cpp.h + wx/crt.h + wx/datetime.h + wx/datstrm.h + wx/dde.h + wx/debug.h + wx/defs.h + wx/dir.h + wx/dlimpexp.h + wx/dlist.h + wx/dynarray.h + wx/dynlib.h + wx/dynload.h + wx/encconv.h + wx/event.h + wx/eventfilter.h + wx/evtloop.h + wx/except.h + wx/features.h + wx/flags.h + wx/ffile.h + wx/file.h + wx/fileconf.h + wx/filefn.h + wx/filename.h + wx/filesys.h + wx/fontenc.h + wx/fontmap.h + wx/fs_arc.h + wx/fs_filter.h + wx/fs_mem.h + wx/fs_zip.h + wx/hash.h + wx/hashmap.h + wx/hashset.h + wx/iconloc.h + wx/init.h + wx/intl.h + wx/iosfwrap.h + wx/ioswrap.h + wx/ipc.h + wx/ipcbase.h + wx/kbdstate.h + wx/language.h + wx/link.h + wx/list.h + wx/listimpl.cpp + wx/log.h + wx/longlong.h + wx/math.h + wx/memconf.h + wx/memory.h + wx/memtext.h + wx/mimetype.h + wx/module.h + wx/mousestate.h + wx/msgout.h + wx/msgqueue.h + wx/mstream.h + wx/numformatter.h + wx/object.h + wx/platform.h + wx/platinfo.h + wx/power.h + wx/process.h + wx/ptr_scpd.h + wx/ptr_shrd.h + wx/recguard.h + wx/regex.h + wx/rtti.h + wx/scopedarray.h + wx/scopedptr.h + wx/scopeguard.h + wx/secretstore.h + wx/sharedptr.h + wx/snglinst.h + wx/sstream.h + wx/stack.h + wx/stackwalk.h + wx/stdpaths.h + wx/stdstream.h + wx/stockitem.h + wx/stopwatch.h + wx/strconv.h + wx/stream.h + wx/string.h + wx/stringimpl.h + wx/stringops.h + wx/strvararg.h + wx/sysopt.h + wx/tarstrm.h + wx/textbuf.h + wx/textfile.h + wx/thread.h + wx/thrimpl.cpp + wx/time.h + wx/timer.h + wx/tls.h + wx/tokenzr.h + wx/tracker.h + wx/translation.h + wx/txtstrm.h + wx/typeinfo.h + wx/types.h + wx/unichar.h + wx/uri.h + wx/ustring.h + wx/utils.h + wx/variant.h + wx/vector.h + wx/version.h + wx/versioninfo.h + wx/volume.h + wx/weakref.h + wx/wfstream.h + wx/wx.h + wx/wxchar.h + wx/wxcrt.h + wx/wxcrtbase.h + wx/wxcrtvararg.h + wx/wxprec.h + wx/xlocale.h + wx/xti.h + wx/xti2.h + wx/xtistrm.h + wx/xtictor.h + wx/xtihandler.h + wx/xtiprop.h + wx/xtitypes.h + wx/zipstrm.h + wx/zstream.h + wx/meta/convertible.h + wx/meta/if.h + wx/meta/implicitconversion.h + wx/meta/int2type.h + wx/meta/movable.h + wx/meta/pod.h + wx/meta/removeref.h + wx/fswatcher.h + wx/generic/fswatcher.h +) + +set(NET_UNIX_SRC + src/common/socketiohandler.cpp + src/unix/sockunix.cpp +) + +set(NET_OSX_SRC + src/osx/core/sockosx.cpp +) + +set(NET_WIN32_SRC + src/msw/sockmsw.cpp + src/msw/urlmsw.cpp +) + +set(NET_WIN32_HDR +) + +set(NET_CMN_SRC + src/common/fs_inet.cpp + src/common/ftp.cpp + src/common/http.cpp + src/common/protocol.cpp + src/common/sckaddr.cpp + src/common/sckfile.cpp + src/common/sckipc.cpp + src/common/sckstrm.cpp + src/common/socket.cpp + src/common/url.cpp +) + +set(NET_CMN_HDR + wx/fs_inet.h + wx/protocol/file.h + wx/protocol/ftp.h + wx/protocol/http.h + wx/protocol/log.h + wx/protocol/protocol.h + wx/sckaddr.h + wx/sckipc.h + wx/sckstrm.h + wx/socket.h + wx/url.h +) + +set(QA_SRC + src/common/debugrpt.cpp + src/generic/dbgrptg.cpp +) + +set(QA_HDR + wx/debugrpt.h +) + +set(GUI_CMN_SRC + src/common/accelcmn.cpp + src/common/accesscmn.cpp + src/common/anidecod.cpp + src/common/affinematrix2d.cpp + src/common/appcmn.cpp + src/common/artprov.cpp + src/common/artstd.cpp + src/common/arttango.cpp + src/common/bmpbase.cpp + src/common/bmpbtncmn.cpp + src/common/bookctrl.cpp + src/common/btncmn.cpp + src/common/cairo.cpp + src/common/checkboxcmn.cpp + src/common/checklstcmn.cpp + src/common/choiccmn.cpp + src/common/clipcmn.cpp + src/common/clrpickercmn.cpp + src/common/colourcmn.cpp + src/common/colourdata.cpp + src/common/combocmn.cpp + src/common/cmdproc.cpp + src/common/cmndata.cpp + src/common/containr.cpp + src/common/cshelp.cpp + src/common/ctrlcmn.cpp + src/common/ctrlsub.cpp + src/common/dcbase.cpp + src/common/dcbufcmn.cpp + src/common/dcgraph.cpp + src/common/dcsvg.cpp + src/common/dirctrlcmn.cpp + src/common/dlgcmn.cpp + src/common/dndcmn.cpp + src/common/dobjcmn.cpp + src/common/docmdi.cpp + src/common/docview.cpp + src/common/dpycmn.cpp + src/common/dseldlg.cpp + src/common/effects.cpp + src/common/fddlgcmn.cpp + src/common/filectrlcmn.cpp + src/common/filehistorycmn.cpp + src/common/filepickercmn.cpp + src/common/fontpickercmn.cpp + src/common/fldlgcmn.cpp + src/common/fontcmn.cpp + src/common/fontdata.cpp + src/generic/graphicc.cpp + src/common/fontenumcmn.cpp + src/common/fontmap.cpp + src/common/fontutilcmn.cpp + src/common/framecmn.cpp + src/common/gaugecmn.cpp + src/common/gbsizer.cpp + src/common/gdicmn.cpp + src/common/geometry.cpp + src/common/gifdecod.cpp + src/common/graphcmn.cpp + src/common/headercolcmn.cpp + src/common/headerctrlcmn.cpp + src/common/helpbase.cpp + src/common/iconbndl.cpp + src/common/imagall.cpp + src/common/imagbmp.cpp + src/common/image.cpp + src/common/imagfill.cpp + src/common/imaggif.cpp + src/common/imagiff.cpp + src/common/imagjpeg.cpp + src/common/imagpcx.cpp + src/common/imagpng.cpp + src/common/imagpnm.cpp + src/common/imagtga.cpp + src/common/imagtiff.cpp + src/common/imagxpm.cpp + src/common/layout.cpp + src/common/lboxcmn.cpp + src/common/listctrlcmn.cpp + src/common/markupparser.cpp + src/common/matrix.cpp + src/common/menucmn.cpp + src/common/modalhook.cpp + src/common/mousemanager.cpp + src/common/nbkbase.cpp + src/common/overlaycmn.cpp + src/common/ownerdrwcmn.cpp + src/common/paper.cpp + src/common/panelcmn.cpp + src/common/persist.cpp + src/common/pickerbase.cpp + src/common/popupcmn.cpp + src/common/preferencescmn.cpp + src/common/prntbase.cpp + src/common/quantize.cpp + src/common/radiobtncmn.cpp + src/common/radiocmn.cpp + src/common/rearrangectrl.cpp + src/common/rendcmn.cpp + src/common/rgncmn.cpp + src/common/scrolbarcmn.cpp + src/common/settcmn.cpp + src/common/sizer.cpp + src/common/slidercmn.cpp + src/common/spinbtncmn.cpp + src/common/spinctrlcmn.cpp + src/common/srchcmn.cpp + src/common/statbar.cpp + src/common/statbmpcmn.cpp + src/common/statboxcmn.cpp + src/common/statlinecmn.cpp + src/common/stattextcmn.cpp + src/common/stockitem.cpp + src/common/tbarbase.cpp + src/common/textcmn.cpp + src/common/textentrycmn.cpp + src/common/textmeasurecmn.cpp + src/common/toplvcmn.cpp + src/common/treebase.cpp + src/common/uiactioncmn.cpp + src/common/valgen.cpp + src/common/validate.cpp + src/common/valtext.cpp + src/common/valnum.cpp + src/common/wincmn.cpp + src/common/windowid.cpp + src/common/wrapsizer.cpp + src/common/xpmdecod.cpp + src/generic/busyinfo.cpp + src/generic/buttonbar.cpp + src/generic/choicdgg.cpp + src/generic/choicbkg.cpp + src/generic/collheaderctrlg.cpp + src/generic/combog.cpp + src/generic/dcpsg.cpp + src/generic/dirctrlg.cpp + src/generic/dragimgg.cpp + src/generic/filectrlg.cpp + src/generic/headerctrlg.cpp + src/generic/infobar.cpp + src/generic/listbkg.cpp + src/generic/logg.cpp + src/generic/markuptext.cpp + src/generic/msgdlgg.cpp + src/generic/numdlgg.cpp + src/generic/progdlgg.cpp + src/generic/preferencesg.cpp + src/generic/printps.cpp + src/generic/renderg.cpp + src/generic/richmsgdlgg.cpp + src/generic/scrlwing.cpp + src/generic/selstore.cpp + src/generic/spinctlg.cpp + src/generic/splitter.cpp + src/generic/srchctlg.cpp + src/generic/statbmpg.cpp + src/generic/stattextg.cpp + src/generic/textdlgg.cpp + src/generic/tipwin.cpp + src/generic/toolbkg.cpp + src/generic/treectlg.cpp + src/generic/treebkg.cpp + src/generic/vlbox.cpp + src/generic/vscroll.cpp + src/xrc/xmlreshandler.cpp +) + +set(GUI_CMN_HDR + wx/affinematrix2dbase.h + wx/affinematrix2d.h + wx/anybutton.h + wx/bmpbuttn.h + wx/brush.h + wx/button.h + wx/checkbox.h + wx/checklst.h + wx/choicdlg.h + wx/choice.h + wx/cmndata.h + wx/collheaderctrl.h + wx/collpane.h + wx/combo.h + wx/combobox.h + wx/compositewin.h + wx/control.h + wx/ctrlsub.h + wx/cursor.h + wx/custombgwin.h + wx/dc.h + wx/dcclient.h + wx/dcgraph.h + wx/dcmemory.h + wx/dcprint.h + wx/dcscreen.h + wx/dcsvg.h + wx/dialog.h + wx/dirdlg.h + wx/dragimag.h + wx/encinfo.h + wx/filedlg.h + wx/frame.h + wx/gauge.h + wx/gbsizer.h + wx/gdicmn.h + wx/generic/accel.h + wx/generic/buttonbar.h + wx/generic/choicdgg.h + wx/generic/collheaderctrl.h + wx/generic/combo.h + wx/generic/custombgwin.h + wx/generic/dcpsg.h + wx/generic/dirctrlg.h + wx/generic/dragimgg.h + wx/generic/filectrlg.h + wx/generic/headerctrlg.h + wx/generic/infobar.h + wx/generic/logg.h + wx/generic/msgdlgg.h + wx/generic/numdlgg.h + wx/generic/notebook.h + wx/generic/panelg.h + wx/generic/prntdlgg.h + wx/generic/printps.h + wx/generic/progdlgg.h + wx/generic/richmsgdlgg.h + wx/generic/scrolwin.h + wx/generic/spinctlg.h + wx/generic/splitter.h + wx/generic/srchctlg.h + wx/generic/statbmpg.h + wx/generic/stattextg.h + wx/generic/textdlgg.h + wx/generic/treectlg.h + wx/graphics.h + wx/headercol.h + wx/headerctrl.h + wx/helphtml.h + wx/icon.h + wx/infobar.h + wx/itemid.h + wx/layout.h + wx/listbox.h + wx/mdi.h + wx/menu.h + wx/modalhook.h + wx/mousemanager.h + wx/msgdlg.h + wx/nativewin.h + wx/numdlg.h + wx/overlay.h + wx/palette.h + wx/panel.h + wx/pen.h + wx/position.h + wx/preferences.h + wx/radiobox.h + wx/radiobut.h + wx/range.h + wx/rearrangectrl.h + wx/renderer.h + wx/richmsgdlg.h + wx/scrolbar.h + wx/scrolbar.h + wx/scrolwin.h + wx/selstore.h + wx/settings.h + wx/sizer.h + wx/slider.h + wx/statbmp.h + wx/statbox.h + wx/stattext.h + wx/statusbr.h + wx/systhemectrl.h + wx/taskbarbutton.h + wx/testing.h + wx/textcompleter.h + wx/textctrl.h + wx/textdlg.h + wx/textentry.h + wx/textwrapper.h + wx/toolbar.h + wx/validate.h + wx/valtext.h + wx/valnum.h + wx/window.h + wx/windowid.h + wx/windowptr.h + wx/withimages.h + wx/wrapsizer.h + wx/wupdlock.h + wx/accel.h + wx/access.h + wx/anidecod.h + wx/animdecod.h + wx/appprogress.h + wx/artprov.h + wx/bitmap.h + wx/bookctrl.h + wx/busyinfo.h + wx/generic/busyinfo.h + wx/caret.h + wx/choicebk.h + wx/clipbrd.h + wx/clrpicker.h + wx/cmdproc.h + wx/colordlg.h + wx/colour.h + wx/colourdata.h + wx/cshelp.h + wx/dataobj.h + wx/dcmirror.h + wx/dcps.h + wx/dialup.h + wx/dirctrl.h + wx/display.h + wx/display_impl.h + wx/dnd.h + wx/docmdi.h + wx/docview.h + wx/effects.h + wx/evtloopsrc.h + wx/fdrepdlg.h + wx/filectrl.h + wx/filehistory.h + wx/filepicker.h + wx/fontpicker.h + wx/fmappriv.h + wx/font.h + wx/fontdata.h + wx/fontdlg.h + wx/fontenum.h + wx/fontutil.h + wx/gdiobj.h + wx/geometry.h + wx/gifdecod.h + wx/help.h + wx/helpbase.h + wx/helpwin.h + wx/iconbndl.h + wx/imagbmp.h + wx/image.h + wx/imaggif.h + wx/imagiff.h + wx/imagjpeg.h + wx/imaglist.h + wx/imagpcx.h + wx/imagpng.h + wx/imagpnm.h + wx/imagtga.h + wx/imagtiff.h + wx/imagxpm.h + wx/itemattr.h + wx/listbase.h + wx/listbook.h + wx/listctrl.h + wx/matrix.h + wx/menuitem.h + wx/metafile.h + wx/minifram.h + wx/nonownedwnd.h + wx/notebook.h + wx/ownerdrw.h + wx/paper.h + wx/persist.h + wx/persist/bookctrl.h + wx/persist/splitter.h + wx/persist/toplevel.h + wx/persist/treebook.h + wx/persist/window.h + wx/pickerbase.h + wx/popupwin.h + wx/print.h + wx/printdlg.h + wx/prntbase.h + wx/progdlg.h + wx/quantize.h + wx/rawbmp.h + wx/region.h + wx/scopeguard.h + wx/simplebook.h + wx/spinbutt.h + wx/spinctrl.h + wx/splitter.h + wx/srchctrl.h + wx/statline.h + wx/tbarbase.h + wx/tglbtn.h + wx/tipwin.h + wx/toolbook.h + wx/tooltip.h + wx/toplevel.h + wx/treebase.h + wx/treebook.h + wx/treectrl.h + wx/uiaction.h + wx/valgen.h + wx/vidmode.h + wx/vlbox.h + wx/vms_x_fix.h + wx/vscroll.h + wx/xpmdecod.h + wx/xpmhand.h + wx/xrc/xmlreshandler.h +) + +set(UNIX_SRC + src/unix/apptraits.cpp +) + +set(XWIN_LOWLEVEL_SRC + src/generic/caret.cpp + src/generic/imaglist.cpp + src/unix/dialup.cpp + src/unix/displayx11.cpp + src/unix/fontenum.cpp + src/unix/fontutil.cpp + src/unix/uiactionx11.cpp + src/unix/utilsx11.cpp +) + +set(XWIN_LOWLEVEL_HDR + wx/generic/caret.h + wx/generic/imaglist.h + wx/unix/fontutil.h + wx/unix/utilsx11.h +) + +set(GTK_WIN32_SRC + src/generic/caret.cpp + src/generic/imaglist.cpp + src/msw/ole/automtn.cpp + src/msw/ole/oleutils.cpp + src/msw/ole/safearray.cpp + src/msw/ole/uuid.cpp + src/msw/dialup.cpp + src/msw/dib.cpp + src/msw/display.cpp + src/msw/utilswin.cpp + src/unix/fontenum.cpp + src/unix/fontutil.cpp +) + +set(GTK_WIN32_HDR + wx/generic/caret.h + wx/generic/imaglist.h + wx/msw/ole/automtn.h + wx/msw/ole/oleutils.h + wx/msw/ole/safearray.h + wx/msw/ole/uuid.h + wx/msw/dib.h + wx/unix/fontutil.h +) + +set(GTK_LOWLEVEL_SRC + ${GTK_PLATFORM_SRC} + src/generic/icon.cpp + src/generic/paletteg.cpp + src/gtk/app.cpp + src/gtk/assertdlg_gtk.cpp + src/gtk/bitmap.cpp + src/gtk/brush.cpp + src/gtk/clipbrd.cpp + src/gtk/colour.cpp + src/gtk/cursor.cpp + src/gtk/dataobj.cpp + src/gtk/dc.cpp + src/gtk/display.cpp + src/gtk/dnd.cpp + src/gtk/evtloop.cpp + src/gtk/filectrl.cpp + src/gtk/filehistory.cpp + src/gtk/font.cpp + src/gtk/sockgtk.cpp + src/gtk/mimetype.cpp + src/gtk/minifram.cpp + src/gtk/nonownedwnd.cpp + src/gtk/pen.cpp + src/gtk/popupwin.cpp + src/gtk/private.cpp + src/gtk/region.cpp + src/gtk/renderer.cpp + src/gtk/settings.cpp + src/gtk/textmeasure.cpp + src/gtk/timer.cpp + src/gtk/tooltip.cpp + src/gtk/toplevel.cpp + src/gtk/utilsgtk.cpp + src/gtk/win_gtk.cpp + src/gtk/window.cpp +) + +set(GTK2_LOWLEVEL_SRC + ${GTK_LOWLEVEL_SRC} + src/gtk/dcclient.cpp + src/gtk/dcmemory.cpp + src/gtk/dcscreen.cpp +) + +set(GTK_LOWLEVEL_HDR + ${GTK_PLATFORM_HDR} + wx/generic/icon.h + wx/generic/paletteg.h + wx/gtk/app.h + wx/gtk/assertdlg_gtk.h + wx/gtk/bitmap.h + wx/gtk/brush.h + wx/gtk/clipbrd.h + wx/gtk/colour.h + wx/gtk/cursor.h + wx/gtk/dataform.h + wx/gtk/dataobj.h + wx/gtk/dataobj2.h + wx/gtk/dnd.h + wx/gtk/evtloop.h + wx/gtk/evtloopsrc.h + wx/gtk/font.h + wx/gtk/filehistory.h + wx/gtk/mimetype.h + wx/gtk/minifram.h + wx/gtk/nonownedwnd.h + wx/gtk/pen.h + wx/gtk/popupwin.h + wx/gtk/region.h + wx/gtk/tooltip.h + wx/gtk/toplevel.h + wx/gtk/window.h +) + +set(GTK_SRC + # Generic implementations used by wxGTK: + src/generic/accel.cpp + src/generic/fdrepdlg.cpp + # Needed as long as we support GTK+ < 2.6 + src/generic/filepickerg.cpp + src/generic/listctrl.cpp + src/generic/prntdlgg.cpp + src/generic/statusbr.cpp + # GTK+ specific files: + src/gtk/anybutton.cpp + src/gtk/artgtk.cpp + src/gtk/bmpbuttn.cpp + src/gtk/button.cpp + src/gtk/checkbox.cpp + src/gtk/checklst.cpp + src/gtk/choice.cpp + src/gtk/collpane.cpp + src/gtk/colordlg.cpp + src/gtk/combobox.cpp + src/gtk/control.cpp + src/gtk/clrpicker.cpp + src/gtk/dialog.cpp + src/gtk/fontpicker.cpp + src/gtk/filepicker.cpp + src/gtk/dirdlg.cpp + src/gtk/filedlg.cpp + src/gtk/fontdlg.cpp + src/gtk/frame.cpp + src/gtk/gauge.cpp + src/gtk/gnome/gvfs.cpp + src/gtk/infobar.cpp + src/gtk/listbox.cpp + src/gtk/mdi.cpp + src/gtk/menu.cpp + src/gtk/mnemonics.cpp + src/gtk/msgdlg.cpp + src/gtk/nativewin.cpp + src/gtk/notebook.cpp + src/gtk/print.cpp + src/gtk/radiobox.cpp + src/gtk/radiobut.cpp + src/gtk/scrolbar.cpp + src/gtk/scrolwin.cpp + src/gtk/slider.cpp + src/gtk/spinbutt.cpp + src/gtk/spinctrl.cpp + src/gtk/statbmp.cpp + src/gtk/statbox.cpp + src/gtk/statline.cpp + src/gtk/stattext.cpp + src/gtk/toolbar.cpp + src/gtk/textctrl.cpp + src/gtk/textentry.cpp + src/gtk/tglbtn.cpp + src/gtk/treeentry_gtk.c +) + +set(GTK2_SRC + ${GTK_SRC} + # Generic implementations used by wxGPE: + src/generic/fontdlgg.cpp +) + +set(GTK_HDR + wx/generic/fdrepdlg.h + wx/generic/filepickerg.h + wx/generic/listctrl.h + wx/generic/statusbr.h + wx/gtk/accel.h + wx/gtk/anybutton.h + wx/gtk/bmpbuttn.h + wx/gtk/button.h + wx/gtk/checkbox.h + wx/gtk/checklst.h + wx/gtk/chkconf.h + wx/gtk/collpane.h + wx/gtk/colordlg.h + wx/gtk/choice.h + wx/gtk/combobox.h + wx/gtk/control.h + wx/gtk/clrpicker.h + wx/gtk/dialog.h + wx/gtk/dirdlg.h + wx/gtk/filectrl.h + wx/gtk/filedlg.h + wx/gtk/fontpicker.h + wx/gtk/filepicker.h + wx/gtk/fontdlg.h + wx/gtk/frame.h + wx/gtk/gauge.h + wx/gtk/gnome/gvfs.h + wx/gtk/infobar.h + wx/gtk/listbox.h + wx/gtk/mdi.h + wx/gtk/menu.h + wx/gtk/menuitem.h + wx/gtk/msgdlg.h + wx/gtk/notebook.h + wx/gtk/print.h + wx/gtk/radiobox.h + wx/gtk/radiobut.h + wx/gtk/scrolbar.h + wx/gtk/scrolwin.h + wx/gtk/slider.h + wx/gtk/spinbutt.h + wx/gtk/spinctrl.h + wx/gtk/statbmp.h + wx/gtk/statbox.h + wx/gtk/statline.h + wx/gtk/stattext.h + wx/gtk/toolbar.h + wx/gtk/textctrl.h + wx/gtk/textentry.h + wx/gtk/tglbtn.h +) + +set(GTK2_HDR + ${GTK_HDR} + wx/generic/fontdlgg.h +) + +set(GTK1_LOWLEVEL_SRC + ${XWIN_LOWLEVEL_SRC} + src/generic/icon.cpp + src/generic/paletteg.cpp + src/generic/textmeasure.cpp + src/gtk1/app.cpp + src/gtk1/bitmap.cpp + src/gtk1/brush.cpp + src/gtk1/clipbrd.cpp + src/gtk1/colour.cpp + src/gtk1/cursor.cpp + src/gtk1/data.cpp + src/gtk1/dataobj.cpp + src/gtk1/dc.cpp + src/gtk1/dcclient.cpp + src/gtk1/dcmemory.cpp + src/gtk1/dcscreen.cpp + src/gtk1/dnd.cpp + src/gtk1/evtloop.cpp + src/gtk1/font.cpp + src/gtk1/sockgtk.cpp + src/gtk1/main.cpp + src/gtk1/minifram.cpp + src/gtk1/pen.cpp + src/gtk1/popupwin.cpp + src/gtk1/region.cpp + src/gtk1/renderer.cpp + src/gtk1/settings.cpp + src/gtk1/timer.cpp + src/gtk1/tooltip.cpp + src/gtk1/toplevel.cpp + src/gtk1/utilsgtk.cpp + src/gtk1/win_gtk.c + src/gtk1/window.cpp +) + +set(GTK1_LOWLEVEL_HDR + ${XWIN_LOWLEVEL_HDR} + wx/generic/icon.h + wx/generic/paletteg.h + wx/gtk1/app.h + wx/gtk1/bitmap.h + wx/gtk1/brush.h + wx/gtk1/clipbrd.h + wx/gtk1/colour.h + wx/gtk1/cursor.h + wx/gtk1/dataform.h + wx/gtk1/dataobj.h + wx/gtk1/dataobj2.h + wx/gtk1/dc.h + wx/gtk1/dcclient.h + wx/gtk1/dcmemory.h + wx/gtk1/dcscreen.h + wx/gtk1/dnd.h + wx/gtk1/font.h + wx/gtk1/minifram.h + wx/gtk1/pen.h + wx/gtk1/popupwin.h + wx/gtk1/region.h + wx/gtk1/tooltip.h + wx/gtk1/toplevel.h + wx/gtk1/win_gtk.h + wx/gtk1/window.h +) + +set(GTK1_SRC + # Generic implementations used by wxGTK1: + src/generic/accel.cpp + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/generic/colrdlgg.cpp + src/generic/dirdlgg.cpp + src/generic/fdrepdlg.cpp + src/generic/filedlgg.cpp + src/generic/filepickerg.cpp + src/generic/fontdlgg.cpp + src/generic/fontpickerg.cpp + src/generic/listctrl.cpp + src/generic/prntdlgg.cpp + src/generic/statusbr.cpp + # GTK1 specific files: + src/gtk1/bmpbuttn.cpp + src/gtk1/button.cpp + src/gtk1/checkbox.cpp + src/gtk1/checklst.cpp + src/gtk1/choice.cpp + src/gtk1/combobox.cpp + src/gtk1/control.cpp + src/gtk1/dialog.cpp + src/gtk1/filedlg.cpp + src/gtk1/fontdlg.cpp + src/gtk1/frame.cpp + src/gtk1/gauge.cpp + src/gtk1/listbox.cpp + src/gtk1/mdi.cpp + src/gtk1/menu.cpp + src/gtk1/mnemonics.cpp + src/gtk1/notebook.cpp + src/gtk1/radiobox.cpp + src/gtk1/radiobut.cpp + src/gtk1/scrolbar.cpp + src/gtk1/scrolwin.cpp + src/gtk1/slider.cpp + src/gtk1/spinbutt.cpp + src/gtk1/spinctrl.cpp + src/gtk1/statbmp.cpp + src/gtk1/statbox.cpp + src/gtk1/statline.cpp + src/gtk1/stattext.cpp + src/gtk1/toolbar.cpp + src/gtk1/textctrl.cpp + src/gtk1/tglbtn.cpp +) + +set(GTK1_HDR + wx/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/generic/colrdlgg.h + wx/generic/dirdlgg.h + wx/generic/fdrepdlg.h + wx/generic/filedlgg.h + wx/generic/filepickerg.h + wx/generic/fontdlgg.h + wx/generic/fontpickerg.h + wx/generic/listctrl.h + wx/generic/statusbr.h + wx/gtk1/accel.h + wx/gtk1/bmpbuttn.h + wx/gtk1/button.h + wx/gtk1/checkbox.h + wx/gtk1/checklst.h + wx/gtk1/choice.h + wx/gtk1/combobox.h + wx/gtk1/control.h + wx/gtk1/dialog.h + wx/gtk1/filedlg.h + wx/gtk1/fontdlg.h + wx/gtk1/frame.h + wx/gtk1/gauge.h + wx/gtk1/listbox.h + wx/gtk1/mdi.h + wx/gtk1/menu.h + wx/gtk1/menuitem.h + wx/gtk1/msgdlg.h + wx/gtk1/notebook.h + wx/gtk1/radiobox.h + wx/gtk1/radiobut.h + wx/gtk1/scrolbar.h + wx/gtk1/scrolwin.h + wx/gtk1/slider.h + wx/gtk1/spinbutt.h + wx/gtk1/spinctrl.h + wx/gtk1/statbmp.h + wx/gtk1/statbox.h + wx/gtk1/statline.h + wx/gtk1/stattext.h + wx/gtk1/toolbar.h + wx/gtk1/textctrl.h + wx/gtk1/tglbtn.h + wx/gtk1/treectrl.h +) + +set(MOTIF_LOWLEVEL_SRC + ${XWIN_LOWLEVEL_SRC} + src/generic/textmeasure.cpp + src/x11/bitmap.cpp + src/x11/brush.cpp + src/x11/palette.cpp + src/x11/pen.cpp + src/x11/region.cpp + src/x11/utilsx.cpp +) + +set(MOTIF_LOWLEVEL_HDR + ${XWIN_LOWLEVEL_HDR} + wx/x11/bitmap.h + wx/x11/brush.h + wx/x11/palette.h + wx/x11/pen.h + wx/x11/region.h +) + +set(MOTIF_SRC + src/motif/accel.cpp + src/motif/app.cpp + src/motif/bmpbuttn.cpp + src/motif/bmpmotif.cpp + src/motif/button.cpp + src/motif/checkbox.cpp + src/motif/checklst.cpp + src/motif/choice.cpp + src/motif/clipbrd.cpp + src/motif/colour.cpp + src/motif/combobox.cpp + src/motif/combobox_native.cpp + src/motif/control.cpp + src/motif/cursor.cpp + src/motif/data.cpp + src/motif/dataobj.cpp + src/motif/dc.cpp + src/motif/dcclient.cpp + src/motif/dcmemory.cpp + src/motif/dcscreen.cpp + src/motif/dialog.cpp + src/motif/evtloop.cpp + src/motif/filedlg.cpp + src/motif/font.cpp + src/motif/frame.cpp + src/motif/gauge.cpp + src/motif/sockmot.cpp + src/motif/icon.cpp + src/motif/listbox.cpp + src/motif/main.cpp + src/motif/menu.cpp + src/motif/menuitem.cpp + src/motif/minifram.cpp + src/motif/msgdlg.cpp + src/motif/popupwin.cpp + src/motif/radiobox.cpp + src/motif/radiobut.cpp + src/motif/scrolbar.cpp + src/motif/settings.cpp + src/motif/slider.cpp + src/motif/spinbutt.cpp + src/motif/statbmp.cpp + src/motif/statbox.cpp + src/motif/stattext.cpp + src/motif/textctrl.cpp + src/motif/textentry.cpp + src/motif/timer.cpp + src/motif/toolbar.cpp + src/motif/toplevel.cpp + src/motif/utils.cpp + src/motif/window.cpp + src/motif/xmcombo/xmcombo.c + # Generic files used by wxMotif: + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/generic/colrdlgg.cpp + src/generic/dirdlgg.cpp + src/generic/fdrepdlg.cpp + src/generic/filepickerg.cpp + src/generic/fontdlgg.cpp + src/generic/fontpickerg.cpp + src/generic/listctrl.cpp + src/generic/mdig.cpp + src/generic/notebook.cpp + src/generic/prntdlgg.cpp + src/generic/statline.cpp + src/generic/statusbr.cpp + src/generic/tabg.cpp +) + +set(MOTIF_HDR + wx/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/generic/colrdlgg.h + wx/generic/ctrlsub.h + wx/generic/dirdlgg.h + wx/generic/fdrepdlg.h + wx/generic/filepickerg.h + wx/generic/fontdlgg.h + wx/generic/fontpickerg.h + wx/generic/listctrl.h + wx/generic/mdig.h + wx/generic/notebook.h + wx/generic/prntdlgg.h + wx/generic/statline.h + wx/generic/statusbr.h + wx/generic/tabg.h + wx/motif/accel.h + wx/motif/app.h + wx/motif/bmpbuttn.h + wx/motif/bmpmotif.h + wx/motif/button.h + wx/motif/checkbox.h + wx/motif/checklst.h + wx/motif/chkconf.h + wx/motif/choice.h + wx/motif/clipbrd.h + wx/motif/colour.h + wx/motif/combobox.h + wx/motif/control.h + wx/motif/ctrlsub.h + wx/motif/cursor.h + wx/motif/dataform.h + wx/motif/dataobj.h + wx/motif/dataobj2.h + wx/motif/dc.h + wx/motif/dcclient.h + wx/motif/dcmemory.h + wx/motif/dcprint.h + wx/motif/dcscreen.h + wx/motif/dialog.h + wx/motif/dnd.h + wx/motif/filedlg.h + wx/motif/font.h + wx/motif/frame.h + wx/motif/gauge.h + wx/motif/icon.h + wx/motif/listbox.h + wx/motif/menu.h + wx/motif/menuitem.h + wx/motif/minifram.h + wx/motif/msgdlg.h + wx/motif/popupwin.h + wx/motif/print.h + wx/motif/private.h + wx/motif/radiobox.h + wx/motif/radiobut.h + wx/motif/scrolbar.h + wx/motif/slider.h + wx/motif/spinbutt.h + wx/motif/statbmp.h + wx/motif/statbox.h + wx/motif/stattext.h + wx/motif/textctrl.h + wx/motif/textentry.h + wx/motif/tglbtn.h + wx/motif/toolbar.h + wx/motif/toplevel.h + wx/motif/window.h +) + +set(X11_LOWLEVEL_SRC + ${XWIN_LOWLEVEL_SRC} + src/generic/icon.cpp + src/generic/textmeasure.cpp + src/generic/timer.cpp + src/x11/app.cpp + src/x11/bitmap.cpp + src/x11/brush.cpp + src/x11/clipbrd.cpp + src/x11/colour.cpp + src/x11/cursor.cpp + src/x11/data.cpp + src/x11/dataobj.cpp + src/x11/dc.cpp + src/x11/dcclient.cpp + src/x11/dcmemory.cpp + src/x11/dcscreen.cpp + src/x11/evtloop.cpp + src/x11/font.cpp + src/x11/minifram.cpp + src/x11/nanox.c + src/x11/palette.cpp + src/x11/pen.cpp + src/x11/popupwin.cpp + src/x11/region.cpp + src/x11/reparent.cpp + src/x11/settings.cpp + src/x11/toplevel.cpp + src/x11/utils.cpp + src/x11/utilsx.cpp + src/x11/window.cpp +) + +set(X11_LOWLEVEL_HDR + ${XWIN_LOWLEVEL_HDR} + wx/generic/icon.h + wx/x11/app.h + wx/x11/bitmap.h + wx/x11/brush.h + wx/x11/chkconf.h + wx/x11/clipbrd.h + wx/x11/colour.h + wx/x11/cursor.h + wx/x11/dataform.h + wx/x11/dataobj.h + wx/x11/dataobj2.h + wx/x11/dc.h + wx/x11/dcclient.h + wx/x11/dcmemory.h + wx/x11/dcprint.h + wx/x11/dcscreen.h + wx/x11/dnd.h + wx/x11/font.h + wx/x11/minifram.h + wx/x11/palette.h + wx/x11/pen.h + wx/x11/popupwin.h + wx/x11/print.h + wx/x11/private.h + wx/x11/privx.h + wx/x11/region.h + wx/x11/reparent.h + wx/x11/textctrl.h + wx/x11/toplevel.h + wx/x11/window.h +) + +set(MSW_LOWLEVEL_SRC + src/msw/ole/activex.cpp + src/msw/app.cpp + src/msw/bitmap.cpp + src/msw/brush.cpp + src/msw/caret.cpp + src/msw/clipbrd.cpp + src/msw/colour.cpp + src/msw/cursor.cpp + src/msw/data.cpp + src/msw/dc.cpp + src/msw/dcclient.cpp + src/msw/dcmemory.cpp + src/msw/dcprint.cpp + src/msw/dcscreen.cpp + src/msw/dialup.cpp + src/msw/dib.cpp + src/msw/display.cpp + src/msw/enhmeta.cpp + src/msw/font.cpp + src/msw/fontenum.cpp + src/msw/fontutil.cpp + src/msw/gdiimage.cpp + src/msw/gdiobj.cpp + src/msw/gdiplus.cpp + src/msw/graphics.cpp + src/msw/graphicsd2d.cpp + src/msw/icon.cpp + src/msw/imaglist.cpp + src/msw/minifram.cpp + src/msw/nonownedwnd.cpp + src/msw/ole/dataobj.cpp + src/msw/ole/dropsrc.cpp + src/msw/ole/droptgt.cpp + src/msw/ole/oleutils.cpp + src/msw/ole/safearray.cpp + src/msw/palette.cpp + src/msw/pen.cpp + src/msw/popupwin.cpp + src/msw/printdlg.cpp + src/msw/printwin.cpp + src/msw/region.cpp + src/msw/renderer.cpp + src/msw/rt/utilsrt.cpp + src/msw/settings.cpp + src/msw/textmeasure.cpp + src/msw/tooltip.cpp + src/msw/toplevel.cpp + src/msw/uiaction.cpp + src/msw/utilsgui.cpp + src/msw/utilswin.cpp + src/msw/uxtheme.cpp + src/msw/window.cpp +) + +set(MSW_LOWLEVEL_HDR + wx/msw/nonownedwnd.h + wx/msw/ole/activex.h + wx/msw/popupwin.h + wx/msw/uxtheme.h + wx/msw/uxthemep.h + wx/msw/htmlhelp.h +) + +set(MSW_DESKTOP_LOWLEVEL_SRC + src/msw/helpchm.cpp + src/msw/helpwin.cpp + src/msw/ole/automtn.cpp + src/msw/ole/uuid.cpp +) + +set(MSW_DESKTOP_LOWLEVEL_HDR + wx/msw/helpchm.h + wx/msw/helpwin.h +) + +set(MSW_SRC + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/generic/filepickerg.cpp + src/generic/fontpickerg.cpp + src/generic/statusbr.cpp + src/generic/prntdlgg.cpp + src/msw/accel.cpp + src/msw/anybutton.cpp + src/msw/appprogress.cpp + src/msw/artmsw.cpp + src/msw/bmpbuttn.cpp + src/msw/button.cpp + src/msw/checkbox.cpp + src/msw/choice.cpp + src/msw/colordlg.cpp + src/msw/combo.cpp + src/msw/combobox.cpp + src/msw/control.cpp + src/msw/customdraw.cpp + src/msw/dialog.cpp + src/msw/dirdlg.cpp + src/msw/dragimag.cpp + src/msw/evtloop.cpp + src/msw/filedlg.cpp + src/msw/frame.cpp + src/msw/gauge.cpp + src/msw/headerctrl.cpp + src/msw/iniconf.cpp + src/msw/listbox.cpp + src/msw/listctrl.cpp + src/msw/mdi.cpp + src/msw/menu.cpp + src/msw/menuitem.cpp + src/msw/metafile.cpp + src/msw/msgdlg.cpp + src/msw/nativdlg.cpp + src/msw/nativewin.cpp + src/msw/notebook.cpp + src/msw/ole/access.cpp + src/msw/ownerdrw.cpp + src/msw/progdlg.cpp + src/msw/radiobox.cpp + src/msw/radiobut.cpp + src/msw/richmsgdlg.cpp + src/msw/scrolbar.cpp + src/msw/slider.cpp + src/msw/spinbutt.cpp + src/msw/spinctrl.cpp + src/msw/statbmp.cpp + src/msw/statbox.cpp + src/msw/statusbar.cpp + src/msw/statline.cpp + src/msw/stattext.cpp + src/msw/systhemectrl.cpp + src/msw/taskbarbutton.cpp + src/msw/toolbar.cpp + src/msw/textctrl.cpp + src/msw/textentry.cpp + src/msw/tglbtn.cpp + src/msw/treectrl.cpp +) + +set(MSW_HDR + wx/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/generic/filepickerg.h + wx/generic/fontpickerg.h + wx/msw/accel.h + wx/msw/anybutton.h + wx/msw/app.h + wx/msw/appprogress.h + wx/msw/bitmap.h + wx/msw/bmpbuttn.h + wx/msw/brush.h + wx/msw/button.h + wx/msw/caret.h + wx/msw/checkbox.h + wx/msw/choice.h + wx/msw/clipbrd.h + wx/msw/colordlg.h + wx/msw/colour.h + wx/msw/combo.h + wx/msw/combobox.h + wx/msw/control.h + wx/msw/ctrlsub.h + wx/msw/cursor.h + wx/msw/custombgwin.h + wx/msw/dc.h + wx/msw/dcclient.h + wx/msw/dcmemory.h + wx/msw/dcprint.h + wx/msw/dcscreen.h + wx/msw/dialog.h + wx/msw/dib.h + wx/msw/dirdlg.h + wx/msw/dragimag.h + wx/msw/enhmeta.h + wx/msw/evtloop.h + wx/msw/filedlg.h + wx/msw/font.h + wx/msw/frame.h + wx/msw/gauge.h + wx/msw/gdiimage.h + wx/msw/headerctrl.h + wx/msw/icon.h + wx/msw/imaglist.h + wx/msw/iniconf.h + wx/msw/init.h + wx/msw/listbox.h + wx/msw/listctrl.h + wx/msw/mdi.h + wx/msw/menu.h + wx/msw/menuitem.h + wx/msw/metafile.h + wx/msw/minifram.h + wx/msw/missing.h + wx/msw/msgdlg.h + wx/msw/msvcrt.h + wx/msw/notebook.h + wx/msw/ole/access.h + wx/msw/ole/dataform.h + wx/msw/ole/dataobj.h + wx/msw/ole/dataobj2.h + wx/msw/ole/dropsrc.h + wx/msw/ole/droptgt.h + wx/msw/ole/oleutils.h + wx/msw/ole/safearray.h + wx/msw/ownerdrw.h + wx/msw/ownerdrawnbutton.h + wx/msw/palette.h + wx/msw/panel.h + wx/msw/pen.h + wx/msw/printdlg.h + wx/msw/printwin.h + wx/msw/progdlg.h + wx/msw/radiobox.h + wx/msw/radiobut.h + wx/msw/region.h + wx/msw/rcdefs.h + wx/msw/richmsgdlg.h + wx/msw/rt/utils.h + wx/msw/scrolbar.h + wx/msw/slider.h + wx/msw/spinbutt.h + wx/msw/spinctrl.h + wx/msw/statbmp.h + wx/msw/statbox.h + wx/msw/statusbar.h + wx/msw/statline.h + wx/msw/stattext.h + wx/msw/taskbarbutton.h + wx/msw/toolbar.h + wx/msw/textctrl.h + wx/msw/textentry.h + wx/msw/tglbtn.h + wx/msw/tooltip.h + wx/msw/toplevel.h + wx/msw/treectrl.h + wx/msw/window.h +) + +set(MSW_RSC + # Resources must be installed together with headers: + wx/msw/wx.manifest + wx/msw/amd64.manifest + wx/msw/ia64.manifest + wx/msw/wx.rc + # bitmaps + wx/msw/colours.bmp + wx/msw/csquery.bmp + # cursors + wx/msw/blank.cur + wx/msw/bullseye.cur + wx/msw/cross.cur + wx/msw/hand.cur + wx/msw/magnif1.cur + wx/msw/pbrush.cur + wx/msw/pencil.cur + wx/msw/pntleft.cur + wx/msw/pntright.cur + wx/msw/roller.cur + # icons + wx/msw/cdrom.ico + wx/msw/child.ico + wx/msw/computer.ico + wx/msw/drive.ico + wx/msw/file1.ico + wx/msw/floppy.ico + wx/msw/folder1.ico + wx/msw/folder2.ico + wx/msw/mdi.ico + wx/msw/question.ico + wx/msw/removble.ico + wx/msw/std.ico +) + +set(MSW_DESKTOP_SRC + src/msw/checklst.cpp + src/msw/fdrepdlg.cpp + src/msw/fontdlg.cpp +) + +set(MSW_DESKTOP_HDR + wx/msw/checklst.h + wx/msw/fdrepdlg.h + wx/msw/fontdlg.h + wx/msw/ole/automtn.h + wx/msw/ole/uuid.h +) + +set(DFB_LOWLEVEL_SRC + src/common/fontmgrcmn.cpp + src/generic/caret.cpp + src/generic/colour.cpp + src/generic/icon.cpp + src/generic/imaglist.cpp + src/generic/mask.cpp + src/generic/textmeasure.cpp + src/dfb/app.cpp + src/dfb/bitmap.cpp + src/dfb/brush.cpp + src/dfb/cursor.cpp + src/dfb/dc.cpp + src/dfb/dcclient.cpp + src/dfb/dcmemory.cpp + src/dfb/dcscreen.cpp + src/dfb/evtloop.cpp + src/dfb/font.cpp + src/dfb/fontenum.cpp + src/dfb/fontmgr.cpp + src/dfb/nonownedwnd.cpp + src/dfb/overlay.cpp + src/dfb/pen.cpp + src/dfb/region.cpp + src/dfb/settings.cpp + src/dfb/toplevel.cpp + src/dfb/utils.cpp + src/dfb/window.cpp + src/dfb/wrapdfb.cpp +) + +set(DFB_LOWLEVEL_HDR + wx/generic/caret.h + wx/generic/colour.h + wx/generic/icon.h + wx/generic/imaglist.h + wx/generic/mask.h + wx/dfb/app.h + wx/dfb/bitmap.h + wx/dfb/brush.h + wx/dfb/chkconf.h + wx/dfb/cursor.h + wx/dfb/dc.h + wx/dfb/dcclient.h + wx/dfb/dcmemory.h + wx/dfb/dcscreen.h + wx/dfb/dfbptr.h + wx/dfb/evtloop.h + wx/dfb/font.h + wx/dfb/nonownedwnd.h + wx/dfb/pen.h + wx/dfb/popupwin.h + wx/dfb/private.h + wx/dfb/region.h + wx/dfb/toplevel.h + wx/dfb/window.h + wx/dfb/wrapdfb.h +) + +set(OSX_LOWLEVEL_SRC + # Shared wxMac and wxCocoa files + #TODO: + src/osx/artmac.cpp + src/osx/brush.cpp + src/osx/dialog_osx.cpp + src/osx/fontutil.cpp + src/osx/imaglist.cpp + src/osx/minifram.cpp + src/osx/nonownedwnd_osx.cpp + src/osx/palette.cpp + src/osx/pen.cpp + src/osx/toplevel_osx.cpp + src/osx/uiaction_osx.cpp + src/osx/utils_osx.cpp + src/osx/window_osx.cpp + src/osx/core/bitmap.cpp + src/osx/core/colour.cpp + src/osx/core/dcmemory.cpp + src/osx/core/display.cpp + src/osx/core/fontenum.cpp + src/osx/core/hid.cpp + src/osx/core/printmac.cpp + src/osx/core/timer.cpp + src/osx/core/utilsexc_cf.cpp + #TODO: +) + +set(OSX_LOWLEVEL_HDR +) + +set(OSX_COMMON_SRC + #TODO: + # Common controls implementation + src/osx/anybutton_osx.cpp + src/osx/bmpbuttn_osx.cpp + src/osx/button_osx.cpp + src/osx/checkbox_osx.cpp + src/osx/checklst_osx.cpp + src/osx/choice_osx.cpp + src/osx/combobox_osx.cpp + src/osx/dnd_osx.cpp + src/osx/gauge_osx.cpp + src/osx/listbox_osx.cpp + src/osx/menu_osx.cpp + src/osx/menuitem_osx.cpp + src/osx/notebook_osx.cpp + src/osx/printdlg_osx.cpp + src/osx/radiobox_osx.cpp + src/osx/radiobut_osx.cpp + src/osx/scrolbar_osx.cpp + src/osx/slider_osx.cpp + src/osx/spinbutt_osx.cpp + src/osx/srchctrl_osx.cpp + src/osx/statbox_osx.cpp + src/osx/statline_osx.cpp + src/osx/stattext_osx.cpp + src/osx/textentry_osx.cpp + src/osx/textctrl_osx.cpp + src/osx/tglbtn_osx.cpp + src/osx/toolbar_osx.cpp + # wxWebKit files + src/html/htmlctrl/webkit/webkit.mm + # Native color/font dialogs + src/osx/carbon/colordlgosx.mm + src/osx/carbon/fontdlgosx.mm + # other shared files + src/osx/accel.cpp + src/osx/carbon/clipbrd.cpp + src/osx/carbon/cursor.cpp + src/osx/carbon/fontdlg.cpp + src/osx/carbon/gdiobj.cpp + src/osx/carbon/icon.cpp + src/osx/carbon/app.cpp + src/osx/carbon/control.cpp + src/osx/carbon/dataobj.cpp + src/osx/carbon/dcclient.cpp + src/osx/carbon/dcprint.cpp + src/osx/carbon/dcscreen.cpp + src/osx/carbon/graphics.cpp + src/osx/carbon/font.cpp + src/osx/carbon/frame.cpp + src/osx/carbon/mdi.cpp + src/osx/carbon/metafile.cpp + src/osx/carbon/overlay.cpp + src/osx/carbon/popupwin.cpp + src/osx/carbon/renderer.cpp + src/osx/carbon/statbrma.cpp + src/osx/carbon/region.cpp + # cocoa bridge + src/osx/carbon/utilscocoa.mm + # Generic implementations used by wxOSX: + src/generic/caret.cpp + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/generic/colrdlgg.cpp + src/generic/dirdlgg.cpp + src/generic/fdrepdlg.cpp + src/generic/filedlgg.cpp + src/generic/filepickerg.cpp + src/generic/fontdlgg.cpp + src/generic/fontpickerg.cpp + src/generic/listctrl.cpp + src/generic/prntdlgg.cpp + src/generic/statusbr.cpp + src/generic/textmeasure.cpp + #TODO: +) + +set(OSX_SHARED_HDR + # wxWebKit headers + wx/html/webkit.h + # other shared headers + wx/osx/accel.h + wx/osx/anybutton.h + wx/osx/app.h + wx/osx/bitmap.h + wx/osx/bmpbuttn.h + wx/osx/brush.h + wx/osx/button.h + wx/osx/checkbox.h + wx/osx/checklst.h + wx/osx/chkconf.h + wx/osx/choice.h + wx/osx/clipbrd.h + wx/osx/colordlg.h + wx/osx/colour.h + wx/osx/combobox.h + wx/osx/control.h + wx/osx/cursor.h + wx/osx/dataform.h + wx/osx/dataobj.h + wx/osx/dataobj2.h + wx/osx/dc.h + wx/osx/dcclient.h + wx/osx/dcmemory.h + wx/osx/dcprint.h + wx/osx/dcscreen.h + wx/osx/dialog.h + wx/osx/dirdlg.h + wx/osx/dnd.h + wx/osx/evtloop.h + wx/osx/evtloopsrc.h + wx/osx/filedlg.h + wx/osx/font.h + wx/osx/fontdlg.h + wx/osx/frame.h + wx/osx/gauge.h + wx/osx/icon.h + wx/osx/imaglist.h + wx/osx/listbox.h + wx/osx/listctrl.h + wx/osx/mdi.h + wx/osx/menu.h + wx/osx/menuitem.h + wx/osx/metafile.h + wx/osx/mimetype.h + wx/osx/minifram.h + wx/osx/msgdlg.h + wx/osx/nonownedwnd.h + wx/osx/notebook.h + wx/osx/palette.h + wx/osx/pen.h + wx/osx/popupwin.h + wx/osx/printdlg.h + wx/osx/printmac.h + wx/osx/private.h + wx/osx/radiobox.h + wx/osx/radiobut.h + wx/osx/region.h + wx/osx/scrolbar.h + wx/osx/slider.h + wx/osx/spinbutt.h + wx/osx/srchctrl.h + wx/osx/statbmp.h + wx/osx/statbox.h + wx/osx/statline.h + wx/osx/stattext.h + wx/osx/statusbr.h + wx/osx/taskbarosx.h + wx/osx/textctrl.h + wx/osx/textentry.h + wx/osx/tglbtn.h + wx/osx/toolbar.h + wx/osx/tooltip.h + wx/osx/toplevel.h + wx/osx/uma.h + wx/osx/window.h + # Generic implementations used by wxOSX: + wx/generic/caret.h + wx/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/generic/colrdlgg.h + wx/generic/dirdlgg.h + wx/generic/fdrepdlg.h + wx/generic/filedlgg.h + wx/generic/filepickerg.h + wx/generic/fontdlgg.h + wx/generic/fontpickerg.h + wx/generic/listctrl.h + wx/generic/prntdlgg.h + wx/generic/statusbr.h +) + +set(OSX_COCOA_SRC + ${OSX_COMMON_SRC} + src/osx/cocoa/anybutton.mm + src/osx/cocoa/appprogress.mm + src/osx/cocoa/button.mm + src/osx/cocoa/checkbox.mm + src/osx/cocoa/choice.mm + src/osx/cocoa/colour.mm + src/osx/cocoa/combobox.mm + src/osx/cocoa/dialog.mm + src/osx/cocoa/dirdlg.mm + src/osx/cocoa/dnd.mm + src/osx/cocoa/evtloop.mm + src/osx/cocoa/filedlg.mm + src/osx/cocoa/gauge.mm + src/osx/cocoa/listbox.mm + src/osx/cocoa/menu.mm + src/osx/cocoa/menuitem.mm + src/osx/cocoa/msgdlg.mm + src/osx/cocoa/nativewin.mm + src/osx/cocoa/nonownedwnd.mm + src/osx/cocoa/notebook.mm + src/osx/cocoa/radiobut.mm + src/osx/cocoa/preferences.mm + src/osx/cocoa/printdlg.mm + src/osx/cocoa/scrolbar.mm + src/osx/cocoa/settings.mm + src/osx/cocoa/slider.mm + src/osx/cocoa/spinbutt.mm + src/osx/cocoa/srchctrl.mm + src/osx/cocoa/statbox.mm + src/osx/cocoa/statline.mm + src/osx/cocoa/stattext.mm + src/osx/cocoa/textctrl.mm + src/osx/cocoa/tglbtn.mm + src/osx/cocoa/toolbar.mm + src/osx/cocoa/tooltip.mm + src/osx/cocoa/window.mm +) + +set(OSX_COCOA_HDR + wx/osx/cocoa/chkconf.h + wx/osx/cocoa/evtloop.h + wx/osx/cocoa/private.h + wx/osx/cocoa/stdpaths.h + wx/generic/region.h +) + +set(OSX_IPHONE_SRC + ${OSX_COMMON_SRC} + src/generic/regiong.cpp + src/generic/icon.cpp + src/osx/cocoa/stdpaths.mm + # iphone files + src/osx/iphone/anybutton.mm + src/osx/iphone/button.mm + src/osx/iphone/checkbox.mm + src/osx/iphone/dialog.mm + src/osx/iphone/evtloop.mm + src/osx/iphone/gauge.mm + src/osx/iphone/msgdlg.mm + src/osx/iphone/nonownedwnd.mm + src/osx/iphone/scrolbar.mm + src/osx/iphone/settings.mm + src/osx/iphone/slider.mm + src/osx/iphone/stattext.mm + src/osx/iphone/textctrl.mm + src/osx/iphone/toolbar.mm + src/osx/iphone/utils.mm + src/osx/iphone/window.mm +) + +set(OSX_IPHONE_HDR + wx/osx/iphone/chkconf.h + wx/osx/iphone/evtloop.h + wx/osx/iphone/private.h + wx/generic/region.h +) + +set(UNIV_THEMES_SRC + src/univ/themes/gtk.cpp + src/univ/themes/metal.cpp + src/univ/themes/mono.cpp + src/univ/themes/win32.cpp +) + +set(UNIV_SRC + ${UNIV_PLATFORM_SRC} + src/generic/accel.cpp + src/generic/activityindicator.cpp + src/generic/clrpickerg.cpp + src/generic/collpaneg.cpp + src/generic/colrdlgg.cpp + src/generic/dirdlgg.cpp + src/generic/fdrepdlg.cpp + src/generic/filedlgg.cpp + src/generic/filepickerg.cpp + src/generic/fontdlgg.cpp + src/generic/fontpickerg.cpp + src/generic/listctrl.cpp + src/generic/mdig.cpp + src/generic/prntdlgg.cpp + src/univ/anybutton.cpp + src/univ/bmpbuttn.cpp + src/univ/button.cpp + src/univ/checkbox.cpp + src/univ/checklst.cpp + src/univ/choice.cpp + src/univ/combobox.cpp + src/univ/control.cpp + src/univ/ctrlrend.cpp + src/univ/dialog.cpp + src/univ/framuniv.cpp + src/univ/gauge.cpp + src/univ/inpcons.cpp + src/univ/inphand.cpp + src/univ/listbox.cpp + src/univ/menu.cpp + src/univ/notebook.cpp + src/univ/radiobox.cpp + src/univ/radiobut.cpp + src/univ/scrarrow.cpp + src/univ/scrolbar.cpp + src/univ/scrthumb.cpp + src/univ/settingsuniv.cpp + src/univ/slider.cpp + src/univ/spinbutt.cpp + src/univ/statbmp.cpp + src/univ/statbox.cpp + src/univ/statline.cpp + src/univ/stattext.cpp + src/univ/statusbr.cpp + src/univ/stdrend.cpp + src/univ/textctrl.cpp + src/univ/tglbtn.cpp + src/univ/theme.cpp + src/univ/toolbar.cpp + src/univ/topluniv.cpp + src/univ/winuniv.cpp +) + +set(UNIV_HDR + ${UNIV_PLATFORM_HDR} + wx/generic/accel.h + wx/generic/activityindicator.h + wx/generic/animate.h + wx/generic/clrpickerg.h + wx/generic/collpaneg.h + wx/generic/ctrlsub.h + wx/generic/dirdlgg.h + wx/generic/fdrepdlg.h + wx/generic/filedlgg.h + wx/generic/filepickerg.h + wx/generic/fontdlgg.h + wx/generic/fontpickerg.h + wx/generic/listctrl.h + wx/generic/mdig.h + wx/generic/statusbr.h + wx/univ/anybutton.h + wx/univ/app.h + wx/univ/bmpbuttn.h + wx/univ/button.h + wx/univ/checkbox.h + wx/univ/checklst.h + wx/univ/chkconf.h + wx/univ/choice.h + wx/univ/colschem.h + wx/univ/combobox.h + wx/univ/control.h + wx/univ/custombgwin.h + wx/univ/dialog.h + wx/univ/frame.h + wx/univ/gauge.h + wx/univ/inpcons.h + wx/univ/inphand.h + wx/univ/listbox.h + wx/univ/menu.h + wx/univ/menuitem.h + wx/univ/notebook.h + wx/univ/panel.h + wx/univ/radiobox.h + wx/univ/radiobut.h + wx/univ/renderer.h + wx/univ/scrarrow.h + wx/univ/scrolbar.h + wx/univ/scrthumb.h + wx/univ/scrtimer.h + wx/univ/slider.h + wx/univ/spinbutt.h + wx/univ/statbmp.h + wx/univ/statbox.h + wx/univ/statline.h + wx/univ/stattext.h + wx/univ/statusbr.h + wx/univ/stdrend.h + wx/univ/textctrl.h + wx/univ/theme.h + wx/univ/tglbtn.h + wx/univ/toolbar.h + wx/univ/toplevel.h + wx/univ/window.h +) + +set(ADVANCED_CMN_SRC + src/common/addremovectrl.cpp + src/common/animatecmn.cpp + src/common/bmpcboxcmn.cpp + src/common/calctrlcmn.cpp + src/common/datavcmn.cpp + src/common/gridcmn.cpp + src/common/hyperlnkcmn.cpp + src/common/notifmsgcmn.cpp + src/common/odcombocmn.cpp + src/common/richtooltipcmn.cpp + src/generic/aboutdlgg.cpp + src/generic/bannerwindow.cpp + src/generic/bmpcboxg.cpp + src/generic/calctrlg.cpp + src/generic/commandlinkbuttong.cpp + src/generic/datavgen.cpp + src/generic/datectlg.cpp + src/generic/editlbox.cpp + src/generic/grid.cpp + src/generic/gridctrl.cpp + src/generic/grideditors.cpp + src/generic/gridsel.cpp + src/generic/helpext.cpp + src/generic/hyperlinkg.cpp + src/generic/laywin.cpp + src/generic/notifmsgg.cpp + src/generic/odcombo.cpp + src/generic/propdlg.cpp + src/generic/richtooltipg.cpp + src/generic/sashwin.cpp + src/generic/splash.cpp + src/generic/timectrlg.cpp + src/generic/tipdlg.cpp + src/generic/treelist.cpp + src/generic/wizard.cpp +) + +set(ADVANCED_CMN_HDR + wx/aboutdlg.h + wx/activityindicator.h + wx/addremovectrl.h + wx/animate.h + wx/bannerwindow.h + wx/bmpcbox.h + wx/calctrl.h + wx/commandlinkbutton.h + wx/dataview.h + wx/datectrl.h + wx/dateevt.h + wx/datetimectrl.h + wx/dcbuffer.h + wx/dvrenderers.h + wx/editlbox.h + wx/generic/aboutdlgg.h + wx/generic/bmpcbox.h + wx/generic/calctrlg.h + wx/generic/datectrl.h + wx/generic/dataview.h + wx/generic/dvrenderer.h + wx/generic/dvrenderers.h + wx/generic/grid.h + wx/generic/gridctrl.h + wx/generic/grideditors.h + wx/generic/gridsel.h + wx/generic/helpext.h + wx/generic/hyperlink.h + wx/generic/laywin.h + wx/generic/notifmsg.h + wx/generic/propdlg.h + wx/generic/sashwin.h + wx/generic/splash.h + wx/generic/timectrl.h + wx/generic/wizard.h + wx/grid.h + wx/hyperlink.h + wx/joystick.h + wx/laywin.h + wx/notifmsg.h + wx/odcombo.h + wx/propdlg.h + wx/richtooltip.h + wx/sashwin.h + wx/sound.h + wx/splash.h + wx/taskbar.h + wx/timectrl.h + wx/tipdlg.h + wx/treelist.h + wx/wizard.h +) + +set(ADVANCED_MSW_SRC + src/generic/activityindicator.cpp + src/common/taskbarcmn.cpp + src/msw/aboutdlg.cpp + src/msw/notifmsg.cpp + src/msw/rt/notifmsgrt.cpp + src/msw/richtooltip.cpp + src/msw/sound.cpp + src/msw/taskbar.cpp +) + +set(ADVANCED_MSW_HDR + wx/generic/activityindicator.h + wx/msw/sound.h + wx/msw/taskbar.h +) + +set(ADVANCED_MSW_NATIVE_SRC + src/generic/animateg.cpp + src/msw/bmpcbox.cpp + src/msw/calctrl.cpp + src/msw/commandlinkbutton.cpp + src/msw/datecontrols.cpp + src/msw/datectrl.cpp + src/msw/datetimectrl.cpp + src/msw/hyperlink.cpp + src/msw/timectrl.cpp +) + +set(ADVANCED_MSW_NATIVE_HDR + wx/generic/animate.h + wx/msw/bmpcbox.h + wx/msw/commandlinkbutton.h + wx/msw/calctrl.h + wx/msw/datectrl.h + wx/msw/datetimectrl.h + wx/msw/hyperlink.h + wx/msw/timectrl.h +) + +set(ADVANCED_MSW_DESKTOP_SRC + src/msw/joystick.cpp +) + +set(ADVANCED_MSW_DESKTOP_HDR + wx/msw/joystick.h +) + +set(ADVANCED_OSX_COCOA_SRC + src/common/taskbarcmn.cpp + src/generic/animateg.cpp + src/osx/cocoa/activityindicator.mm + src/osx/datetimectrl_osx.cpp + src/osx/datectrl_osx.cpp + src/osx/sound_osx.cpp + src/osx/timectrl_osx.cpp + src/osx/carbon/sound.cpp + src/osx/core/sound.cpp + src/osx/cocoa/aboutdlg.mm + src/osx/dataview_osx.cpp + src/osx/cocoa/dataview.mm + src/osx/cocoa/datetimectrl.mm + src/osx/cocoa/notifmsg.mm + src/osx/cocoa/taskbar.mm + src/osx/core/hidjoystick.cpp +) + +set(ADVANCED_OSX_COCOA_HDR + wx/generic/animate.h + wx/osx/activityindicator.h + wx/osx/dataview.h + wx/osx/datectrl.h + wx/osx/datetimectrl.h + wx/osx/dvrenderer.h + wx/osx/dvrenderers.h + wx/osx/joystick.h + wx/osx/sound.h + wx/osx/taskbarosx.h + wx/osx/timectrl.h + wx/osx/core/joystick.h + wx/osx/cocoa/dataview.h +) + +set(ADVANCED_OSX_IPHONE_SRC + src/generic/animateg.cpp + src/osx/sound_osx.cpp + src/osx/core/sound.cpp +) + +set(ADVANCED_OSX_IPHONE_HDR + wx/generic/animate.h + wx/osx/sound.h +) + +set(ADVANCED_COCOA_SRC + src/cocoa/taskbar.mm + src/common/taskbarcmn.cpp + src/generic/animateg.cpp + src/osx/core/hidjoystick.cpp +) + +set(ADVANCED_COCOA_HDR + wx/cocoa/taskbar.h + wx/generic/animate.h + wx/osx/core/joystick.h +) + +set(ADVANCED_UNIX_SRC + src/common/taskbarcmn.cpp + src/unix/joystick.cpp + src/unix/sound.cpp + src/unix/taskbarx11.cpp +) + +set(ADVANCED_UNIX_HDR + wx/unix/joystick.h + wx/unix/sound.h + wx/unix/taskbarx11.h +) + +set(ADVANCED_MOTIF_SRC + src/generic/activityindicator.cpp + src/generic/animateg.cpp +) + +set(ADVANCED_MOTIF_HDR + wx/generic/animateanimate.h + wx/generic/animate.h +) + +set(ADVANCED_GTK_WIN32_SRC + src/common/taskbarcmn.cpp + src/msw/joystick.cpp + src/msw/sound.cpp +) + +set(ADVANCED_GTK_WIN32_HDR + wx/msw/joystick.h + wx/msw/sound.h + wx/msw/taskbar.h +) + +set(ADVANCED_GTK_SRC + ${ADVANCED_GTK_PLATFORM_SRC} + src/gtk/notifmsg.cpp + src/gtk/taskbar.cpp +) + +set(ADVANCED_GTK2_SRC + ${ADVANCED_GTK_SRC} + src/generic/activityindicator.cpp + src/gtk/eggtrayicon.c +) + +set(ADVANCED_GTK_HDR + ${ADVANCED_GTK_PLATFORM_HDR} + wx/generic/activityindicator.h + wx/gtk/taskbar.h +) + +set(ADVANCED_GTK2_HDR + ${ADVANCED_GTK_HDR} +) + +set(ADVANCED_GTK_NATIVE_SRC + src/gtk/aboutdlg.cpp + src/gtk/activityindicator.cpp + src/gtk/animate.cpp + src/gtk/bmpcbox.cpp + src/gtk/calctrl.cpp + src/gtk/dataview.cpp + src/gtk/hyperlink.cpp +) + +set(ADVANCED_GTK_NATIVE_HDR + wx/gtk/activityindicator.h + wx/gtk/animate.h + wx/gtk/bmpcbox.h + wx/gtk/calctrl.h + wx/gtk/dataview.h + wx/gtk/dvrenderer.h + wx/gtk/dvrenderers.h + wx/gtk/hyperlink.h +) + +set(ADVANCED_GTK1_SRC + src/generic/activityindicator.cpp + src/generic/animateg.cpp + src/gtk1/eggtrayicon.c + src/gtk1/taskbar.cpp +) + +set(ADVANCED_GTK1_HDR + wx/generic/activityindicator.h + wx/generic/animate.h +) + +set(MEDIA_CMN_SRC + src/common/mediactrlcmn.cpp +) + +set(MEDIA_CMN_HDR + wx/mediactrl.h +) + +set(MEDIA_MSW_SRC + src/msw/mediactrl_am.cpp + src/msw/mediactrl_wmp10.cpp + src/msw/mediactrl_qt.cpp +) + +set(MEDIA_MSW_HDR +) + +set(MEDIA_MSW_DESKTOP_SRC +) + +set(MEDIA_MSW_DESKTOP_HDR +) + +set(MEDIA_OSX_COCOA_SRC + src/osx/cocoa/mediactrl.mm +) + +set(MEDIA_OSX_COCOA_HDR +) + +set(MEDIA_OSX_IPHONE_SRC + src/osx/cocoa/mediactrl.mm +) + +set(MEDIA_OSX_IPHONE_HDR +) + +set(MEDIA_COCOA_SRC + src/cocoa/mediactrl.mm +) + +set(MEDIA_COCOA_HDR +) + +set(MEDIA_UNIX_SRC + src/unix/mediactrl.cpp + src/unix/mediactrl_gstplayer.cpp +) + +set(MEDIA_UNIX_HDR +) + +set(MEDIA_GTK_SRC +) + +set(MEDIA_GTK1_SRC +) + +set(HTML_MSW_SRC + src/msw/helpbest.cpp + src/html/chm.cpp +) + +set(HTML_CMN_SRC + src/html/helpctrl.cpp + src/html/helpdata.cpp + src/html/helpdlg.cpp + src/html/helpfrm.cpp + src/html/helpwnd.cpp + src/html/htmlcell.cpp + src/html/htmlfilt.cpp + src/html/htmlpars.cpp + src/html/htmltag.cpp + src/html/htmlwin.cpp + src/html/htmprint.cpp + src/html/m_dflist.cpp + src/html/m_fonts.cpp + src/html/m_hline.cpp + src/html/m_image.cpp + src/html/m_layout.cpp + src/html/m_links.cpp + src/html/m_list.cpp + src/html/m_pre.cpp + src/html/m_span.cpp + src/html/m_style.cpp + src/html/m_tables.cpp + src/html/styleparams.cpp + src/html/winpars.cpp + # wxHTML users: + src/generic/htmllbox.cpp +) + +set(HTML_MSW_HDR + wx/msw/helpbest.h +) + +set(HTML_CMN_HDR + wx/html/forcelnk.h + wx/html/helpctrl.h + wx/html/helpdata.h + wx/html/helpdlg.h + wx/html/helpfrm.h + wx/html/helpwnd.h + wx/html/htmlcell.h + wx/html/htmldefs.h + wx/html/htmlfilt.h + wx/html/htmlpars.h + wx/html/htmlproc.h + wx/html/htmltag.h + wx/html/htmlwin.h + wx/html/htmprint.h + wx/html/m_templ.h + wx/html/styleparams.h + wx/html/winpars.h + wx/wxhtml.h + # wxHTML users: + wx/htmllbox.h +) + +set(WEBVIEW_MSW_SRC + src/msw/webview_ie.cpp +) + +set(WEBVIEW_CMN_SRC + src/common/webview.cpp + src/common/webviewarchivehandler.cpp + src/common/webviewfshandler.cpp +) + +set(WEBVIEW_MSW_HDR + wx/msw/webviewhistoryitem_ie.h + wx/msw/webview_ie.h + wx/msw/webview_missing.h +) + +set(WEBVIEW_CMN_HDR + wx/webview.h + wx/webviewarchivehandler.h + wx/webviewfshandler.h +) + +set(WEBVIEW_OSX_SHARED_HDR + wx/osx/webviewhistoryitem_webkit.h + wx/osx/webview_webkit.h +) + +set(WEBVIEW_OSX_SHARED_SRC + src/osx/webview_webkit.mm +) + +set(WEBVIEW_GTK_HDR + wx/gtk/webviewhistoryitem_webkit.h + wx/gtk/webview_webkit.h +) + +set(WEBVIEW_GTK_SRC + src/gtk/webview_webkit.cpp +) + +set(XRC_SRC + src/xrc/xh_activityindicator.cpp + src/xrc/xh_animatctrl.cpp + src/xrc/xh_bannerwindow.cpp + src/xrc/xh_bmp.cpp + src/xrc/xh_bmpcbox.cpp + src/xrc/xh_bmpbt.cpp + src/xrc/xh_bttn.cpp + src/xrc/xh_cald.cpp + src/xrc/xh_chckb.cpp + src/xrc/xh_chckl.cpp + src/xrc/xh_choic.cpp + src/xrc/xh_choicbk.cpp + src/xrc/xh_clrpicker.cpp + src/xrc/xh_cmdlinkbn.cpp + src/xrc/xh_collpane.cpp + src/xrc/xh_combo.cpp + src/xrc/xh_comboctrl.cpp + src/xrc/xh_datectrl.cpp + src/xrc/xh_dirpicker.cpp + src/xrc/xh_dlg.cpp + src/xrc/xh_editlbox.cpp + src/xrc/xh_filectrl.cpp + src/xrc/xh_filepicker.cpp + src/xrc/xh_fontpicker.cpp + src/xrc/xh_frame.cpp + src/xrc/xh_gauge.cpp + src/xrc/xh_gdctl.cpp + src/xrc/xh_grid.cpp + src/xrc/xh_html.cpp + src/xrc/xh_hyperlink.cpp + src/xrc/xh_listb.cpp + src/xrc/xh_listbk.cpp + src/xrc/xh_listc.cpp + src/xrc/xh_mdi.cpp + src/xrc/xh_menu.cpp + src/xrc/xh_notbk.cpp + src/xrc/xh_odcombo.cpp + src/xrc/xh_panel.cpp + src/xrc/xh_propdlg.cpp + src/xrc/xh_radbt.cpp + src/xrc/xh_radbx.cpp + src/xrc/xh_scrol.cpp + src/xrc/xh_scwin.cpp + src/xrc/xh_htmllbox.cpp + src/xrc/xh_simplebook.cpp + src/xrc/xh_sizer.cpp + src/xrc/xh_slidr.cpp + src/xrc/xh_spin.cpp + src/xrc/xh_split.cpp + src/xrc/xh_srchctrl.cpp + src/xrc/xh_statbar.cpp + src/xrc/xh_stbmp.cpp + src/xrc/xh_stbox.cpp + src/xrc/xh_stlin.cpp + src/xrc/xh_sttxt.cpp + src/xrc/xh_text.cpp + src/xrc/xh_tglbtn.cpp + src/xrc/xh_timectrl.cpp + src/xrc/xh_toolb.cpp + src/xrc/xh_toolbk.cpp + src/xrc/xh_tree.cpp + src/xrc/xh_treebk.cpp + src/xrc/xh_unkwn.cpp + src/xrc/xh_wizrd.cpp + src/xrc/xmlres.cpp + src/xrc/xmladv.cpp + src/xrc/xmlrsall.cpp +) + +set(XRC_HDR + wx/xrc/xh_activityindicator.h + wx/xrc/xh_all.h + wx/xrc/xh_animatctrl.h + wx/xrc/xh_bannerwindow.h + wx/xrc/xh_bmpbt.h + wx/xrc/xh_bmp.h + wx/xrc/xh_bmpcbox.h + wx/xrc/xh_bttn.h + wx/xrc/xh_cald.h + wx/xrc/xh_chckb.h + wx/xrc/xh_chckl.h + wx/xrc/xh_choic.h + wx/xrc/xh_choicbk.h + wx/xrc/xh_clrpicker.h + wx/xrc/xh_cmdlinkbn.h + wx/xrc/xh_collpane.h + wx/xrc/xh_combo.h + wx/xrc/xh_comboctrl.h + wx/xrc/xh_datectrl.h + wx/xrc/xh_dirpicker.h + wx/xrc/xh_dlg.h + wx/xrc/xh_editlbox.h + wx/xrc/xh_filectrl.h + wx/xrc/xh_filepicker.h + wx/xrc/xh_fontpicker.h + wx/xrc/xh_frame.h + wx/xrc/xh_mdi.h + wx/xrc/xh_gauge.h + wx/xrc/xh_gdctl.h + wx/xrc/xh_grid.h + wx/xrc/xh_html.h + wx/xrc/xh_hyperlink.h + wx/xrc/xh_listb.h + wx/xrc/xh_listbk.h + wx/xrc/xh_listc.h + wx/xrc/xh_menu.h + wx/xrc/xh_notbk.h + wx/xrc/xh_odcombo.h + wx/xrc/xh_panel.h + wx/xrc/xh_propdlg.h + wx/xrc/xh_radbt.h + wx/xrc/xh_radbx.h + wx/xrc/xh_scrol.h + wx/xrc/xh_scwin.h + wx/xrc/xh_htmllbox.h + wx/xrc/xh_simplebook.h + wx/xrc/xh_sizer.h + wx/xrc/xh_slidr.h + wx/xrc/xh_spin.h + wx/xrc/xh_split.h + wx/xrc/xh_srchctrl.h + wx/xrc/xh_statbar.h + wx/xrc/xh_stbmp.h + wx/xrc/xh_stbox.h + wx/xrc/xh_stlin.h + wx/xrc/xh_sttxt.h + wx/xrc/xh_text.h + wx/xrc/xh_tglbtn.h + wx/xrc/xh_timectrl.h + wx/xrc/xh_toolb.h + wx/xrc/xh_toolbk.h + wx/xrc/xh_tree.h + wx/xrc/xh_treebk.h + wx/xrc/xh_unkwn.h + wx/xrc/xh_wizrd.h + wx/xrc/xmlres.h +) + +set(XML_SRC + src/xml/xml.cpp + src/common/xtixml.cpp # FIXME - temporary solution +) + +set(XML_HDR + wx/xml/xml.h + wx/xtixml.h # FIXME - temporary solution +) + +set(OPENGL_CMN_SRC + src/common/glcmn.cpp +) + +set(OPENGL_CMN_HDR + wx/glcanvas.h +) + +set(OPENGL_MSW_SRC + src/msw/glcanvas.cpp +) + +set(OPENGL_MSW_HDR + wx/msw/glcanvas.h +) + +set(OPENGL_OSX_SHARED_SRC + src/osx/cocoa/glcanvas.mm + src/osx/glcanvas_osx.cpp +) + +set(UNIX_SOUND_SRC_SDL + src/unix/sound_sdl.cpp +) + +set(AUI_CMN_SRC + src/aui/framemanager.cpp + src/aui/dockart.cpp + src/aui/floatpane.cpp + src/aui/auibook.cpp + src/aui/auibar.cpp + src/aui/tabmdi.cpp + src/aui/tabart.cpp + src/xrc/xh_aui.cpp + src/xrc/xh_auitoolb.cpp +) + +set(AUI_CMN_HDR + wx/aui/framemanager.h + wx/aui/dockart.h + wx/aui/floatpane.h + wx/aui/auibook.h + wx/aui/auibar.h + wx/aui/tabmdi.h + wx/aui/aui.h + wx/aui/tabart.h + wx/xrc/xh_aui.h + wx/xrc/xh_auitoolb.h +) + +set(AUI_MSW_HDR + wx/aui/tabartmsw.h + wx/aui/barartmsw.h +) + +set(AUI_MSW_SRC + src/aui/tabartmsw.cpp + src/aui/barartmsw.cpp +) + +set(AUI_GTK_SRC + src/aui/tabartgtk.cpp +) + +set(AUI_GTK_HDR + wx/aui/tabartgtk.h +) + +set(RIBBON_SRC + src/ribbon/art_internal.cpp + src/ribbon/art_msw.cpp + src/ribbon/art_aui.cpp + src/ribbon/bar.cpp + src/ribbon/buttonbar.cpp + src/ribbon/control.cpp + src/ribbon/gallery.cpp + src/ribbon/page.cpp + src/ribbon/panel.cpp + src/ribbon/toolbar.cpp + src/xrc/xh_ribbon.cpp +) + +set(RIBBON_HDR + wx/ribbon/art.h + wx/ribbon/art_internal.h + wx/ribbon/bar.h + wx/ribbon/buttonbar.h + wx/ribbon/control.h + wx/ribbon/gallery.h + wx/ribbon/page.h + wx/ribbon/panel.h + wx/ribbon/toolbar.h + wx/xrc/xh_ribbon.h +) + +set(PROPGRID_SRC + src/propgrid/advprops.cpp + src/propgrid/editors.cpp + src/propgrid/manager.cpp + src/propgrid/property.cpp + src/propgrid/propgrid.cpp + src/propgrid/propgridiface.cpp + src/propgrid/propgridpagestate.cpp + src/propgrid/props.cpp +) + +set(PROPGRID_HDR + wx/propgrid/advprops.h + wx/propgrid/editors.h + wx/propgrid/manager.h + wx/propgrid/property.h + wx/propgrid/propgrid.h + wx/propgrid/propgriddefs.h + wx/propgrid/propgridiface.h + wx/propgrid/propgridpagestate.h + wx/propgrid/props.h +) + +set(RICHTEXT_SRC + src/richtext/richtextbuffer.cpp + src/richtext/richtextctrl.cpp + src/richtext/richtextformatdlg.cpp + src/richtext/richtexthtml.cpp + src/richtext/richtextimagedlg.cpp + src/richtext/richtextprint.cpp + src/richtext/richtextstyledlg.cpp + src/richtext/richtextstyles.cpp + src/richtext/richtextsymboldlg.cpp + src/richtext/richtextxml.cpp + src/xrc/xh_richtext.cpp +) + +set(RICHTEXT_HDR + wx/richtext/richtextbackgroundpage.h + wx/richtext/richtextborderspage.h + wx/richtext/richtextbuffer.h + wx/richtext/richtextbulletspage.h + wx/richtext/richtextctrl.h + wx/richtext/richtextdialogpage.h + wx/richtext/richtextfontpage.h + wx/richtext/richtextformatdlg.h + wx/richtext/richtexthtml.h + wx/richtext/richtextimagedlg.h + wx/richtext/richtextindentspage.h + wx/richtext/richtextliststylepage.h + wx/richtext/richtextmarginspage.h + wx/richtext/richtextprint.h + wx/richtext/richtextsizepage.h + wx/richtext/richtextstyledlg.h + wx/richtext/richtextstylepage.h + wx/richtext/richtextstyles.h + wx/richtext/richtextsymboldlg.h + wx/richtext/richtexttabspage.h + wx/richtext/richtextuicustomization.h + wx/richtext/richtextxml.h + wx/xrc/xh_richtext.h +) + +set(STC_SRC + src/stc/stc.cpp + src/stc/PlatWX.cpp + src/stc/ScintillaWX.cpp +) + +set(STC_HDR + wx/stc/stc.h +) + diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake new file mode 100644 index 0000000000..decb10639b --- /dev/null +++ b/build/cmake/functions.cmake @@ -0,0 +1,710 @@ +############################################################################# +# Name: build/cmake/functions.cmake +# Purpose: Common CMake functions for wxWidgets +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(CMakeDependentOption) +include(CMakeParseArguments) # For compatiblity with CMake < 3.4 +include(ExternalProject) +if(CMAKE_GENERATOR STREQUAL "Xcode") + # wxWidgets does not use the unity features of cotire so we can + # include Obj-C files when using precompiled headers with Xcode + set(COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "" CACHE STRING "wxWidgets override of cotire exclude") +endif() +include(cotire) # For precompiled header handling +include(CMakePrintHelpers) + +# This function adds a list of headers to a variable while prepending +# include/ to the path +function(wx_add_headers src_var) + set(headers) + list(REMOVE_AT ARGV 0) + foreach(header ${ARGV}) + list(APPEND headers ${wxSOURCE_DIR}/include/${header}) + if(header MATCHES "\\.cpp$") + # .cpp files in include directory should not be compiled + set_source_files_properties(${wxSOURCE_DIR}/include/${header} + PROPERTIES HEADER_FILE_ONLY TRUE) + endif() + endforeach() + set(${src_var} ${${src_var}} ${headers} PARENT_SCOPE) +endfunction() + +# Add sources from a ..._SRC variable and headers from a ..._HDR +macro(wx_append_sources src_var source_base_name) + if(NOT DEFINED ${src_var}) + set(${src_var} "") + endif() + if(DEFINED ${source_base_name}_SRC) + wx_list_add_prefix(${src_var} "${wxSOURCE_DIR}/" ${${source_base_name}_SRC}) + endif() + if(DEFINED ${source_base_name}_HDR) + wx_add_headers(${src_var} ${${source_base_name}_HDR}) + endif() +endmacro() + +# Add prefix to list of items +# wx_list_add_prefix( ) +macro(wx_list_add_prefix out_var prefix) + foreach(item ${ARGN}) + list(APPEND ${out_var} ${prefix}${item}) + endforeach() +endmacro() + +# Older cmake versions don't support string(APPEND ...) provide a workaround +macro(wx_string_append var str) + set(${var} ${${var}}${str}) +endmacro() + +# wx_install(...) +# Forward to install call if wxBUILD_INSTALL is enabled +macro(wx_install) + if(wxBUILD_INSTALL) + install(${ARGN}) + endif() +endmacro() + +# Set properties common to builtin third party libraries and wx libs +function(wx_set_common_target_properties target_name) + if(DEFINED wxBUILD_CXX_STANDARD AND NOT wxBUILD_CXX_STANDARD STREQUAL COMPILER_DEFAULT) + # TODO: implement for older CMake versions ? + set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${wxBUILD_CXX_STANDARD}) + if(wxBUILD_CXX_STANDARD EQUAL 11 OR wxBUILD_CXX_STANDARD EQUAL 14) + set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY libc++) + #TODO: define for other generators than Xcode + endif() + endif() + set_target_properties(${target_name} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" + RUNTIME_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" + ) +endfunction() + +# Set common properties on wx library target +function(wx_set_target_properties target_name is_base) + # Set library name according to: + # docs/contrib/about-platform-toolkit-and-library-names.md + if(is_base) + set(lib_toolkit base) + else() + set(lib_toolkit ${wxBUILD_TOOLKIT}${wxBUILD_WIDGETSET}) + endif() + if(WIN32) + set(lib_version ${wxMAJOR_VERSION}${wxMINOR_VERSION}) + else() + set(lib_version ${wxMAJOR_VERSION}.${wxMINOR_VERSION}) + endif() + if(wxUSE_UNICODE) + set(lib_unicode u) + else() + set(lib_unicode) + endif() + if(NOT target_name STREQUAL "base" AND NOT target_name STREQUAL "mono") + # Do not append library name for base library + set(lib_suffix _${target_name}) + else() + set(lib_suffix) + endif() + if(WIN32) + if(wxBUILD_SHARED) + # Add compiler type and or vendor + set(dll_suffix "_${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}") + if(wxBUILD_VENDOR) + wx_string_append(dll_suffix "_${wxBUILD_VENDOR}") + endif() + + set(dll_version ${lib_version}) + if(wxVERSION_IS_DEV) + wx_string_append(dll_version ${wxRELEASE_NUMBER}) + endif() + set_target_properties(${target_name} + PROPERTIES + RUNTIME_OUTPUT_NAME wx${lib_toolkit}${dll_version}${lib_unicode}${lib_suffix}${dll_suffix} + RUNTIME_OUTPUT_NAME_DEBUG wx${lib_toolkit}${dll_version}${lib_unicode}d${lib_suffix}${dll_suffix}) + if(MINGW) + # Modify MinGW output to match other build systems + set_target_properties(${target_name} + PROPERTIES + PREFIX "" + IMPORT_SUFFIX .a + ) + endif() + target_compile_definitions(${target_name} PRIVATE + "-DWXDLLNAME=wx${lib_toolkit}${dll_version}${lib_unicode}$<$:d>${lib_suffix}${dll_suffix}") + endif() + + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME wx${lib_toolkit}${lib_version}${lib_unicode}${lib_suffix} + OUTPUT_NAME_DEBUG wx${lib_toolkit}${lib_version}${lib_unicode}d${lib_suffix} + PREFIX "" + ) + else() + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME wx_${lib_toolkit}${lib_unicode}${lib_suffix}-${lib_version} + OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}d${lib_suffix}-${lib_version} + ) + endif() + if(CYGWIN) + target_link_libraries(${target_name} PUBLIC -L/usr/lib/w32api) + endif() + + # Set common compile definitions + target_compile_definitions(${target_name} PRIVATE WXBUILDING _LIB) + if(target_name STREQUAL "mono" AND wxUSE_GUI) + target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=1 wxUSE_BASE=1) + elseif(is_base OR NOT wxUSE_GUI) + target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1) + else() + target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=1 wxUSE_BASE=0) + endif() + + if(wxUSE_UNICODE) + target_compile_definitions(${target_name} PUBLIC _UNICODE) + endif() + + if(WIN32 AND MSVC) + # Suppress deprecation warnings for standard library calls + target_compile_definitions(${target_name} PRIVATE + _CRT_SECURE_NO_DEPRECATE=1 + _CRT_NON_CONFORMING_SWPRINTFS=1 + _SCL_SECURE_NO_WARNINGS=1 + ) + endif() + + target_include_directories(${target_name} + BEFORE + PUBLIC + ${wxSETUP_HEADER_PATH} + ${wxSOURCE_DIR}/include + ) + + if(wxTOOLKIT_INCLUDE_DIRS) + target_include_directories(${target_name} + PUBLIC ${wxTOOLKIT_INCLUDE_DIRS}) + endif() + if(wxTOOLKIT_LIBRARIES) + target_link_libraries(${target_name} + PUBLIC ${wxTOOLKIT_LIBRARIES}) + endif() + target_compile_definitions(${target_name} + PUBLIC ${wxTOOLKIT_DEFINITIONS}) + + if(wxBUILD_SHARED) + string(TOUPPER ${target_name} target_name_upper) + if(target_name STREQUAL "mono") + target_compile_definitions(${target_name} PRIVATE DLL_EXPORTS WXMAKINGDLL) + else() + target_compile_definitions(${target_name} PRIVATE DLL_EXPORTS WXMAKINGDLL_${target_name_upper}) + endif() + if(NOT target_name STREQUAL "base") + target_compile_definitions(${target_name} PRIVATE WXUSINGDLL) + endif() + endif() + + # Link common libraries + if(NOT target_name STREQUAL "mono") + if(NOT target_name STREQUAL "base") + # All libraries except base need the base library + target_link_libraries(${target_name} PUBLIC base) + endif() + if(NOT is_base AND NOT target_name STREQUAL "core") + # All non base libraries except core need core + target_link_libraries(${target_name} PUBLIC core) + endif() + endif() + + set_target_properties(${target_name} PROPERTIES FOLDER Libraries) + + wx_set_common_target_properties(${target_name}) +endfunction() + +# Add a wxWidgets library +# wx_add_library( [IS_BASE] ...) +# first parameter is the name of the library +# if the second parameter is set to IS_BASE a non UI lib is created +# all additional parameters are source files for the library +function(wx_add_library name) + cmake_parse_arguments(wxADD_LIBRARY "IS_BASE" "" "" ${ARGN}) + set(src_files ${wxADD_LIBRARY_UNPARSED_ARGUMENTS}) + + if(wxBUILD_MONOLITHIC AND NOT name STREQUAL "mono") + # collect all source files for mono library + set(wxMONO_SRC_FILES ${wxMONO_SRC_FILES} ${src_files} PARENT_SCOPE) + return() + endif() + + if(wxBUILD_PRECOMP AND MSVC) + # Add dummy source file to be used by cotire for PCH creation + list(INSERT src_files 0 "${wxSOURCE_DIR}/src/common/dummy.cpp") + endif() + list(APPEND src_files ${wxSETUP_HEADER_FILE}) + + if(wxBUILD_SHARED) + set(wxBUILD_LIB_TYPE SHARED) + if(WIN32) + # Add WIN32 version information + list(APPEND src_files "${wxSOURCE_DIR}/src/msw/version.rc" "${wxSOURCE_DIR}/include/wx/msw/genrcdefs.h") + endif() + else() + set(wxBUILD_LIB_TYPE STATIC) + endif() + + add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files}) + wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE}) + + # Setup install + wx_install(TARGETS ${name} + LIBRARY DESTINATION "lib${wxPLATFORM_LIB_DIR}" + ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}" + RUNTIME DESTINATION "lib${wxPLATFORM_LIB_DIR}" + BUNDLE DESTINATION Applications/wxWidgets + ) + + set(wxLIB_TARGETS ${wxLIB_TARGETS} ${name} PARENT_SCOPE) +endfunction() + +# Enable cotire for target if precompiled headers are enabled +macro(wx_target_enable_precomp target_name) + if(wxBUILD_PRECOMP) + if(CMAKE_GENERATOR STREQUAL "Xcode" AND ${target_name} STREQUAL "wxscintilla") + # TODO: workaround/fix cotire issue with wxscintilla when using Xcode + else() + set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) + cotire(${target_name}) + endif() + endif() +endmacro() + +# Enable precompiled headers for tests +macro(wx_test_enable_precomp target_name) + if(wxBUILD_PRECOMP) + target_compile_definitions(${target_name} PRIVATE WX_PRECOMP) + set_target_properties(${target_name} PROPERTIES + COTIRE_CXX_PREFIX_HEADER_INIT "${wxSOURCE_DIR}/tests/testprec.h") + wx_target_enable_precomp(${target_name}) + elseif(MSVC) + target_compile_definitions(${target_name} PRIVATE NOPCH) + endif() +endmacro() + +# Enable precompiled headers for wx libraries +macro(wx_finalize_lib target_name) + set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE) + if(wxBUILD_PRECOMP AND TARGET ${target_name}) + target_compile_definitions(${target_name} PRIVATE WX_PRECOMP) + set_target_properties(${target_name} PROPERTIES + COTIRE_CXX_PREFIX_HEADER_INIT "${wxSOURCE_DIR}/include/wx/wxprec.h") + wx_target_enable_precomp(${target_name}) + elseif(MSVC) + target_compile_definitions(${target_name} PRIVATE NOPCH) + endif() +endmacro() + +# wx_lib_link_libraries(name []) +# Forwards everything to target_link_libraries() except for monolithic +# build where it collects all libraries for linking with the mono lib +macro(wx_lib_link_libraries name) + if(wxBUILD_MONOLITHIC) + cmake_parse_arguments(_LIB_LINK "" "" "PUBLIC;PRIVATE" ${ARGN}) + list(APPEND wxMONO_LIBS_PUBLIC ${_LIB_LINK_PUBLIC}) + list(APPEND wxMONO_LIBS_PRIVATE ${_LIB_LINK_PRIVATE}) + else() + target_link_libraries(${name};${ARGN}) + endif() +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 mono) + else() + target_link_libraries(${name};${ARGN}) + endif() +endmacro() + +# wx_lib_include_directories(name []) +# Forwards everything to target_include_directories() except for monolithic +# build where it collects all include paths for linking with the mono lib +macro(wx_lib_include_directories name) + if(wxBUILD_MONOLITHIC) + cmake_parse_arguments(_LIB_INCLUDE_DIRS "" "" "PUBLIC;PRIVATE" ${ARGN}) + list(APPEND wxMONO_INCLUDE_DIRS_PUBLIC ${_LIB_INCLUDE_DIRS_PUBLIC}) + list(APPEND wxMONO_INCLUDE_DIRS_PRIVATE ${_LIB_INCLUDE_DIRS_PRIVATE}) + else() + target_include_directories(${name};${ARGN}) + endif() +endmacro() + +# wx_lib_compile_definitions(name []) +# Forwards everything to target_compile_definitions() except for monolithic +# build where it collects all definitions for linking with the mono lib +macro(wx_lib_compile_definitions name) + if(wxBUILD_MONOLITHIC) + cmake_parse_arguments(_LIB_DEFINITIONS "" "" "PUBLIC;PRIVATE" ${ARGN}) + list(APPEND wxMONO_DEFINITIONS_PUBLIC ${_LIB_DEFINITIONS_PUBLIC}) + list(APPEND wxMONO_DEFINITIONS_PRIVATE ${_LIB_DEFINITIONS_PRIVATE}) + else() + target_compile_definitions(${name};${ARGN}) + endif() +endmacro() + +# Set common properties for a builtin third party library +function(wx_set_builtin_target_properties target_name) + if(wxUSE_UNICODE AND target_name STREQUAL "wxregex") + set(lib_unicode u) + else() + set(lib_unicode) + endif() + if(NOT WIN32) + set(postfix -${wxMAJOR_VERSION}.${wxMINOR_VERSION}) + endif() + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME ${target_name}${lib_unicode}${postfix} + ) + if(WIN32) + set_target_properties(${target_name} + PROPERTIES + OUTPUT_NAME_DEBUG ${target_name}${lib_unicode}d + ) + endif() + if(MSVC) + # we're not interested in deprecation warnings about the use of + # standard C functions in the 3rd party libraries (these warnings + # are only given by VC8+ but it's simpler to just always define + # this symbol which disables them, even for previous VC versions) + target_compile_definitions(${target_name} PRIVATE _CRT_SECURE_NO_WARNINGS) + endif() + + set_target_properties(${target_name} PROPERTIES FOLDER "Third Party Libraries") + + wx_set_common_target_properties(${target_name}) + if(NOT wxBUILD_SHARED) + wx_install(TARGETS ${name} ARCHIVE DESTINATION "lib${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}) + add_library(${name} STATIC ${src_list}) + wx_set_builtin_target_properties(${name}) + if(wxBUILD_SHARED) + set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() +endfunction() + +# List of third party libraries added via wx_add_thirdparty_library() +# to display in configuration summary +set(wxTHIRD_PARTY_LIBRARIES) + +# Add third party library +function(wx_add_thirdparty_library var_name lib_name help_str) + cmake_parse_arguments(THIRDPARTY "" "DEFAULT;DEFAULT_APPLE;DEFAULT_WIN32" "" ${ARGN}) + + if(THIRDPARTY_DEFAULT) + set(thirdparty_lib_default ${THIRDPARTY_DEFAULT}) + elseif(THIRDPARTY_DEFAULT_APPLE AND APPLE) + set(thirdparty_lib_default ${THIRDPARTY_DEFAULT_APPLE}) + elseif(THIRDPARTY_DEFAULT_WIN32 AND WIN32) + set(thirdparty_lib_default ${THIRDPARTY_DEFAULT_WIN32}) + elseif(UNIX AND NOT APPLE) + # Try sys libraries for MSYS and CYGWIN + set(thirdparty_lib_default sys) + elseif(WIN32 OR APPLE) + # On Windows or apple platforms prefer using the builtin libraries + set(thirdparty_lib_default builtin) + else() + set(thirdparty_lib_default sys) + endif() + + 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}) + string(TOUPPER ${lib_name} lib_name_upper) + if(NOT ${${lib_name_upper}_FOUND}) + wx_option_force_value(${var_name} builtin) + endif() + endif() + + if(${var_name} STREQUAL "builtin" AND NOT wxBUILD_SHARED) + # Only install if we build as static libraries + wx_install(TARGETS ${target_name} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + endif() + + set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} ${var_name} "${help_str}" PARENT_SCOPE) +endfunction() + +function(wx_print_thirdparty_library_summary) + set(var_name) + set(message "Which libraries should wxWidgets use?\n") + foreach(entry IN + LISTS wxTHIRD_PARTY_LIBRARIES + ITEMS wxUSE_STL "Use C++ STL classes") + + if(NOT var_name) + set(var_name ${entry}) + else() + wx_string_append(message " ${var_name}: ${${var_name}} (${entry})\n") + set(var_name) + endif() + endforeach() + 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}/ +# Optionally: +# DATA followed by required data files +# 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 +# +# Additinally 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 + "CONSOLE;DLL;IMPORTANT" + "NAME;FOLDER" + "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES" + ${ARGN} + ) + if(NOT SAMPLE_FOLDER AND wxSAMPLE_FOLDER) + set(SAMPLE_FOLDER ${wxSAMPLE_FOLDER}) + endif() + + # Only build important samples without wxBUILD_SAMPLES=ALL + if(NOT SAMPLE_IMPORTANT AND NOT wxBUILD_SAMPLES STREQUAL "ALL") + return() + endif() + foreach(depend ${SAMPLE_DEPENDS}) + if(NOT ${depend}) + return() + endif() + endforeach() + + # Only build GUI samples with wxUSE_GUI=1 + if(NOT wxUSE_GUI AND NOT SAMPLE_CONSOLE) + return() + endif() + + if(SAMPLE_UNPARSED_ARGUMENTS) + wx_list_add_prefix(src_files + "${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/" + ${SAMPLE_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) + endif() + + if(WIN32) + if(SAMPLE_RES) + foreach(res ${SAMPLE_RES}) + list(APPEND src_files ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${res}) + endforeach() + else() + # Include default sample.rc + list(APPEND src_files ${wxSOURCE_DIR}/samples/sample.rc) + 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) + add_library(${target_name} SHARED ${src_files}) + else() + if(SAMPLE_CONSOLE) + set(exe_type) + else() + set(exe_type WIN32 MACOSX_BUNDLE) + endif() + add_executable(${target_name} ${exe_type} ${src_files}) + endif() + # All samples use at least the base library other libraries + # will have to be added with wx_link_sample_libraries() + wx_exe_link_libraries(${target_name} base) + if(NOT SAMPLE_CONSOLE) + # UI samples always require core + wx_exe_link_libraries(${target_name} core) + 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}) + endif() + if(wxBUILD_SHARED) + target_compile_definitions(${target_name} PRIVATE WXUSINGDLL) + endif() + if(SAMPLE_DEFINITIONS) + target_compile_definitions(${target_name} PRIVATE ${SAMPLE_DEFINITIONS}) + endif() + # Disable precompile headers for samples + target_compile_definitions(${target_name} PRIVATE NOPCH) + if(SAMPLE_DATA) + # TODO: handle data files differently for OS X bundles + # Copy data files to output directory + foreach(data_file ${SAMPLE_DATA}) + list(APPEND cmds COMMAND ${CMAKE_COMMAND} + -E copy ${wxSOURCE_DIR}/samples/${wxSAMPLE_SUBDIR}${name}/${data_file} + ${wxOUTPUT_DIR}/${data_file}) + endforeach() + add_custom_command( + TARGET ${target_name} ${cmds} + COMMENT "Copying sample 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(NOT IPHONE) + set_target_properties(${target_name} PROPERTIES + RESOURCE "${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns") + endif() + set_target_properties(${target_name} PROPERTIES + MACOSX_BUNDLE_ICON_FILE wxmac.icns + MACOSX_BUNDLE_LONG_VERSION_STRING "${wxVERSION}" + MACOSX_BUNDLE_SHORT_VERSION_STRING "${wxVERSION}" + MACOSX_BUNDLE_VERSION "${wxVERSION}" + MACOSX_BUNDLE_COPYRIGHT "${wxCOPYRIGHT}" + MACOSX_BUNDLE_GUI_IDENTIFIER "org.wxwidgets.${target_name}" + ) + endif() + + set(folder "Samples") + if(SAMPLE_FOLDER) + wx_string_append(folder "/${SAMPLE_FOLDER}") + endif() + wx_set_common_target_properties(${target_name}) + set_target_properties(${target_name} PROPERTIES + FOLDER ${folder} + ) +endfunction() + +# Link libraries to a sample +function(wx_link_sample_libraries name) + target_link_libraries(${name} ${ARGN}) +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 +function(wx_option name desc) + cmake_parse_arguments(OPTION "" "" "STRINGS" ${ARGN}) + if(ARGC EQUAL 2) + set(default ON) + else() + set(default ${OPTION_UNPARSED_ARGUMENTS}) + endif() + + if(OPTION_STRINGS) + set(cache_type STRING) + else() + set(cache_type BOOL) + endif() + + set(${name} "${default}" CACHE ${cache_type} "${desc}") + string(SUBSTRING ${name} 0 6 prefix) + if(prefix STREQUAL "wxUSE_") + mark_as_advanced(${name}) + endif() + if(OPTION_STRINGS) + set_property(CACHE ${name} PROPERTY STRINGS ${OPTION_STRINGS}) + # Check valid value + set(value_is_valid FALSE) + set(avail_values) + foreach(opt ${OPTION_STRINGS}) + if(${name} STREQUAL opt) + set(value_is_valid TRUE) + break() + endif() + wx_string_append(avail_values " ${opt}") + endforeach() + if(NOT value_is_valid) + message(FATAL_ERROR "Invalid value \"${${name}}\" for option ${name}. Valid values are: ${avail_values}") + endif() + endif() +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) + get_property(type CACHE ${name} PROPERTY TYPE) + set(${name} ${value} CACHE ${type} ${helpstring} FORCE) +endfunction() + +macro(wx_dependent_option option doc default depends force) + if(${option}_ISSET MATCHES "^${option}_ISSET$") + set(${option}_AVAILABLE 1) + foreach(d ${depends}) + string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}") + if(${CMAKE_DEPENDENT_OPTION_DEP}) + else() + set(${option}_AVAILABLE 0) + endif() + endforeach() + if(${option}_AVAILABLE) + wx_option(${option} "${doc}" "${default}") + set(${option} "${${option}}" CACHE BOOL "${doc}" FORCE) + else() + if(${option} MATCHES "^${option}$") + else() + set(${option} "${${option}}" CACHE INTERNAL "${doc}") + endif() + set(${option} ${force}) + endif() + else() + set(${option} "${${option}_ISSET}") + endif() +endmacro() + +# wx_add_test( [src...]) +function(wx_add_test name) + wx_list_add_prefix(test_src "${wxSOURCE_DIR}/tests/" ${ARGN}) + if(wxBUILD_PRECOMP AND MSVC) + # Add dummy source file to be used by cotire for PCH creation + list(INSERT test_src 0 "${wxSOURCE_DIR}/tests/dummy.cpp") + endif() + add_executable(${name} ${test_src}) + target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" ${CPPUNIT_INCLUDE_DIR}) + wx_exe_link_libraries(${name} base net) + target_link_libraries(${name} + ${CPPUNIT_LIBRARIES} + ) + if(wxBUILD_SHARED) + target_compile_definitions(${name} PRIVATE WXUSINGDLL) + endif() + wx_set_common_target_properties(${name}) + set_target_properties(${name} PROPERTIES FOLDER "Tests") + + add_test(NAME ${name} + COMMAND ${name} -t + WORKING_DIRECTORY ${wxSOURCE_DIR}/tests) +endfunction() diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake new file mode 100644 index 0000000000..689cc2c291 --- /dev/null +++ b/build/cmake/init.cmake @@ -0,0 +1,181 @@ +############################################################################# +# Name: build/cmake/init.cmake +# Purpose: Initialize variables based on user selection and system +# information before creating build targets +# Author: Tobias Taschner +# Created: 2016-09-24 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +if(DEFINED wxBUILD_USE_STATIC_RUNTIME AND wxBUILD_USE_STATIC_RUNTIME) + # Set MSVC runtime flags for all configurations + foreach(cfg "" ${CMAKE_CONFIGURATION_TYPES}) + set(flag_var CMAKE_CXX_FLAGS) + if(cfg) + string(TOUPPER ${cfg} cfg_upper) + wx_string_append(flag_var "_${cfg_upper}") + endif() + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif() + endforeach() +endif() + +if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0) + set(WXWIN_COMPATIBILITY_2_8 ON) +endif() +if(wxBUILD_COMPATIBILITY VERSION_LESS 3.1) + set(WXWIN_COMPATIBILITY_3_0 ON) +endif() + +# Build wxBUILD_FILE_ID used for config and setup path +#TODO: build different id for WIN32 +set(wxBUILD_FILE_ID "${wxBUILD_TOOLKIT}${wxBUILD_WIDGETSET}-") +if(wxUSE_UNICODE) + wx_string_append(wxBUILD_FILE_ID "unicode") +else() + wx_string_append(wxBUILD_FILE_ID "ansi") +endif() +if(NOT wxBUILD_SHARED) + wx_string_append(wxBUILD_FILE_ID "-static") +endif() +wx_string_append(wxBUILD_FILE_ID "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") + +set(wxARCH_SUFFIX) + +# TODO: include compiler version in wxCOMPILER_PREFIX ? +if(WIN32) + if(MSVC) + set(wxCOMPILER_PREFIX "vc") + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(wxCOMPILER_PREFIX "gcc") + else() + message(FATAL_ERROR "Unknown WIN32 compiler type") + endif() + + if(CMAKE_CL_64) + set(wxARCH_SUFFIX "_x64") + endif() +else() + set(wxCOMPILER_PREFIX) +endif() + +if(MSVC OR MINGW) + if(wxBUILD_SHARED) + set(lib_suffix "dll") + else() + set(lib_suffix "lib") + endif() + + if(MSVC) + # Include generator expression to supress default Debug/Release pair + set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") + else() + set(wxPLATFORM_LIB_DIR "/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") + endif() +else() + set(wxPLATFORM_LIB_DIR) +endif() + +if(wxBUILD_CUSTOM_SETUP_HEADER_PATH) + if(NOT EXISTS "${wxBUILD_CUSTOM_SETUP_HEADER_PATH}/wx/setup.h") + message(FATAL_ERROR "wxBUILD_CUSTOM_SETUP_HEADER_PATH needs to contain a wx/setup.h file") + endif() + set(wxSETUP_HEADER_PATH ${wxBUILD_CUSTOM_SETUP_HEADER_PATH}) +else() + # Set path where setup.h will be created + if(MSVC OR MINGW) + if(wxUSE_UNICODE) + set(lib_unicode u) + else() + set(lib_unicode) + endif() + set(wxSETUP_HEADER_PATH + ${wxOUTPUT_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}/${wxBUILD_TOOLKIT}${lib_unicode}) + file(MAKE_DIRECTORY ${wxSETUP_HEADER_PATH}/wx) + file(MAKE_DIRECTORY ${wxSETUP_HEADER_PATH}d/wx) + set(wxSETUP_HEADER_FILE_DEBUG ${wxSETUP_HEADER_PATH}d/wx/setup.h) + else() + set(wxSETUP_HEADER_PATH + ${wxOUTPUT_DIR}/wx/include/${wxBUILD_FILE_ID}) + file(MAKE_DIRECTORY ${wxSETUP_HEADER_PATH}/wx) + endif() +endif() +set(wxSETUP_HEADER_FILE ${wxSETUP_HEADER_PATH}/wx/setup.h) + +if(NOT wxBUILD_CUSTOM_SETUP_HEADER_PATH AND MSVC) + # Append configuration specific suffix to setup header path + wx_string_append(wxSETUP_HEADER_PATH "$<$:d>") +endif() + +if(wxUSE_ON_FATAL_EXCEPTION AND MSVC AND (MSVC_VERSION GREATER 1800) ) + # see include/wx/msw/seh.h for more details + add_compile_options("/EHa") +endif() + +# Constants for setup.h creation +set(wxUSE_STD_DEFAULT ON) +if(wxUSE_UNICODE) + set(wxUSE_WCHAR_T ON) +endif() +if(wxUSE_EXPAT) + set(wxUSE_XML ON) +else() + set(wxUSE_XML OFF) +endif() +if(wxUSE_CONFIG) + set(wxUSE_CONFIG_NATIVE ON) +endif() + +if(DEFINED wxUSE_OLE AND wxUSE_OLE) + set(wxUSE_OLE_AUTOMATION ON) + set(wxUSE_ACTIVEX ON) +endif() + +if(wxUSE_THREADS) + find_package(Threads REQUIRED) +endif() + +if(wxUSE_GUI) + # Constants for GUI + set(wxUSE_COMMON_DIALOGS ON) + + if(wxUSE_TASKBARICON) + set(wxUSE_TASKBARICON_BALLOONS ON) + endif() + + if(WIN32 AND wxUSE_METAFILE) + # this one should probably be made separately configurable + set(wxUSE_ENH_METAFILE ON) + endif() + + if(wxUSE_IMAGE) + set(wxUSE_WXDIB ON) + endif() + + if(wxUSE_OPENGL) + find_package(OpenGL) + if(NOT OPENGL_FOUND) + message(WARNING "opengl not found, wxGLCanvas won't be available") + wx_option_force_value(wxUSE_OPENGL OFF) + endif() + endif() + + if(wxUSE_WEBVIEW AND WXGTK) + find_package(LibSoup) + find_package(Webkit) + if(NOT WEBKIT_FOUND OR NOT LIBSOUP_FOUND) + message(WARNING "webkit not found, wxWebview won't be available") + wx_option_force_value(wxUSE_WEBVIEW OFF) + endif() + endif() + + if(wxUSE_MEDIACTRL AND UNIX AND NOT APPLE AND NOT WIN32) + find_package(GStreamer) + if(NOT GSTREAMER_FOUND) + message(WARNING "GStreamer not found, wxMediaCtrl won't be available") + wx_option_force_value(wxUSE_MEDIACTRL OFF) + endif() + endif() +endif() diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake new file mode 100644 index 0000000000..3e038c8fcf --- /dev/null +++ b/build/cmake/install.cmake @@ -0,0 +1,49 @@ +############################################################################# +# Name: build/cmake/install.cmake +# Purpose: Install target CMake file +# Author: Tobias Taschner +# Created: 2016-10-17 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +if(NOT wxBUILD_INSTALL) + return() +endif() + +install(CODE "message(STATUS \"Installing: Headers...\")") +wx_install( + DIRECTORY "${wxSOURCE_DIR}/include/wx" + DESTINATION "include") +if(MSVC) + wx_install( + DIRECTORY "${wxSOURCE_DIR}/include/msvc" + DESTINATION "include") +endif() +if(MSVC OR MINGW) + wx_install( + DIRECTORY "${wxSETUP_HEADER_PATH}" + DESTINATION "lib${wxPLATFORM_LIB_DIR}") +endif() + +# uninstall target +if(MSVC_IDE) + set(UNINST_NAME UNINSTALL) +else() + set(UNINST_NAME uninstall) +endif() + +if(NOT TARGET ${UNINST_NAME}) + configure_file( + "${wxSOURCE_DIR}/build/cmake/uninstall.cmake.in" + "${wxBINARY_DIR}/uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(${UNINST_NAME} + COMMAND ${CMAKE_COMMAND} -P ${wxBINARY_DIR}/uninstall.cmake) + get_property(PREDEF_FOLDER GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER) + if(NOT PREDEF_FOLDER) + set(PREDEF_FOLDER "CMakePredefinedTargets") + endif() + set_target_properties(${UNINST_NAME} PROPERTIES FOLDER "${PREDEF_FOLDER}") +endif() diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt new file mode 100644 index 0000000000..a676510ad7 --- /dev/null +++ b/build/cmake/lib/CMakeLists.txt @@ -0,0 +1,94 @@ +############################################################################# +# Name: build/cmake/lib/CMakeLists.txt +# Purpose: Main lib CMake file +# Author: Tobias Taschner +# Created: 2016-10-14 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../source_groups.cmake) + +set(wxLIB_TARGETS) +if(wxBUILD_MONOLITHIC) + # Initialize variables for monolithic build + set(wxMONO_SRC_FILES) + set(wxMONO_LIBS_PRIVATE) + set(wxMONO_LIBS_PUBLIC) + set(wxMONO_INCLUDE_DIRS_PRIVATE) + set(wxMONO_INCLUDE_DIRS_PUBLIC) +endif() + +# Define third party libraries +set(LIBS_THIRDPARTY regex zlib) +if(wxUSE_GUI) + list(APPEND LIBS_THIRDPARTY jpeg png tiff) +endif() +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) +add_opt_lib(xml wxUSE_XML) + +# Define UI libraries +if(wxUSE_GUI) + list(APPEND LIBS core adv) + foreach(lib + aui + html + propgrid + ribbon + richtext + webview + stc + 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 cmake file for every library +foreach(LIB ${LIBS}) + add_subdirectory(${LIB}) +endforeach() + +if(wxBUILD_MONOLITHIC) + # Create monolithic library target + list(LENGTH wxMONO_SRC_FILES src_file_count) + wx_add_library(mono ${wxMONO_SRC_FILES}) + foreach(vis PRIVATE PUBLIC) + if(wxMONO_LIBS_${vis}) + # Remove libs included in mono from list + foreach(lib IN LISTS LIBS) + list(REMOVE_ITEM wxMONO_LIBS_${vis} ${lib}) + endforeach() + + target_link_libraries(mono ${vis} ${wxMONO_LIBS_${vis}}) + endif() + if(wxMONO_INCLUDE_DIRS_${vis}) + target_include_directories(mono ${vis} ${wxMONO_INCLUDE_DIRS_${vis}}) + endif() + if(wxMONO_DEFINITIONS_${vis}) + target_compile_definitions(mono ${vis} ${wxMONO_DEFINITIONS_${vis}}) + endif() + endforeach() +endif() + +# Propagate variable(s) to parent scope +set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE) +set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} PARENT_SCOPE) diff --git a/build/cmake/lib/adv/CMakeLists.txt b/build/cmake/lib/adv/CMakeLists.txt new file mode 100644 index 0000000000..9db332822c --- /dev/null +++ b/build/cmake/lib/adv/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################# +# Name: build/cmake/lib/adv/CMakeLists.txt +# Purpose: CMake file for adv library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(ADV_FILES ADVANCED_CMN) + +if(WXMSW) + wx_append_sources(ADV_FILES ADVANCED_MSW) + wx_append_sources(ADV_FILES ADVANCED_MSW_NATIVE) + wx_append_sources(ADV_FILES ADVANCED_MSW_DESKTOP) +elseif(WXOSX_COCOA) + wx_append_sources(ADV_FILES ADVANCED_OSX_COCOA) +elseif(WXGTK) + wx_append_sources(ADV_FILES ADVANCED_GTK2) + wx_append_sources(ADV_FILES ADVANCED_GTK_NATIVE) +endif() + +if(UNIX AND NOT APPLE AND NOT WIN32) + wx_append_sources(ADV_FILES ADVANCED_UNIX) +endif() + +wx_add_library(adv ${ADV_FILES}) +if(WIN32) + wx_lib_link_libraries(adv PRIVATE + winmm + ) +endif() +if(WXOSX_COCOA) + wx_lib_link_libraries(adv PUBLIC + "-framework AudioToolbox" + ) +endif() + +wx_finalize_lib(adv) diff --git a/build/cmake/lib/aui/CMakeLists.txt b/build/cmake/lib/aui/CMakeLists.txt new file mode 100644 index 0000000000..ba369af670 --- /dev/null +++ b/build/cmake/lib/aui/CMakeLists.txt @@ -0,0 +1,22 @@ +############################################################################# +# Name: build/cmake/lib/aui/CMakeLists.txt +# Purpose: CMake file for aui library +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(AUI_FILES AUI_CMN) + +if(WXMSW) + wx_append_sources(AUI_FILES AUI_MSW) +elseif(WXGTK) + wx_append_sources(AUI_FILES AUI_GTK) +endif() + +wx_add_library(aui ${AUI_FILES}) + +wx_finalize_lib(aui) diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt new file mode 100644 index 0000000000..1871c54bde --- /dev/null +++ b/build/cmake/lib/base/CMakeLists.txt @@ -0,0 +1,92 @@ +############################################################################# +# Name: build/cmake/lib/base/CMakeLists.txt +# Purpose: CMake file for base library +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(BASE_FILES BASE_CMN) +wx_append_sources(BASE_FILES BASE_AND_GUI_CMN) + +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(wxBUILD_TOOLKIT MATCHES "osx_iphone") + wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_IPHONE) + else() + wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA) + endif() +elseif(UNIX) + wx_append_sources(BASE_FILES BASE_UNIX) + if(wxUSE_SECRETSTORE) + # The required APIs are always available under MSW and OS X but we must + # have GNOME libsecret under Unix to be able to compile this class. + find_package(Libsecret REQUIRED) + if(NOT LIBSECRET_FOUND) + message(WARNING "libsecret not found, wxSecretStore won't be available") + wx_option_force_value(wxUSE_SECRETSTORE OFF) + endif() + endif() +endif() + +wx_add_library(base IS_BASE ${BASE_FILES}) +wx_lib_link_libraries(base PRIVATE + ${ZLIB_LIBRARIES} + ${REGEX_LIBRARIES} +) +if(NOT wxBUILD_MONOLITHIC) + wx_lib_compile_definitions(base PRIVATE wxUSE_BASE=1) +endif() +if(wxUSE_ZLIB) + wx_lib_include_directories(base PRIVATE ${ZLIB_INCLUDE_DIRS}) +endif() +if(wxUSE_REGEX) + wx_lib_include_directories(base PRIVATE ${REGEX_INCLUDE_DIRS}) +endif() +if(LIBSECRET_FOUND) + wx_lib_include_directories(base PRIVATE ${LIBSECRET_INCLUDE_DIRS}) +endif() +if(wxUSE_LIBICONV AND ICONV_LIBRARIES) + wx_lib_link_libraries(base PRIVATE ${ICONV_LIBRARIES}) +endif() +if(wxUSE_THREADS AND CMAKE_THREAD_LIBS_INIT) + wx_lib_link_libraries(base PRIVATE ${CMAKE_THREAD_LIBS_INIT}) +endif() +if(WIN32) + wx_lib_link_libraries(base PUBLIC + kernel32 + user32 + shell32 + ole32 + oleaut32 + uuid + rpcrt4 + advapi32 + Shlwapi + version + uuid + ) +elseif(APPLE) + wx_lib_link_libraries(base + PRIVATE + "-framework Security" + PUBLIC + "-framework Carbon" + "-framework Cocoa" + "-framework CoreFoundation" + "-framework IOKit" + ) +elseif(UNIX) + wx_lib_link_libraries(base PRIVATE + dl + ${LIBSECRET_LIBRARIES} + ) +endif() + +wx_finalize_lib(base) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt new file mode 100644 index 0000000000..1c5714ca27 --- /dev/null +++ b/build/cmake/lib/core/CMakeLists.txt @@ -0,0 +1,52 @@ +############################################################################# +# Name: build/cmake/lib/core/CMakeLists.txt +# Purpose: CMake file for core library +# Author: Tobias Taschner +# Created: 2016-10-01 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_option(wxUSE_IMAGE "use wxImage class" ON) + +wx_append_sources(CORE_SRC GUI_CMN) +wx_append_sources(CORE_SRC BASE_AND_GUI_CMN) +if(WIN32) + wx_append_sources(CORE_SRC BASE_AND_GUI_WIN32) +elseif(UNIX) + wx_append_sources(CORE_SRC UNIX) +endif() + +if(WXMSW) + wx_append_sources(CORE_SRC MSW_LOWLEVEL) + wx_append_sources(CORE_SRC MSW_DESKTOP_LOWLEVEL) + wx_append_sources(CORE_SRC MSW) + wx_append_sources(CORE_SRC MSW_DESKTOP) +elseif(WXGTK) + wx_append_sources(CORE_SRC GTK2_LOWLEVEL) + wx_append_sources(CORE_SRC GTK2) + + wx_append_sources(CORE_SRC XWIN_LOWLEVEL) +elseif(WXOSX_COCOA) + wx_append_sources(CORE_SRC BASE_AND_GUI_OSX_COCOA) + wx_append_sources(CORE_SRC OSX_LOWLEVEL) + wx_append_sources(CORE_SRC OSX_SHARED) + wx_append_sources(CORE_SRC OSX_COCOA) +endif() + +wx_add_library(core ${CORE_SRC}) +foreach(lib JPEG PNG TIFF) + if(${lib}_LIBRARIES) + if(lib STREQUAL JPEG) + wx_lib_include_directories(core PRIVATE ${${lib}_INCLUDE_DIR}) + else() + wx_lib_include_directories(core PRIVATE ${${lib}_INCLUDE_DIRS}) + endif() + + wx_lib_link_libraries(core PRIVATE ${${lib}_LIBRARIES}) + endif() +endforeach() + +wx_finalize_lib(core) diff --git a/build/cmake/lib/gl/CMakeLists.txt b/build/cmake/lib/gl/CMakeLists.txt new file mode 100644 index 0000000000..4b656a8217 --- /dev/null +++ b/build/cmake/lib/gl/CMakeLists.txt @@ -0,0 +1,24 @@ +############################################################################# +# Name: build/cmake/lib/gl/CMakeLists.txt +# Purpose: CMake file for gl library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(GL_FILES OPENGL_CMN) + +if(WIN32) + wx_append_sources(GL_FILES OPENGL_MSW) +elseif(APPLE) + wx_append_sources(GL_FILES OPENGL_OSX_SHARED) +endif() + +wx_add_library(gl ${GL_FILES}) +wx_lib_include_directories(gl PUBLIC ${OPENGL_INCLUDE_DIR}) +wx_lib_link_libraries(gl PUBLIC ${OPENGL_LIBRARIES}) + +wx_finalize_lib(gl) diff --git a/build/cmake/lib/html/CMakeLists.txt b/build/cmake/lib/html/CMakeLists.txt new file mode 100644 index 0000000000..b9dbd5a553 --- /dev/null +++ b/build/cmake/lib/html/CMakeLists.txt @@ -0,0 +1,20 @@ +############################################################################# +# Name: build/cmake/lib/html/CMakeLists.txt +# Purpose: CMake file for html library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(HTML_FILES HTML_CMN) + +if(WIN32) + wx_append_sources(HTML_FILES HTML_MSW) +endif() + +wx_add_library(html ${HTML_FILES}) + +wx_finalize_lib(html) diff --git a/build/cmake/lib/jpeg.cmake b/build/cmake/lib/jpeg.cmake new file mode 100644 index 0000000000..2c732282f1 --- /dev/null +++ b/build/cmake/lib/jpeg.cmake @@ -0,0 +1,69 @@ +############################################################################# +# Name: build/cmake/lib/jpeg.cmake +# Purpose: Use external or internal libjpeg +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_LIBJPEG JPEG "use libjpeg (JPEG file format)") + +if(wxUSE_LIBJPEG STREQUAL "builtin") + wx_add_builtin_library(wxjpeg + src/jpeg/jcomapi.c + src/jpeg/jutils.c + src/jpeg/jerror.c + src/jpeg/jmemmgr.c + src/jpeg/jmemnobs.c + src/jpeg/jcapimin.c + src/jpeg/jcapistd.c + src/jpeg/jctrans.c + src/jpeg/jcparam.c + src/jpeg/jdatadst.c + src/jpeg/jcinit.c + src/jpeg/jcmaster.c + src/jpeg/jcmarker.c + src/jpeg/jcmainct.c + src/jpeg/jcprepct.c + src/jpeg/jccoefct.c + src/jpeg/jccolor.c + src/jpeg/jcsample.c + src/jpeg/jchuff.c + src/jpeg/jcphuff.c + src/jpeg/jcdctmgr.c + src/jpeg/jfdctfst.c + src/jpeg/jfdctflt.c + src/jpeg/jfdctint.c + src/jpeg/jdapimin.c + src/jpeg/jdapistd.c + src/jpeg/jdtrans.c + src/jpeg/jdatasrc.c + src/jpeg/jdmaster.c + src/jpeg/jdinput.c + src/jpeg/jdmarker.c + src/jpeg/jdhuff.c + src/jpeg/jdphuff.c + src/jpeg/jdmainct.c + src/jpeg/jdcoefct.c + src/jpeg/jdpostct.c + src/jpeg/jddctmgr.c + src/jpeg/jidctfst.c + src/jpeg/jidctflt.c + src/jpeg/jidctint.c + src/jpeg/jidctred.c + src/jpeg/jdsample.c + src/jpeg/jdcolor.c + src/jpeg/jquant1.c + src/jpeg/jquant2.c + src/jpeg/jdmerge.c + ) + target_include_directories(wxjpeg + BEFORE PRIVATE + ${wxSETUP_HEADER_PATH} + ) + 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 new file mode 100644 index 0000000000..5c536daa1a --- /dev/null +++ b/build/cmake/lib/media/CMakeLists.txt @@ -0,0 +1,36 @@ +############################################################################# +# Name: build/cmake/lib/media/CMakeLists.txt +# Purpose: CMake file for media library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(MEDIA_FILES MEDIA_CMN) + +if(WXMSW) + wx_append_sources(MEDIA_FILES MEDIA_MSW) +elseif(WXOSX_COCOA) + wx_append_sources(MEDIA_FILES MEDIA_OSX_COCOA) +elseif(UNIX) + wx_append_sources(MEDIA_FILES MEDIA_UNIX) +endif() + +wx_add_library(media ${MEDIA_FILES}) +if(WXOSX_COCOA) + # TODO: add version detection of some kind and/or wx_option + wx_lib_compile_definitions(media PRIVATE -DwxOSX_USE_QTKIT=0) + wx_lib_link_libraries(media PUBLIC + "-framework AVFoundation" + "-framework AVKit" + "-framework CoreMedia" + ) +elseif(UNIX) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_INCLUDE_DIRS}) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_LIBRARIES}) +endif() + +wx_finalize_lib(media) diff --git a/build/cmake/lib/net/CMakeLists.txt b/build/cmake/lib/net/CMakeLists.txt new file mode 100644 index 0000000000..077148bae5 --- /dev/null +++ b/build/cmake/lib/net/CMakeLists.txt @@ -0,0 +1,30 @@ +############################################################################# +# Name: build/cmake/lib/net/CMakeLists.txt +# Purpose: CMake file for net library +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(NET_FILES NET_CMN) + +if(WIN32) + wx_append_sources(NET_FILES NET_WIN32) +elseif(APPLE) + wx_append_sources(NET_FILES NET_OSX) +endif() + +if(UNIX AND NOT WIN32) + wx_append_sources(NET_FILES NET_UNIX) +endif() + +wx_add_library(net IS_BASE ${NET_FILES}) + +if(WIN32) + wx_lib_link_libraries(net PRIVATE Ws2_32) +endif() + +wx_finalize_lib(net) diff --git a/build/cmake/lib/png.cmake b/build/cmake/lib/png.cmake new file mode 100644 index 0000000000..d0fe5b854a --- /dev/null +++ b/build/cmake/lib/png.cmake @@ -0,0 +1,43 @@ +############################################################################# +# Name: build/cmake/lib/png.cmake +# Purpose: Use external or internal libpng +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)") + +if(wxUSE_LIBPNG STREQUAL "builtin") + wx_add_builtin_library(wxpng + src/png/png.c + src/png/pngerror.c + src/png/pngget.c + src/png/pngmem.c + src/png/pngpread.c + src/png/pngread.c + src/png/pngrio.c + src/png/pngrtran.c + src/png/pngrutil.c + src/png/pngset.c + src/png/pngtrans.c + src/png/pngwio.c + src/png/pngwrite.c + src/png/pngwtran.c + src/png/pngwutil.c + ) + if(WIN32) + # define this to get rid of a warning about using POSIX lfind(): + # confusingly enough, we do define lfind as _lfind for MSVC but + # doing this results in a just more confusing warning, see: + # http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101278 + target_compile_definitions(wxpng PRIVATE _CRT_NONSTDC_NO_WARNINGS) + endif() + target_include_directories(wxpng PRIVATE ${ZLIB_INCLUDE_DIRS}) + 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 new file mode 100644 index 0000000000..9b033683cc --- /dev/null +++ b/build/cmake/lib/propgrid/CMakeLists.txt @@ -0,0 +1,17 @@ +############################################################################# +# Name: build/cmake/lib/propgrid/CMakeLists.txt +# Purpose: CMake file for propgrid library +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(PROPGRID_FILES PROPGRID) + +wx_add_library(propgrid ${PROPGRID_FILES}) +wx_lib_link_libraries(propgrid PRIVATE adv) + +wx_finalize_lib(propgrid) diff --git a/build/cmake/lib/qa/CMakeLists.txt b/build/cmake/lib/qa/CMakeLists.txt new file mode 100644 index 0000000000..8a0674c9a3 --- /dev/null +++ b/build/cmake/lib/qa/CMakeLists.txt @@ -0,0 +1,17 @@ +############################################################################# +# Name: build/cmake/lib/qa/CMakeLists.txt +# Purpose: CMake file for qa library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(QA_FILES QA) + +wx_add_library(qa ${QA_FILES}) +wx_lib_link_libraries(qa PUBLIC xml) + +wx_finalize_lib(qa) diff --git a/build/cmake/lib/regex.cmake b/build/cmake/lib/regex.cmake new file mode 100644 index 0000000000..e2bc97c546 --- /dev/null +++ b/build/cmake/lib/regex.cmake @@ -0,0 +1,26 @@ +############################################################################# +# Name: build/cmake/lib/regex.cmake +# Purpose: Use external or internal regex lib +# Author: Tobias Taschner +# Created: 2016-09-25 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_REGEX REGEX "enable support for wxRegEx class" DEFAULT builtin) + +if(wxUSE_REGEX) + # TODO: Forcing builtin until sys is implemented + set(wxUSE_REGEX builtin) + wx_add_builtin_library(wxregex + src/regex/regcomp.c + src/regex/regexec.c + src/regex/regerror.c + src/regex/regfree.c + ) + target_include_directories(wxregex PRIVATE ${wxSETUP_HEADER_PATH} ${wxSOURCE_DIR}/include) + set(REGEX_LIBRARIES wxregex) + set(REGEX_INCLUDE_DIRS ${wxSOURCE_DIR}/src/regex) +endif() + +#TODO: find external lib and include dir diff --git a/build/cmake/lib/ribbon/CMakeLists.txt b/build/cmake/lib/ribbon/CMakeLists.txt new file mode 100644 index 0000000000..756fdbacc6 --- /dev/null +++ b/build/cmake/lib/ribbon/CMakeLists.txt @@ -0,0 +1,16 @@ +############################################################################# +# Name: build/cmake/lib/ribbon/CMakeLists.txt +# Purpose: CMake file for ribbon library +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(RIBBON_FILES RIBBON) + +wx_add_library(ribbon ${RIBBON_FILES}) + +wx_finalize_lib(ribbon) diff --git a/build/cmake/lib/richtext/CMakeLists.txt b/build/cmake/lib/richtext/CMakeLists.txt new file mode 100644 index 0000000000..8a7b01bae8 --- /dev/null +++ b/build/cmake/lib/richtext/CMakeLists.txt @@ -0,0 +1,17 @@ +############################################################################# +# Name: build/cmake/lib/richtext/CMakeLists.txt +# Purpose: CMake file for richtext library +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(RICHTEXT_FILES RICHTEXT) + +wx_add_library(richtext ${RICHTEXT_FILES}) +wx_lib_link_libraries(richtext PRIVATE adv html xml) + +wx_finalize_lib(richtext) diff --git a/build/cmake/lib/stc/CMakeLists.txt b/build/cmake/lib/stc/CMakeLists.txt new file mode 100644 index 0000000000..a1b236453b --- /dev/null +++ b/build/cmake/lib/stc/CMakeLists.txt @@ -0,0 +1,180 @@ +############################################################################# +# Name: build/cmake/lib/stc/CMakeLists.txt +# Purpose: CMake file for stc library +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(STC_FILES STC) + +wx_add_builtin_library(wxscintilla + src/stc/scintilla/lexers/LexA68k.cxx + src/stc/scintilla/lexers/LexAbaqus.cxx + src/stc/scintilla/lexers/LexAda.cxx + src/stc/scintilla/lexers/LexAPDL.cxx + src/stc/scintilla/lexers/LexAsm.cxx + src/stc/scintilla/lexers/LexAsn1.cxx + src/stc/scintilla/lexers/LexASY.cxx + src/stc/scintilla/lexers/LexAU3.cxx + src/stc/scintilla/lexers/LexAVE.cxx + src/stc/scintilla/lexers/LexAVS.cxx + src/stc/scintilla/lexers/LexBaan.cxx + src/stc/scintilla/lexers/LexBash.cxx + src/stc/scintilla/lexers/LexBasic.cxx + src/stc/scintilla/lexers/LexBatch.cxx + src/stc/scintilla/lexers/LexBibTeX.cxx + src/stc/scintilla/lexers/LexBullant.cxx + src/stc/scintilla/lexers/LexCaml.cxx + src/stc/scintilla/lexers/LexCLW.cxx + src/stc/scintilla/lexers/LexCmake.cxx + src/stc/scintilla/lexers/LexCOBOL.cxx + src/stc/scintilla/lexers/LexCoffeeScript.cxx + src/stc/scintilla/lexers/LexConf.cxx + src/stc/scintilla/lexers/LexCPP.cxx + src/stc/scintilla/lexers/LexCrontab.cxx + src/stc/scintilla/lexers/LexCsound.cxx + src/stc/scintilla/lexers/LexCSS.cxx + src/stc/scintilla/lexers/LexD.cxx + src/stc/scintilla/lexers/LexDiff.cxx + src/stc/scintilla/lexers/LexDMAP.cxx + src/stc/scintilla/lexers/LexDMIS.cxx + src/stc/scintilla/lexers/LexECL.cxx + src/stc/scintilla/lexers/LexEiffel.cxx + src/stc/scintilla/lexers/LexErlang.cxx + src/stc/scintilla/lexers/LexErrorList.cxx + src/stc/scintilla/lexers/LexEScript.cxx + src/stc/scintilla/lexers/LexFlagship.cxx + src/stc/scintilla/lexers/LexForth.cxx + src/stc/scintilla/lexers/LexFortran.cxx + src/stc/scintilla/lexers/LexGAP.cxx + src/stc/scintilla/lexers/LexGui4Cli.cxx + src/stc/scintilla/lexers/LexHaskell.cxx + src/stc/scintilla/lexers/LexHex.cxx + src/stc/scintilla/lexers/LexHTML.cxx + src/stc/scintilla/lexers/LexInno.cxx + src/stc/scintilla/lexers/LexJSON.cxx + src/stc/scintilla/lexers/LexKix.cxx + src/stc/scintilla/lexers/LexKVIrc.cxx + src/stc/scintilla/lexers/LexLaTeX.cxx + src/stc/scintilla/lexers/LexLisp.cxx + src/stc/scintilla/lexers/LexLout.cxx + src/stc/scintilla/lexers/LexLua.cxx + src/stc/scintilla/lexers/LexMagik.cxx + src/stc/scintilla/lexers/LexMake.cxx + src/stc/scintilla/lexers/LexMarkdown.cxx + src/stc/scintilla/lexers/LexMatlab.cxx + src/stc/scintilla/lexers/LexMetapost.cxx + src/stc/scintilla/lexers/LexMMIXAL.cxx + src/stc/scintilla/lexers/LexModula.cxx + src/stc/scintilla/lexers/LexMPT.cxx + src/stc/scintilla/lexers/LexMSSQL.cxx + src/stc/scintilla/lexers/LexMySQL.cxx + src/stc/scintilla/lexers/LexNimrod.cxx + src/stc/scintilla/lexers/LexNsis.cxx + src/stc/scintilla/lexers/LexNull.cxx + src/stc/scintilla/lexers/LexOpal.cxx + src/stc/scintilla/lexers/LexOScript.cxx + src/stc/scintilla/lexers/LexPascal.cxx + src/stc/scintilla/lexers/LexPB.cxx + src/stc/scintilla/lexers/LexPerl.cxx + src/stc/scintilla/lexers/LexPLM.cxx + src/stc/scintilla/lexers/LexPO.cxx + src/stc/scintilla/lexers/LexPOV.cxx + src/stc/scintilla/lexers/LexPowerPro.cxx + src/stc/scintilla/lexers/LexPowerShell.cxx + src/stc/scintilla/lexers/LexProgress.cxx + src/stc/scintilla/lexers/LexProps.cxx + src/stc/scintilla/lexers/LexPS.cxx + src/stc/scintilla/lexers/LexPython.cxx + src/stc/scintilla/lexers/LexR.cxx + src/stc/scintilla/lexers/LexRebol.cxx + src/stc/scintilla/lexers/LexRegistry.cxx + src/stc/scintilla/lexers/LexRuby.cxx + src/stc/scintilla/lexers/LexRust.cxx + src/stc/scintilla/lexers/LexScriptol.cxx + src/stc/scintilla/lexers/LexSmalltalk.cxx + src/stc/scintilla/lexers/LexSML.cxx + src/stc/scintilla/lexers/LexSorcus.cxx + src/stc/scintilla/lexers/LexSpecman.cxx + src/stc/scintilla/lexers/LexSpice.cxx + src/stc/scintilla/lexers/LexSQL.cxx + src/stc/scintilla/lexers/LexSTTXT.cxx + src/stc/scintilla/lexers/LexTACL.cxx + src/stc/scintilla/lexers/LexTADS3.cxx + src/stc/scintilla/lexers/LexTAL.cxx + src/stc/scintilla/lexers/LexTCL.cxx + src/stc/scintilla/lexers/LexTCMD.cxx + src/stc/scintilla/lexers/LexTeX.cxx + src/stc/scintilla/lexers/LexTxt2tags.cxx + src/stc/scintilla/lexers/LexVB.cxx + src/stc/scintilla/lexers/LexVerilog.cxx + src/stc/scintilla/lexers/LexVHDL.cxx + src/stc/scintilla/lexers/LexVisualProlog.cxx + src/stc/scintilla/lexers/LexYAML.cxx + src/stc/scintilla/lexlib/Accessor.cxx + src/stc/scintilla/lexlib/CharacterCategory.cxx + src/stc/scintilla/lexlib/CharacterSet.cxx + src/stc/scintilla/lexlib/LexerBase.cxx + src/stc/scintilla/lexlib/LexerModule.cxx + src/stc/scintilla/lexlib/LexerNoExceptions.cxx + src/stc/scintilla/lexlib/LexerSimple.cxx + src/stc/scintilla/lexlib/PropSetSimple.cxx + src/stc/scintilla/lexlib/StyleContext.cxx + src/stc/scintilla/lexlib/WordList.cxx + src/stc/scintilla/src/AutoComplete.cxx + src/stc/scintilla/src/CallTip.cxx + src/stc/scintilla/src/CaseConvert.cxx + src/stc/scintilla/src/CaseFolder.cxx + src/stc/scintilla/src/Catalogue.cxx + src/stc/scintilla/src/CellBuffer.cxx + src/stc/scintilla/src/CharClassify.cxx + src/stc/scintilla/src/ContractionState.cxx + src/stc/scintilla/src/Decoration.cxx + src/stc/scintilla/src/Document.cxx + src/stc/scintilla/src/EditModel.cxx + src/stc/scintilla/src/EditView.cxx + src/stc/scintilla/src/Editor.cxx + src/stc/scintilla/src/ExternalLexer.cxx + src/stc/scintilla/src/Indicator.cxx + src/stc/scintilla/src/KeyMap.cxx + src/stc/scintilla/src/LineMarker.cxx + src/stc/scintilla/src/MarginView.cxx + src/stc/scintilla/src/PerLine.cxx + src/stc/scintilla/src/PositionCache.cxx + src/stc/scintilla/src/RESearch.cxx + src/stc/scintilla/src/RunStyles.cxx + src/stc/scintilla/src/ScintillaBase.cxx + src/stc/scintilla/src/Selection.cxx + src/stc/scintilla/src/Style.cxx + src/stc/scintilla/src/UniConversion.cxx + src/stc/scintilla/src/ViewStyle.cxx + src/stc/scintilla/src/XPM.cxx +) +target_include_directories(wxscintilla PRIVATE + ${wxSOURCE_DIR}/src/stc/scintilla/include + ${wxSOURCE_DIR}/src/stc/scintilla/lexlib + ${wxSOURCE_DIR}/src/stc/scintilla/src + ) +target_compile_definitions(wxscintilla PUBLIC + NO_CXX11_REGEX + __WX__ +) +wx_target_enable_precomp(wxscintilla) + +wx_add_library(stc ${STC_FILES}) +wx_lib_include_directories(stc PRIVATE + ${wxSOURCE_DIR}/src/stc/scintilla/include + ${wxSOURCE_DIR}/src/stc/scintilla/lexlib + ${wxSOURCE_DIR}/src/stc/scintilla/src + ) +wx_lib_compile_definitions(stc PRIVATE + SCI_LEXER + LINK_LEXERS +) +wx_lib_link_libraries(stc PRIVATE wxscintilla) + +wx_finalize_lib(stc) diff --git a/build/cmake/lib/tiff.cmake b/build/cmake/lib/tiff.cmake new file mode 100644 index 0000000000..3cd5a664ac --- /dev/null +++ b/build/cmake/lib/tiff.cmake @@ -0,0 +1,84 @@ +############################################################################# +# Name: build/cmake/lib/tiff.cmake +# Purpose: Use external or internal libtiff +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)") + +if(wxUSE_LIBTIFF STREQUAL "builtin") + # TODO: implement building libtiff via ExternalProject_Add() + if(UNIX AND NOT APPLE) + message(WARNING "Builtin libtiff on unix is currently not supported") + wx_option_force_value(wxUSE_LIBTIFF OFF) + return() + endif() + + if(WIN32) + set(TIFF_PLATFORM_SRC src/tiff/libtiff/tif_win32.c) + elseif(UNIX) + set(TIFF_PLATFORM_SRC src/tiff/libtiff/tif_unix.c) + endif() + + wx_add_builtin_library(wxtiff + ${TIFF_PLATFORM_SRC} + src/tiff/libtiff/tif_aux.c + src/tiff/libtiff/tif_close.c + src/tiff/libtiff/tif_codec.c + src/tiff/libtiff/tif_color.c + src/tiff/libtiff/tif_compress.c + src/tiff/libtiff/tif_dir.c + src/tiff/libtiff/tif_dirinfo.c + src/tiff/libtiff/tif_dirread.c + src/tiff/libtiff/tif_dirwrite.c + src/tiff/libtiff/tif_dumpmode.c + src/tiff/libtiff/tif_error.c + src/tiff/libtiff/tif_extension.c + src/tiff/libtiff/tif_fax3.c + src/tiff/libtiff/tif_fax3sm.c + src/tiff/libtiff/tif_flush.c + src/tiff/libtiff/tif_getimage.c + src/tiff/libtiff/tif_jbig.c + src/tiff/libtiff/tif_jpeg.c + src/tiff/libtiff/tif_jpeg_12.c + src/tiff/libtiff/tif_luv.c + src/tiff/libtiff/tif_lzma.c + src/tiff/libtiff/tif_lzw.c + src/tiff/libtiff/tif_next.c + src/tiff/libtiff/tif_ojpeg.c + src/tiff/libtiff/tif_open.c + src/tiff/libtiff/tif_packbits.c + src/tiff/libtiff/tif_pixarlog.c + src/tiff/libtiff/tif_predict.c + src/tiff/libtiff/tif_print.c + src/tiff/libtiff/tif_read.c + src/tiff/libtiff/tif_strip.c + src/tiff/libtiff/tif_swab.c + src/tiff/libtiff/tif_thunder.c + src/tiff/libtiff/tif_tile.c + src/tiff/libtiff/tif_version.c + src/tiff/libtiff/tif_warning.c + src/tiff/libtiff/tif_write.c + src/tiff/libtiff/tif_zip.c + ) + if(WIN32) + # define this to get rid of a warning about using POSIX lfind(): + # confusingly enough, we do define lfind as _lfind for MSVC but + # doing this results in a just more confusing warning, see: + # http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101278 + target_compile_definitions(wxtiff PRIVATE _CRT_NONSTDC_NO_WARNINGS) + endif() + target_include_directories(wxtiff PRIVATE + ${wxSOURCE_DIR}/src/tiff/libtiff + ${ZLIB_INCLUDE_DIRS} + ${JPEG_INCLUDE_DIR} + ) + 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 new file mode 100644 index 0000000000..317bb1be62 --- /dev/null +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -0,0 +1,38 @@ +############################################################################# +# Name: build/cmake/lib/webview/CMakeLists.txt +# Purpose: CMake file for webview library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(WEBVIEW_FILES WEBVIEW_CMN) + +if(WXMSW) + wx_append_sources(WEBVIEW_FILES WEBVIEW_MSW) +elseif(WXGTK) + wx_append_sources(WEBVIEW_FILES WEBVIEW_GTK) +elseif(APPLE) + wx_append_sources(WEBVIEW_FILES WEBVIEW_OSX_SHARED) +endif() + +wx_add_library(webview ${WEBVIEW_FILES}) +if(APPLE) + wx_lib_link_libraries(webview PUBLIC + "-framework WebKit" + ) +elseif(WXGTK) + wx_lib_include_directories(webview PUBLIC + ${WEBKIT_INCLUDE_DIR} + ${LIBSOUP_INCLUDE_DIRS} + ) + wx_lib_link_libraries(webview PUBLIC + ${WEBKIT_LIBRARIES} + ${LIBSOUP_LIBRARIES} + ) +endif() + +wx_finalize_lib(webview) diff --git a/build/cmake/lib/xml/CMakeLists.txt b/build/cmake/lib/xml/CMakeLists.txt new file mode 100644 index 0000000000..f39d24e393 --- /dev/null +++ b/build/cmake/lib/xml/CMakeLists.txt @@ -0,0 +1,57 @@ +############################################################################# +# Name: build/cmake/lib/xml/CMakeLists.txt +# Purpose: CMake file for xml library +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +if(wxUSE_EXPAT STREQUAL "builtin") + ExternalProject_Add(wxexpat + DOWNLOAD_COMMAND "" + SOURCE_DIR ${wxSOURCE_DIR}/src/expat + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX= + -DBUILD_tools=OFF + -DBUILD_examples=OFF + -DBUILD_tests=OFF + -DBUILD_shared=OFF + INSTALL_COMMAND + ${CMAKE_COMMAND} --build --config $ --target install + COMMAND + ${CMAKE_COMMAND} -E make_directory /wxlib + COMMAND + ${CMAKE_COMMAND} -E rename + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}expat${CMAKE_STATIC_LIBRARY_SUFFIX} + /wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + ExternalProject_Get_Property(wxexpat INSTALL_DIR) + add_library(expat STATIC IMPORTED) + set_target_properties(expat PROPERTIES + IMPORTED_LOCATION "${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_DEBUG "${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpatd${CMAKE_STATIC_LIBRARY_SUFFIX}" + FOLDER "Third Party Libraries" + ) + add_dependencies(expat wxexpat) + set(EXPAT_INCLUDE_DIRS "${INSTALL_DIR}/include") + set(EXPAT_LIBRARIES expat) + if(NOT wxBUILD_SHARED) + wx_install( + FILES ${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + DESTINATION "lib${wxPLATFORM_LIB_DIR}") + endif() +elseif(wxUSE_EXPAT) + find_package(EXPAT) +endif() + +wx_append_sources(XML_FILES XML) +wx_add_library(xml IS_BASE ${XML_FILES}) +wx_lib_link_libraries(xml + PRIVATE ${EXPAT_LIBRARIES} + ) +wx_lib_include_directories(xml PRIVATE ${EXPAT_INCLUDE_DIRS}) + +wx_finalize_lib(xml) diff --git a/build/cmake/lib/xrc/CMakeLists.txt b/build/cmake/lib/xrc/CMakeLists.txt new file mode 100644 index 0000000000..8ea9d4b270 --- /dev/null +++ b/build/cmake/lib/xrc/CMakeLists.txt @@ -0,0 +1,17 @@ +############################################################################# +# Name: build/cmake/lib/xrc/CMakeLists.txt +# Purpose: CMake file for xrc library +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +include(../../source_groups.cmake) + +wx_append_sources(XRC_FILES XRC) + +wx_add_library(xrc ${XRC_FILES}) +wx_lib_link_libraries(xrc PRIVATE adv html xml) + +wx_finalize_lib(xrc) diff --git a/build/cmake/lib/zlib.cmake b/build/cmake/lib/zlib.cmake new file mode 100644 index 0000000000..c5687f2deb --- /dev/null +++ b/build/cmake/lib/zlib.cmake @@ -0,0 +1,41 @@ +############################################################################# +# Name: build/cmake/lib/zlib.cmake +# Purpose: Use external or internal zlib +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_ZLIB ZLIB "use zlib for LZW compression" + DEFAULT_APPLE sys) + +if(wxUSE_ZLIB STREQUAL "builtin") + wx_add_builtin_library(wxzlib + src/zlib/adler32.c + src/zlib/compress.c + src/zlib/crc32.c + src/zlib/deflate.c + src/zlib/gzclose.c + src/zlib/gzlib.c + src/zlib/gzread.c + src/zlib/gzwrite.c + src/zlib/infback.c + src/zlib/inffast.c + src/zlib/inflate.c + src/zlib/inftrees.c + src/zlib/trees.c + src/zlib/uncompr.c + src/zlib/zutil.c + ) + if(WIN32) + # 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() + 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/main.cmake b/build/cmake/main.cmake new file mode 100644 index 0000000000..98d40b5869 --- /dev/null +++ b/build/cmake/main.cmake @@ -0,0 +1,75 @@ +############################################################################# +# Name: build/cmake/main.cmake +# Purpose: Main CMake file +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +list(APPEND CMAKE_MODULE_PATH "${wxSOURCE_DIR}/build/cmake/modules") + +include(build/cmake/files.cmake) # Files list +include(build/cmake/functions.cmake) # wxWidgets functions +include(build/cmake/toolkit.cmake) # Platform/toolkit settings +include(build/cmake/options.cmake) # User options +include(build/cmake/init.cmake) # Init various global build vars +include(build/cmake/install.cmake) # Install target support + +add_subdirectory(build/cmake/lib libs) +add_subdirectory(build/cmake/utils utils) + +if(wxBUILD_SAMPLES) + add_subdirectory(build/cmake/samples samples) +endif() + +if(wxBUILD_TESTS) + enable_testing() + add_subdirectory(build/cmake/tests tests) +endif() + +if(wxBUILD_DEMOS) + add_subdirectory(build/cmake/demos demos) +endif() + +if(NOT wxBUILD_CUSTOM_SETUP_HEADER_PATH) + # Write setup.h after all variables are available + include(build/cmake/setup.cmake) +endif() + +if(UNIX) + # Write wx-config + include(build/cmake/config.cmake) +endif() + +# Determine minimum required OS at runtime +set(wxREQUIRED_OS_DESC "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}") +if(MSVC OR MINGW OR CYGWIN) + # Determine based on used toolkit + if(MINGW OR CYGWIN OR (MSVC_VERSION LESS 1700) OR (CMAKE_VS_PLATFORM_TOOLSET MATCHES "_xp$") ) + # Visual Studio < 2012 and MinGW always create XP compatible binaries + # XP Toolset is required since VS 2012 + set(wxREQUIRED_OS_DESC "Windows XP / Windows Server 2003") + else() + set(wxREQUIRED_OS_DESC "Windows Vista / Windows Server 2008") + endif() + if(CMAKE_CL_64) + wx_string_append(wxREQUIRED_OS_DESC " (x64 Edition)") + endif() +elseif(APPLE AND NOT IPHONE) + if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) + set(wxREQUIRED_OS_DESC "macOS ${CMAKE_OSX_DEPLOYMENT_TARGET}") + endif() +endif() + +# Print configuration summary +wx_print_thirdparty_library_summary() + +message(STATUS "Configured wxWidgets ${wxVERSION} for ${CMAKE_SYSTEM} + Min OS Version required at runtime: ${wxREQUIRED_OS_DESC} + Which GUI toolkit should wxWidgets use?: ${wxBUILD_TOOLKIT} ${wxTOOLKIT_VERSION} + 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 level of wxWidgets compatibility should be enabled? ${wxBUILD_COMPATIBILITY}" + ) diff --git a/build/cmake/modules/FindGStreamer.cmake b/build/cmake/modules/FindGStreamer.cmake new file mode 100644 index 0000000000..99fb58faae --- /dev/null +++ b/build/cmake/modules/FindGStreamer.cmake @@ -0,0 +1,132 @@ +# - Try to find GStreamer and its plugins +# Once done, this will define +# +# GSTREAMER_FOUND - system has GStreamer +# GSTREAMER_INCLUDE_DIRS - the GStreamer include directories +# GSTREAMER_LIBRARIES - link these to use GStreamer +# +# Additionally, gstreamer-base is always looked for and required, and +# the following related variables are defined: +# +# GSTREAMER_BASE_INCLUDE_DIRS - gstreamer-base's include directory +# GSTREAMER_BASE_LIBRARIES - link to these to use gstreamer-base +# +# Optionally, the COMPONENTS keyword can be passed to find_package() +# and GStreamer plugins can be looked for. Currently, the following +# plugins can be searched, and they define the following variables if +# found: +# +# gstreamer-app: GSTREAMER_APP_INCLUDE_DIRS and GSTREAMER_APP_LIBRARIES +# gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES +# gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES +# gstreamer-interfaces: GSTREAMER_INTERFACES_INCLUDE_DIRS and GSTREAMER_INTERFACES_LIBRARIES +# gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES +# gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# 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) + +# The minimum GStreamer version we support. +set(GSTREAMER_MINIMUM_VERSION 0.10.30) + +# Helper macro to find a GStreamer plugin (or GStreamer itself) +# _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO") +# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-0.10", or "gstreamer-video-0.10"). +# _header is the component's header, relative to the gstreamer-0.10 directory (eg. "gst/gst.h"). +# _library is the component's library name (eg. "gstreamer-0.10" or "gstvideo-0.10") +macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library) + # FIXME: The QUIET keyword can be used once we require CMake 2.8.2. + pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name}) + + find_path(${_component_prefix}_INCLUDE_DIRS + NAMES ${_header} + HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR} + PATH_SUFFIXES gstreamer-0.10 + ) + + find_library(${_component_prefix}_LIBRARIES + NAMES ${_library} + HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR} + ) +endmacro() + +# ------------------------ +# 1. Find GStreamer itself +# ------------------------ + +# 1.1. Find headers and libraries +FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-0.10 gst/gst.h gstreamer-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-0.10 gst/gst.h gstbase-0.10) + +# 1.2. Check GStreamer version +if (GSTREAMER_INCLUDE_DIRS) + if (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h") + file(READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS) + + string(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") + set(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") + set(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") + set(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}") + + set(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}") + endif () +endif () + +# FIXME: With CMake 2.8.3 we can just pass GSTREAMER_VERSION to FIND_PACKAGE_HANDLE_STARNDARD_ARGS as VERSION_VAR +# and remove the version check here (GSTREAMER_MINIMUM_VERSION would be passed to FIND_PACKAGE). +set(VERSION_OK TRUE) +if ("${GSTREAMER_VERSION}" VERSION_LESS "${GSTREAMER_MINIMUM_VERSION}") + set(VERSION_OK FALSE) +endif () + +# ------------------------- +# 2. Find GStreamer plugins +# ------------------------- + +FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-0.10 gst/app/gstappsink.h gstapp-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-0.10 gst/audio/audio.h gstaudio-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-0.10 gst/fft/gstfft.h gstfft-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces-0.10 gst/interfaces/mixer.h gstinterfaces-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-0.10 gst/pbutils/pbutils.h gstpbutils-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-0.10 gst/video/video.h gstvideo-0.10) + +# ------------------------------------------------ +# 3. Process the COMPONENTS passed to FIND_PACKAGE +# ------------------------------------------------ +set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES VERSION_OK GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES) + +foreach (_component ${GStreamer_FIND_COMPONENTS}) + set(_gst_component "GSTREAMER_${_component}") + string(TOUPPER ${_gst_component} _UPPER_NAME) + + list(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES) +endforeach () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) \ No newline at end of file diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake new file mode 100644 index 0000000000..2b510aee5f --- /dev/null +++ b/build/cmake/modules/FindGTK3.cmake @@ -0,0 +1,46 @@ +# - Try to find GTK+ 3 +# Once done, this will define +# +# GTK3_FOUND - system has GTK+ 3. +# GTK3_INCLUDE_DIRS - the GTK+ 3. include directories +# GTK3_LIBRARIES - link these to use GTK+ 3. +# +# 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(GTK3 gtk+-3.0) +set(VERSION_OK TRUE) +if (GTK3_VERSION) +if (GTK3_FIND_VERSION_EXACT) +if (NOT("${GTK3_FIND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")) +set(VERSION_OK FALSE) +endif () +else () +if ("${GTK3_VERSION}" VERSION_LESS "${GTK3_FIND_VERSION}") +set(VERSION_OK FALSE) +endif () +endif () +endif () +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK) diff --git a/build/cmake/modules/FindIconv.cmake b/build/cmake/modules/FindIconv.cmake new file mode 100644 index 0000000000..4353c0bc6b --- /dev/null +++ b/build/cmake/modules/FindIconv.cmake @@ -0,0 +1,59 @@ +# https://github.com/onyx-intl/cmake_modules/blob/master/FindIconv.cmake +# +# - Try to find Iconv +# Once done this will define +# +# ICONV_FOUND - system has Iconv +# ICONV_INCLUDE_DIR - the Iconv include directory +# ICONV_LIBRARIES - Link these to use Iconv +# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const +# +include(CheckCXXSourceCompiles) + +IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + SET(ICONV_FIND_QUIETLY TRUE) +ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + +FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) + +IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) +ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +IF(ICONV_FOUND) + check_cxx_source_compiles(" + #include + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) +ENDIF(ICONV_FOUND) +set(CMAKE_REQUIRED_INCLUDES) +set(CMAKE_REQUIRED_LIBRARIES) + +IF(ICONV_FOUND) + IF(NOT ICONV_FIND_QUIETLY) + MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") + ENDIF(NOT ICONV_FIND_QUIETLY) +ELSE(ICONV_FOUND) + IF(Iconv_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Iconv") + ENDIF(Iconv_FIND_REQUIRED) +ENDIF(ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_SECOND_ARGUMENT_IS_CONST +) diff --git a/build/cmake/modules/FindLibSoup.cmake b/build/cmake/modules/FindLibSoup.cmake new file mode 100644 index 0000000000..c7448921a9 --- /dev/null +++ b/build/cmake/modules/FindLibSoup.cmake @@ -0,0 +1,54 @@ +# - Try to find LibSoup 2.4 +# This module defines the following variables: +# +# LIBSOUP_FOUND - LibSoup 2.4 was found +# LIBSOUP_INCLUDE_DIRS - the LibSoup 2.4 include directories +# LIBSOUP_LIBRARIES - link these to use LibSoup 2.4 +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# 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. + +# LibSoup does not provide an easy way to retrieve its version other than its +# .pc file, so we need to rely on PC_LIBSOUP_VERSION and REQUIRE the .pc file +# to be found. +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_LIBSOUP QUIET libsoup-2.4) + +if(PC_LIBSOUP_FOUND) + FIND_PATH(LIBSOUP_INCLUDE_DIRS + NAMES libsoup/soup.h + HINTS ${PC_LIBSOUP_INCLUDEDIR} + ${PC_LIBSOUP_INCLUDE_DIRS} + PATH_SUFFIXES libsoup-2.4 + ) + + FIND_LIBRARY(LIBSOUP_LIBRARIES + NAMES soup-2.4 + HINTS ${PC_LIBSOUP_LIBDIR} + ${PC_LIBSOUP_LIBRARY_DIRS} + ) +endif() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSoup REQUIRED_VARS LIBSOUP_INCLUDE_DIRS LIBSOUP_LIBRARIES + VERSION_VAR PC_LIBSOUP_VERSION) diff --git a/build/cmake/modules/FindLibsecret.cmake b/build/cmake/modules/FindLibsecret.cmake new file mode 100644 index 0000000000..d33228a77a --- /dev/null +++ b/build/cmake/modules/FindLibsecret.cmake @@ -0,0 +1,49 @@ +# - Try to find libsecret +# Once done, this will define +# +# LIBSECRET_FOUND - system has libsecret +# LIBSECRET_INCLUDE_DIRS - the libsecret include directories +# LIBSECRET_LIBRARIES - link these to use libsecret +# +# Copyright (C) 2012 Raphael Kubo da Costa +# Copyright (C) 2014 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(LIBSECRET libsecret-1) + +set(VERSION_OK TRUE) +if (LIBSECRET_VERSION) + if (LIBSECRET_FIND_VERSION_EXACT) + if (NOT("${LIBSECRET_FIND_VERSION}" VERSION_EQUAL "${LIBSECRET_VERSION}")) + set(VERSION_OK FALSE) + endif () + else () + if ("${LIBSECRET_VERSION}" VERSION_LESS "${LIBSECRET_FIND_VERSION}") + set(VERSION_OK FALSE) + endif () + endif () +endif () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSECRET DEFAULT_MSG LIBSECRET_INCLUDE_DIRS LIBSECRET_LIBRARIES VERSION_OK) diff --git a/build/cmake/modules/FindWebkit.cmake b/build/cmake/modules/FindWebkit.cmake new file mode 100644 index 0000000000..0b47c17482 --- /dev/null +++ b/build/cmake/modules/FindWebkit.cmake @@ -0,0 +1,38 @@ +# - Find Webkit-3.0 +# Find the Webkit-3.0 includes and library +# +# WEBKIT_INCLUDE_DIR - Where to find webkit include sub-directory. +# WEBKIT_LIBRARIES - List of libraries when using Webkit-3.0. +# WEBKIT_FOUND - True if Webkit-3.0 found. + +SET( WEBKIT_VERSION "1.0") + +IF (WEBKIT_INCLUDE_DIR) + # Already in cache, be silent. + SET(WEBKIT_FIND_QUIETLY TRUE) +ENDIF (WEBKIT_INCLUDE_DIR) + +FIND_PATH(WEBKIT_INCLUDE_DIR webkit/webkit.h + PATH_SUFFIXES "webkitgtk-${WEBKIT_VERSION}" +) + +SET(WEBKIT_NAMES "webkitgtk-${WEBKIT_VERSION}") +FIND_LIBRARY(WEBKIT_LIBRARY + NAMES ${WEBKIT_NAMES} +) + +# Handle the QUIETLY and REQUIRED arguments and set WEBKIT_FOUND to +# TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + WEBKIT DEFAULT_MSG + WEBKIT_LIBRARY WEBKIT_INCLUDE_DIR +) + +IF(WEBKIT_FOUND) + SET( WEBKIT_LIBRARIES ${WEBKIT_LIBRARY} ) +ELSE(WEBKIT_FOUND) + SET( WEBKIT_LIBRARIES ) +ENDIF(WEBKIT_FOUND) + +MARK_AS_ADVANCED( WEBKIT_LIBRARY WEBKIT_INCLUDE_DIR ) diff --git a/build/cmake/modules/Findcppunit.cmake b/build/cmake/modules/Findcppunit.cmake new file mode 100644 index 0000000000..1d47a91844 --- /dev/null +++ b/build/cmake/modules/Findcppunit.cmake @@ -0,0 +1,77 @@ +# - try to find cppunit library +# +# Cache Variables: (probably not for direct use in your scripts) +# CPPUNIT_INCLUDE_DIR +# CPPUNIT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# CPPUNIT_FOUND +# CPPUNIT_INCLUDE_DIRS +# CPPUNIT_LIBRARIES +# +# Requires these CMake modules: +# SelectLibraryConfigurations (included with CMake >= 2.8.0) +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2011 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2011. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(CPPUNIT_ROOT_DIR + "${CPPUNIT_ROOT_DIR}" + CACHE + PATH + "Directory to search") + +find_library(CPPUNIT_LIBRARY_RELEASE + NAMES + cppunit + HINTS + "${CPPUNIT_ROOT_DIR}" + "${CPPUNIT_ROOT_DIR}/lib") + +find_library(CPPUNIT_LIBRARY_DEBUG + NAMES + cppunitd + HINTS + "${CPPUNIT_ROOT_DIR}" + "${CPPUNIT_ROOT_DIR}/lib") + +include(SelectLibraryConfigurations) +select_library_configurations(CPPUNIT) + +# Might want to look close to the library first for the includes. +get_filename_component(_libdir "${CPPUNIT_LIBRARY_RELEASE}" PATH) + +find_path(CPPUNIT_INCLUDE_DIR + NAMES + cppunit/TestCase.h + HINTS + "${_libdir}/.." + PATHS + "${CPPUNIT_ROOT_DIR}" + PATH_SUFFIXES + include/) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cppunit + DEFAULT_MSG + CPPUNIT_LIBRARY + CPPUNIT_INCLUDE_DIR) + +if(CPPUNIT_FOUND) + set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) + set(CPPUNIT_INCLUDE_DIRS "${CPPUNIT_INCLUDE_DIR}") + mark_as_advanced(CPPUNIT_ROOT_DIR) +endif() + +mark_as_advanced(CPPUNIT_INCLUDE_DIR + CPPUNIT_LIBRARY_RELEASE + CPPUNIT_LIBRARY_DEBUG) diff --git a/build/cmake/modules/cotire.cmake b/build/cmake/modules/cotire.cmake new file mode 100644 index 0000000000..ab611007dc --- /dev/null +++ b/build/cmake/modules/cotire.cmake @@ -0,0 +1,4008 @@ +# - cotire (compile time reducer) +# +# See the cotire manual for usage hints. +# +#============================================================================= +# Copyright 2012-2016 Sascha Kratky +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +#============================================================================= + +if(__COTIRE_INCLUDED) + return() +endif() +set(__COTIRE_INCLUDED TRUE) + +# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode +# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid +if (NOT CMAKE_SCRIPT_MODE_FILE) + cmake_policy(PUSH) +endif() +cmake_minimum_required(VERSION 2.8.12) +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.7.9") + +# activate select policies +if (POLICY CMP0025) + # Compiler id for Apple Clang is now AppleClang + cmake_policy(SET CMP0025 NEW) +endif() + +if (POLICY CMP0026) + # disallow use of the LOCATION target property + cmake_policy(SET CMP0026 NEW) +endif() + +if (POLICY CMP0038) + # targets may not link directly to themselves + cmake_policy(SET CMP0038 NEW) +endif() + +if (POLICY CMP0039) + # utility targets may not have link dependencies + cmake_policy(SET CMP0039 NEW) +endif() + +if (POLICY CMP0040) + # target in the TARGET signature of add_custom_command() must exist + cmake_policy(SET CMP0040 NEW) +endif() + +if (POLICY CMP0045) + # error on non-existent target in get_target_property + cmake_policy(SET CMP0045 NEW) +endif() + +if (POLICY CMP0046) + # error on non-existent dependency in add_dependencies + cmake_policy(SET CMP0046 NEW) +endif() + +if (POLICY CMP0049) + # do not expand variables in target source entries + cmake_policy(SET CMP0049 NEW) +endif() + +if (POLICY CMP0050) + # disallow add_custom_command SOURCE signatures + cmake_policy(SET CMP0050 NEW) +endif() + +if (POLICY CMP0051) + # include TARGET_OBJECTS expressions in a target's SOURCES property + cmake_policy(SET CMP0051 NEW) +endif() + +if (POLICY CMP0053) + # simplify variable reference and escape sequence evaluation + cmake_policy(SET CMP0053 NEW) +endif() + +if (POLICY CMP0054) + # only interpret if() arguments as variables or keywords when unquoted + cmake_policy(SET CMP0054 NEW) +endif() + +include(CMakeParseArguments) +include(ProcessorCount) + +function (cotire_get_configuration_types _configsVar) + set (_configs "") + if (CMAKE_CONFIGURATION_TYPES) + list (APPEND _configs ${CMAKE_CONFIGURATION_TYPES}) + endif() + if (CMAKE_BUILD_TYPE) + list (APPEND _configs "${CMAKE_BUILD_TYPE}") + endif() + if (_configs) + list (REMOVE_DUPLICATES _configs) + set (${_configsVar} ${_configs} PARENT_SCOPE) + else() + set (${_configsVar} "None" PARENT_SCOPE) + endif() +endfunction() + +function (cotire_get_source_file_extension _sourceFile _extVar) + # get_filename_component returns extension from first occurrence of . in file name + # this function computes the extension from last occurrence of . in file name + string (FIND "${_sourceFile}" "." _index REVERSE) + if (_index GREATER -1) + math (EXPR _index "${_index} + 1") + string (SUBSTRING "${_sourceFile}" ${_index} -1 _sourceExt) + else() + set (_sourceExt "") + endif() + set (${_extVar} "${_sourceExt}" PARENT_SCOPE) +endfunction() + +macro (cotire_check_is_path_relative_to _path _isRelativeVar) + set (${_isRelativeVar} FALSE) + if (IS_ABSOLUTE "${_path}") + foreach (_dir ${ARGN}) + file (RELATIVE_PATH _relPath "${_dir}" "${_path}") + if (NOT _relPath OR (NOT IS_ABSOLUTE "${_relPath}" AND NOT "${_relPath}" MATCHES "^\\.\\.")) + set (${_isRelativeVar} TRUE) + break() + endif() + endforeach() + endif() +endmacro() + +function (cotire_filter_language_source_files _language _target _sourceFilesVar _excludedSourceFilesVar _cotiredSourceFilesVar) + if (CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) + set (_languageExtensions "${CMAKE_${_language}_SOURCE_FILE_EXTENSIONS}") + else() + set (_languageExtensions "") + endif() + if (CMAKE_${_language}_IGNORE_EXTENSIONS) + set (_ignoreExtensions "${CMAKE_${_language}_IGNORE_EXTENSIONS}") + else() + set (_ignoreExtensions "") + endif() + if (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS) + set (_excludeExtensions "${COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS}") + else() + set (_excludeExtensions "") + endif() + if (COTIRE_DEBUG AND _languageExtensions) + message (STATUS "${_language} source file extensions: ${_languageExtensions}") + endif() + if (COTIRE_DEBUG AND _ignoreExtensions) + message (STATUS "${_language} ignore extensions: ${_ignoreExtensions}") + endif() + if (COTIRE_DEBUG AND _excludeExtensions) + message (STATUS "${_language} exclude extensions: ${_excludeExtensions}") + endif() + if (CMAKE_VERSION VERSION_LESS "3.1.0") + set (_allSourceFiles ${ARGN}) + else() + # as of CMake 3.1 target sources may contain generator expressions + # since we cannot obtain required property information about source files added + # through generator expressions at configure time, we filter them out + string (GENEX_STRIP "${ARGN}" _allSourceFiles) + endif() + set (_filteredSourceFiles "") + set (_excludedSourceFiles "") + foreach (_sourceFile ${_allSourceFiles}) + get_source_file_property(_sourceIsHeaderOnly "${_sourceFile}" HEADER_FILE_ONLY) + get_source_file_property(_sourceIsExternal "${_sourceFile}" EXTERNAL_OBJECT) + get_source_file_property(_sourceIsSymbolic "${_sourceFile}" SYMBOLIC) + if (NOT _sourceIsHeaderOnly AND NOT _sourceIsExternal AND NOT _sourceIsSymbolic) + cotire_get_source_file_extension("${_sourceFile}" _sourceExt) + if (_sourceExt) + list (FIND _ignoreExtensions "${_sourceExt}" _ignoreIndex) + if (_ignoreIndex LESS 0) + list (FIND _excludeExtensions "${_sourceExt}" _excludeIndex) + if (_excludeIndex GREATER -1) + list (APPEND _excludedSourceFiles "${_sourceFile}") + else() + list (FIND _languageExtensions "${_sourceExt}" _sourceIndex) + if (_sourceIndex GREATER -1) + # consider source file unless it is excluded explicitly + get_source_file_property(_sourceIsExcluded "${_sourceFile}" COTIRE_EXCLUDED) + if (_sourceIsExcluded) + list (APPEND _excludedSourceFiles "${_sourceFile}") + else() + list (APPEND _filteredSourceFiles "${_sourceFile}") + endif() + else() + get_source_file_property(_sourceLanguage "${_sourceFile}" LANGUAGE) + if ("${_sourceLanguage}" STREQUAL "${_language}") + # add to excluded sources, if file is not ignored and has correct language without having the correct extension + list (APPEND _excludedSourceFiles "${_sourceFile}") + endif() + endif() + endif() + endif() + endif() + endif() + endforeach() + # separate filtered source files from already cotired ones + # the COTIRE_TARGET property of a source file may be set while a target is being processed by cotire + set (_sourceFiles "") + set (_cotiredSourceFiles "") + foreach (_sourceFile ${_filteredSourceFiles}) + get_source_file_property(_sourceIsCotired "${_sourceFile}" COTIRE_TARGET) + if (_sourceIsCotired) + list (APPEND _cotiredSourceFiles "${_sourceFile}") + else() + get_source_file_property(_sourceCompileFlags "${_sourceFile}" COMPILE_FLAGS) + if (_sourceCompileFlags) + # add to excluded sources, if file has custom compile flags + list (APPEND _excludedSourceFiles "${_sourceFile}") + else() + list (APPEND _sourceFiles "${_sourceFile}") + endif() + endif() + endforeach() + if (COTIRE_DEBUG) + if (_sourceFiles) + message (STATUS "Filtered ${_target} ${_language} sources: ${_sourceFiles}") + endif() + if (_excludedSourceFiles) + message (STATUS "Excluded ${_target} ${_language} sources: ${_excludedSourceFiles}") + endif() + if (_cotiredSourceFiles) + message (STATUS "Cotired ${_target} ${_language} sources: ${_cotiredSourceFiles}") + endif() + endif() + set (${_sourceFilesVar} ${_sourceFiles} PARENT_SCOPE) + set (${_excludedSourceFilesVar} ${_excludedSourceFiles} PARENT_SCOPE) + set (${_cotiredSourceFilesVar} ${_cotiredSourceFiles} PARENT_SCOPE) +endfunction() + +function (cotire_get_objects_with_property_on _filteredObjectsVar _property _type) + set (_filteredObjects "") + foreach (_object ${ARGN}) + get_property(_isSet ${_type} "${_object}" PROPERTY ${_property} SET) + if (_isSet) + get_property(_propertyValue ${_type} "${_object}" PROPERTY ${_property}) + if (_propertyValue) + list (APPEND _filteredObjects "${_object}") + endif() + endif() + endforeach() + set (${_filteredObjectsVar} ${_filteredObjects} PARENT_SCOPE) +endfunction() + +function (cotire_get_objects_with_property_off _filteredObjectsVar _property _type) + set (_filteredObjects "") + foreach (_object ${ARGN}) + get_property(_isSet ${_type} "${_object}" PROPERTY ${_property} SET) + if (_isSet) + get_property(_propertyValue ${_type} "${_object}" PROPERTY ${_property}) + if (NOT _propertyValue) + list (APPEND _filteredObjects "${_object}") + endif() + endif() + endforeach() + set (${_filteredObjectsVar} ${_filteredObjects} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_file_property_values _valuesVar _property) + set (_values "") + foreach (_sourceFile ${ARGN}) + get_source_file_property(_propertyValue "${_sourceFile}" ${_property}) + if (_propertyValue) + list (APPEND _values "${_propertyValue}") + endif() + endforeach() + set (${_valuesVar} ${_values} PARENT_SCOPE) +endfunction() + +function (cotire_resolve_config_properites _configurations _propertiesVar) + set (_properties "") + foreach (_property ${ARGN}) + if ("${_property}" MATCHES "") + foreach (_config ${_configurations}) + string (TOUPPER "${_config}" _upperConfig) + string (REPLACE "" "${_upperConfig}" _configProperty "${_property}") + list (APPEND _properties ${_configProperty}) + endforeach() + else() + list (APPEND _properties ${_property}) + endif() + endforeach() + set (${_propertiesVar} ${_properties} PARENT_SCOPE) +endfunction() + +function (cotire_copy_set_properites _configurations _type _source _target) + cotire_resolve_config_properites("${_configurations}" _properties ${ARGN}) + foreach (_property ${_properties}) + get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET) + if (_isSet) + get_property(_propertyValue ${_type} ${_source} PROPERTY ${_property}) + set_property(${_type} ${_target} PROPERTY ${_property} "${_propertyValue}") + endif() + endforeach() +endfunction() + +function (cotire_get_target_usage_requirements _target _targetRequirementsVar) + set (_targetRequirements "") + get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES) + while (_librariesToProcess) + # remove from head + list (GET _librariesToProcess 0 _library) + list (REMOVE_AT _librariesToProcess 0) + if (TARGET ${_library}) + list (FIND _targetRequirements ${_library} _index) + if (_index LESS 0) + list (APPEND _targetRequirements ${_library}) + # BFS traversal of transitive libraries + get_target_property(_libraries ${_library} INTERFACE_LINK_LIBRARIES) + if (_libraries) + list (APPEND _librariesToProcess ${_libraries}) + list (REMOVE_DUPLICATES _librariesToProcess) + endif() + endif() + endif() + endwhile() + set (${_targetRequirementsVar} ${_targetRequirements} PARENT_SCOPE) +endfunction() + +function (cotire_filter_compile_flags _language _flagFilter _matchedOptionsVar _unmatchedOptionsVar) + if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + set (_flagPrefix "[/-]") + else() + set (_flagPrefix "--?") + endif() + set (_optionFlag "") + set (_matchedOptions "") + set (_unmatchedOptions "") + foreach (_compileFlag ${ARGN}) + if (_compileFlag) + if (_optionFlag AND NOT "${_compileFlag}" MATCHES "^${_flagPrefix}") + # option with separate argument + list (APPEND _matchedOptions "${_compileFlag}") + set (_optionFlag "") + elseif ("${_compileFlag}" MATCHES "^(${_flagPrefix})(${_flagFilter})$") + # remember option + set (_optionFlag "${CMAKE_MATCH_2}") + elseif ("${_compileFlag}" MATCHES "^(${_flagPrefix})(${_flagFilter})(.+)$") + # option with joined argument + list (APPEND _matchedOptions "${CMAKE_MATCH_3}") + set (_optionFlag "") + else() + # flush remembered option + if (_optionFlag) + list (APPEND _matchedOptions "${_optionFlag}") + set (_optionFlag "") + endif() + # add to unfiltered options + list (APPEND _unmatchedOptions "${_compileFlag}") + endif() + endif() + endforeach() + if (_optionFlag) + list (APPEND _matchedOptions "${_optionFlag}") + endif() + if (COTIRE_DEBUG AND _matchedOptions) + message (STATUS "Filter ${_flagFilter} matched: ${_matchedOptions}") + endif() + if (COTIRE_DEBUG AND _unmatchedOptions) + message (STATUS "Filter ${_flagFilter} unmatched: ${_unmatchedOptions}") + endif() + set (${_matchedOptionsVar} ${_matchedOptions} PARENT_SCOPE) + set (${_unmatchedOptionsVar} ${_unmatchedOptions} PARENT_SCOPE) +endfunction() + +function (cotire_is_target_supported _target _isSupportedVar) + if (NOT TARGET "${_target}") + set (${_isSupportedVar} FALSE PARENT_SCOPE) + return() + endif() + get_target_property(_imported ${_target} IMPORTED) + if (_imported) + set (${_isSupportedVar} FALSE PARENT_SCOPE) + return() + endif() + get_target_property(_targetType ${_target} TYPE) + if (NOT _targetType MATCHES "EXECUTABLE|(STATIC|SHARED|MODULE|OBJECT)_LIBRARY") + set (${_isSupportedVar} FALSE PARENT_SCOPE) + return() + endif() + set (${_isSupportedVar} TRUE PARENT_SCOPE) +endfunction() + +function (cotire_get_target_compile_flags _config _language _target _flagsVar) + string (TOUPPER "${_config}" _upperConfig) + # collect options from CMake language variables + set (_compileFlags "") + if (CMAKE_${_language}_FLAGS) + set (_compileFlags "${_compileFlags} ${CMAKE_${_language}_FLAGS}") + endif() + if (CMAKE_${_language}_FLAGS_${_upperConfig}) + set (_compileFlags "${_compileFlags} ${CMAKE_${_language}_FLAGS_${_upperConfig}}") + endif() + if (_target) + # add target compile flags + get_target_property(_targetflags ${_target} COMPILE_FLAGS) + if (_targetflags) + set (_compileFlags "${_compileFlags} ${_targetflags}") + endif() + endif() + if (UNIX) + separate_arguments(_compileFlags UNIX_COMMAND "${_compileFlags}") + elseif(WIN32) + separate_arguments(_compileFlags WINDOWS_COMMAND "${_compileFlags}") + else() + separate_arguments(_compileFlags) + endif() + # target compile options + if (_target) + get_target_property(_targetOptions ${_target} COMPILE_OPTIONS) + if (_targetOptions) + list (APPEND _compileFlags ${_targetOptions}) + endif() + endif() + # interface compile options from linked library targets + if (_target) + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS) + if (_targetOptions) + list (APPEND _compileFlags ${_targetOptions}) + endif() + endforeach() + endif() + # handle language standard properties + if (CMAKE_${_language}_STANDARD_DEFAULT) + # used compiler supports language standard levels + if (_target) + get_target_property(_targetLanguageStandard ${_target} ${_language}_STANDARD) + if (_targetLanguageStandard) + set (_type "EXTENSION") + get_property(_isSet TARGET ${_target} PROPERTY ${_language}_EXTENSIONS SET) + if (_isSet) + get_target_property(_targetUseLanguageExtensions ${_target} ${_language}_EXTENSIONS) + if (NOT _targetUseLanguageExtensions) + set (_type "STANDARD") + endif() + endif() + if (CMAKE_${_language}${_targetLanguageStandard}_${_type}_COMPILE_OPTION) + list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_${_type}_COMPILE_OPTION}") + endif() + endif() + endif() + endif() + # handle the POSITION_INDEPENDENT_CODE target property + if (_target) + get_target_property(_targetPIC ${_target} POSITION_INDEPENDENT_CODE) + if (_targetPIC) + get_target_property(_targetType ${_target} TYPE) + if (_targetType STREQUAL "EXECUTABLE" AND CMAKE_${_language}_COMPILE_OPTIONS_PIE) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_PIE}") + elseif (CMAKE_${_language}_COMPILE_OPTIONS_PIC) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_PIC}") + endif() + endif() + endif() + # handle visibility target properties + if (_target) + get_target_property(_targetVisibility ${_target} ${_language}_VISIBILITY_PRESET) + if (_targetVisibility AND CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY}${_targetVisibility}") + endif() + get_target_property(_targetVisibilityInlines ${_target} VISIBILITY_INLINES_HIDDEN) + if (_targetVisibilityInlines AND CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}") + endif() + endif() + # platform specific flags + if (APPLE) + get_target_property(_architectures ${_target} OSX_ARCHITECTURES_${_upperConfig}) + if (NOT _architectures) + get_target_property(_architectures ${_target} OSX_ARCHITECTURES) + endif() + if (_architectures) + foreach (_arch ${_architectures}) + list (APPEND _compileFlags "-arch" "${_arch}") + endforeach() + endif() + if (CMAKE_OSX_SYSROOT) + if (CMAKE_${_language}_SYSROOT_FLAG) + list (APPEND _compileFlags "${CMAKE_${_language}_SYSROOT_FLAG}" "${CMAKE_OSX_SYSROOT}") + else() + list (APPEND _compileFlags "-isysroot" "${CMAKE_OSX_SYSROOT}") + endif() + endif() + if (CMAKE_OSX_DEPLOYMENT_TARGET) + if (CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG) + list (APPEND _compileFlags "${CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG}${CMAKE_OSX_DEPLOYMENT_TARGET}") + else() + list (APPEND _compileFlags "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + endif() + endif() + endif() + if (COTIRE_DEBUG AND _compileFlags) + message (STATUS "Target ${_target} compile flags: ${_compileFlags}") + endif() + set (${_flagsVar} ${_compileFlags} PARENT_SCOPE) +endfunction() + +function (cotire_get_target_include_directories _config _language _target _includeDirsVar _systemIncludeDirsVar) + set (_includeDirs "") + set (_systemIncludeDirs "") + # default include dirs + if (CMAKE_INCLUDE_CURRENT_DIR) + list (APPEND _includeDirs "${CMAKE_CURRENT_BINARY_DIR}") + list (APPEND _includeDirs "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + set (_targetFlags "") + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + # parse additional include directories from target compile flags + if (CMAKE_INCLUDE_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_dirs "") + cotire_filter_compile_flags("${_language}" "${_includeFlag}" _dirs _ignore ${_targetFlags}) + if (_dirs) + list (APPEND _includeDirs ${_dirs}) + endif() + endif() + endif() + # parse additional system include directories from target compile flags + if (CMAKE_INCLUDE_SYSTEM_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_dirs "") + cotire_filter_compile_flags("${_language}" "${_includeFlag}" _dirs _ignore ${_targetFlags}) + if (_dirs) + list (APPEND _systemIncludeDirs ${_dirs}) + endif() + endif() + endif() + # target include directories + get_directory_property(_dirs DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" INCLUDE_DIRECTORIES) + if (_target) + get_target_property(_targetDirs ${_target} INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _dirs ${_targetDirs}) + endif() + get_target_property(_targetDirs ${_target} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _systemIncludeDirs ${_targetDirs}) + endif() + endif() + # interface include directories from linked library targets + if (_target) + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_linkedTargetType ${_linkedTarget} TYPE) + if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND + _linkedTargetType MATCHES "(STATIC|SHARED|MODULE|OBJECT)_LIBRARY") + # CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE refers to CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR + # at the time, when the target was created. These correspond to the target properties BINARY_DIR and SOURCE_DIR + # which are only available with CMake 3.4 or later. + get_target_property(_targetDirs ${_linkedTarget} BINARY_DIR) + if (_targetDirs) + list (APPEND _dirs ${_targetDirs}) + endif() + get_target_property(_targetDirs ${_linkedTarget} SOURCE_DIR) + if (_targetDirs) + list (APPEND _dirs ${_targetDirs}) + endif() + endif() + get_target_property(_targetDirs ${_linkedTarget} INTERFACE_INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _dirs ${_targetDirs}) + endif() + get_target_property(_targetDirs ${_linkedTarget} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _systemIncludeDirs ${_targetDirs}) + endif() + endforeach() + endif() + if (dirs) + list (REMOVE_DUPLICATES _dirs) + endif() + list (LENGTH _includeDirs _projectInsertIndex) + foreach (_dir ${_dirs}) + if (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE) + cotire_check_is_path_relative_to("${_dir}" _isRelative "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}") + if (_isRelative) + list (LENGTH _includeDirs _len) + if (_len EQUAL _projectInsertIndex) + list (APPEND _includeDirs "${_dir}") + else() + list (INSERT _includeDirs _projectInsertIndex "${_dir}") + endif() + math (EXPR _projectInsertIndex "${_projectInsertIndex} + 1") + else() + list (APPEND _includeDirs "${_dir}") + endif() + else() + list (APPEND _includeDirs "${_dir}") + endif() + endforeach() + list (REMOVE_DUPLICATES _includeDirs) + list (REMOVE_DUPLICATES _systemIncludeDirs) + if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES) + list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES}) + endif() + if (WIN32) + # convert Windows paths in include directories to CMake paths + if (_includeDirs) + set (_paths "") + foreach (_dir ${_includeDirs}) + file (TO_CMAKE_PATH "${_dir}" _path) + list (APPEND _paths "${_path}") + endforeach() + set (_includeDirs ${_paths}) + endif() + if (_systemIncludeDirs) + set (_paths "") + foreach (_dir ${_systemIncludeDirs}) + file (TO_CMAKE_PATH "${_dir}" _path) + list (APPEND _paths "${_path}") + endforeach() + set (_systemIncludeDirs ${_paths}) + endif() + endif() + if (COTIRE_DEBUG AND _includeDirs) + message (STATUS "Target ${_target} include dirs: ${_includeDirs}") + endif() + set (${_includeDirsVar} ${_includeDirs} PARENT_SCOPE) + if (COTIRE_DEBUG AND _systemIncludeDirs) + message (STATUS "Target ${_target} system include dirs: ${_systemIncludeDirs}") + endif() + set (${_systemIncludeDirsVar} ${_systemIncludeDirs} PARENT_SCOPE) +endfunction() + +function (cotire_get_target_export_symbol _target _exportSymbolVar) + set (_exportSymbol "") + get_target_property(_targetType ${_target} TYPE) + get_target_property(_enableExports ${_target} ENABLE_EXPORTS) + if (_targetType MATCHES "(SHARED|MODULE)_LIBRARY" OR + (_targetType STREQUAL "EXECUTABLE" AND _enableExports)) + get_target_property(_exportSymbol ${_target} DEFINE_SYMBOL) + if (NOT _exportSymbol) + set (_exportSymbol "${_target}_EXPORTS") + endif() + string (MAKE_C_IDENTIFIER "${_exportSymbol}" _exportSymbol) + endif() + set (${_exportSymbolVar} ${_exportSymbol} PARENT_SCOPE) +endfunction() + +function (cotire_get_target_compile_definitions _config _language _target _definitionsVar) + string (TOUPPER "${_config}" _upperConfig) + set (_configDefinitions "") + # CMAKE_INTDIR for multi-configuration build systems + if (NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") + list (APPEND _configDefinitions "CMAKE_INTDIR=\"${_config}\"") + endif() + # target export define symbol + cotire_get_target_export_symbol("${_target}" _defineSymbol) + if (_defineSymbol) + list (APPEND _configDefinitions "${_defineSymbol}") + endif() + # directory compile definitions + get_directory_property(_definitions DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + get_directory_property(_definitions DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS_${_upperConfig}) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + # target compile definitions + get_target_property(_definitions ${_target} COMPILE_DEFINITIONS) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + get_target_property(_definitions ${_target} COMPILE_DEFINITIONS_${_upperConfig}) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + # interface compile definitions from linked library targets + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + endforeach() + # parse additional compile definitions from target compile flags + # and don't look at directory compile definitions, which we already handled + set (_targetFlags "") + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags}) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) + endif() + list (REMOVE_DUPLICATES _configDefinitions) + if (COTIRE_DEBUG AND _configDefinitions) + message (STATUS "Target ${_target} compile definitions: ${_configDefinitions}") + endif() + set (${_definitionsVar} ${_configDefinitions} PARENT_SCOPE) +endfunction() + +function (cotire_get_target_compiler_flags _config _language _target _compilerFlagsVar) + # parse target compile flags omitting compile definitions and include directives + set (_targetFlags "") + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + set (_flagFilter "D") + if (CMAKE_INCLUDE_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_flagFilter "${_flagFilter}|${_includeFlag}") + endif() + endif() + if (CMAKE_INCLUDE_SYSTEM_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_flagFilter "${_flagFilter}|${_includeFlag}") + endif() + endif() + set (_compilerFlags "") + cotire_filter_compile_flags("${_language}" "${_flagFilter}" _ignore _compilerFlags ${_targetFlags}) + if (COTIRE_DEBUG AND _compilerFlags) + message (STATUS "Target ${_target} compiler flags: ${_compilerFlags}") + endif() + set (${_compilerFlagsVar} ${_compilerFlags} PARENT_SCOPE) +endfunction() + +function (cotire_add_sys_root_paths _pathsVar) + if (APPLE) + if (CMAKE_OSX_SYSROOT AND CMAKE_${_language}_HAS_ISYSROOT) + foreach (_path IN LISTS ${_pathsVar}) + if (IS_ABSOLUTE "${_path}") + get_filename_component(_path "${CMAKE_OSX_SYSROOT}/${_path}" ABSOLUTE) + if (EXISTS "${_path}") + list (APPEND ${_pathsVar} "${_path}") + endif() + endif() + endforeach() + endif() + endif() + set (${_pathsVar} ${${_pathsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_extra_properties _sourceFile _pattern _resultVar) + set (_extraProperties ${ARGN}) + set (_result "") + if (_extraProperties) + list (FIND _extraProperties "${_sourceFile}" _index) + if (_index GREATER -1) + math (EXPR _index "${_index} + 1") + list (LENGTH _extraProperties _len) + math (EXPR _len "${_len} - 1") + foreach (_index RANGE ${_index} ${_len}) + list (GET _extraProperties ${_index} _value) + if (_value MATCHES "${_pattern}") + list (APPEND _result "${_value}") + else() + break() + endif() + endforeach() + endif() + endif() + set (${_resultVar} ${_result} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_compile_definitions _config _language _sourceFile _definitionsVar) + set (_compileDefinitions "") + if (NOT CMAKE_SCRIPT_MODE_FILE) + string (TOUPPER "${_config}" _upperConfig) + get_source_file_property(_definitions "${_sourceFile}" COMPILE_DEFINITIONS) + if (_definitions) + list (APPEND _compileDefinitions ${_definitions}) + endif() + get_source_file_property(_definitions "${_sourceFile}" COMPILE_DEFINITIONS_${_upperConfig}) + if (_definitions) + list (APPEND _compileDefinitions ${_definitions}) + endif() + endif() + cotire_get_source_extra_properties("${_sourceFile}" "^[a-zA-Z0-9_]+(=.*)?$" _definitions ${ARGN}) + if (_definitions) + list (APPEND _compileDefinitions ${_definitions}) + endif() + if (COTIRE_DEBUG AND _compileDefinitions) + message (STATUS "Source ${_sourceFile} compile definitions: ${_compileDefinitions}") + endif() + set (${_definitionsVar} ${_compileDefinitions} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_files_compile_definitions _config _language _definitionsVar) + set (_configDefinitions "") + foreach (_sourceFile ${ARGN}) + cotire_get_source_compile_definitions("${_config}" "${_language}" "${_sourceFile}" _sourceDefinitions) + if (_sourceDefinitions) + list (APPEND _configDefinitions "${_sourceFile}" ${_sourceDefinitions} "-") + endif() + endforeach() + set (${_definitionsVar} ${_configDefinitions} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_undefs _sourceFile _property _sourceUndefsVar) + set (_sourceUndefs "") + if (NOT CMAKE_SCRIPT_MODE_FILE) + get_source_file_property(_undefs "${_sourceFile}" ${_property}) + if (_undefs) + list (APPEND _sourceUndefs ${_undefs}) + endif() + endif() + cotire_get_source_extra_properties("${_sourceFile}" "^[a-zA-Z0-9_]+$" _undefs ${ARGN}) + if (_undefs) + list (APPEND _sourceUndefs ${_undefs}) + endif() + if (COTIRE_DEBUG AND _sourceUndefs) + message (STATUS "Source ${_sourceFile} ${_property} undefs: ${_sourceUndefs}") + endif() + set (${_sourceUndefsVar} ${_sourceUndefs} PARENT_SCOPE) +endfunction() + +function (cotire_get_source_files_undefs _property _sourceUndefsVar) + set (_sourceUndefs "") + foreach (_sourceFile ${ARGN}) + cotire_get_source_undefs("${_sourceFile}" ${_property} _undefs) + if (_undefs) + list (APPEND _sourceUndefs "${_sourceFile}" ${_undefs} "-") + endif() + endforeach() + set (${_sourceUndefsVar} ${_sourceUndefs} PARENT_SCOPE) +endfunction() + +macro (cotire_set_cmd_to_prologue _cmdVar) + set (${_cmdVar} "${CMAKE_COMMAND}") + if (COTIRE_DEBUG) + list (APPEND ${_cmdVar} "--warn-uninitialized") + endif() + list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$") + if (COTIRE_VERBOSE) + list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON") + elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles") + list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=$(VERBOSE)") + endif() +endmacro() + +function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerExe _compilerArg1) + if (NOT _compilerLauncher) + set (_compilerLauncher ${CMAKE_${_language}_COMPILER_LAUNCHER}) + endif() + if (NOT _compilerExe) + set (_compilerExe "${CMAKE_${_language}_COMPILER}") + endif() + if (NOT _compilerArg1) + set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1}) + endif() + string (STRIP "${_compilerArg1}" _compilerArg1) + if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + # compiler launcher is only supported for Makefile and Ninja + set (${_cmdVar} ${_compilerLauncher} "${_compilerExe}" ${_compilerArg1} PARENT_SCOPE) + else() + set (${_cmdVar} "${_compilerExe}" ${_compilerArg1} PARENT_SCOPE) + endif() +endfunction() + +macro (cotire_add_definitions_to_cmd _cmdVar _language) + foreach (_definition ${ARGN}) + if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + list (APPEND ${_cmdVar} "/D${_definition}") + else() + list (APPEND ${_cmdVar} "-D${_definition}") + endif() + endforeach() +endmacro() + +function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemIncludesVar) + set (_includeDirs ${${_includesVar}} ${${_systemIncludesVar}}) + if (_includeDirs) + list (REMOVE_DUPLICATES _includeDirs) + foreach (_include ${_includeDirs}) + if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + file (TO_NATIVE_PATH "${_include}" _include) + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") + else() + set (_index -1) + if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+") + list (FIND ${_systemIncludesVar} "${_include}" _index) + endif() + if (_index GREATER -1) + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}") + else() + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") + endif() + endif() + endforeach() + endif() + set (${_cmdVar} ${${_cmdVar}} PARENT_SCOPE) +endfunction() + +function (cotire_add_frameworks_to_cmd _cmdVar _language _includesVar _systemIncludesVar) + if (APPLE) + set (_frameworkDirs "") + foreach (_include ${${_includesVar}}) + if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$") + get_filename_component(_frameworkDir "${_include}" DIRECTORY) + list (APPEND _frameworkDirs "${_frameworkDir}") + endif() + endforeach() + set (_systemFrameworkDirs "") + foreach (_include ${${_systemIncludesVar}}) + if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$") + get_filename_component(_frameworkDir "${_include}" DIRECTORY) + list (APPEND _systemFrameworkDirs "${_frameworkDir}") + endif() + endforeach() + if (_systemFrameworkDirs) + list (APPEND _frameworkDirs ${_systemFrameworkDirs}) + endif() + if (_frameworkDirs) + list (REMOVE_DUPLICATES _frameworkDirs) + foreach (_frameworkDir ${_frameworkDirs}) + set (_index -1) + if ("${CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG}" MATCHES ".+") + list (FIND _systemFrameworkDirs "${_frameworkDir}" _index) + endif() + if (_index GREATER -1) + list (APPEND ${_cmdVar} "${CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG}${_frameworkDir}") + else() + list (APPEND ${_cmdVar} "${CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG}${_frameworkDir}") + endif() + endforeach() + endif() + endif() + set (${_cmdVar} ${${_cmdVar}} PARENT_SCOPE) +endfunction() + +macro (cotire_add_compile_flags_to_cmd _cmdVar) + foreach (_flag ${ARGN}) + list (APPEND ${_cmdVar} "${_flag}") + endforeach() +endmacro() + +function (cotire_check_file_up_to_date _fileIsUpToDateVar _file) + if (EXISTS "${_file}") + set (_triggerFile "") + foreach (_dependencyFile ${ARGN}) + if (EXISTS "${_dependencyFile}") + # IS_NEWER_THAN returns TRUE if both files have the same timestamp + # thus we do the comparison in both directions to exclude ties + if ("${_dependencyFile}" IS_NEWER_THAN "${_file}" AND + NOT "${_file}" IS_NEWER_THAN "${_dependencyFile}") + set (_triggerFile "${_dependencyFile}") + break() + endif() + endif() + endforeach() + if (_triggerFile) + if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) + message (STATUS "${_fileName} update triggered by ${_triggerFile} change.") + endif() + set (${_fileIsUpToDateVar} FALSE PARENT_SCOPE) + else() + if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) + message (STATUS "${_fileName} is up-to-date.") + endif() + set (${_fileIsUpToDateVar} TRUE PARENT_SCOPE) + endif() + else() + if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) + message (STATUS "${_fileName} does not exist yet.") + endif() + set (${_fileIsUpToDateVar} FALSE PARENT_SCOPE) + endif() +endfunction() + +macro (cotire_find_closest_relative_path _headerFile _includeDirs _relPathVar) + set (${_relPathVar} "") + foreach (_includeDir ${_includeDirs}) + if (IS_DIRECTORY "${_includeDir}") + file (RELATIVE_PATH _relPath "${_includeDir}" "${_headerFile}") + if (NOT IS_ABSOLUTE "${_relPath}" AND NOT "${_relPath}" MATCHES "^\\.\\.") + string (LENGTH "${${_relPathVar}}" _closestLen) + string (LENGTH "${_relPath}" _relLen) + if (_closestLen EQUAL 0 OR _relLen LESS _closestLen) + set (${_relPathVar} "${_relPath}") + endif() + endif() + elseif ("${_includeDir}" STREQUAL "${_headerFile}") + # if path matches exactly, return short non-empty string + set (${_relPathVar} "1") + break() + endif() + endforeach() +endmacro() + +macro (cotire_check_header_file_location _headerFile _insideIncludeDirs _outsideIncludeDirs _headerIsInside) + # check header path against ignored and honored include directories + cotire_find_closest_relative_path("${_headerFile}" "${_insideIncludeDirs}" _insideRelPath) + if (_insideRelPath) + # header is inside, but could be become outside if there is a shorter outside match + cotire_find_closest_relative_path("${_headerFile}" "${_outsideIncludeDirs}" _outsideRelPath) + if (_outsideRelPath) + string (LENGTH "${_insideRelPath}" _insideRelPathLen) + string (LENGTH "${_outsideRelPath}" _outsideRelPathLen) + if (_outsideRelPathLen LESS _insideRelPathLen) + set (${_headerIsInside} FALSE) + else() + set (${_headerIsInside} TRUE) + endif() + else() + set (${_headerIsInside} TRUE) + endif() + else() + # header is outside + set (${_headerIsInside} FALSE) + endif() +endmacro() + +macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar) + if (NOT EXISTS "${_headerFile}") + 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 + # 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" + set (${_headerIsIgnoredVar} TRUE) + else() + set (${_headerIsIgnoredVar} FALSE) + endif() +endmacro() + +macro (cotire_check_ignore_header_file_ext _headerFile _ignoreExtensionsVar _headerIsIgnoredVar) + # check header file extension + cotire_get_source_file_extension("${_headerFile}" _headerFileExt) + set (${_headerIsIgnoredVar} FALSE) + if (_headerFileExt) + list (FIND ${_ignoreExtensionsVar} "${_headerFileExt}" _index) + if (_index GREATER -1) + set (${_headerIsIgnoredVar} TRUE) + endif() + endif() +endmacro() + +macro (cotire_parse_line _line _headerFileVar _headerDepthVar) + if (MSVC) + # cl.exe /showIncludes output looks different depending on the language pack used, e.g.: + # English: "Note: including file: C:\directory\file" + # German: "Hinweis: Einlesen der Datei: C:\directory\file" + # We use a very general regular expression, relying on the presence of the : characters + if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$") + # Visual Studio compiler output + string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar}) + get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE) + else() + set (${_headerFileVar} "") + set (${_headerDepthVar} 0) + endif() + else() + if (_line MATCHES "^(\\.+) (.*)$") + # GCC like output + string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar}) + if (IS_ABSOLUTE "${CMAKE_MATCH_2}") + set (${_headerFileVar} "${CMAKE_MATCH_2}") + else() + get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" REALPATH) + endif() + else() + set (${_headerFileVar} "") + set (${_headerDepthVar} 0) + endif() + endif() +endmacro() + +function (cotire_parse_includes _language _scanOutput _ignoredIncludeDirs _honoredIncludeDirs _ignoredExtensions _selectedIncludesVar _unparsedLinesVar) + if (WIN32) + # prevent CMake macro invocation errors due to backslash characters in Windows paths + string (REPLACE "\\" "/" _scanOutput "${_scanOutput}") + endif() + # canonize slashes + string (REPLACE "//" "/" _scanOutput "${_scanOutput}") + # prevent semicolon from being interpreted as a line separator + string (REPLACE ";" "\\;" _scanOutput "${_scanOutput}") + # then separate lines + string (REGEX REPLACE "\n" ";" _scanOutput "${_scanOutput}") + list (LENGTH _scanOutput _len) + # remove duplicate lines to speed up parsing + list (REMOVE_DUPLICATES _scanOutput) + list (LENGTH _scanOutput _uniqueLen) + if (COTIRE_VERBOSE OR COTIRE_DEBUG) + message (STATUS "Scanning ${_uniqueLen} unique lines of ${_len} for includes") + if (_ignoredExtensions) + message (STATUS "Ignored extensions: ${_ignoredExtensions}") + endif() + if (_ignoredIncludeDirs) + message (STATUS "Ignored paths: ${_ignoredIncludeDirs}") + endif() + if (_honoredIncludeDirs) + message (STATUS "Included paths: ${_honoredIncludeDirs}") + endif() + endif() + set (_sourceFiles ${ARGN}) + set (_selectedIncludes "") + set (_unparsedLines "") + # stack keeps track of inside/outside project status of processed header files + set (_headerIsInsideStack "") + foreach (_line IN LISTS _scanOutput) + if (_line) + cotire_parse_line("${_line}" _headerFile _headerDepth) + if (_headerFile) + cotire_check_header_file_location("${_headerFile}" "${_ignoredIncludeDirs}" "${_honoredIncludeDirs}" _headerIsInside) + if (COTIRE_DEBUG) + message (STATUS "${_headerDepth}: ${_headerFile} ${_headerIsInside}") + endif() + # update stack + list (LENGTH _headerIsInsideStack _stackLen) + if (_headerDepth GREATER _stackLen) + math (EXPR _stackLen "${_stackLen} + 1") + foreach (_index RANGE ${_stackLen} ${_headerDepth}) + list (APPEND _headerIsInsideStack ${_headerIsInside}) + endforeach() + else() + foreach (_index RANGE ${_headerDepth} ${_stackLen}) + list (REMOVE_AT _headerIsInsideStack -1) + endforeach() + list (APPEND _headerIsInsideStack ${_headerIsInside}) + endif() + if (COTIRE_DEBUG) + message (STATUS "${_headerIsInsideStack}") + endif() + # header is a candidate if it is outside project + if (NOT _headerIsInside) + # get parent header file's inside/outside status + if (_headerDepth GREATER 1) + math (EXPR _index "${_headerDepth} - 2") + list (GET _headerIsInsideStack ${_index} _parentHeaderIsInside) + else() + set (_parentHeaderIsInside TRUE) + endif() + # select header file if parent header file is inside project + # (e.g., a project header file that includes a standard header file) + if (_parentHeaderIsInside) + cotire_check_ignore_header_file_path("${_headerFile}" _headerIsIgnored) + if (NOT _headerIsIgnored) + cotire_check_ignore_header_file_ext("${_headerFile}" _ignoredExtensions _headerIsIgnored) + if (NOT _headerIsIgnored) + list (APPEND _selectedIncludes "${_headerFile}") + else() + # fix header's inside status on stack, it is ignored by extension now + list (REMOVE_AT _headerIsInsideStack -1) + list (APPEND _headerIsInsideStack TRUE) + endif() + endif() + if (COTIRE_DEBUG) + message (STATUS "${_headerFile} ${_ignoredExtensions} ${_headerIsIgnored}") + endif() + endif() + endif() + else() + if (MSVC) + # for cl.exe do not keep unparsed lines which solely consist of a source file name + string (FIND "${_sourceFiles}" "${_line}" _index) + if (_index LESS 0) + list (APPEND _unparsedLines "${_line}") + endif() + else() + list (APPEND _unparsedLines "${_line}") + endif() + endif() + endif() + endforeach() + list (REMOVE_DUPLICATES _selectedIncludes) + set (${_selectedIncludesVar} ${_selectedIncludes} PARENT_SCOPE) + set (${_unparsedLinesVar} ${_unparsedLines} PARENT_SCOPE) +endfunction() + +function (cotire_scan_includes _includesVar) + set(_options "") + set(_oneValueArgs COMPILER_ID COMPILER_EXECUTABLE COMPILER_ARG1 COMPILER_VERSION LANGUAGE UNPARSED_LINES SCAN_RESULT) + set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES + IGNORE_PATH INCLUDE_PATH IGNORE_EXTENSIONS INCLUDE_PRIORITY_PATH COMPILER_LAUNCHER) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + set (_sourceFiles ${_option_UNPARSED_ARGUMENTS}) + if (NOT _option_LANGUAGE) + set (_option_LANGUAGE "CXX") + endif() + if (NOT _option_COMPILER_ID) + set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") + endif() + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() + cotire_init_compile_cmd(_cmd "${_option_LANGUAGE}" "${_option_COMPILER_LAUNCHER}" "${_option_COMPILER_EXECUTABLE}" "${_option_COMPILER_ARG1}") + cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS}) + cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS}) + cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_makedep_flags("${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}" _cmd) + # only consider existing source files for scanning + set (_existingSourceFiles "") + foreach (_sourceFile ${_sourceFiles}) + if (EXISTS "${_sourceFile}") + list (APPEND _existingSourceFiles "${_sourceFile}") + endif() + endforeach() + if (NOT _existingSourceFiles) + set (${_includesVar} "" PARENT_SCOPE) + return() + endif() + list (APPEND _cmd ${_existingSourceFiles}) + if (COTIRE_VERBOSE) + message (STATUS "execute_process: ${_cmd}") + endif() + if (_option_COMPILER_ID MATCHES "MSVC") + # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared + unset (ENV{VS_UNICODE_OUTPUT}) + endif() + execute_process( + COMMAND ${_cmd} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_VARIABLE _output) + if (_result) + message (STATUS "Result ${_result} scanning includes of ${_existingSourceFiles}.") + endif() + cotire_parse_includes( + "${_option_LANGUAGE}" "${_output}" + "${_option_IGNORE_PATH}" "${_option_INCLUDE_PATH}" + "${_option_IGNORE_EXTENSIONS}" + _includes _unparsedLines + ${_sourceFiles}) + if (_option_INCLUDE_PRIORITY_PATH) + set (_sortedIncludes "") + foreach (_priorityPath ${_option_INCLUDE_PRIORITY_PATH}) + foreach (_include ${_includes}) + string (FIND ${_include} ${_priorityPath} _position) + if (_position GREATER -1) + list (APPEND _sortedIncludes ${_include}) + endif() + endforeach() + endforeach() + if (_sortedIncludes) + list (INSERT _includes 0 ${_sortedIncludes}) + list (REMOVE_DUPLICATES _includes) + endif() + endif() + set (${_includesVar} ${_includes} PARENT_SCOPE) + if (_option_UNPARSED_LINES) + set (${_option_UNPARSED_LINES} ${_unparsedLines} PARENT_SCOPE) + endif() + if (_option_SCAN_RESULT) + set (${_option_SCAN_RESULT} ${_result} PARENT_SCOPE) + endif() +endfunction() + +macro (cotire_append_undefs _contentsVar) + set (_undefs ${ARGN}) + if (_undefs) + list (REMOVE_DUPLICATES _undefs) + foreach (_definition ${_undefs}) + list (APPEND ${_contentsVar} "#undef ${_definition}") + endforeach() + endif() +endmacro() + +macro (cotire_comment_str _language _commentText _commentVar) + if ("${_language}" STREQUAL "CMAKE") + set (${_commentVar} "# ${_commentText}") + else() + set (${_commentVar} "/* ${_commentText} */") + endif() +endmacro() + +function (cotire_write_file _language _file _contents _force) + get_filename_component(_moduleName "${COTIRE_CMAKE_MODULE_FILE}" NAME) + cotire_comment_str("${_language}" "${_moduleName} ${COTIRE_CMAKE_MODULE_VERSION} generated file" _header1) + cotire_comment_str("${_language}" "${_file}" _header2) + set (_contents "${_header1}\n${_header2}\n${_contents}") + if (COTIRE_DEBUG) + message (STATUS "${_contents}") + endif() + if (_force OR NOT EXISTS "${_file}") + file (WRITE "${_file}" "${_contents}") + else() + file (READ "${_file}" _oldContents) + if (NOT "${_oldContents}" STREQUAL "${_contents}") + file (WRITE "${_file}" "${_contents}") + else() + if (COTIRE_DEBUG) + message (STATUS "${_file} unchanged") + endif() + endif() + endif() +endfunction() + +function (cotire_generate_unity_source _unityFile) + set(_options "") + set(_oneValueArgs LANGUAGE) + set(_multiValueArgs + DEPENDS SOURCES_COMPILE_DEFINITIONS + PRE_UNDEFS SOURCES_PRE_UNDEFS POST_UNDEFS SOURCES_POST_UNDEFS PROLOGUE EPILOGUE) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + if (_option_DEPENDS) + cotire_check_file_up_to_date(_unityFileIsUpToDate "${_unityFile}" ${_option_DEPENDS}) + if (_unityFileIsUpToDate) + return() + endif() + endif() + set (_sourceFiles ${_option_UNPARSED_ARGUMENTS}) + if (NOT _option_PRE_UNDEFS) + set (_option_PRE_UNDEFS "") + endif() + if (NOT _option_SOURCES_PRE_UNDEFS) + set (_option_SOURCES_PRE_UNDEFS "") + endif() + if (NOT _option_POST_UNDEFS) + set (_option_POST_UNDEFS "") + endif() + if (NOT _option_SOURCES_POST_UNDEFS) + set (_option_SOURCES_POST_UNDEFS "") + endif() + set (_contents "") + if (_option_PROLOGUE) + list (APPEND _contents ${_option_PROLOGUE}) + endif() + if (_option_LANGUAGE AND _sourceFiles) + if ("${_option_LANGUAGE}" STREQUAL "CXX") + list (APPEND _contents "#ifdef __cplusplus") + elseif ("${_option_LANGUAGE}" STREQUAL "C") + list (APPEND _contents "#ifndef __cplusplus") + endif() + endif() + set (_compileUndefinitions "") + foreach (_sourceFile ${_sourceFiles}) + cotire_get_source_compile_definitions( + "${_option_CONFIGURATION}" "${_option_LANGUAGE}" "${_sourceFile}" _compileDefinitions + ${_option_SOURCES_COMPILE_DEFINITIONS}) + cotire_get_source_undefs("${_sourceFile}" COTIRE_UNITY_SOURCE_PRE_UNDEFS _sourcePreUndefs ${_option_SOURCES_PRE_UNDEFS}) + cotire_get_source_undefs("${_sourceFile}" COTIRE_UNITY_SOURCE_POST_UNDEFS _sourcePostUndefs ${_option_SOURCES_POST_UNDEFS}) + if (_option_PRE_UNDEFS) + list (APPEND _compileUndefinitions ${_option_PRE_UNDEFS}) + endif() + if (_sourcePreUndefs) + list (APPEND _compileUndefinitions ${_sourcePreUndefs}) + endif() + if (_compileUndefinitions) + cotire_append_undefs(_contents ${_compileUndefinitions}) + set (_compileUndefinitions "") + endif() + if (_sourcePostUndefs) + list (APPEND _compileUndefinitions ${_sourcePostUndefs}) + endif() + if (_option_POST_UNDEFS) + list (APPEND _compileUndefinitions ${_option_POST_UNDEFS}) + endif() + foreach (_definition ${_compileDefinitions}) + if (_definition MATCHES "^([a-zA-Z0-9_]+)=(.+)$") + list (APPEND _contents "#define ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}") + list (INSERT _compileUndefinitions 0 "${CMAKE_MATCH_1}") + else() + list (APPEND _contents "#define ${_definition}") + list (INSERT _compileUndefinitions 0 "${_definition}") + endif() + endforeach() + # use absolute path as source file location + get_filename_component(_sourceFileLocation "${_sourceFile}" ABSOLUTE) + if (WIN32) + file (TO_NATIVE_PATH "${_sourceFileLocation}" _sourceFileLocation) + endif() + list (APPEND _contents "#include \"${_sourceFileLocation}\"") + endforeach() + if (_compileUndefinitions) + cotire_append_undefs(_contents ${_compileUndefinitions}) + set (_compileUndefinitions "") + endif() + if (_option_LANGUAGE AND _sourceFiles) + list (APPEND _contents "#endif") + endif() + if (_option_EPILOGUE) + list (APPEND _contents ${_option_EPILOGUE}) + endif() + list (APPEND _contents "") + string (REPLACE ";" "\n" _contents "${_contents}") + if (COTIRE_VERBOSE) + message ("${_contents}") + endif() + cotire_write_file("${_option_LANGUAGE}" "${_unityFile}" "${_contents}" TRUE) +endfunction() + +function (cotire_generate_prefix_header _prefixFile) + set(_options "") + set(_oneValueArgs LANGUAGE COMPILER_EXECUTABLE COMPILER_ARG1 COMPILER_ID COMPILER_VERSION) + set(_multiValueArgs DEPENDS COMPILE_DEFINITIONS COMPILE_FLAGS + INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES IGNORE_PATH INCLUDE_PATH + IGNORE_EXTENSIONS INCLUDE_PRIORITY_PATH COMPILER_LAUNCHER) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + if (NOT _option_COMPILER_ID) + set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") + endif() + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() + if (_option_DEPENDS) + cotire_check_file_up_to_date(_prefixFileIsUpToDate "${_prefixFile}" ${_option_DEPENDS}) + if (_prefixFileIsUpToDate) + # create empty log file + set (_unparsedLinesFile "${_prefixFile}.log") + file (WRITE "${_unparsedLinesFile}" "") + return() + endif() + endif() + set (_prologue "") + set (_epilogue "") + if (_option_COMPILER_ID MATCHES "Clang") + set (_prologue "#pragma clang system_header") + elseif (_option_COMPILER_ID MATCHES "GNU") + set (_prologue "#pragma GCC system_header") + elseif (_option_COMPILER_ID MATCHES "MSVC") + set (_prologue "#pragma warning(push, 0)") + set (_epilogue "#pragma warning(pop)") + elseif (_option_COMPILER_ID MATCHES "Intel") + # Intel compiler requires hdrstop pragma to stop generating PCH file + set (_epilogue "#pragma hdrstop") + endif() + set (_sourceFiles ${_option_UNPARSED_ARGUMENTS}) + cotire_scan_includes(_selectedHeaders ${_sourceFiles} + LANGUAGE "${_option_LANGUAGE}" + COMPILER_LAUNCHER "${_option_COMPILER_LAUNCHER}" + COMPILER_EXECUTABLE "${_option_COMPILER_EXECUTABLE}" + COMPILER_ARG1 "${_option_COMPILER_ARG1}" + COMPILER_ID "${_option_COMPILER_ID}" + COMPILER_VERSION "${_option_COMPILER_VERSION}" + COMPILE_DEFINITIONS ${_option_COMPILE_DEFINITIONS} + COMPILE_FLAGS ${_option_COMPILE_FLAGS} + INCLUDE_DIRECTORIES ${_option_INCLUDE_DIRECTORIES} + SYSTEM_INCLUDE_DIRECTORIES ${_option_SYSTEM_INCLUDE_DIRECTORIES} + IGNORE_PATH ${_option_IGNORE_PATH} + INCLUDE_PATH ${_option_INCLUDE_PATH} + IGNORE_EXTENSIONS ${_option_IGNORE_EXTENSIONS} + INCLUDE_PRIORITY_PATH ${_option_INCLUDE_PRIORITY_PATH} + UNPARSED_LINES _unparsedLines + SCAN_RESULT _scanResult) + cotire_generate_unity_source("${_prefixFile}" + PROLOGUE ${_prologue} EPILOGUE ${_epilogue} LANGUAGE "${_option_LANGUAGE}" ${_selectedHeaders}) + set (_unparsedLinesFile "${_prefixFile}.log") + if (_unparsedLines) + if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders) + list (LENGTH _unparsedLines _skippedLineCount) + message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}") + endif() + string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}") + endif() + file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}") +endfunction() + +function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar) + set (_flags ${${_flagsVar}}) + if (_compilerID MATCHES "MSVC") + # cl.exe options used + # /nologo suppresses display of sign-on banner + # /TC treat all files named on the command line as C source files + # /TP treat all files named on the command line as C++ source files + # /EP preprocess to stdout without #line directives + # /showIncludes list include files + set (_sourceFileTypeC "/TC") + set (_sourceFileTypeCXX "/TP") + if (_flags) + # append to list + list (APPEND _flags /nologo "${_sourceFileType${_language}}" /EP /showIncludes) + else() + # return as a flag string + set (_flags "${_sourceFileType${_language}} /EP /showIncludes") + endif() + elseif (_compilerID MATCHES "GNU") + # GCC options used + # -H print the name of each header file used + # -E invoke preprocessor + # -fdirectives-only do not expand macros, requires GCC >= 4.3 + if (_flags) + # append to list + list (APPEND _flags -H -E) + if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0") + list (APPEND _flags "-fdirectives-only") + endif() + else() + # return as a flag string + set (_flags "-H -E") + if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0") + set (_flags "${_flags} -fdirectives-only") + endif() + endif() + elseif (_compilerID MATCHES "Clang") + # Clang options used + # -H print the name of each header file used + # -E invoke preprocessor + # -fno-color-diagnostics don't prints diagnostics in color + if (_flags) + # append to list + list (APPEND _flags -H -E -fno-color-diagnostics) + else() + # return as a flag string + set (_flags "-H -E -fno-color-diagnostics") + endif() + elseif (_compilerID MATCHES "Intel") + if (WIN32) + # Windows Intel options used + # /nologo do not display compiler version information + # /QH display the include file order + # /EP preprocess to stdout, omitting #line directives + # /TC process all source or unrecognized file types as C source files + # /TP process all source or unrecognized file types as C++ source files + set (_sourceFileTypeC "/TC") + set (_sourceFileTypeCXX "/TP") + if (_flags) + # append to list + list (APPEND _flags /nologo "${_sourceFileType${_language}}" /EP /QH) + else() + # return as a flag string + set (_flags "${_sourceFileType${_language}} /EP /QH") + endif() + else() + # Linux / Mac OS X Intel options used + # -H print the name of each header file used + # -EP preprocess to stdout, omitting #line directives + # -Kc++ process all source or unrecognized file types as C++ source files + if (_flags) + # append to list + if ("${_language}" STREQUAL "CXX") + list (APPEND _flags -Kc++) + endif() + list (APPEND _flags -H -EP) + else() + # return as a flag string + if ("${_language}" STREQUAL "CXX") + set (_flags "-Kc++ ") + endif() + set (_flags "${_flags}-H -EP") + endif() + endif() + else() + message (FATAL_ERROR "cotire: unsupported ${_language} compiler ${_compilerID} version ${_compilerVersion}.") + endif() + set (${_flagsVar} ${_flags} PARENT_SCOPE) +endfunction() + +function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersion _prefixFile _pchFile _hostFile _flagsVar) + set (_flags ${${_flagsVar}}) + if (_compilerID MATCHES "MSVC") + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) + file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative) + # cl.exe options used + # /Yc creates a precompiled header file + # /Fp specifies precompiled header binary file name + # /FI forces inclusion of file + # /TC treat all files named on the command line as C source files + # /TP treat all files named on the command line as C++ source files + # /Zs syntax check only + # /Zm precompiled header memory allocation scaling factor + set (_sourceFileTypeC "/TC") + set (_sourceFileTypeCXX "/TP") + if (_flags) + # append to list + list (APPEND _flags /nologo "${_sourceFileType${_language}}" + "/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + list (APPEND _flags "/Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() + else() + # return as a flag string + set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() + endif() + elseif (_compilerID MATCHES "GNU|Clang") + # GCC / Clang options used + # -x specify the source language + # -c compile but do not link + # -o place output in file + # note that we cannot use -w to suppress all warnings upon pre-compiling, because turning off a warning may + # alter compile flags as a side effect (e.g., -Wwrite-string implies -fconst-strings) + set (_xLanguage_C "c-header") + set (_xLanguage_CXX "c++-header") + if (_flags) + # append to list + list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}") + else() + # return as a flag string + set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"") + endif() + elseif (_compilerID MATCHES "Intel") + if (WIN32) + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) + file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative) + # Windows Intel options used + # /nologo do not display compiler version information + # /Yc create a precompiled header (PCH) file + # /Fp specify a path or file name for precompiled header files + # /FI tells the preprocessor to include a specified file name as the header file + # /TC process all source or unrecognized file types as C source files + # /TP process all source or unrecognized file types as C++ source files + # /Zs syntax check only + # /Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) + set (_sourceFileTypeC "/TC") + set (_sourceFileTypeCXX "/TP") + if (_flags) + # append to list + list (APPEND _flags /nologo "${_sourceFileType${_language}}" + "/Yc" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + list (APPEND _flags "/Wpch-messages") + endif() + else() + # return as a flag string + set (_flags "/Yc /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + set (_flags "${_flags} /Wpch-messages") + endif() + endif() + else() + # Linux / Mac OS X Intel options used + # -pch-dir location for precompiled header files + # -pch-create name of the precompiled header (PCH) to create + # -Kc++ process all source or unrecognized file types as C++ source files + # -fsyntax-only check only for correct syntax + # -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) + get_filename_component(_pchDir "${_pchFile}" DIRECTORY) + get_filename_component(_pchName "${_pchFile}" NAME) + set (_xLanguage_C "c-header") + set (_xLanguage_CXX "c++-header") + if (_flags) + # append to list + if ("${_language}" STREQUAL "CXX") + list (APPEND _flags -Kc++) + endif() + list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + list (APPEND _flags "-Wpch-messages") + endif() + else() + # return as a flag string + set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + set (_flags "${_flags} -Wpch-messages") + endif() + endif() + endif() + else() + message (FATAL_ERROR "cotire: unsupported ${_language} compiler ${_compilerID} version ${_compilerVersion}.") + endif() + set (${_flagsVar} ${_flags} PARENT_SCOPE) +endfunction() + +function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerVersion _prefixFile _pchFile _flagsVar) + set (_flags ${${_flagsVar}}) + if (_compilerID MATCHES "MSVC") + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) + # cl.exe options used + # /Yu uses a precompiled header file during build + # /Fp specifies precompiled header binary file name + # /FI forces inclusion of file + # /Zm precompiled header memory allocation scaling factor + if (_pchFile) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) + if (_flags) + # append to list + list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + list (APPEND _flags "/Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() + else() + # return as a flag string + set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() + endif() + else() + # no precompiled header, force inclusion of prefix header + if (_flags) + # append to list + list (APPEND _flags "/FI${_prefixFileNative}") + else() + # return as a flag string + set (_flags "/FI\"${_prefixFileNative}\"") + endif() + endif() + elseif (_compilerID MATCHES "GNU") + # GCC options used + # -include process include file as the first line of the primary source file + # -Winvalid-pch warns if precompiled header is found but cannot be used + # note: ccache requires the -include flag to be used in order to process precompiled header correctly + if (_flags) + # append to list + list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}") + else() + # return as a flag string + set (_flags "-Winvalid-pch -include \"${_prefixFile}\"") + endif() + elseif (_compilerID MATCHES "Clang") + # Clang options used + # -include process include file as the first line of the primary source file + # -include-pch include precompiled header file + # -Qunused-arguments don't emit warning for unused driver arguments + # note: ccache requires the -include flag to be used in order to process precompiled header correctly + if (_flags) + # append to list + list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}") + else() + # return as a flag string + set (_flags "-Qunused-arguments -include \"${_prefixFile}\"") + endif() + elseif (_compilerID MATCHES "Intel") + if (WIN32) + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) + # Windows Intel options used + # /Yu use a precompiled header (PCH) file + # /Fp specify a path or file name for precompiled header files + # /FI tells the preprocessor to include a specified file name as the header file + # /Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) + if (_pchFile) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) + if (_flags) + # append to list + list (APPEND _flags "/Yu" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + list (APPEND _flags "/Wpch-messages") + endif() + else() + # return as a flag string + set (_flags "/Yu /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + set (_flags "${_flags} /Wpch-messages") + endif() + endif() + else() + # no precompiled header, force inclusion of prefix header + if (_flags) + # append to list + list (APPEND _flags "/FI${_prefixFileNative}") + else() + # return as a flag string + set (_flags "/FI\"${_prefixFileNative}\"") + endif() + endif() + else() + # Linux / Mac OS X Intel options used + # -pch-dir location for precompiled header files + # -pch-use name of the precompiled header (PCH) to use + # -include process include file as the first line of the primary source file + # -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) + if (_pchFile) + get_filename_component(_pchDir "${_pchFile}" DIRECTORY) + get_filename_component(_pchName "${_pchFile}" NAME) + if (_flags) + # append to list + list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + list (APPEND _flags "-Wpch-messages") + endif() + else() + # return as a flag string + set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"") + if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") + set (_flags "${_flags} -Wpch-messages") + endif() + endif() + else() + # no precompiled header, force inclusion of prefix header + if (_flags) + # append to list + list (APPEND _flags "-include" "${_prefixFile}") + else() + # return as a flag string + set (_flags "-include \"${_prefixFile}\"") + endif() + endif() + endif() + else() + message (FATAL_ERROR "cotire: unsupported ${_language} compiler ${_compilerID} version ${_compilerVersion}.") + endif() + set (${_flagsVar} ${_flags} PARENT_SCOPE) +endfunction() + +function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile) + set(_options "") + set(_oneValueArgs COMPILER_EXECUTABLE COMPILER_ARG1 COMPILER_ID COMPILER_VERSION LANGUAGE) + set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES SYS COMPILER_LAUNCHER) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + if (NOT _option_LANGUAGE) + set (_option_LANGUAGE "CXX") + endif() + if (NOT _option_COMPILER_ID) + set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") + endif() + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() + cotire_init_compile_cmd(_cmd "${_option_LANGUAGE}" "${_option_COMPILER_LAUNCHER}" "${_option_COMPILER_EXECUTABLE}" "${_option_COMPILER_ARG1}") + cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS}) + cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS}) + cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_pch_compilation_flags( + "${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" "${_hostFile}" _cmd) + if (COTIRE_VERBOSE) + message (STATUS "execute_process: ${_cmd}") + endif() + if (_option_COMPILER_ID MATCHES "MSVC") + # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared + unset (ENV{VS_UNICODE_OUTPUT}) + endif() + execute_process( + COMMAND ${_cmd} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE _result) + if (_result) + message (FATAL_ERROR "cotire: error ${_result} precompiling ${_prefixFile}.") + endif() +endfunction() + +function (cotire_check_precompiled_header_support _language _target _msgVar) + set (_unsupportedCompiler + "Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}") + if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC") + # supported since Visual Studio C++ 6.0 + # and CMake does not support an earlier version + set (${_msgVar} "" PARENT_SCOPE) + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU") + # GCC PCH support requires version >= 3.4 + if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "3.4.0") + set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) + else() + set (${_msgVar} "" PARENT_SCOPE) + endif() + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang") + # all Clang versions have PCH support + set (${_msgVar} "" PARENT_SCOPE) + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel") + # Intel PCH support requires version >= 8.0.0 + if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0") + set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) + else() + set (${_msgVar} "" PARENT_SCOPE) + endif() + else() + set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE) + endif() + get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER) + if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache") + if (DEFINED ENV{CCACHE_SLOPPINESS}) + if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros") + set (${_msgVar} + "ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"." + PARENT_SCOPE) + endif() + else() + if (_launcher MATCHES "ccache") + get_filename_component(_ccacheExe "${_launcher}" REALPATH) + else() + get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH) + endif() + execute_process( + COMMAND "${_ccacheExe}" "--print-config" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + RESULT_VARIABLE _result + OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + if (_result OR NOT + _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT + _ccacheConfig MATCHES "sloppiness.*=.*pch_defines") + set (${_msgVar} + "ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"." + PARENT_SCOPE) + endif() + endif() + endif() + if (APPLE) + # PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64) + cotire_get_configuration_types(_configs) + foreach (_config ${_configs}) + set (_targetFlags "") + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + cotire_filter_compile_flags("${_language}" "arch" _architectures _ignore ${_targetFlags}) + list (LENGTH _architectures _numberOfArchitectures) + if (_numberOfArchitectures GREATER 1) + string (REPLACE ";" ", " _architectureStr "${_architectures}") + set (${_msgVar} + "Precompiled headers not supported on Darwin for multi-architecture builds (${_architectureStr})." + PARENT_SCOPE) + break() + endif() + endforeach() + endif() +endfunction() + +macro (cotire_get_intermediate_dir _cotireDir) + # ${CMAKE_CFG_INTDIR} may reference a build-time variable when using a generator which supports configuration types + get_filename_component(${_cotireDir} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${COTIRE_INTDIR}" ABSOLUTE) +endmacro() + +macro (cotire_setup_file_extension_variables) + set (_unityFileExt_C ".c") + set (_unityFileExt_CXX ".cxx") + set (_prefixFileExt_C ".h") + set (_prefixFileExt_CXX ".hxx") + set (_prefixSourceFileExt_C ".c") + set (_prefixSourceFileExt_CXX ".cxx") +endmacro() + +function (cotire_make_single_unity_source_file_path _language _target _unityFileVar) + cotire_setup_file_extension_variables() + if (NOT DEFINED _unityFileExt_${_language}) + set (${_unityFileVar} "" PARENT_SCOPE) + return() + endif() + set (_unityFileBaseName "${_target}_${_language}${COTIRE_UNITY_SOURCE_FILENAME_SUFFIX}") + set (_unityFileName "${_unityFileBaseName}${_unityFileExt_${_language}}") + cotire_get_intermediate_dir(_baseDir) + set (_unityFile "${_baseDir}/${_unityFileName}") + set (${_unityFileVar} "${_unityFile}" PARENT_SCOPE) +endfunction() + +function (cotire_make_unity_source_file_paths _language _target _maxIncludes _unityFilesVar) + cotire_setup_file_extension_variables() + if (NOT DEFINED _unityFileExt_${_language}) + set (${_unityFileVar} "" PARENT_SCOPE) + return() + endif() + set (_unityFileBaseName "${_target}_${_language}${COTIRE_UNITY_SOURCE_FILENAME_SUFFIX}") + cotire_get_intermediate_dir(_baseDir) + set (_startIndex 0) + set (_index 0) + set (_unityFiles "") + set (_sourceFiles ${ARGN}) + foreach (_sourceFile ${_sourceFiles}) + get_source_file_property(_startNew "${_sourceFile}" COTIRE_START_NEW_UNITY_SOURCE) + math (EXPR _unityFileCount "${_index} - ${_startIndex}") + if (_startNew OR (_maxIncludes GREATER 0 AND NOT _unityFileCount LESS _maxIncludes)) + if (_index GREATER 0) + # start new unity file segment + math (EXPR _endIndex "${_index} - 1") + set (_unityFileName "${_unityFileBaseName}_${_startIndex}_${_endIndex}${_unityFileExt_${_language}}") + list (APPEND _unityFiles "${_baseDir}/${_unityFileName}") + endif() + set (_startIndex ${_index}) + endif() + math (EXPR _index "${_index} + 1") + endforeach() + list (LENGTH _sourceFiles _numberOfSources) + if (_startIndex EQUAL 0) + # there is only a single unity file + cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFiles) + elseif (_startIndex LESS _numberOfSources) + # end with final unity file segment + math (EXPR _endIndex "${_index} - 1") + set (_unityFileName "${_unityFileBaseName}_${_startIndex}_${_endIndex}${_unityFileExt_${_language}}") + list (APPEND _unityFiles "${_baseDir}/${_unityFileName}") + endif() + set (${_unityFilesVar} ${_unityFiles} PARENT_SCOPE) + if (COTIRE_DEBUG AND _unityFiles) + message (STATUS "unity files: ${_unityFiles}") + endif() +endfunction() + +function (cotire_unity_to_prefix_file_path _language _target _unityFile _prefixFileVar) + cotire_setup_file_extension_variables() + if (NOT DEFINED _unityFileExt_${_language}) + set (${_prefixFileVar} "" PARENT_SCOPE) + return() + endif() + set (_unityFileBaseName "${_target}_${_language}${COTIRE_UNITY_SOURCE_FILENAME_SUFFIX}") + set (_prefixFileBaseName "${_target}_${_language}${COTIRE_PREFIX_HEADER_FILENAME_SUFFIX}") + string (REPLACE "${_unityFileBaseName}" "${_prefixFileBaseName}" _prefixFile "${_unityFile}") + string (REGEX REPLACE "${_unityFileExt_${_language}}$" "${_prefixFileExt_${_language}}" _prefixFile "${_prefixFile}") + set (${_prefixFileVar} "${_prefixFile}" PARENT_SCOPE) +endfunction() + +function (cotire_prefix_header_to_source_file_path _language _prefixHeaderFile _prefixSourceFileVar) + cotire_setup_file_extension_variables() + if (NOT DEFINED _prefixSourceFileExt_${_language}) + set (${_prefixSourceFileVar} "" PARENT_SCOPE) + return() + endif() + string (REGEX REPLACE "${_prefixFileExt_${_language}}$" "${_prefixSourceFileExt_${_language}}" _prefixSourceFile "${_prefixHeaderFile}") + set (${_prefixSourceFileVar} "${_prefixSourceFile}" PARENT_SCOPE) +endfunction() + +function (cotire_make_prefix_file_name _language _target _prefixFileBaseNameVar _prefixFileNameVar) + cotire_setup_file_extension_variables() + if (NOT _language) + set (_prefixFileBaseName "${_target}${COTIRE_PREFIX_HEADER_FILENAME_SUFFIX}") + set (_prefixFileName "${_prefixFileBaseName}${_prefixFileExt_C}") + elseif (DEFINED _prefixFileExt_${_language}) + set (_prefixFileBaseName "${_target}_${_language}${COTIRE_PREFIX_HEADER_FILENAME_SUFFIX}") + set (_prefixFileName "${_prefixFileBaseName}${_prefixFileExt_${_language}}") + else() + set (_prefixFileBaseName "") + set (_prefixFileName "") + endif() + set (${_prefixFileBaseNameVar} "${_prefixFileBaseName}" PARENT_SCOPE) + set (${_prefixFileNameVar} "${_prefixFileName}" PARENT_SCOPE) +endfunction() + +function (cotire_make_prefix_file_path _language _target _prefixFileVar) + cotire_make_prefix_file_name("${_language}" "${_target}" _prefixFileBaseName _prefixFileName) + set (${_prefixFileVar} "" PARENT_SCOPE) + if (_prefixFileName) + if (NOT _language) + set (_language "C") + endif() + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang|Intel|MSVC") + cotire_get_intermediate_dir(_baseDir) + set (${_prefixFileVar} "${_baseDir}/${_prefixFileName}" PARENT_SCOPE) + endif() + endif() +endfunction() + +function (cotire_make_pch_file_path _language _target _pchFileVar) + cotire_make_prefix_file_name("${_language}" "${_target}" _prefixFileBaseName _prefixFileName) + set (${_pchFileVar} "" PARENT_SCOPE) + if (_prefixFileBaseName AND _prefixFileName) + cotire_check_precompiled_header_support("${_language}" "${_target}" _msg) + if (NOT _msg) + if (XCODE) + # For Xcode, we completely hand off the compilation of the prefix header to the IDE + return() + endif() + cotire_get_intermediate_dir(_baseDir) + if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC") + # MSVC uses the extension .pch added to the prefix header base name + set (${_pchFileVar} "${_baseDir}/${_prefixFileBaseName}.pch" PARENT_SCOPE) + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang") + # Clang looks for a precompiled header corresponding to the prefix header with the extension .pch appended + set (${_pchFileVar} "${_baseDir}/${_prefixFileName}.pch" PARENT_SCOPE) + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU") + # GCC looks for a precompiled header corresponding to the prefix header with the extension .gch appended + set (${_pchFileVar} "${_baseDir}/${_prefixFileName}.gch" PARENT_SCOPE) + elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel") + # Intel uses the extension .pchi added to the prefix header base name + set (${_pchFileVar} "${_baseDir}/${_prefixFileBaseName}.pchi" PARENT_SCOPE) + endif() + endif() + endif() +endfunction() + +function (cotire_select_unity_source_files _unityFile _sourcesVar) + set (_sourceFiles ${ARGN}) + if (_sourceFiles AND "${_unityFile}" MATCHES "${COTIRE_UNITY_SOURCE_FILENAME_SUFFIX}_([0-9]+)_([0-9]+)") + set (_startIndex ${CMAKE_MATCH_1}) + set (_endIndex ${CMAKE_MATCH_2}) + list (LENGTH _sourceFiles _numberOfSources) + if (NOT _startIndex LESS _numberOfSources) + math (EXPR _startIndex "${_numberOfSources} - 1") + endif() + if (NOT _endIndex LESS _numberOfSources) + math (EXPR _endIndex "${_numberOfSources} - 1") + endif() + set (_files "") + foreach (_index RANGE ${_startIndex} ${_endIndex}) + list (GET _sourceFiles ${_index} _file) + list (APPEND _files "${_file}") + endforeach() + else() + set (_files ${_sourceFiles}) + endif() + set (${_sourcesVar} ${_files} PARENT_SCOPE) +endfunction() + +function (cotire_get_unity_source_dependencies _language _target _dependencySourcesVar) + set (_dependencySources "") + # depend on target's generated source files + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${_targetSourceFiles}) + if (_generatedSources) + # but omit all generated source files that have the COTIRE_EXCLUDED property set to true + cotire_get_objects_with_property_on(_excludedGeneratedSources COTIRE_EXCLUDED SOURCE ${_generatedSources}) + if (_excludedGeneratedSources) + list (REMOVE_ITEM _generatedSources ${_excludedGeneratedSources}) + endif() + # and omit all generated source files that have the COTIRE_DEPENDENCY property set to false explicitly + cotire_get_objects_with_property_off(_excludedNonDependencySources COTIRE_DEPENDENCY SOURCE ${_generatedSources}) + if (_excludedNonDependencySources) + list (REMOVE_ITEM _generatedSources ${_excludedNonDependencySources}) + endif() + if (_generatedSources) + list (APPEND _dependencySources ${_generatedSources}) + endif() + endif() + if (COTIRE_DEBUG AND _dependencySources) + message (STATUS "${_language} ${_target} unity source dependencies: ${_dependencySources}") + endif() + set (${_dependencySourcesVar} ${_dependencySources} PARENT_SCOPE) +endfunction() + +function (cotire_get_prefix_header_dependencies _language _target _dependencySourcesVar) + set (_dependencySources "") + # depend on target source files marked with custom COTIRE_DEPENDENCY property + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_dependencySources COTIRE_DEPENDENCY SOURCE ${_targetSourceFiles}) + if (COTIRE_DEBUG AND _dependencySources) + message (STATUS "${_language} ${_target} prefix header dependencies: ${_dependencySources}") + endif() + set (${_dependencySourcesVar} ${_dependencySources} PARENT_SCOPE) +endfunction() + +function (cotire_generate_target_script _language _configurations _target _targetScriptVar _targetConfigScriptVar) + set (_targetSources ${ARGN}) + cotire_get_prefix_header_dependencies(${_language} ${_target} COTIRE_TARGET_PREFIX_DEPENDS ${_targetSources}) + cotire_get_unity_source_dependencies(${_language} ${_target} COTIRE_TARGET_UNITY_DEPENDS ${_targetSources}) + # set up variables to be configured + set (COTIRE_TARGET_LANGUAGE "${_language}") + get_target_property(COTIRE_TARGET_IGNORE_PATH ${_target} COTIRE_PREFIX_HEADER_IGNORE_PATH) + cotire_add_sys_root_paths(COTIRE_TARGET_IGNORE_PATH) + get_target_property(COTIRE_TARGET_INCLUDE_PATH ${_target} COTIRE_PREFIX_HEADER_INCLUDE_PATH) + cotire_add_sys_root_paths(COTIRE_TARGET_INCLUDE_PATH) + get_target_property(COTIRE_TARGET_PRE_UNDEFS ${_target} COTIRE_UNITY_SOURCE_PRE_UNDEFS) + get_target_property(COTIRE_TARGET_POST_UNDEFS ${_target} COTIRE_UNITY_SOURCE_POST_UNDEFS) + get_target_property(COTIRE_TARGET_MAXIMUM_NUMBER_OF_INCLUDES ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES) + get_target_property(COTIRE_TARGET_INCLUDE_PRIORITY_PATH ${_target} COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH) + cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_PRE_UNDEFS COTIRE_TARGET_SOURCES_PRE_UNDEFS ${_targetSources}) + cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_POST_UNDEFS COTIRE_TARGET_SOURCES_POST_UNDEFS ${_targetSources}) + set (COTIRE_TARGET_CONFIGURATION_TYPES "${_configurations}") + foreach (_config ${_configurations}) + string (TOUPPER "${_config}" _upperConfig) + cotire_get_target_include_directories( + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_INCLUDE_DIRECTORIES_${_upperConfig} COTIRE_TARGET_SYSTEM_INCLUDE_DIRECTORIES_${_upperConfig}) + cotire_get_target_compile_definitions( + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_DEFINITIONS_${_upperConfig}) + cotire_get_target_compiler_flags( + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig}) + cotire_get_source_files_compile_definitions( + "${_config}" "${_language}" COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig} ${_targetSources}) + endforeach() + get_target_property(COTIRE_TARGET_${_language}_COMPILER_LAUNCHER ${_target} ${_language}_COMPILER_LAUNCHER) + # set up COTIRE_TARGET_SOURCES + set (COTIRE_TARGET_SOURCES "") + foreach (_sourceFile ${_targetSources}) + get_source_file_property(_generated "${_sourceFile}" GENERATED) + if (_generated) + # use absolute paths for generated files only, retrieving the LOCATION property is an expensive operation + get_source_file_property(_sourceLocation "${_sourceFile}" LOCATION) + list (APPEND COTIRE_TARGET_SOURCES "${_sourceLocation}") + else() + list (APPEND COTIRE_TARGET_SOURCES "${_sourceFile}") + endif() + endforeach() + # copy variable definitions to cotire target script + get_cmake_property(_vars VARIABLES) + string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+" _matchVars "${_vars}") + # omit COTIRE_*_INIT variables + string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+_INIT" _initVars "${_matchVars}") + if (_initVars) + list (REMOVE_ITEM _matchVars ${_initVars}) + endif() + # omit COTIRE_VERBOSE which is passed as a CMake define on command line + list (REMOVE_ITEM _matchVars COTIRE_VERBOSE) + set (_contents "") + set (_contentsHasGeneratorExpressions FALSE) + foreach (_var IN LISTS _matchVars ITEMS + XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES + CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION + CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1 + CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP + CMAKE_INCLUDE_SYSTEM_FLAG_${_language} + CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG + CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG + CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) + if (DEFINED ${_var}) + string (REPLACE "\"" "\\\"" _value "${${_var}}") + set (_contents "${_contents}set (${_var} \"${_value}\")\n") + if (NOT _contentsHasGeneratorExpressions) + if ("${_value}" MATCHES "\\$<.*>") + set (_contentsHasGeneratorExpressions TRUE) + endif() + endif() + endif() + endforeach() + # generate target script file + get_filename_component(_moduleName "${COTIRE_CMAKE_MODULE_FILE}" NAME) + set (_targetCotireScript "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${_language}_${_moduleName}") + cotire_write_file("CMAKE" "${_targetCotireScript}" "${_contents}" FALSE) + if (_contentsHasGeneratorExpressions) + # use file(GENERATE ...) to expand generator expressions in the target script at CMake generate-time + set (_configNameOrNoneGeneratorExpression "$<$:None>$<$>:$>") + set (_targetCotireConfigScript "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${_language}_${_configNameOrNoneGeneratorExpression}_${_moduleName}") + file (GENERATE OUTPUT "${_targetCotireConfigScript}" INPUT "${_targetCotireScript}") + else() + set (_targetCotireConfigScript "${_targetCotireScript}") + endif() + set (${_targetScriptVar} "${_targetCotireScript}" PARENT_SCOPE) + set (${_targetConfigScriptVar} "${_targetCotireConfigScript}" PARENT_SCOPE) +endfunction() + +function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile) + set (_sourceFiles ${ARGN}) + if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + # for Visual Studio and Intel, we attach the precompiled header compilation to the host file + # the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion + if (_sourceFiles) + set (_flags "") + cotire_add_pch_compilation_flags( + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags) + set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + 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}") + # mark host file as cotired to prevent it from being used in another cotired target + set_property (SOURCE ${_hostFile} PROPERTY COTIRE_TARGET "${_target}") + endif() + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + # for makefile based generator, we add a custom command to precompile the prefix header + if (_targetScript) + cotire_set_cmd_to_prologue(_cmds) + list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "precompile" "${_targetScript}" "${_prefixFile}" "${_pchFile}" "${_hostFile}") + if (MSVC_IDE) + file (TO_NATIVE_PATH "${_pchFile}" _pchFileLogPath) + else() + file (RELATIVE_PATH _pchFileLogPath "${CMAKE_BINARY_DIR}" "${_pchFile}") + endif() + # make precompiled header compilation depend on the actual compiler executable used to force + # re-compilation when the compiler executable is updated. This prevents "created by a different GCC executable" + # warnings when the precompiled header is included. + get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" ABSOLUTE) + if (COTIRE_DEBUG) + message (STATUS "add_custom_command: OUTPUT ${_pchFile} ${_cmds} DEPENDS ${_prefixFile} ${_realCompilerExe} IMPLICIT_DEPENDS ${_language} ${_prefixFile}") + endif() + set_property (SOURCE "${_pchFile}" PROPERTY GENERATED TRUE) + add_custom_command( + OUTPUT "${_pchFile}" + COMMAND ${_cmds} + DEPENDS "${_prefixFile}" "${_realCompilerExe}" + IMPLICIT_DEPENDS ${_language} "${_prefixFile}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Building ${_language} precompiled header ${_pchFileLogPath}" + VERBATIM) + endif() + endif() +endfunction() + +function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile) + if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + # for Visual Studio and Intel, we include the precompiled header in all but the host file + # the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation + set (_sourceFiles ${ARGN}) + list (LENGTH _sourceFiles _numberOfSourceFiles) + if (_numberOfSourceFiles GREATER 0) + # mark sources as cotired to prevent them from being used in another cotired target + set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") + set (_flags "") + cotire_add_prefix_pch_inclusion_flags( + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _flags) + set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + # make object files generated from source files depend on precompiled header + set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") + endif() + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + set (_sourceFiles ${_hostFile} ${ARGN}) + if (NOT _wholeTarget) + # for makefile based generator, we force the inclusion of the prefix header for a subset + # of the source files, if this is a multi-language target or has excluded files + set (_flags "") + cotire_add_prefix_pch_inclusion_flags( + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _flags) + set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + # mark sources as cotired to prevent them from being used in another cotired target + set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") + endif() + # make object files generated from source files depend on precompiled header + set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") + endif() +endfunction() + +function (cotire_setup_prefix_file_inclusion _language _target _prefixFile) + set (_sourceFiles ${ARGN}) + # force the inclusion of the prefix header for the given source files + set (_flags "") + set (_pchFile "") + cotire_add_prefix_pch_inclusion_flags( + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _flags) + set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + # 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 + set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}") +endfunction() + +function (cotire_get_first_set_property_value _propertyValueVar _type _object) + set (_properties ${ARGN}) + foreach (_property ${_properties}) + get_property(_propertyValue ${_type} "${_object}" PROPERTY ${_property}) + if (_propertyValue) + set (${_propertyValueVar} ${_propertyValue} PARENT_SCOPE) + return() + endif() + endforeach() + set (${_propertyValueVar} "" PARENT_SCOPE) +endfunction() + +function (cotire_setup_combine_command _language _targetScript _joinedFile _cmdsVar) + set (_files ${ARGN}) + set (_filesPaths "") + foreach (_file ${_files}) + get_filename_component(_filePath "${_file}" ABSOLUTE) + list (APPEND _filesPaths "${_filePath}") + endforeach() + cotire_set_cmd_to_prologue(_prefixCmd) + list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "combine") + if (_targetScript) + list (APPEND _prefixCmd "${_targetScript}") + endif() + list (APPEND _prefixCmd "${_joinedFile}" ${_filesPaths}) + if (COTIRE_DEBUG) + message (STATUS "add_custom_command: OUTPUT ${_joinedFile} COMMAND ${_prefixCmd} DEPENDS ${_files}") + endif() + set_property (SOURCE "${_joinedFile}" PROPERTY GENERATED TRUE) + if (MSVC_IDE) + file (TO_NATIVE_PATH "${_joinedFile}" _joinedFileLogPath) + else() + file (RELATIVE_PATH _joinedFileLogPath "${CMAKE_BINARY_DIR}" "${_joinedFile}") + endif() + get_filename_component(_joinedFileBaseName "${_joinedFile}" NAME_WE) + get_filename_component(_joinedFileExt "${_joinedFile}" EXT) + if (_language AND _joinedFileBaseName MATCHES "${COTIRE_UNITY_SOURCE_FILENAME_SUFFIX}$") + set (_comment "Generating ${_language} unity source ${_joinedFileLogPath}") + elseif (_language AND _joinedFileBaseName MATCHES "${COTIRE_PREFIX_HEADER_FILENAME_SUFFIX}$") + if (_joinedFileExt MATCHES "^\\.c") + set (_comment "Generating ${_language} prefix source ${_joinedFileLogPath}") + else() + set (_comment "Generating ${_language} prefix header ${_joinedFileLogPath}") + endif() + else() + set (_comment "Generating ${_joinedFileLogPath}") + endif() + add_custom_command( + OUTPUT "${_joinedFile}" + COMMAND ${_prefixCmd} + DEPENDS ${_files} + COMMENT "${_comment}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) + list (APPEND ${_cmdsVar} COMMAND ${_prefixCmd}) + set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_setup_target_pch_usage _languages _target _wholeTarget) + if (XCODE) + # for Xcode, we attach a pre-build action to generate the unity sources and prefix headers + set (_prefixFiles "") + foreach (_language ${_languages}) + get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) + if (_prefixFile) + list (APPEND _prefixFiles "${_prefixFile}") + endif() + endforeach() + set (_cmds ${ARGN}) + list (LENGTH _prefixFiles _numberOfPrefixFiles) + if (_numberOfPrefixFiles GREATER 1) + # we also generate a generic, single prefix header which includes all language specific prefix headers + set (_language "") + set (_targetScript "") + cotire_make_prefix_file_path("${_language}" ${_target} _prefixHeader) + cotire_setup_combine_command("${_language}" "${_targetScript}" "${_prefixHeader}" _cmds ${_prefixFiles}) + else() + set (_prefixHeader "${_prefixFiles}") + endif() + if (COTIRE_DEBUG) + message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}") + endif() + # because CMake PRE_BUILD command does not support dependencies, + # we check dependencies explicity in cotire script mode when the pre-build action is run + add_custom_command( + TARGET "${_target}" + PRE_BUILD ${_cmds} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Updating target ${_target} prefix headers" + VERBATIM) + # make Xcode precompile the generated prefix header with ProcessPCH and ProcessPCH++ + set_target_properties(${_target} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") + set_target_properties(${_target} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${_prefixHeader}") + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + # for makefile based generator, we force inclusion of the prefix header for all target source files + # if this is a single-language target without any excluded files + if (_wholeTarget) + set (_language "${_languages}") + # for Visual Studio and Intel, precompiled header inclusion is always done on the source file level + # see cotire_setup_pch_file_inclusion + if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) + if (_prefixFile) + get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER) + set (_options COMPILE_OPTIONS) + cotire_add_prefix_pch_inclusion_flags( + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _options) + set_property(TARGET ${_target} APPEND PROPERTY ${_options}) + endif() + endif() + endif() + endif() +endfunction() + +function (cotire_setup_unity_generation_commands _language _target _targetScript _targetConfigScript _unityFiles _cmdsVar) + set (_dependencySources "") + cotire_get_unity_source_dependencies(${_language} ${_target} _dependencySources ${ARGN}) + foreach (_unityFile ${_unityFiles}) + set_property (SOURCE "${_unityFile}" PROPERTY GENERATED TRUE) + # set up compiled unity source dependencies via OBJECT_DEPENDS + # this ensures that missing source files are generated before the unity file is compiled + if (COTIRE_DEBUG AND _dependencySources) + message (STATUS "${_unityFile} OBJECT_DEPENDS ${_dependencySources}") + endif() + if (_dependencySources) + # the OBJECT_DEPENDS property requires a list of full paths + set (_objectDependsPaths "") + foreach (_sourceFile ${_dependencySources}) + get_source_file_property(_sourceLocation "${_sourceFile}" LOCATION) + list (APPEND _objectDependsPaths "${_sourceLocation}") + endforeach() + set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths}) + endif() + if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + # unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel + set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj") + endif() + cotire_set_cmd_to_prologue(_unityCmd) + list (APPEND _unityCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "unity" "${_targetConfigScript}" "${_unityFile}") + if (CMAKE_VERSION VERSION_LESS "3.1.0") + set (_unityCmdDepends "${_targetScript}") + else() + # CMake 3.1.0 supports generator expressions in arguments to DEPENDS + set (_unityCmdDepends "${_targetConfigScript}") + endif() + if (MSVC_IDE) + file (TO_NATIVE_PATH "${_unityFile}" _unityFileLogPath) + else() + file (RELATIVE_PATH _unityFileLogPath "${CMAKE_BINARY_DIR}" "${_unityFile}") + endif() + if (COTIRE_DEBUG) + message (STATUS "add_custom_command: OUTPUT ${_unityFile} COMMAND ${_unityCmd} DEPENDS ${_unityCmdDepends}") + endif() + add_custom_command( + OUTPUT "${_unityFile}" + COMMAND ${_unityCmd} + DEPENDS ${_unityCmdDepends} + COMMENT "Generating ${_language} unity source ${_unityFileLogPath}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + VERBATIM) + list (APPEND ${_cmdsVar} COMMAND ${_unityCmd}) + endforeach() + set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_setup_prefix_generation_command _language _target _targetScript _prefixFile _unityFiles _cmdsVar) + set (_sourceFiles ${ARGN}) + set (_dependencySources "") + cotire_get_prefix_header_dependencies(${_language} ${_target} _dependencySources ${_sourceFiles}) + cotire_set_cmd_to_prologue(_prefixCmd) + list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" ${_unityFiles}) + set_property (SOURCE "${_prefixFile}" PROPERTY GENERATED TRUE) + # make prefix header generation depend on the actual compiler executable used to force + # re-generation when the compiler executable is updated. This prevents "file not found" + # errors for compiler version specific system header files. + get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" ABSOLUTE) + if (COTIRE_DEBUG) + message (STATUS "add_custom_command: OUTPUT ${_prefixFile} COMMAND ${_prefixCmd} DEPENDS ${_unityFile} ${_dependencySources} ${_realCompilerExe}") + endif() + if (MSVC_IDE) + file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileLogPath) + else() + file (RELATIVE_PATH _prefixFileLogPath "${CMAKE_BINARY_DIR}" "${_prefixFile}") + endif() + get_filename_component(_prefixFileExt "${_prefixFile}" EXT) + if (_prefixFileExt MATCHES "^\\.c") + set (_comment "Generating ${_language} prefix source ${_prefixFileLogPath}") + else() + set (_comment "Generating ${_language} prefix header ${_prefixFileLogPath}") + endif() + # prevent pre-processing errors upon generating the prefix header when a target's generated include file does not yet exist + # we do not add a file-level dependency for the target's generated files though, because we only want to depend on their existence + # thus we make the prefix header generation depend on a custom helper target which triggers the generation of the files + set (_preTargetName "${_target}${COTIRE_PCH_TARGET_SUFFIX}_pre") + if (TARGET ${_preTargetName}) + # custom helper target has already been generated while processing a different language + list (APPEND _dependencySources ${_preTargetName}) + else() + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${_targetSourceFiles}) + if (_generatedSources) + add_custom_target("${_preTargetName}" DEPENDS ${_generatedSources}) + cotire_init_target("${_preTargetName}") + list (APPEND _dependencySources ${_preTargetName}) + endif() + endif() + add_custom_command( + OUTPUT "${_prefixFile}" "${_prefixFile}.log" + COMMAND ${_prefixCmd} + DEPENDS ${_unityFiles} ${_dependencySources} "${_realCompilerExe}" + COMMENT "${_comment}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + VERBATIM) + list (APPEND ${_cmdsVar} COMMAND ${_prefixCmd}) + set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_setup_prefix_generation_from_unity_command _language _target _targetScript _prefixFile _unityFiles _cmdsVar) + set (_sourceFiles ${ARGN}) + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") + # GNU and Clang require indirect compilation of the prefix header to make them honor the system_header pragma + cotire_prefix_header_to_source_file_path(${_language} "${_prefixFile}" _prefixSourceFile) + else() + set (_prefixSourceFile "${_prefixFile}") + endif() + cotire_setup_prefix_generation_command( + ${_language} ${_target} "${_targetScript}" + "${_prefixSourceFile}" "${_unityFiles}" ${_cmdsVar} ${_sourceFiles}) + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") + # set up generation of a prefix source file which includes the prefix header + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile}) + endif() + set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_setup_prefix_generation_from_provided_command _language _target _targetScript _prefixFile _cmdsVar) + set (_prefixHeaderFiles ${ARGN}) + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") + # GNU and Clang require indirect compilation of the prefix header to make them honor the system_header pragma + cotire_prefix_header_to_source_file_path(${_language} "${_prefixFile}" _prefixSourceFile) + else() + set (_prefixSourceFile "${_prefixFile}") + endif() + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixSourceFile}" _cmds ${_prefixHeaderFiles}) + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") + # set up generation of a prefix source file which includes the prefix header + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile}) + endif() + set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) +endfunction() + +function (cotire_init_cotire_target_properties _target) + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER TRUE) + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD TRUE) + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_ADD_CLEAN SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_ADD_CLEAN FALSE) + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${CMAKE_SOURCE_DIR}") + cotire_check_is_path_relative_to("${CMAKE_BINARY_DIR}" _isRelative "${CMAKE_SOURCE_DIR}") + if (NOT _isRelative) + set_property(TARGET ${_target} APPEND PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${CMAKE_BINARY_DIR}") + endif() + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PATH SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PATH "") + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH "") + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_PRE_UNDEFS SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_PRE_UNDEFS "") + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_POST_UNDEFS SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_POST_UNDEFS "") + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") + endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES SET) + if (NOT _isSet) + if (COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES) + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES "${COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES}") + else() + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES "") + endif() + endif() +endfunction() + +function (cotire_make_target_message _target _languages _disableMsg _targetMsgVar) + get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) + get_target_property(_targetAddSCU ${_target} COTIRE_ADD_UNITY_BUILD) + string (REPLACE ";" " " _languagesStr "${_languages}") + math (EXPR _numberOfExcludedFiles "${ARGC} - 4") + if (_numberOfExcludedFiles EQUAL 0) + set (_excludedStr "") + elseif (COTIRE_VERBOSE OR _numberOfExcludedFiles LESS 4) + string (REPLACE ";" ", " _excludedStr "excluding ${ARGN}") + else() + set (_excludedStr "excluding ${_numberOfExcludedFiles} files") + endif() + set (_targetMsg "") + if (NOT _languages) + set (_targetMsg "Target ${_target} cannot be cotired.") + if (_disableMsg) + set (_targetMsg "${_targetMsg} ${_disableMsg}") + endif() + elseif (NOT _targetUsePCH AND NOT _targetAddSCU) + set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build and precompiled header.") + if (_disableMsg) + set (_targetMsg "${_targetMsg} ${_disableMsg}") + endif() + elseif (NOT _targetUsePCH) + if (_excludedStr) + set (_targetMsg "${_languagesStr} target ${_target} cotired without precompiled header ${_excludedStr}.") + else() + set (_targetMsg "${_languagesStr} target ${_target} cotired without precompiled header.") + endif() + if (_disableMsg) + set (_targetMsg "${_targetMsg} ${_disableMsg}") + endif() + elseif (NOT _targetAddSCU) + if (_excludedStr) + set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build ${_excludedStr}.") + else() + set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.") + endif() + else() + if (_excludedStr) + set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.") + else() + set (_targetMsg "${_languagesStr} target ${_target} cotired.") + endif() + endif() + set (${_targetMsgVar} "${_targetMsg}" PARENT_SCOPE) +endfunction() + +function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTargetVar) + set (_languages ${ARGN}) + set (_allSourceFiles "") + set (_allExcludedSourceFiles "") + set (_allCotiredSourceFiles "") + set (_targetLanguages "") + set (_pchEligibleTargetLanguages "") + get_target_property(_targetType ${_target} TYPE) + get_target_property(_targetSourceFiles ${_target} SOURCES) + get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) + get_target_property(_targetAddSCU ${_target} COTIRE_ADD_UNITY_BUILD) + set (_disableMsg "") + foreach (_language ${_languages}) + get_target_property(_prefixHeader ${_target} COTIRE_${_language}_PREFIX_HEADER) + get_target_property(_unityBuildFile ${_target} COTIRE_${_language}_UNITY_SOURCE) + if (_prefixHeader OR _unityBuildFile) + message (STATUS "cotire: target ${_target} has already been cotired.") + set (${_targetLanguagesVar} "" PARENT_SCOPE) + return() + endif() + if (_targetUsePCH AND "${_language}" MATCHES "^C|CXX$" AND DEFINED CMAKE_${_language}_COMPILER_ID) + if (CMAKE_${_language}_COMPILER_ID) + cotire_check_precompiled_header_support("${_language}" "${_target}" _disableMsg) + if (_disableMsg) + set (_targetUsePCH FALSE) + endif() + endif() + endif() + set (_sourceFiles "") + set (_excludedSources "") + set (_cotiredSources "") + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + if (_sourceFiles OR _excludedSources OR _cotiredSources) + list (APPEND _targetLanguages ${_language}) + endif() + if (_sourceFiles) + list (APPEND _allSourceFiles ${_sourceFiles}) + endif() + list (LENGTH _sourceFiles _numberOfSources) + if (NOT _numberOfSources LESS ${COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES}) + list (APPEND _pchEligibleTargetLanguages ${_language}) + endif() + if (_excludedSources) + list (APPEND _allExcludedSourceFiles ${_excludedSources}) + endif() + if (_cotiredSources) + list (APPEND _allCotiredSourceFiles ${_cotiredSources}) + endif() + endforeach() + set (_targetMsgLevel STATUS) + if (NOT _targetLanguages) + string (REPLACE ";" " or " _languagesStr "${_languages}") + set (_disableMsg "No ${_languagesStr} source files.") + set (_targetUsePCH FALSE) + set (_targetAddSCU FALSE) + endif() + if (_targetUsePCH) + if (_allCotiredSourceFiles) + cotire_get_source_file_property_values(_cotireTargets COTIRE_TARGET ${_allCotiredSourceFiles}) + list (REMOVE_DUPLICATES _cotireTargets) + string (REPLACE ";" ", " _cotireTargetsStr "${_cotireTargets}") + set (_disableMsg "Target sources already include a precompiled header for target(s) ${_cotireTargets}.") + set (_disableMsg "${_disableMsg} Set target property COTIRE_ENABLE_PRECOMPILED_HEADER to FALSE for targets ${_target},") + set (_disableMsg "${_disableMsg} ${_cotireTargetsStr} to get a workable build system.") + set (_targetMsgLevel SEND_ERROR) + set (_targetUsePCH FALSE) + elseif (NOT _pchEligibleTargetLanguages) + set (_disableMsg "Too few applicable sources.") + set (_targetUsePCH FALSE) + elseif (XCODE AND _allExcludedSourceFiles) + # for Xcode, we cannot apply the precompiled header to individual sources, only to the whole target + set (_disableMsg "Exclusion of source files not supported for generator Xcode.") + set (_targetUsePCH FALSE) + elseif (XCODE AND "${_targetType}" STREQUAL "OBJECT_LIBRARY") + # for Xcode, we cannot apply the required PRE_BUILD action to generate the prefix header to an OBJECT_LIBRARY target + set (_disableMsg "Required PRE_BUILD action not supported for OBJECT_LIBRARY targets for generator Xcode.") + set (_targetUsePCH FALSE) + endif() + endif() + set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH}) + set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU}) + cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles}) + if (_targetMsg) + if (NOT DEFINED COTIREMSG_${_target}) + set (COTIREMSG_${_target} "") + endif() + if (COTIRE_VERBOSE OR NOT "${_targetMsgLevel}" STREQUAL "STATUS" OR + NOT "${COTIREMSG_${_target}}" STREQUAL "${_targetMsg}") + # cache message to avoid redundant messages on re-configure + set (COTIREMSG_${_target} "${_targetMsg}" CACHE INTERNAL "${_target} cotire message.") + message (${_targetMsgLevel} "${_targetMsg}") + endif() + endif() + list (LENGTH _targetLanguages _numberOfLanguages) + if (_numberOfLanguages GREATER 1 OR _allExcludedSourceFiles) + set (${_wholeTargetVar} FALSE PARENT_SCOPE) + else() + set (${_wholeTargetVar} TRUE PARENT_SCOPE) + endif() + set (${_targetLanguagesVar} ${_targetLanguages} PARENT_SCOPE) +endfunction() + +function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar) + set (_sourceFiles ${ARGN}) + get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES) + if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)") + set (_numberOfThreads "${CMAKE_MATCH_2}") + if (NOT _numberOfThreads) + # use all available cores + ProcessorCount(_numberOfThreads) + endif() + list (LENGTH _sourceFiles _numberOfSources) + math (EXPR _maxIncludes "(${_numberOfSources} + ${_numberOfThreads} - 1) / ${_numberOfThreads}") + elseif (NOT _maxIncludes MATCHES "[0-9]+") + set (_maxIncludes 0) + endif() + if (COTIRE_DEBUG) + message (STATUS "${_target} unity source max includes: ${_maxIncludes}") + endif() + set (${_maxIncludesVar} ${_maxIncludes} PARENT_SCOPE) +endfunction() + +function (cotire_process_target_language _language _configurations _target _wholeTarget _cmdsVar) + set (${_cmdsVar} "" PARENT_SCOPE) + get_target_property(_targetSourceFiles ${_target} SOURCES) + set (_sourceFiles "") + set (_excludedSources "") + set (_cotiredSources "") + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + if (NOT _sourceFiles AND NOT _cotiredSources) + return() + endif() + set (_cmds "") + # check for user provided unity source file list + get_property(_unitySourceFiles TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE_INIT) + if (NOT _unitySourceFiles) + set (_unitySourceFiles ${_sourceFiles} ${_cotiredSources}) + endif() + cotire_generate_target_script( + ${_language} "${_configurations}" ${_target} _targetScript _targetConfigScript ${_unitySourceFiles}) + # set up unity files for parallel compilation + cotire_compute_unity_max_number_of_includes(${_target} _maxIncludes ${_unitySourceFiles}) + cotire_make_unity_source_file_paths(${_language} ${_target} ${_maxIncludes} _unityFiles ${_unitySourceFiles}) + list (LENGTH _unityFiles _numberOfUnityFiles) + if (_numberOfUnityFiles EQUAL 0) + return() + elseif (_numberOfUnityFiles GREATER 1) + cotire_setup_unity_generation_commands( + ${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFiles}" _cmds ${_unitySourceFiles}) + endif() + # set up single unity file for prefix header generation + cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile) + cotire_setup_unity_generation_commands( + ${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFile}" _cmds ${_unitySourceFiles}) + cotire_make_prefix_file_path(${_language} ${_target} _prefixFile) + # set up prefix header + if (_prefixFile) + # check for user provided prefix header files + get_property(_prefixHeaderFiles TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT) + if (_prefixHeaderFiles) + cotire_setup_prefix_generation_from_provided_command( + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles}) + else() + cotire_setup_prefix_generation_from_unity_command( + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFile}" _cmds ${_unitySourceFiles}) + endif() + # check if selected language has enough sources at all + list (LENGTH _sourceFiles _numberOfSources) + if (_numberOfSources LESS ${COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES}) + set (_targetUsePCH FALSE) + else() + get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) + endif() + if (_targetUsePCH) + cotire_make_pch_file_path(${_language} ${_target} _pchFile) + if (_pchFile) + # first file in _sourceFiles is passed as the host file + cotire_setup_pch_file_compilation( + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_pchFile}" ${_sourceFiles}) + cotire_setup_pch_file_inclusion( + ${_language} ${_target} ${_wholeTarget} "${_prefixFile}" "${_pchFile}" ${_sourceFiles}) + endif() + elseif (_prefixHeaderFiles) + # user provided prefix header must be included unconditionally + cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_sourceFiles}) + endif() + endif() + # mark target as cotired for language + set_property(TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE "${_unityFiles}") + if (_prefixFile) + set_property(TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER "${_prefixFile}") + if (_targetUsePCH AND _pchFile) + set_property(TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER "${_pchFile}") + endif() + endif() + set (${_cmdsVar} ${_cmds} PARENT_SCOPE) +endfunction() + +function (cotire_setup_clean_target _target) + set (_cleanTargetName "${_target}${COTIRE_CLEAN_TARGET_SUFFIX}") + if (NOT TARGET "${_cleanTargetName}") + cotire_set_cmd_to_prologue(_cmds) + get_filename_component(_outputDir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" ABSOLUTE) + list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "cleanup" "${_outputDir}" "${COTIRE_INTDIR}" "${_target}") + add_custom_target(${_cleanTargetName} + COMMAND ${_cmds} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMENT "Cleaning up target ${_target} cotire generated files" + VERBATIM) + cotire_init_target("${_cleanTargetName}") + endif() +endfunction() + +function (cotire_setup_pch_target _languages _configurations _target) + if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + # for makefile based generators, we add a custom target to trigger the generation of the cotire related files + set (_dependsFiles "") + foreach (_language ${_languages}) + set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE) + if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + # Visual Studio and Intel only create precompiled header as a side effect + list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER) + endif() + cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props}) + if (_dependsFile) + list (APPEND _dependsFiles "${_dependsFile}") + endif() + endforeach() + if (_dependsFiles) + set (_pchTargetName "${_target}${COTIRE_PCH_TARGET_SUFFIX}") + add_custom_target("${_pchTargetName}" DEPENDS ${_dependsFiles}) + cotire_init_target("${_pchTargetName}") + cotire_add_to_pch_all_target(${_pchTargetName}) + endif() + else() + # for other generators, we add the "clean all" target to clean up the precompiled header + cotire_setup_clean_all_target() + endif() +endfunction() + +function (cotire_filter_object_libraries _target _objectLibrariesVar) + set (_objectLibraries "") + foreach (_source ${ARGN}) + if (_source MATCHES "^\\$$") + list (APPEND _objectLibraries "${_source}") + endif() + endforeach() + set (${_objectLibrariesVar} ${_objectLibraries} PARENT_SCOPE) +endfunction() + +function (cotire_collect_unity_target_sources _target _languages _unityTargetSourcesVar) + get_target_property(_targetSourceFiles ${_target} SOURCES) + set (_unityTargetSources ${_targetSourceFiles}) + foreach (_language ${_languages}) + get_property(_unityFiles TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE) + if (_unityFiles) + # remove source files that are included in the unity source + set (_sourceFiles "") + set (_excludedSources "") + set (_cotiredSources "") + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + if (_sourceFiles OR _cotiredSources) + list (REMOVE_ITEM _unityTargetSources ${_sourceFiles} ${_cotiredSources}) + endif() + # add unity source files instead + list (APPEND _unityTargetSources ${_unityFiles}) + endif() + endforeach() + get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT) + if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$") + cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles}) + if (_objectLibraries) + cotire_map_libraries("${_linkLibrariesStrategy}" _unityObjectLibraries ${_objectLibraries}) + list (REMOVE_ITEM _unityTargetSources ${_objectLibraries}) + list (APPEND _unityTargetSources ${_unityObjectLibraries}) + endif() + endif() + set (${_unityTargetSourcesVar} ${_unityTargetSources} PARENT_SCOPE) +endfunction() + +function (cotire_setup_unity_target_pch_usage _languages _target) + foreach (_language ${_languages}) + get_property(_unityFiles TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE) + if (_unityFiles) + get_property(_userPrefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT) + get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) + if (_userPrefixFile AND _prefixFile) + # user provided prefix header must be included unconditionally by unity sources + cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_unityFiles}) + endif() + endif() + endforeach() +endfunction() + +function (cotire_setup_unity_build_target _languages _configurations _target) + get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) + if (NOT _unityTargetName) + set (_unityTargetName "${_target}${COTIRE_UNITY_BUILD_TARGET_SUFFIX}") + endif() + # determine unity target sub type + get_target_property(_targetType ${_target} TYPE) + if ("${_targetType}" STREQUAL "EXECUTABLE") + set (_unityTargetSubType "") + elseif (_targetType MATCHES "(STATIC|SHARED|MODULE|OBJECT)_LIBRARY") + set (_unityTargetSubType "${CMAKE_MATCH_1}") + else() + message (WARNING "cotire: target ${_target} has unknown target type ${_targetType}.") + return() + endif() + # determine unity target sources + set (_unityTargetSources "") + cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources) + # handle automatic Qt processing + get_target_property(_targetAutoMoc ${_target} AUTOMOC) + get_target_property(_targetAutoUic ${_target} AUTOUIC) + get_target_property(_targetAutoRcc ${_target} AUTORCC) + if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) + # if the original target sources are subject to CMake's automatic Qt processing, + # also include implicitly generated _automoc.cpp file + list (APPEND _unityTargetSources "${_target}_automoc.cpp") + set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE) + endif() + # prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created + set (CMAKE_AUTOMOC OFF) + set (CMAKE_AUTOUIC OFF) + set (CMAKE_AUTORCC OFF) + if (COTIRE_DEBUG) + message (STATUS "add target ${_targetType} ${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}") + endif() + # generate unity target + if ("${_targetType}" STREQUAL "EXECUTABLE") + add_executable(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) + else() + add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) + endif() + if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # depend on original target's automoc target, if it exists + if (TARGET ${_target}_automoc) + add_dependencies(${_unityTargetName} ${_target}_automoc) + endif() + else() + if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) + # depend on the original target's implicity generated _automoc target + add_dependencies(${_unityTargetName} ${_target}_automoc) + endif() + endif() + # copy output location properties + set (_outputDirProperties + ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_ + LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_ + RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY_) + if (COTIRE_UNITY_OUTPUT_DIRECTORY) + set (_setDefaultOutputDir TRUE) + if (IS_ABSOLUTE "${COTIRE_UNITY_OUTPUT_DIRECTORY}") + set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}") + else() + # append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties}) + cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties}) + foreach (_property ${_properties}) + get_property(_outputDir TARGET ${_target} PROPERTY ${_property}) + if (_outputDir) + get_filename_component(_outputDir "${_outputDir}/${COTIRE_UNITY_OUTPUT_DIRECTORY}" ABSOLUTE) + set_property(TARGET ${_unityTargetName} PROPERTY ${_property} "${_outputDir}") + set (_setDefaultOutputDir FALSE) + endif() + endforeach() + if (_setDefaultOutputDir) + get_filename_component(_outputDir "${CMAKE_CURRENT_BINARY_DIR}/${COTIRE_UNITY_OUTPUT_DIRECTORY}" ABSOLUTE) + endif() + endif() + if (_setDefaultOutputDir) + set_target_properties(${_unityTargetName} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${_outputDir}" + LIBRARY_OUTPUT_DIRECTORY "${_outputDir}" + RUNTIME_OUTPUT_DIRECTORY "${_outputDir}") + endif() + else() + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + ${_outputDirProperties}) + endif() + # copy output name + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_ + LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_ + OUTPUT_NAME OUTPUT_NAME_ + RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_ + PREFIX _POSTFIX SUFFIX + IMPORT_PREFIX IMPORT_SUFFIX) + # copy compile stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + COMPILE_DEFINITIONS COMPILE_DEFINITIONS_ + COMPILE_FLAGS COMPILE_OPTIONS + Fortran_FORMAT Fortran_MODULE_DIRECTORY + INCLUDE_DIRECTORIES + INTERPROCEDURAL_OPTIMIZATION INTERPROCEDURAL_OPTIMIZATION_ + POSITION_INDEPENDENT_CODE + C_COMPILER_LAUNCHER CXX_COMPILER_LAUNCHER + C_INCLUDE_WHAT_YOU_USE CXX_INCLUDE_WHAT_YOU_USE + C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN + C_CLANG_TIDY CXX_CLANG_TIDY) + # copy compile features + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED + CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED + COMPILE_FEATURES) + # copy interface stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN + COMPATIBLE_INTERFACE_STRING + INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES INTERFACE_SOURCES + INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED) + # copy link stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH + LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED + LINK_FLAGS LINK_FLAGS_ + LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_ + LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_ + LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC + STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_ + NO_SONAME SOVERSION VERSION + LINK_WHAT_YOU_USE) + # copy cmake stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK) + # copy Apple platform specific stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR + MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH + OSX_ARCHITECTURES OSX_ARCHITECTURES_ PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST + IOS_INSTALL_COMBINED) + # copy Windows platform specific stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + GNUtoMS + COMPILE_PDB_NAME COMPILE_PDB_NAME_ + COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_ + PDB_NAME PDB_NAME_ PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_ + VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION + VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE + VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK + VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION + VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER + VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION + VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES + WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS + DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE + VS_SDK_REFERENCES) + # copy Android platform specific stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + ANDROID_API ANDROID_API_MIN ANDROID_GUI + ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES + ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR + ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES + ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH + ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE) + # use output name from original target + get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME) + if (NOT _targetOutputName) + set_property(TARGET ${_unityTargetName} PROPERTY OUTPUT_NAME "${_target}") + endif() + # use export symbol from original target + cotire_get_target_export_symbol("${_target}" _defineSymbol) + if (_defineSymbol) + set_property(TARGET ${_unityTargetName} PROPERTY DEFINE_SYMBOL "${_defineSymbol}") + if ("${_targetType}" STREQUAL "EXECUTABLE") + set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE) + endif() + endif() + cotire_init_target(${_unityTargetName}) + cotire_add_to_unity_all_target(${_unityTargetName}) + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}") +endfunction(cotire_setup_unity_build_target) + +function (cotire_target _target) + set(_options "") + set(_oneValueArgs "") + set(_multiValueArgs LANGUAGES CONFIGURATIONS) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + if (NOT _option_LANGUAGES) + get_property (_option_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + endif() + if (NOT _option_CONFIGURATIONS) + cotire_get_configuration_types(_option_CONFIGURATIONS) + endif() + # check if cotire can be applied to target at all + cotire_is_target_supported(${_target} _isSupported) + if (NOT _isSupported) + get_target_property(_imported ${_target} IMPORTED) + get_target_property(_targetType ${_target} TYPE) + if (_imported) + message (WARNING "cotire: imported ${_targetType} target ${_target} cannot be cotired.") + else() + message (STATUS "cotire: ${_targetType} target ${_target} cannot be cotired.") + endif() + return() + endif() + # resolve alias + get_target_property(_aliasName ${_target} ALIASED_TARGET) + if (_aliasName) + if (COTIRE_DEBUG) + message (STATUS "${_target} is an alias. Applying cotire to aliased target ${_aliasName} instead.") + endif() + set (_target ${_aliasName}) + endif() + # check if target needs to be cotired for build type + # when using configuration types, the test is performed at build time + cotire_init_cotire_target_properties(${_target}) + if (NOT CMAKE_CONFIGURATION_TYPES) + if (CMAKE_BUILD_TYPE) + list (FIND _option_CONFIGURATIONS "${CMAKE_BUILD_TYPE}" _index) + else() + list (FIND _option_CONFIGURATIONS "None" _index) + endif() + if (_index EQUAL -1) + if (COTIRE_DEBUG) + message (STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} not cotired (${_option_CONFIGURATIONS})") + endif() + return() + endif() + endif() + # when not using configuration types, immediately create cotire intermediate dir + if (NOT CMAKE_CONFIGURATION_TYPES) + cotire_get_intermediate_dir(_baseDir) + file (MAKE_DIRECTORY "${_baseDir}") + endif() + # choose languages that apply to the target + cotire_choose_target_languages("${_target}" _targetLanguages _wholeTarget ${_option_LANGUAGES}) + if (NOT _targetLanguages) + return() + endif() + set (_cmds "") + foreach (_language ${_targetLanguages}) + cotire_process_target_language("${_language}" "${_option_CONFIGURATIONS}" ${_target} ${_wholeTarget} _cmd) + if (_cmd) + list (APPEND _cmds ${_cmd}) + endif() + endforeach() + get_target_property(_targetAddSCU ${_target} COTIRE_ADD_UNITY_BUILD) + if (_targetAddSCU) + cotire_setup_unity_build_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" ${_target}) + endif() + get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) + if (_targetUsePCH) + cotire_setup_target_pch_usage("${_targetLanguages}" ${_target} ${_wholeTarget} ${_cmds}) + cotire_setup_pch_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" ${_target}) + if (_targetAddSCU) + cotire_setup_unity_target_pch_usage("${_targetLanguages}" ${_target}) + endif() + endif() + get_target_property(_targetAddCleanTarget ${_target} COTIRE_ADD_CLEAN) + if (_targetAddCleanTarget) + cotire_setup_clean_target(${_target}) + endif() +endfunction(cotire_target) + +function (cotire_map_libraries _strategy _mappedLibrariesVar) + set (_mappedLibraries "") + foreach (_library ${ARGN}) + if (_library MATCHES "^\\$$") + set (_libraryName "${CMAKE_MATCH_1}") + set (_linkOnly TRUE) + set (_objectLibrary FALSE) + elseif (_library MATCHES "^\\$$") + set (_libraryName "${CMAKE_MATCH_1}") + set (_linkOnly FALSE) + set (_objectLibrary TRUE) + else() + set (_libraryName "${_library}") + set (_linkOnly FALSE) + set (_objectLibrary FALSE) + endif() + if ("${_strategy}" MATCHES "COPY_UNITY") + cotire_is_target_supported(${_libraryName} _isSupported) + if (_isSupported) + # use target's corresponding unity target, if available + get_target_property(_libraryUnityTargetName ${_libraryName} COTIRE_UNITY_TARGET_NAME) + if (TARGET "${_libraryUnityTargetName}") + if (_linkOnly) + list (APPEND _mappedLibraries "$") + elseif (_objectLibrary) + list (APPEND _mappedLibraries "$") + else() + list (APPEND _mappedLibraries "${_libraryUnityTargetName}") + endif() + else() + list (APPEND _mappedLibraries "${_library}") + endif() + else() + list (APPEND _mappedLibraries "${_library}") + endif() + else() + list (APPEND _mappedLibraries "${_library}") + endif() + endforeach() + list (REMOVE_DUPLICATES _mappedLibraries) + set (${_mappedLibrariesVar} ${_mappedLibraries} PARENT_SCOPE) +endfunction() + +function (cotire_target_link_libraries _target) + cotire_is_target_supported(${_target} _isSupported) + if (NOT _isSupported) + return() + endif() + get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) + if (TARGET "${_unityTargetName}") + get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT) + if (COTIRE_DEBUG) + message (STATUS "unity target ${_unityTargetName} link strategy: ${_linkLibrariesStrategy}") + endif() + if ("${_linkLibrariesStrategy}" MATCHES "^(COPY|COPY_UNITY)$") + get_target_property(_linkLibraries ${_target} LINK_LIBRARIES) + if (_linkLibraries) + cotire_map_libraries("${_linkLibrariesStrategy}" _unityLinkLibraries ${_linkLibraries}) + set_target_properties(${_unityTargetName} PROPERTIES LINK_LIBRARIES "${_unityLinkLibraries}") + if (COTIRE_DEBUG) + message (STATUS "unity target ${_unityTargetName} link libraries: ${_unityLinkLibraries}") + endif() + endif() + get_target_property(_interfaceLinkLibraries ${_target} INTERFACE_LINK_LIBRARIES) + if (_interfaceLinkLibraries) + cotire_map_libraries("${_linkLibrariesStrategy}" _unityLinkInterfaceLibraries ${_interfaceLinkLibraries}) + set_target_properties(${_unityTargetName} PROPERTIES INTERFACE_LINK_LIBRARIES "${_unityLinkInterfaceLibraries}") + if (COTIRE_DEBUG) + message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}") + endif() + endif() + endif() + endif() +endfunction(cotire_target_link_libraries) + +function (cotire_cleanup _binaryDir _cotireIntermediateDirName _targetName) + if (_targetName) + file (GLOB_RECURSE _cotireFiles "${_binaryDir}/${_targetName}*.*") + else() + file (GLOB_RECURSE _cotireFiles "${_binaryDir}/*.*") + endif() + # filter files in intermediate directory + set (_filesToRemove "") + foreach (_file ${_cotireFiles}) + get_filename_component(_dir "${_file}" DIRECTORY) + get_filename_component(_dirName "${_dir}" NAME) + if ("${_dirName}" STREQUAL "${_cotireIntermediateDirName}") + list (APPEND _filesToRemove "${_file}") + endif() + endforeach() + if (_filesToRemove) + if (COTIRE_VERBOSE) + message (STATUS "cleaning up ${_filesToRemove}") + endif() + file (REMOVE ${_filesToRemove}) + endif() +endfunction() + +function (cotire_init_target _targetName) + if (COTIRE_TARGETS_FOLDER) + set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}") + endif() + set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE) + if (MSVC_IDE) + set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) + endif() +endfunction() + +function (cotire_add_to_pch_all_target _pchTargetName) + set (_targetName "${COTIRE_PCH_ALL_TARGET_NAME}") + if (NOT TARGET "${_targetName}") + add_custom_target("${_targetName}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) + cotire_init_target("${_targetName}") + endif() + cotire_setup_clean_all_target() + add_dependencies(${_targetName} ${_pchTargetName}) +endfunction() + +function (cotire_add_to_unity_all_target _unityTargetName) + set (_targetName "${COTIRE_UNITY_BUILD_ALL_TARGET_NAME}") + if (NOT TARGET "${_targetName}") + add_custom_target("${_targetName}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) + cotire_init_target("${_targetName}") + endif() + cotire_setup_clean_all_target() + add_dependencies(${_targetName} ${_unityTargetName}) +endfunction() + +function (cotire_setup_clean_all_target) + set (_targetName "${COTIRE_CLEAN_ALL_TARGET_NAME}") + if (NOT TARGET "${_targetName}") + cotire_set_cmd_to_prologue(_cmds) + list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "cleanup" "${CMAKE_BINARY_DIR}" "${COTIRE_INTDIR}") + add_custom_target(${_targetName} + COMMAND ${_cmds} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMENT "Cleaning up all cotire generated files" + VERBATIM) + cotire_init_target("${_targetName}") + endif() +endfunction() + +function (cotire) + set(_options "") + set(_oneValueArgs "") + set(_multiValueArgs LANGUAGES CONFIGURATIONS) + cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + set (_targets ${_option_UNPARSED_ARGUMENTS}) + foreach (_target ${_targets}) + if (TARGET ${_target}) + cotire_target(${_target} LANGUAGES ${_option_LANGUAGES} CONFIGURATIONS ${_option_CONFIGURATIONS}) + else() + message (WARNING "cotire: ${_target} is not a target.") + endif() + endforeach() + foreach (_target ${_targets}) + if (TARGET ${_target}) + cotire_target_link_libraries(${_target}) + endif() + endforeach() +endfunction() + +if (CMAKE_SCRIPT_MODE_FILE) + + # cotire is being run in script mode + # locate -P on command args + set (COTIRE_ARGC -1) + foreach (_index RANGE ${CMAKE_ARGC}) + if (COTIRE_ARGC GREATER -1) + set (COTIRE_ARGV${COTIRE_ARGC} "${CMAKE_ARGV${_index}}") + math (EXPR COTIRE_ARGC "${COTIRE_ARGC} + 1") + elseif ("${CMAKE_ARGV${_index}}" STREQUAL "-P") + set (COTIRE_ARGC 0) + endif() + endforeach() + + # include target script if available + if ("${COTIRE_ARGV2}" MATCHES "\\.cmake$") + # the included target scripts sets up additional variables relating to the target (e.g., COTIRE_TARGET_SOURCES) + include("${COTIRE_ARGV2}") + endif() + + if (COTIRE_DEBUG) + message (STATUS "${COTIRE_ARGV0} ${COTIRE_ARGV1} ${COTIRE_ARGV2} ${COTIRE_ARGV3} ${COTIRE_ARGV4} ${COTIRE_ARGV5}") + endif() + + if (NOT COTIRE_BUILD_TYPE) + set (COTIRE_BUILD_TYPE "None") + endif() + string (TOUPPER "${COTIRE_BUILD_TYPE}" _upperConfig) + set (_includeDirs ${COTIRE_TARGET_INCLUDE_DIRECTORIES_${_upperConfig}}) + set (_systemIncludeDirs ${COTIRE_TARGET_SYSTEM_INCLUDE_DIRECTORIES_${_upperConfig}}) + set (_compileDefinitions ${COTIRE_TARGET_COMPILE_DEFINITIONS_${_upperConfig}}) + set (_compileFlags ${COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig}}) + # check if target has been cotired for actual build type COTIRE_BUILD_TYPE + list (FIND COTIRE_TARGET_CONFIGURATION_TYPES "${COTIRE_BUILD_TYPE}" _index) + if (_index GREATER -1) + set (_sources ${COTIRE_TARGET_SOURCES}) + set (_sourcesDefinitions ${COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig}}) + else() + if (COTIRE_DEBUG) + message (STATUS "COTIRE_BUILD_TYPE=${COTIRE_BUILD_TYPE} not cotired (${COTIRE_TARGET_CONFIGURATION_TYPES})") + endif() + set (_sources "") + set (_sourcesDefinitions "") + endif() + set (_targetPreUndefs ${COTIRE_TARGET_PRE_UNDEFS}) + set (_targetPostUndefs ${COTIRE_TARGET_POST_UNDEFS}) + set (_sourcesPreUndefs ${COTIRE_TARGET_SOURCES_PRE_UNDEFS}) + set (_sourcesPostUndefs ${COTIRE_TARGET_SOURCES_POST_UNDEFS}) + + if ("${COTIRE_ARGV1}" STREQUAL "unity") + + if (XCODE) + # executing pre-build action under Xcode, check dependency on target script + set (_dependsOption DEPENDS "${COTIRE_ARGV2}") + else() + # executing custom command, no need to re-check for dependencies + set (_dependsOption "") + endif() + + cotire_select_unity_source_files("${COTIRE_ARGV3}" _sources ${_sources}) + + cotire_generate_unity_source( + "${COTIRE_ARGV3}" ${_sources} + LANGUAGE "${COTIRE_TARGET_LANGUAGE}" + SOURCES_COMPILE_DEFINITIONS ${_sourcesDefinitions} + PRE_UNDEFS ${_targetPreUndefs} + POST_UNDEFS ${_targetPostUndefs} + SOURCES_PRE_UNDEFS ${_sourcesPreUndefs} + SOURCES_POST_UNDEFS ${_sourcesPostUndefs} + ${_dependsOption}) + + elseif ("${COTIRE_ARGV1}" STREQUAL "prefix") + + if (XCODE) + # executing pre-build action under Xcode, check dependency on unity file and prefix dependencies + set (_dependsOption DEPENDS "${COTIRE_ARGV4}" ${COTIRE_TARGET_PREFIX_DEPENDS}) + else() + # executing custom command, no need to re-check for dependencies + set (_dependsOption "") + endif() + + set (_files "") + foreach (_index RANGE 4 ${COTIRE_ARGC}) + if (COTIRE_ARGV${_index}) + list (APPEND _files "${COTIRE_ARGV${_index}}") + endif() + endforeach() + + cotire_generate_prefix_header( + "${COTIRE_ARGV3}" ${_files} + COMPILER_LAUNCHER "${COTIRE_TARGET_${COTIRE_TARGET_LANGUAGE}_COMPILER_LAUNCHER}" + COMPILER_EXECUTABLE "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER}" + COMPILER_ARG1 ${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ARG1} + COMPILER_ID "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ID}" + COMPILER_VERSION "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" + LANGUAGE "${COTIRE_TARGET_LANGUAGE}" + IGNORE_PATH "${COTIRE_TARGET_IGNORE_PATH};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH}" + INCLUDE_PATH ${COTIRE_TARGET_INCLUDE_PATH} + IGNORE_EXTENSIONS "${CMAKE_${COTIRE_TARGET_LANGUAGE}_SOURCE_FILE_EXTENSIONS};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS}" + INCLUDE_PRIORITY_PATH ${COTIRE_TARGET_INCLUDE_PRIORITY_PATH} + INCLUDE_DIRECTORIES ${_includeDirs} + SYSTEM_INCLUDE_DIRECTORIES ${_systemIncludeDirs} + COMPILE_DEFINITIONS ${_compileDefinitions} + COMPILE_FLAGS ${_compileFlags} + ${_dependsOption}) + + elseif ("${COTIRE_ARGV1}" STREQUAL "precompile") + + set (_files "") + foreach (_index RANGE 5 ${COTIRE_ARGC}) + if (COTIRE_ARGV${_index}) + list (APPEND _files "${COTIRE_ARGV${_index}}") + endif() + endforeach() + + cotire_precompile_prefix_header( + "${COTIRE_ARGV3}" "${COTIRE_ARGV4}" "${COTIRE_ARGV5}" + COMPILER_LAUNCHER "${COTIRE_TARGET_${COTIRE_TARGET_LANGUAGE}_COMPILER_LAUNCHER}" + COMPILER_EXECUTABLE "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER}" + COMPILER_ARG1 ${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ARG1} + COMPILER_ID "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ID}" + COMPILER_VERSION "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" + LANGUAGE "${COTIRE_TARGET_LANGUAGE}" + INCLUDE_DIRECTORIES ${_includeDirs} + SYSTEM_INCLUDE_DIRECTORIES ${_systemIncludeDirs} + COMPILE_DEFINITIONS ${_compileDefinitions} + COMPILE_FLAGS ${_compileFlags}) + + elseif ("${COTIRE_ARGV1}" STREQUAL "combine") + + if (COTIRE_TARGET_LANGUAGE) + set (_combinedFile "${COTIRE_ARGV3}") + set (_startIndex 4) + else() + set (_combinedFile "${COTIRE_ARGV2}") + set (_startIndex 3) + endif() + set (_files "") + foreach (_index RANGE ${_startIndex} ${COTIRE_ARGC}) + if (COTIRE_ARGV${_index}) + list (APPEND _files "${COTIRE_ARGV${_index}}") + endif() + endforeach() + + if (XCODE) + # executing pre-build action under Xcode, check dependency on files to be combined + set (_dependsOption DEPENDS ${_files}) + else() + # executing custom command, no need to re-check for dependencies + set (_dependsOption "") + endif() + + if (COTIRE_TARGET_LANGUAGE) + cotire_generate_unity_source( + "${_combinedFile}" ${_files} + LANGUAGE "${COTIRE_TARGET_LANGUAGE}" + ${_dependsOption}) + else() + cotire_generate_unity_source("${_combinedFile}" ${_files} ${_dependsOption}) + endif() + + elseif ("${COTIRE_ARGV1}" STREQUAL "cleanup") + + cotire_cleanup("${COTIRE_ARGV2}" "${COTIRE_ARGV3}" "${COTIRE_ARGV4}") + + else() + message (FATAL_ERROR "cotire: unknown command \"${COTIRE_ARGV1}\".") + endif() + +else() + + # cotire is being run in include mode + # set up all variable and property definitions + + if (NOT DEFINED COTIRE_DEBUG_INIT) + if (DEFINED COTIRE_DEBUG) + set (COTIRE_DEBUG_INIT ${COTIRE_DEBUG}) + else() + set (COTIRE_DEBUG_INIT FALSE) + endif() + endif() + option (COTIRE_DEBUG "Enable cotire debugging output?" ${COTIRE_DEBUG_INIT}) + + if (NOT DEFINED COTIRE_VERBOSE_INIT) + if (DEFINED COTIRE_VERBOSE) + set (COTIRE_VERBOSE_INIT ${COTIRE_VERBOSE}) + else() + set (COTIRE_VERBOSE_INIT FALSE) + endif() + endif() + option (COTIRE_VERBOSE "Enable cotire verbose output?" ${COTIRE_VERBOSE_INIT}) + + set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS "inc;inl;ipp" CACHE STRING + "Ignore headers with the listed file extensions from the generated prefix header.") + + set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH "" CACHE STRING + "Ignore headers from these directories when generating the prefix header.") + + set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING + "Ignore sources with the listed file extensions from the generated unity source.") + + set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING + "Minimum number of sources in target required to enable use of precompiled header.") + + if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT) + if (DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES) + set (COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT ${COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES}) + elseif ("${CMAKE_GENERATOR}" MATCHES "JOM|Ninja|Visual Studio") + # enable parallelization for generators that run multiple jobs by default + set (COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT "-j") + else() + set (COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT "0") + endif() + endif() + set (COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES "${COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT}" CACHE STRING + "Maximum number of source files to include in a single unity source file.") + + if (NOT COTIRE_PREFIX_HEADER_FILENAME_SUFFIX) + set (COTIRE_PREFIX_HEADER_FILENAME_SUFFIX "_prefix") + endif() + if (NOT COTIRE_UNITY_SOURCE_FILENAME_SUFFIX) + set (COTIRE_UNITY_SOURCE_FILENAME_SUFFIX "_unity") + endif() + if (NOT COTIRE_INTDIR) + set (COTIRE_INTDIR "cotire") + endif() + if (NOT COTIRE_PCH_ALL_TARGET_NAME) + set (COTIRE_PCH_ALL_TARGET_NAME "all_pch") + endif() + if (NOT COTIRE_UNITY_BUILD_ALL_TARGET_NAME) + set (COTIRE_UNITY_BUILD_ALL_TARGET_NAME "all_unity") + endif() + if (NOT COTIRE_CLEAN_ALL_TARGET_NAME) + set (COTIRE_CLEAN_ALL_TARGET_NAME "clean_cotire") + endif() + if (NOT COTIRE_CLEAN_TARGET_SUFFIX) + set (COTIRE_CLEAN_TARGET_SUFFIX "_clean_cotire") + endif() + if (NOT COTIRE_PCH_TARGET_SUFFIX) + set (COTIRE_PCH_TARGET_SUFFIX "_pch") + endif() + if (MSVC) + # MSVC default PCH memory scaling factor of 100 percent (75 MB) is too small for template heavy C++ code + # use a bigger default factor of 170 percent (128 MB) + if (NOT DEFINED COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (COTIRE_PCH_MEMORY_SCALING_FACTOR "170") + endif() + endif() + if (NOT COTIRE_UNITY_BUILD_TARGET_SUFFIX) + set (COTIRE_UNITY_BUILD_TARGET_SUFFIX "_unity") + endif() + if (NOT DEFINED COTIRE_TARGETS_FOLDER) + set (COTIRE_TARGETS_FOLDER "cotire") + endif() + if (NOT DEFINED COTIRE_UNITY_OUTPUT_DIRECTORY) + if ("${CMAKE_GENERATOR}" MATCHES "Ninja") + # generated Ninja build files do not work if the unity target produces the same output file as the cotired target + set (COTIRE_UNITY_OUTPUT_DIRECTORY "unity") + else() + set (COTIRE_UNITY_OUTPUT_DIRECTORY "") + endif() + endif() + + # define cotire cache variables + + define_property( + CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH" + BRIEF_DOCS "Ignore headers from these directories when generating the prefix header." + FULL_DOCS + "The variable can be set to a semicolon separated list of include directories." + "If a header file is found in one of these directories or sub-directories, it will be excluded from the generated prefix header." + "If not defined, defaults to empty list." + ) + + define_property( + CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS" + BRIEF_DOCS "Ignore includes with the listed file extensions from the generated prefix header." + FULL_DOCS + "The variable can be set to a semicolon separated list of file extensions." + "If a header file extension matches one in the list, it will be excluded from the generated prefix header." + "Includes with an extension in CMAKE__SOURCE_FILE_EXTENSIONS are always ignored." + "If not defined, defaults to inc;inl;ipp." + ) + + define_property( + CACHED_VARIABLE PROPERTY "COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS" + BRIEF_DOCS "Exclude sources with the listed file extensions from the generated unity source." + FULL_DOCS + "The variable can be set to a semicolon separated list of file extensions." + "If a source file extension matches one in the list, it will be excluded from the generated unity source file." + "Source files with an extension in CMAKE__IGNORE_EXTENSIONS are always excluded." + "If not defined, defaults to m;mm." + ) + + define_property( + CACHED_VARIABLE PROPERTY "COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES" + BRIEF_DOCS "Minimum number of sources in target required to enable use of precompiled header." + FULL_DOCS + "The variable can be set to an integer > 0." + "If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target." + "If not defined, defaults to 3." + ) + + define_property( + CACHED_VARIABLE PROPERTY "COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES" + BRIEF_DOCS "Maximum number of source files to include in a single unity source file." + FULL_DOCS + "This may be set to an integer >= 0." + "If 0, cotire will only create a single unity source file." + "If a target contains more than that number of source files, cotire will create multiple unity source files for it." + "Can be set to \"-j\" to optimize the count of unity source files for the number of available processor cores." + "Can be set to \"-j jobs\" to optimize the number of unity source files for the given number of simultaneous jobs." + "Is used to initialize the target property COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES." + "Defaults to \"-j\" for the generators Visual Studio, JOM or Ninja. Defaults to 0 otherwise." + ) + + # define cotire directory properties + + define_property( + DIRECTORY PROPERTY "COTIRE_ENABLE_PRECOMPILED_HEADER" + BRIEF_DOCS "Modify build command of cotired targets added in this directory to make use of the generated precompiled header." + FULL_DOCS + "See target property COTIRE_ENABLE_PRECOMPILED_HEADER." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_ADD_UNITY_BUILD" + BRIEF_DOCS "Add a new target that performs a unity build for cotired targets added in this directory." + FULL_DOCS + "See target property COTIRE_ADD_UNITY_BUILD." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_ADD_CLEAN" + BRIEF_DOCS "Add a new target that cleans all cotire generated files for cotired targets added in this directory." + FULL_DOCS + "See target property COTIRE_ADD_CLEAN." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_PREFIX_HEADER_IGNORE_PATH" + BRIEF_DOCS "Ignore headers from these directories when generating the prefix header." + FULL_DOCS + "See target property COTIRE_PREFIX_HEADER_IGNORE_PATH." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PATH" + BRIEF_DOCS "Honor headers from these directories when generating the prefix header." + FULL_DOCS + "See target property COTIRE_PREFIX_HEADER_INCLUDE_PATH." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH" + BRIEF_DOCS "Header paths matching one of these directories are put at the top of the prefix header." + FULL_DOCS + "See target property COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_UNITY_SOURCE_PRE_UNDEFS" + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file before the inclusion of each source file." + FULL_DOCS + "See target property COTIRE_UNITY_SOURCE_PRE_UNDEFS." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_UNITY_SOURCE_POST_UNDEFS" + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file after the inclusion of each source file." + FULL_DOCS + "See target property COTIRE_UNITY_SOURCE_POST_UNDEFS." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES" + BRIEF_DOCS "Maximum number of source files to include in a single unity source file." + FULL_DOCS + "See target property COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES." + ) + + define_property( + DIRECTORY PROPERTY "COTIRE_UNITY_LINK_LIBRARIES_INIT" + BRIEF_DOCS "Define strategy for setting up the unity target's link libraries." + FULL_DOCS + "See target property COTIRE_UNITY_LINK_LIBRARIES_INIT." + ) + + # define cotire target properties + + define_property( + TARGET PROPERTY "COTIRE_ENABLE_PRECOMPILED_HEADER" INHERITED + BRIEF_DOCS "Modify this target's build command to make use of the generated precompiled header." + FULL_DOCS + "If this property is set to TRUE, cotire will modify the build command to make use of the generated precompiled header." + "Irrespective of the value of this property, cotire will setup custom commands to generate the unity source and prefix header for the target." + "For makefile based generators cotire will also set up a custom target to manually invoke the generation of the precompiled header." + "The target name will be set to this target's name with the suffix _pch appended." + "Inherited from directory." + "Defaults to TRUE." + ) + + define_property( + TARGET PROPERTY "COTIRE_ADD_UNITY_BUILD" INHERITED + BRIEF_DOCS "Add a new target that performs a unity build for this target." + FULL_DOCS + "If this property is set to TRUE, cotire creates a new target of the same type that uses the generated unity source file instead of the target sources." + "Most of the relevant target properties will be copied from this target to the new unity build target." + "Target dependencies and linked libraries have to be manually set up for the new unity build target." + "The unity target name will be set to this target's name with the suffix _unity appended." + "Inherited from directory." + "Defaults to TRUE." + ) + + define_property( + TARGET PROPERTY "COTIRE_ADD_CLEAN" INHERITED + BRIEF_DOCS "Add a new target that cleans all cotire generated files for this target." + FULL_DOCS + "If this property is set to TRUE, cotire creates a new target that clean all files (unity source, prefix header, precompiled header)." + "The clean target name will be set to this target's name with the suffix _clean_cotire appended." + "Inherited from directory." + "Defaults to FALSE." + ) + + define_property( + TARGET PROPERTY "COTIRE_PREFIX_HEADER_IGNORE_PATH" INHERITED + BRIEF_DOCS "Ignore headers from these directories when generating the prefix header." + FULL_DOCS + "The property can be set to a list of directories." + "If a header file is found in one of these directories or sub-directories, it will be excluded from the generated prefix header." + "Inherited from directory." + "If not set, this property is initialized to \${CMAKE_SOURCE_DIR};\${CMAKE_BINARY_DIR}." + ) + + define_property( + TARGET PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PATH" INHERITED + BRIEF_DOCS "Honor headers from these directories when generating the prefix header." + FULL_DOCS + "The property can be set to a list of directories." + "If a header file is found in one of these directories or sub-directories, it will be included in the generated prefix header." + "If a header file is both selected by COTIRE_PREFIX_HEADER_IGNORE_PATH and COTIRE_PREFIX_HEADER_INCLUDE_PATH," + "the option which yields the closer relative path match wins." + "Inherited from directory." + "If not set, this property is initialized to the empty list." + ) + + define_property( + TARGET PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH" INHERITED + BRIEF_DOCS "Header paths matching one of these directories are put at the top of prefix header." + FULL_DOCS + "The property can be set to a list of directories." + "Header file paths matching one of these directories will be inserted at the beginning of the generated prefix header." + "Header files are sorted according to the order of the directories in the property." + "If not set, this property is initialized to the empty list." + ) + + define_property( + TARGET PROPERTY "COTIRE_UNITY_SOURCE_PRE_UNDEFS" INHERITED + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file before the inclusion of each target source file." + FULL_DOCS + "This may be set to a semicolon-separated list of preprocessor symbols." + "cotire will add corresponding #undef directives to the generated unit source file before each target source file." + "Inherited from directory." + "Defaults to empty string." + ) + + define_property( + TARGET PROPERTY "COTIRE_UNITY_SOURCE_POST_UNDEFS" INHERITED + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file after the inclusion of each target source file." + FULL_DOCS + "This may be set to a semicolon-separated list of preprocessor symbols." + "cotire will add corresponding #undef directives to the generated unit source file after each target source file." + "Inherited from directory." + "Defaults to empty string." + ) + + define_property( + TARGET PROPERTY "COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES" INHERITED + BRIEF_DOCS "Maximum number of source files to include in a single unity source file." + FULL_DOCS + "This may be set to an integer > 0." + "If a target contains more than that number of source files, cotire will create multiple unity build files for it." + "If not set, cotire will only create a single unity source file." + "Inherited from directory." + "Defaults to empty." + ) + + define_property( + TARGET PROPERTY "COTIRE__UNITY_SOURCE_INIT" + BRIEF_DOCS "User provided unity source file to be used instead of the automatically generated one." + FULL_DOCS + "If set, cotire will only add the given file(s) to the generated unity source file." + "If not set, cotire will add all the target source files to the generated unity source file." + "The property can be set to a user provided unity source file." + "Defaults to empty." + ) + + define_property( + TARGET PROPERTY "COTIRE__PREFIX_HEADER_INIT" + BRIEF_DOCS "User provided prefix header file to be used instead of the automatically generated one." + FULL_DOCS + "If set, cotire will add the given header file(s) to the generated prefix header file." + "If not set, cotire will generate a prefix header by tracking the header files included by the unity source file." + "The property can be set to a user provided prefix header file (e.g., stdafx.h)." + "Defaults to empty." + ) + + define_property( + TARGET PROPERTY "COTIRE_UNITY_LINK_LIBRARIES_INIT" INHERITED + BRIEF_DOCS "Define strategy for setting up unity target's link libraries." + FULL_DOCS + "If this property is empty or set to NONE, the generated unity target's link libraries have to be set up manually." + "If this property is set to COPY, the unity target's link libraries will be copied from this target." + "If this property is set to COPY_UNITY, the unity target's link libraries will be copied from this target with considering existing unity targets." + "Inherited from directory." + "Defaults to empty." + ) + + define_property( + TARGET PROPERTY "COTIRE__UNITY_SOURCE" + BRIEF_DOCS "Read-only property. The generated unity source file(s)." + FULL_DOCS + "cotire sets this property to the path of the generated single computation unit source file for the target." + "Defaults to empty string." + ) + + define_property( + TARGET PROPERTY "COTIRE__PREFIX_HEADER" + BRIEF_DOCS "Read-only property. The generated prefix header file." + FULL_DOCS + "cotire sets this property to the full path of the generated language prefix header for the target." + "Defaults to empty string." + ) + + define_property( + TARGET PROPERTY "COTIRE__PRECOMPILED_HEADER" + BRIEF_DOCS "Read-only property. The generated precompiled header file." + FULL_DOCS + "cotire sets this property to the full path of the generated language precompiled header binary for the target." + "Defaults to empty string." + ) + + define_property( + TARGET PROPERTY "COTIRE_UNITY_TARGET_NAME" + BRIEF_DOCS "The name of the generated unity build target corresponding to this target." + FULL_DOCS + "This property can be set to the desired name of the unity target that will be created by cotire." + "If not set, the unity target name will be set to this target's name with the suffix _unity appended." + "After this target has been processed by cotire, the property is set to the actual name of the generated unity target." + "Defaults to empty string." + ) + + # define cotire source properties + + define_property( + SOURCE PROPERTY "COTIRE_EXCLUDED" + BRIEF_DOCS "Do not modify source file's build command." + FULL_DOCS + "If this property is set to TRUE, the source file's build command will not be modified to make use of the precompiled header." + "The source file will also be excluded from the generated unity source file." + "Source files that have their COMPILE_FLAGS property set will be excluded by default." + "Defaults to FALSE." + ) + + define_property( + SOURCE PROPERTY "COTIRE_DEPENDENCY" + BRIEF_DOCS "Add this source file to dependencies of the automatically generated prefix header file." + FULL_DOCS + "If this property is set to TRUE, the source file is added to dependencies of the generated prefix header file." + "If the file is modified, cotire will re-generate the prefix header source upon build." + "Defaults to FALSE." + ) + + define_property( + SOURCE PROPERTY "COTIRE_UNITY_SOURCE_PRE_UNDEFS" + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file before the inclusion of this source file." + FULL_DOCS + "This may be set to a semicolon-separated list of preprocessor symbols." + "cotire will add corresponding #undef directives to the generated unit source file before this file is included." + "Defaults to empty string." + ) + + define_property( + SOURCE PROPERTY "COTIRE_UNITY_SOURCE_POST_UNDEFS" + BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file after the inclusion of this source file." + FULL_DOCS + "This may be set to a semicolon-separated list of preprocessor symbols." + "cotire will add corresponding #undef directives to the generated unit source file after this file is included." + "Defaults to empty string." + ) + + define_property( + SOURCE PROPERTY "COTIRE_START_NEW_UNITY_SOURCE" + BRIEF_DOCS "Start a new unity source file which includes this source file as the first one." + FULL_DOCS + "If this property is set to TRUE, cotire will complete the current unity file and start a new one." + "The new unity source file will include this source file as the first one." + "This property essentially works as a separator for unity source files." + "Defaults to FALSE." + ) + + define_property( + SOURCE PROPERTY "COTIRE_TARGET" + BRIEF_DOCS "Read-only property. Mark this source file as cotired for the given target." + FULL_DOCS + "cotire sets this property to the name of target, that the source file's build command has been altered for." + "Defaults to empty string." + ) + + message (STATUS "cotire ${COTIRE_CMAKE_MODULE_VERSION} loaded.") + +endif() diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake new file mode 100644 index 0000000000..1b0427f088 --- /dev/null +++ b/build/cmake/options.cmake @@ -0,0 +1,371 @@ +############################################################################# +# Name: build/cmake/options.cmake +# Purpose: User selectable build options +# Author: Tobias Taschner +# Created: 2016-09-24 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +# Global build options +wx_option(wxBUILD_SHARED "Build wx libraries as shared libs" ${BUILD_SHARED_LIBS}) +wx_option(wxBUILD_MONOLITHIC "build wxWidgets as single library" OFF) +wx_option(wxBUILD_SAMPLES "Build only important samples (SOME) or ALL" OFF + STRINGS SOME ALL OFF) +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_PRECOMP "Use precompiled headers") +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) +# Allow user specified setup.h folder +set(wxBUILD_CUSTOM_SETUP_HEADER_PATH "" CACHE PATH "Include path containing custom wx/setup.h") +mark_as_advanced(wxBUILD_CUSTOM_SETUP_HEADER_PATH) + +if(MSVC) + wx_option(wxBUILD_USE_STATIC_RUNTIME "Link using the static runtime library" OFF) +else() + # Other compilers support setting the C++ standard, present it an option to the user + if(DEFINED CMAKE_CXX_STANDARD) + set(wxCXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD}) + else() + 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) +endif() + +if(WIN32) + set(wxBUILD_VENDOR "custom" CACHE STRING "Short string identifying your company (used in DLL name)") +endif() + +# STL options +wx_option(wxUSE_STL "use standard C++ classes for everything" OFF) +wx_dependent_option(wxUSE_STD_CONTAINERS "use standard C++ container classes" OFF "wxUSE_STL" OFF) + +wx_option(wxUSE_UNICODE "compile with Unicode support (NOT RECOMMENDED to be turned off)") +if(NOT WIN32) + wx_option(wxUSE_UNICODE_UTF8 "use UTF-8 representation for strings (Unix only)" OFF) + wx_dependent_option(wxUSE_UNICODE_UTF8_LOCALE "only support UTF-8 locales in UTF-8 build (Unix only)" ON "wxUSE_UNICODE_UTF8" OFF) +endif() + +wx_option(wxUSE_COMPILER_TLS "enable use of compiler TLS support") +wx_option(wxUSE_VISIBILITY "use of ELF symbols visibility") + +# --------------------------------------------------------------------------- +# external libraries +# --------------------------------------------------------------------------- +wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" + DEFAULT_APPLE sys) + +wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") + +if(NOT WIN32) + wx_option(wxUSE_LIBICONV "use libiconv (character conversion)") +endif() + +# --------------------------------------------------------------------------- +# optional non GUI features +# --------------------------------------------------------------------------- +wx_option(wxUSE_INTL "use internationalization system") +wx_option(wxUSE_XLOCALE "use x-locale support (requires wxLocale)") +wx_option(wxUSE_CONFIG "use wxConfig (and derived) classes") + +wx_option(wxUSE_PROTOCOL "use wxProtocol and derived classes") +wx_option(wxUSE_PROTOCOL_FTP "use wxFTP (requires wxProtocol") +wx_option(wxUSE_PROTOCOL_HTTP "use wxHTTP (requires wxProtocol") +wx_option(wxUSE_PROTOCOL_FILE "use wxFileProto class (requires wxProtocol") +wx_option(wxUSE_SOCKETS "use socket/network classes") +wx_option(wxUSE_IPV6 "enable IPv6 support in wxSocket") +if(WIN32) + wx_option(wxUSE_OLE "use OLE classes") +endif() +wx_option(wxUSE_DATAOBJ "use data object classes") + +wx_option(wxUSE_IPC "use interprocess communication (wxSocket etc.)") + +wx_option(wxUSE_CONSOLE_EVENTLOOP "use event loop in console programs too") + +# please keep the settings below in alphabetical order +wx_option(wxUSE_ANY "use wxAny class") +wx_option(wxUSE_APPLE_IEEE "use the Apple IEEE codec") +wx_option(wxUSE_ARCHIVE_STREAMS "use wxArchive streams") +wx_option(wxUSE_BASE64 "use base64 encoding/decoding functions") +wx_option(wxUSE_STACKWALKER "use wxStackWalker class for getting backtraces") +wx_option(wxUSE_ON_FATAL_EXCEPTION "catch signals in wxApp::OnFatalException (Unix only)") +wx_option(wxUSE_CMDLINE_PARSER "use wxCmdLineParser class") +wx_option(wxUSE_DATETIME "use wxDateTime class") +wx_option(wxUSE_DEBUGREPORT "use wxDebugReport class") +wx_option(wxUSE_DIALUP_MANAGER "use dialup network classes") +wx_option(wxUSE_DYNLIB_CLASS "use wxLibrary class for DLL loading") +wx_option(wxUSE_DYNAMIC_LOADER "use (new) wxDynamicLibrary class") +wx_option(wxUSE_EXCEPTIONS "build exception-safe library") +wx_option(wxUSE_EXTENDED_RTTI "use extended RTTI (XTI)" OFF) +wx_option(wxUSE_FFILE "use wxFFile class") +wx_option(wxUSE_FILE "use wxFile class") +wx_option(wxUSE_FILE_HISTORY "use wxFileHistory class") +wx_option(wxUSE_FILESYSTEM "use virtual file systems classes") +wx_option(wxUSE_FONTENUM "use wxFontEnumerator class") +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") +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(wxUSE_SNGLINST_CHECKER "use wxSingleInstanceChecker class") +wx_option(wxUSE_SOUND "use wxSound class") +wx_option(wxUSE_STDPATHS "use wxStandardPaths class") +wx_option(wxUSE_STOPWATCH "use wxStopWatch class") +wx_option(wxUSE_STREAMS "use wxStream etc classes") +wx_option(wxUSE_SYSTEM_OPTIONS "use wxSystemOptions") +wx_option(wxUSE_TARSTREAM "use wxTar streams") +wx_option(wxUSE_TEXTBUFFER "use wxTextBuffer class") +wx_option(wxUSE_TEXTFILE "use wxTextFile class") +wx_option(wxUSE_TIMER "use wxTimer class") +wx_option(wxUSE_VARIANT "use wxVariant class") +wx_option(wxUSE_ZIPSTREAM "use wxZip streams") + +# URL-related classes +wx_option(wxUSE_URL "use wxURL class") +wx_option(wxUSE_PROTOCOL "use wxProtocol class") +wx_option(wxUSE_PROTOCOL_HTTP "HTTP support in wxProtocol") +wx_option(wxUSE_PROTOCOL_FTP "FTP support in wxProtocol") +wx_option(wxUSE_PROTOCOL_FILE "FILE support in wxProtocol") + +wx_option(wxUSE_THREADS "use threads") + +if(WIN32) + if(MINGW) + #TODO: version check, as newer versions have no problem enabling this + set(wxUSE_DBGHELP_DEFAULT OFF) + else() + set(wxUSE_DBGHELP_DEFAULT ON) + endif() + wx_option(wxUSE_DBGHELP "use dbghelp.dll API" ${wxUSE_DBGHELP_DEFAULT}) + wx_option(wxUSE_INICONF "use wxIniConfig") + wx_option(wxUSE_REGKEY "use wxRegKey class") +endif() + +if(wxUSE_GUI) + +# --------------------------------------------------------------------------- +# optional "big" GUI features +# --------------------------------------------------------------------------- + +wx_option(wxUSE_DOC_VIEW_ARCHITECTURE "use document view architecture") +wx_option(wxUSE_HELP "use help subsystem") +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_AUI "use AUI docking library") +wx_option(wxUSE_PROPGRID "use wxPropertyGrid library") +wx_option(wxUSE_RIBBON "use wxRibbon library") +wx_option(wxUSE_STC "use wxStyledTextCtrl library") +wx_option(wxUSE_CONSTRAINTS "use layout-constraints system") +wx_option(wxUSE_LOGGUI "use standard GUI logger") +wx_option(wxUSE_LOGWINDOW "use wxLogWindow") +wx_option(wxUSE_LOGDIALOG "use wxLogDialog") +wx_option(wxUSE_MDI "use multiple document interface architecture") +wx_option(wxUSE_MDI_ARCHITECTURE "use docview architecture with MDI") +wx_option(wxUSE_MEDIACTRL "use wxMediaCtrl class") +wx_option(wxUSE_RICHTEXT "use wxRichTextCtrl") +wx_option(wxUSE_POSTSCRIPT "use wxPostscriptDC device context (default for gtk+)") +wx_option(wxUSE_PRINTING_ARCHITECTURE "use printing architecture") +wx_option(wxUSE_SVG "use wxSVGFileDC device context") +wx_option(wxUSE_WEBKIT "use wxWebKitCtrl (Mac-only, use wxWebView instead)") +wx_option(wxUSE_WEBVIEW "use wxWebView library") + +# wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter +# can't be disabled, don't even provide an option to do it +if(APPLE) + set(wxUSE_GRAPHICS_CONTEXT ON) +else() + wx_option(wxUSE_GRAPHICS_CONTEXT "use graphics context 2D drawing API") +endif() + +# --------------------------------------------------------------------------- +# IPC &c +# --------------------------------------------------------------------------- + +wx_option(wxUSE_CLIPBOARD "use wxClipboard class") +wx_option(wxUSE_DRAG_AND_DROP "use Drag'n'Drop classes") + +# --------------------------------------------------------------------------- +# optional GUI controls (in alphabetical order except the first one) +# --------------------------------------------------------------------------- + +# don't set DEFAULT_wxUSE_XXX below if the option is not specified +wx_option(wxUSE_CONTROLS "disable compilation of all standard controls") + +# features affecting multiple controls +wx_option(wxUSE_MARKUP "support wxControl::SetLabelMarkup") + +# please keep the settings below in alphabetical order +wx_option(wxUSE_ACCEL "use accelerators") +wx_option(wxUSE_ACTIVITYINDICATOR "use wxActivityIndicator class") +wx_option(wxUSE_ADDREMOVECTRL "use wxAddRemoveCtrl") +wx_option(wxUSE_ANIMATIONCTRL "use wxAnimationCtrl class") +wx_option(wxUSE_BANNERWINDOW "use wxBannerWindow class") +wx_option(wxUSE_ARTPROVIDER_STD "use standard XPM icons in wxArtProvider") +wx_option(wxUSE_ARTPROVIDER_TANGO "use Tango icons in wxArtProvider") +wx_option(wxUSE_BMPBUTTON "use wxBitmapButton class") +wx_option(wxUSE_BITMAPCOMBOBOX "use wxBitmapComboBox class") +wx_option(wxUSE_BUTTON "use wxButton class") +wx_option(wxUSE_CALENDARCTRL "use wxCalendarCtrl class") +wx_option(wxUSE_CARET "use wxCaret class") +wx_option(wxUSE_CHECKBOX "use wxCheckBox class") +wx_option(wxUSE_CHECKLISTBOX "use wxCheckListBox (listbox with checkboxes) class") +wx_option(wxUSE_CHOICE "use wxChoice class") +wx_option(wxUSE_CHOICEBOOK "use wxChoicebook class") +wx_option(wxUSE_COLLPANE "use wxCollapsiblePane class") +wx_option(wxUSE_COLOURPICKERCTRL "use wxColourPickerCtrl class") +wx_option(wxUSE_COMBOBOX "use wxComboBox class") +wx_option(wxUSE_COMBOCTRL "use wxComboCtrl class") +wx_option(wxUSE_COMMANDLINKBUTTON "use wxCommmandLinkButton class") +wx_option(wxUSE_DATAVIEWCTRL "use wxDataViewCtrl class") +wx_option(wxUSE_DATEPICKCTRL "use wxDatePickerCtrl class") +wx_option(wxUSE_DETECT_SM "_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") +wx_option(wxUSE_FILECTRL "use wxFileCtrl class") +wx_option(wxUSE_FILEPICKERCTRL "use wxFilePickerCtrl class") +wx_option(wxUSE_FONTPICKERCTRL "use wxFontPickerCtrl class") +wx_option(wxUSE_GAUGE "use wxGauge class") +wx_option(wxUSE_GRID "use wxGrid class") +wx_option(wxUSE_HEADERCTRL "use wxHeaderCtrl class") +wx_option(wxUSE_HYPERLINKCTRL "use wxHyperlinkCtrl class") +wx_option(wxUSE_IMAGLIST "use wxImageList class") +wx_option(wxUSE_INFOBAR "use wxInfoBar class") +wx_option(wxUSE_LISTBOOK "use wxListbook class") +wx_option(wxUSE_LISTBOX "use wxListBox class") +wx_option(wxUSE_LISTCTRL "use wxListCtrl class") +wx_option(wxUSE_NOTEBOOK "use wxNotebook class") +wx_option(wxUSE_NOTIFICATION_MESSAGE "use wxNotificationMessage class") +wx_option(wxUSE_ODCOMBOBOX "use wxOwnerDrawnComboBox class") +wx_option(wxUSE_POPUPWIN "use wxPopUpWindow class") +wx_option(wxUSE_PREFERENCES_EDITOR "use wxPreferencesEditor class") +wx_option(wxUSE_RADIOBOX "use wxRadioBox class") +wx_option(wxUSE_RADIOBTN "use wxRadioButton class") +wx_option(wxUSE_RICHMSGDLG "use wxRichMessageDialog class") +wx_option(wxUSE_RICHTOOLTIP "use wxRichToolTip class") +wx_option(wxUSE_REARRANGECTRL "use wxRearrangeList/Ctrl/Dialog") +wx_option(wxUSE_SASH "use wxSashWindow class") +wx_option(wxUSE_SCROLLBAR "use wxScrollBar class and scrollable windows") +wx_option(wxUSE_SEARCHCTRL "use wxSearchCtrl class") +wx_option(wxUSE_SLIDER "use wxSlider class") +wx_option(wxUSE_SPINBTN "use wxSpinButton class") +wx_option(wxUSE_SPINCTRL "use wxSpinCtrl class") +wx_option(wxUSE_SPLITTER "use wxSplitterWindow class") +wx_option(wxUSE_STATBMP "use wxStaticBitmap class") +wx_option(wxUSE_STATBOX "use wxStaticBox class") +wx_option(wxUSE_STATLINE "use wxStaticLine class") +wx_option(wxUSE_STATTEXT "use wxStaticText class") +wx_option(wxUSE_STATUSBAR "use wxStatusBar class") +wx_option(wxUSE_TASKBARBUTTON "use wxTaskBarButton class") +wx_option(wxUSE_TASKBARICON "use wxTaskBarIcon class") +wx_option(wxUSE_TOOLBAR_NATIVE "use native wxToolBar class") +wx_option(wxUSE_TEXTCTRL "use wxTextCtrl class") +if(wxUSE_TEXTCTRL) + # we don't have special switches to disable wxUSE_RICHEDIT[2], it doesn't + # seem useful to allow disabling them + set(wxUSE_RICHEDIT ON) + set(wxUSE_RICHEDIT2 ON) +endif() +wx_option(wxUSE_TIMEPICKCTRL "use wxTimePickerCtrl class") +wx_option(wxUSE_TIPWINDOW "use wxTipWindow class") +wx_option(wxUSE_TOGGLEBTN "use wxToggleButton class") +wx_option(wxUSE_TOOLBAR "use wxToolBar class") +wx_option(wxUSE_TOOLBOOK "use wxToolbook class") +wx_option(wxUSE_TREEBOOK "use wxTreebook class") +wx_option(wxUSE_TREECTRL "use wxTreeCtrl class") +wx_option(wxUSE_TREELISTCTRL "use wxTreeListCtrl class") + +# --------------------------------------------------------------------------- +# common dialogs +# --------------------------------------------------------------------------- + +wx_option(wxUSE_COMMONDLGS "use all common dialogs") +wx_option(wxUSE_ABOUTDLG "use wxAboutBox") +wx_option(wxUSE_CHOICEDLG "use wxChoiceDialog") +wx_option(wxUSE_COLOURDLG "use wxColourDialog") +wx_option(wxUSE_FILEDLG "use wxFileDialog") +wx_option(wxUSE_FINDREPLDLG "use wxFindReplaceDialog") +wx_option(wxUSE_FONTDLG "use wxFontDialog") +wx_option(wxUSE_DIRDLG "use wxDirDialog") +wx_option(wxUSE_MSGDLG "use wxMessageDialog") +wx_option(wxUSE_NUMBERDLG "use wxNumberEntryDialog") +wx_option(wxUSE_SPLASH "use wxSplashScreen") +wx_option(wxUSE_TEXTDLG "use wxTextDialog") +wx_option(wxUSE_STARTUP_TIPS "use startup tips") +wx_option(wxUSE_PROGRESSDLG "use wxProgressDialog") +wx_option(wxUSE_WIZARDDLG "use wxWizard") + +# --------------------------------------------------------------------------- +# misc GUI options +# --------------------------------------------------------------------------- + +wx_option(wxUSE_MENUS "use wxMenu/wxMenuBar/wxMenuItem classes") +wx_option(wxUSE_MINIFRAME "use wxMiniFrame class") +wx_option(wxUSE_TOOLTIPS "use wxToolTip class") +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()") +wx_option(wxUSE_JOYSTICK "use wxJoystick") +wx_option(wxUSE_METAFILE "use wxMetaFile") +wx_option(wxUSE_DRAGIMAGE "use wxDragImage") +if(WIN32) + wx_option(wxUSE_ACCESSIBILITY "enable accessibility support" ON) +endif() +wx_option(wxUSE_UIACTIONSIMULATOR "use wxUIActionSimulator (experimental)") +wx_option(wxUSE_DC_TRANSFORM_MATRIX "use wxDC::SetTransformMatrix and related") +wx_option(wxUSE_WEBVIEW_WEBKIT "use wxWebView WebKit backend") + +# --------------------------------------------------------------------------- +# support for image formats that do not rely on external library +# --------------------------------------------------------------------------- + +wx_option(wxUSE_PALETTE "use wxPalette class") +wx_option(wxUSE_IMAGE "use wxImage class") +wx_option(wxUSE_GIF "use gif images (GIF file format)") +wx_option(wxUSE_PCX "use pcx images (PCX file format)") +wx_option(wxUSE_TGA "use tga images (TGA file format)") +wx_option(wxUSE_IFF "use iff images (IFF file format)") +wx_option(wxUSE_PNM "use pnm images (PNM file format)") +wx_option(wxUSE_XPM "use xpm images (XPM file format)") +wx_option(wxUSE_ICO_CUR "_cur use Windows ICO and CUR formats") + +# --------------------------------------------------------------------------- +# wxMSW-only options +# --------------------------------------------------------------------------- + +if(WIN32) + wx_option(wxUSE_DC_CACHEING "cache temporary wxDC objects (Win32 only)") + wx_option(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW "use PS printing in wxMSW (Win32 only)") + wx_option(wxUSE_OWNER_DRAWN "use owner drawn controls (Win32)") + wx_option(wxUSE_UXTHEME "enable support for Windows XP themed look (Win32 only)") + wx_option(wxUSE_DIB "use wxDIB class (Win32 only)") + wx_option(wxUSE_WEBVIEW_IE "use wxWebView IE backend (Win32 only)") +endif() + +# this one is not really MSW-specific but it exists mainly to be turned off +# under MSW, it should be off by default on the other platforms +if(WIN32) + set(wxDEFAULT_wxUSE_AUTOID_MANAGEMENT ON) +else() + set(wxDEFAULT_wxUSE_AUTOID_MANAGEMENT OFF) +endif() + +wx_option(wxUSE_AUTOID_MANAGEMENT "use automatic ids management" ${wxDEFAULT_wxUSE_AUTOID_MANAGEMENT}) + +endif() # wxUSE_GUI diff --git a/build/cmake/policies.cmake b/build/cmake/policies.cmake new file mode 100644 index 0000000000..9c4fd224c2 --- /dev/null +++ b/build/cmake/policies.cmake @@ -0,0 +1,48 @@ +############################################################################# +# Name: CMakeLists.txt +# Purpose: CMake policies for wxWidgets +# Author: Tobias Taschner +# Created: 2016-10-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +if(POLICY CMP0025) + # Compiler id for Apple Clang is now AppleClang + cmake_policy(SET CMP0025 NEW) +endif() + +if(POLICY CMP0038) + # targets may not link directly to themselves + cmake_policy(SET CMP0038 NEW) +endif() + +if(POLICY CMP0045) + # error on non-existent target in get_target_property + cmake_policy(SET CMP0045 NEW) +endif() + +if(POLICY CMP0046) + # error on non-existent dependency in add_dependencies + cmake_policy(SET CMP0046 NEW) +endif() + +if(POLICY CMP0049) + # do not expand variables in target source entries + cmake_policy(SET CMP0049 NEW) +endif() + +if(POLICY CMP0053) + # simplify variable reference and escape sequence evaluation + cmake_policy(SET CMP0053 NEW) +endif() + +if(POLICY CMP0054) + # only interpret if() arguments as variables or keywords when unquoted + cmake_policy(SET CMP0054 NEW) +endif() + +if(POLICY CMP0042) + # MACOSX_RPATH is enabled by default. + cmake_policy(SET CMP0042 NEW) +endif() diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt new file mode 100644 index 0000000000..8879370682 --- /dev/null +++ b/build/cmake/samples/CMakeLists.txt @@ -0,0 +1,240 @@ +############################################################################# +# Name: build/cmake/samples/CMakeLists.txt +# Purpose: CMake script to build samples +# Author: Tobias Taschner +# Created: 2016-10-04 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_sample(access accesstest.cpp) +wx_add_sample(animate anitest.cpp LIBRARIES adv DATA throbber.gif hourglass.ani) +wx_add_sample(artprov arttest.cpp artbrows.cpp artbrows.h) +wx_add_sample(aui auidemo.cpp LIBRARIES adv aui html NAME auidemo) +wx_add_sample(calendar LIBRARIES adv) +wx_add_sample(caret) +wx_add_sample(clipboard) +wx_add_sample(collpane LIBRARIES adv) +wx_add_sample(combo LIBRARIES adv DATA dropbuth.png dropbutn.png dropbutp.png) +wx_add_sample(config conftest.cpp) +wx_add_sample(console CONSOLE IMPORTANT) +wx_add_sample(dataview IMPORTANT dataview.cpp mymodels.cpp mymodels.h LIBRARIES adv) +wx_add_sample(debugrpt LIBRARIES qa) +wx_add_sample(dialogs dialogs.cpp dialogs.h LIBRARIES adv DATA tips.txt) +wx_add_sample(dialup nettest.cpp) +wx_add_sample(display) +wx_add_sample(dnd dnd.cpp RES dnd.rc DATA wxwin.png) +wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h + RES docview.rc) +wx_add_sample(dragimag dragimag.cpp dragimag.h RES dragimag.rc + DATA backgrnd.png shape01.png shape02.png shape03.png) +wx_add_sample(drawing DATA pat4.bmp pat35.bmp pat36.bmp image.bmp mask.bmp) +wx_add_sample(erase) +wx_add_sample(event) +wx_add_sample(except) +wx_add_sample(exec) +wx_add_sample(font) +wx_add_sample(fswatcher) +wx_add_sample(grid griddemo.cpp griddemo.h LIBRARIES adv) + +wx_list_add_prefix(HELP_DOC_FILES doc/ + aindex.html ClassGraph.class ClassGraphPanel.class ClassLayout.class + down.gif dxxgifs.tex HIER.html HIERjava.html icon1.gif icon2.gif + index.html logo.gif NavigatorButton.class USE_HELP.html wx204.htm + wx34.htm wxExtHelpController.html wxhelp.map wx.htm + ) +wx_add_sample(help demo.cpp doc.h LIBRARIES html adv + DATA + back.gif bullet.bmp contents.gif cshelp.txt doc.chm doc.cnt doc.hhc + doc.hhk doc.hhp doc.hlp doc.hpj doc.zip forward.gif up.gif + ${HELP_DOC_FILES} + NAME helpdemo + ) +wx_add_sample(htlbox LIBRARIES html) +include(html.cmake) +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 smile.xbm toucan.png cmyk.jpg cursor.png) +foreach(lang ar bg cs de fr it ka pl ru sv ja ja_JP.EUC-JP) + list(APPEND INTERNAT_DATA_FILES ${lang}/internat.po ${lang}/internat.mo) +endforeach() +wx_add_sample(internat DATA ${INTERNAT_DATA_FILES}) +# IPC samples +set(wxSAMPLE_FOLDER ipc) +wx_add_sample(ipc client.cpp client.h connection.h ipcsetup.h NAME ipcclient LIBRARIES net) +wx_add_sample(ipc server.cpp server.h connection.h ipcsetup.h NAME ipcserver LIBRARIES net) +wx_add_sample(ipc CONSOLE baseclient.cpp connection.h ipcsetup.h NAME baseipcclient LIBRARIES net) +wx_add_sample(ipc CONSOLE baseserver.cpp connection.h ipcsetup.h NAME baseipcserver LIBRARIES net) +set(wxSAMPLE_FOLDER) +wx_add_sample(joytest joytest.cpp joytest.h DATA buttonpress.wav LIBRARIES adv) +wx_add_sample(keyboard) +wx_add_sample(layout layout.cpp layout.h) +wx_add_sample(listctrl listtest.cpp listtest.h RES listtest.rc) +wx_add_sample(mdi mdi.cpp mdi.h RES mdi.rc) +wx_add_sample(mediaplayer LIBRARIES media DEPENDS wxUSE_MEDIACTRL) +wx_add_sample(memcheck) +wx_add_sample(menu) +wx_add_sample(minimal IMPORTANT) +wx_add_sample(notebook notebook.cpp notebook.h LIBRARIES aui adv) +if(wxUSE_OPENGL) + set(wxSAMPLE_SUBDIR opengl/) + set(wxSAMPLE_FOLDER OpenGL) + wx_add_sample(cube cube.cpp cube.h LIBRARIES gl) + wx_add_sample(isosurf isosurf.cpp isosurf.h LIBRARIES gl DATA isosurf.dat.gz) + wx_add_sample(penguin + penguin.cpp dxfrenderer.cpp trackball.c + dxfrenderer.h penguin.h trackball.h + LIBRARIES gl + DATA penguin.dxf.gz) + wx_add_sample(pyramid + pyramid.cpp oglstuff.cpp mathstuff.cpp oglpfuncs.cpp + pyramid.h oglstuff.h mathstuff.h oglpfuncs.h + LIBRARIES gl) + set(wxSAMPLE_SUBDIR) + set(wxSAMPLE_FOLDER) +endif() +wx_add_sample(ownerdrw RES ownerdrw.rc DATA sound.png nosound.png DEPENDS wxUSE_OWNER_DRAWN) +wx_add_sample(popup) +wx_add_sample(power) +wx_add_sample(preferences) +wx_add_sample(printing printing.cpp printing.h) +wx_add_sample(propgrid propgrid.cpp propgrid_minimal.cpp sampleprops.cpp + tests.cpp sampleprops.h propgrid.h LIBRARIES adv propgrid NAME propgriddemo) +wx_add_sample(render FOLDER render) +wx_add_sample(render DLL renddll.cpp NAME renddll FOLDER render) +wx_add_sample(ribbon ribbondemo.cpp LIBRARIES ribbon adv NAME ribbondemo) +wx_add_sample(richtext LIBRARIES richtext adv html xml NAME richtextdemo) +wx_add_sample(sashtest sashtest.cpp sashtest.h LIBRARIES adv) +wx_add_sample(scroll) +wx_add_sample(secretstore CONSOLE DEPENDS wxUSE_SECRETSTORE) +wx_add_sample(shaped DATA star.png) +wx_add_sample(sockets client.cpp NAME client LIBRARIES net FOLDER sockets) +wx_add_sample(sockets server.cpp NAME server LIBRARIES net FOLDER sockets) +wx_add_sample(sockets CONSOLE baseclient.cpp NAME baseclient LIBRARIES net FOLDER sockets) +wx_add_sample(sockets CONSOLE baseserver.cpp NAME baseserver LIBRARIES net FOLDER sockets) +wx_add_sample(sound RES sound.rc DATA 9000g.wav cuckoo.wav doggrowl.wav tinkalink2.wav LIBRARIES adv) +wx_add_sample(splash DATA splash.png press.mpg LIBRARIES adv) +if(TARGET splash AND wxUSE_MEDIACTRL) + target_link_libraries(splash media) +endif() +wx_add_sample(splitter) +wx_add_sample(statbar) +wx_add_sample(stc stctest.cpp edit.cpp prefs.cpp edit.h defsext.h prefs.h + DATA stctest.cpp NAME stctest LIBRARIES stc) +wx_add_sample(svg svgtest.cpp) +wx_add_sample(taborder) +wx_add_sample(taskbar tbtest.cpp tbtest.h LIBRARIES adv DEPENDS wxUSE_TASKBARICON) +wx_add_sample(text) +wx_add_sample(thread) +wx_add_sample(toolbar RES toolbar.rc) +wx_add_sample(treectrl treetest.cpp treetest.h) +wx_add_sample(treelist LIBRARIES adv) +wx_add_sample(typetest typetest.cpp typetest.h) +wx_add_sample(uiaction) +wx_add_sample(validate) +wx_add_sample(vscroll vstest.cpp) +wx_add_sample(webview LIBRARIES webview stc adv NAME webviewsample) +# widgets Sample +set(SAMPLE_WIDGETS_SRC + activityindicator.cpp + bmpcombobox.cpp + button.cpp + checkbox.cpp + choice.cpp + clrpicker.cpp + combobox.cpp + datepick.cpp + dirctrl.cpp + dirpicker.cpp + editlbox.cpp + filectrl.cpp + filepicker.cpp + fontpicker.cpp + gauge.cpp + headerctrl.cpp + hyperlnk.cpp + itemcontainer.cpp + listbox.cpp + native.cpp + notebook.cpp + odcombobox.cpp + radiobox.cpp + searchctrl.cpp + slider.cpp + spinbtn.cpp + static.cpp + statbmp.cpp + textctrl.cpp + timepick.cpp + toggle.cpp + widgets.cpp + widgets.h + itemcontainer.h + ) +if(APPLE) + # The source file using native controls uses Cocoa under OS X, so it must + # be compiled as Objective C++ which means it must have .mm extension. + # But this would make it uncompilable under the other platforms and we + # don't want to have two files with identical contents. Hence this hack: + # we have native.mm which just includes native.cpp under OS X, while + # elsewhere we just compile native.cpp directly. + list(APPEND SAMPLE_WIDGETS_SRC native_wrapper.mm) +endif() +wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC} LIBRARIES adv) +wx_add_sample(wizard LIBRARIES adv) +wx_add_sample(wrapsizer) + +wx_list_add_prefix(XRC_RC_FILES rc/ + aui.xpm aui.xrc + artprov.xpm artprov.xrc basicdlg.xpm + basicdlg.xrc controls.xpm controls.xrc custclas.xpm custclas.xrc + derivdlg.xpm derivdlg.xrc fileopen.gif filesave.gif frame.xrc + fuzzy.gif menu.xrc platform.xpm platform.xrc quotes.gif + resource.xrc toolbar.xrc uncenter.xpm + objref.xrc objrefdlg.xpm + uncenter.xrc update.gif + variable.xpm variable.xrc + variants.xpm variants.xrc + throbber.gif stop.xpm + wxbanner.gif + ) +wx_add_sample(xrc + xrcdemo.cpp + myframe.cpp + derivdlg.cpp + custclas.cpp + objrefdlg.cpp + derivdlg.h + xrcdemo.h + myframe.h + custclas.h + objrefdlg.h + ${XRC_RC_FILES} + LIBRARIES aui ribbon xrc html adv + NAME xrcdemo + ) +wx_add_sample(xti xti.cpp classlist.cpp codereadercallback.cpp LIBRARIES xml + DEPENDS wxUSE_EXTENDED_RTTI) + +if(WIN32) + # Windows only samples + + # DLL Sample + wx_add_sample(dll DLL my_dll.cpp NAME my_dll FOLDER dll + DEFINITIONS MY_DLL_BUILDING) + if(NOT wxBUILD_SHARED) + # 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 NAME wx_exe FOLDER dll LIBRARIES my_dll) + endif() + + wx_add_sample(dll sdk_exe.cpp NAME sdk_exe FOLDER dll LIBRARIES my_dll) + wx_add_sample(flash) + #TODO: renable when sample is fixed + #wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) + wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc) + wx_add_sample(oleauto) + wx_add_sample(regtest RES regtest.rc) + wx_add_sample(taskbarbutton LIBRARIES adv DEPENDS wxUSE_TASKBARBUTTON) +endif() diff --git a/build/cmake/samples/html.cmake b/build/cmake/samples/html.cmake new file mode 100644 index 0000000000..ff25eb8d84 --- /dev/null +++ b/build/cmake/samples/html.cmake @@ -0,0 +1,42 @@ +############################################################################# +# Name: build/cmake/samples/html.cmake +# Purpose: CMake script to build html samples +# Author: Tobias Taschner +# Created: 2016-10-22 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +set(wxSAMPLE_FOLDER html) +set(wxSAMPLE_SUBDIR html/) + +wx_add_sample(about DATA data/about.htm data/logo.png LIBRARIES html) +wx_list_add_prefix(HELP_DATA_FILES helpfiles/ + Index.hhk + another.hhc + another.hhp + another.htm + book1.htm + book2.htm + contents.hhc + main.htm + page2-b.htm + testing.hhp + ) +wx_add_sample(help DATA ${HELP_DATA_FILES} LIBRARIES html NAME htmlhelp) +wx_add_sample(helpview DATA test.zip LIBRARIES html) +#TODO: htmlctrl sample uses outdated definitions +#wx_add_sample(htmlctrl LIBRARIES html) +wx_add_sample(printing DATA logo6.gif test.htm LIBRARIES html NAME htmlprinting) +wx_add_sample(test + DATA + 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 net html NAME htmltest) +wx_add_sample(virtual DATA start.htm LIBRARIES html) +wx_add_sample(widget DATA start.htm LIBRARIES html) +wx_add_sample(zip DATA pages.zip start.htm LIBRARIES html) + +set(wxSAMPLE_SUBDIR) +set(wxSAMPLE_FOLDER) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake new file mode 100644 index 0000000000..5c0fd0e1c9 --- /dev/null +++ b/build/cmake/setup.cmake @@ -0,0 +1,682 @@ +############################################################################# +# Name: build/cmake/setup.cmake +# Purpose: Create and configure setup.h +# Author: Tobias Taschner +# Created: 2016-09-22 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +# Include modules required for setup.h generation +include(CheckCSourceCompiles) +include(CheckCXXCompilerFlag) +include(CheckCXXSourceCompiles) +include(CheckCXXSymbolExists) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +include(CheckIncludeFiles) +include(CheckPrototypeDefinition) +include(CheckStructHasMember) +include(CheckSymbolExists) +include(CheckTypeSize) +include(CMakePushCheckState) +include(TestBigEndian) + +# Add a definition to setup.h and append it to a list of defines for +# for compile checks +macro(wx_setup_definition def) + set(${def} YES) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D${def}) +endmacro() + +# Add define based on system name +string(TOUPPER ${CMAKE_SYSTEM_NAME} wxSYS_NAME) +wx_setup_definition(__${wxSYS_NAME}__) + +if(WIN32) + wx_setup_definition(__WIN32__) +endif() + +if(CYGWIN) + wx_setup_definition(__GNUWIN32__) +endif() + +if(UNIX) + wx_setup_definition(wxUSE_UNIX) + wx_setup_definition(__UNIX__) + wx_setup_definition(_GNU_SOURCE) +endif() + +if(APPLE) + wx_setup_definition(__BSD__) +endif() + +if(WXGTK) + # Add GTK version definitions + foreach(gtk_version 1.2.7 2.0 2.10 2.18 2.20 3.0) + if(wxTOOLKIT_VERSION VERSION_GREATER gtk_version) + string(REPLACE . "" gtk_version_dotless ${gtk_version}) + set(__WXGTK${gtk_version_dotless}__ ON) + endif() + endforeach() +endif() + +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 + +# wx_check_cxx_source_compiles( [headers...]) +function(wx_check_cxx_source_compiles code res_var) + set(src) + foreach(header ${ARGN}) + if(header STREQUAL "DEFINITION") + set(is_definition TRUE) + elseif(is_definition) + set(src "${src}${header}") + set(is_definition FALSE) + else() + set(src "${src}#include <${header}>\n") + endif() + endforeach() + set(src "${src}\n\nint main(int argc, char* argv[]) {\n ${code}\nreturn 0; }") + check_cxx_source_compiles("${src}" ${res_var}) +endfunction() + +# wx_check_cxx_source_compiles( [headers...]) +function(wx_check_c_source_compiles code res_var) + set(src) + foreach(header ${ARGN}) + if(header STREQUAL "DEFINITION") + set(is_definition TRUE) + elseif(is_definition) + set(src "${src}${header}") + set(is_definition FALSE) + else() + set(src "${src}#include <${header}>\n") + endif() + endforeach() + set(src "${src}\n\nint main(int argc, char* argv[]) {\n ${code}\nreturn 0; }") + check_c_source_compiles("${src}" ${res_var}) +endfunction() + +# wx_check_funcs(<...>) +# define a HAVE_... for every function in list if available +function(wx_check_funcs) + foreach(func ${ARGN}) + string(TOUPPER ${func} func_upper) + check_function_exists(${func} HAVE_${func_upper}) + endforeach() +endfunction() + +if(NOT MSVC) + check_symbol_exists(va_copy stdarg.h HAVE_VA_COPY) + if(NOT HAVE_VA_COPY) + # try to understand how can we copy va_lists + set(VA_LIST_IS_ARRAY YES) + endif() +endif() + +wx_check_c_source_compiles( + "#define test(fmt, ...) printf(fmt, __VA_ARGS__) + test(\"%s %d %p\", \"test\", 1, 0);" + HAVE_VARIADIC_MACROS + stdio.h + ) +#TODO: wxNO_VARIADIC_MACROS +if(wxUSE_STL) + wx_check_cxx_source_compiles(" + std::vector moo; + std::list foo; + std::vector::iterator it = + std::find_if(moo.begin(), moo.end(), + std::bind2nd(std::less(), 3));" + wxTEST_STL + string functional algorithm vector list + ) + if(NOT wxTEST_STL) + message(FATAL_ERROR "Can't use wxUSE_STL as basic STL functionality is missing") + endif() + + wx_check_cxx_source_compiles(" + std::string foo, bar; + foo.compare(bar); + foo.compare(1, 1, bar); + foo.compare(1, 1, bar, 1, 1); + foo.compare(\"\"); + foo.compare(1, 1, \"\"); + foo.compare(1, 1, \"\", 2);" + HAVE_STD_STRING_COMPARE + string + ) +endif() + +# Check for availability of GCC's atomic operations builtins. +wx_check_c_source_compiles(" + unsigned int value=0; + /* wxAtomicInc doesn't use return value here */ + __sync_fetch_and_add(&value, 2); + __sync_sub_and_fetch(&value, 1); + /* but wxAtomicDec does, so mimic that: */ + volatile unsigned int r2 = __sync_sub_and_fetch(&value, 1);" + HAVE_GCC_ATOMIC_BUILTINS + ) + +macro(wx_get_socket_param_type name code) + # This test needs to be done in C++ mode since gsocket.cpp now + # is C++ code and pointer cast that are possible even without + # warning in C still fail in C++. + wx_check_cxx_source_compiles( + "socklen_t len; + ${code}" + ${name}_IS_SOCKLEN_T + sys/types.h sys/socket.h + ) + if(${name}_IS_SOCKLEN_T) + set(${name} socklen_t) + else() + wx_check_cxx_source_compiles( + "size_t len; + ${code}" + ${name}_IS_SIZE_T + sys/types.h sys/socket.h + ) + if(${name}_IS_SIZE_T) + set(${name} size_t) + else() + wx_check_cxx_source_compiles( + "int len; + ${code}" + ${name}_IS_INT + sys/types.h sys/socket.h + ) + if(${name}_IS_INT) + set(${name} int) + else() + message(ERROR "Couldn't find ${name} for this system") + endif() + endif() + endif() +endmacro() + +# the following tests are for Unix(like) systems only +if(NOT WIN32) + if(wxUSE_LIBICONV AND NOT APPLE) + find_package(Iconv REQUIRED) + set(HAVE_ICONV ON) + if(ICONV_SECOND_ARGUMENT_IS_CONST) + set(ICONV_CONST "const") + endif() + endif() + + # check for POSIX signals if we need them + if(wxUSE_ON_FATAL_EXCEPTION) + wx_check_funcs(sigaction) + if(NOT HAVE_SIGACTION) + message(WARNING "No POSIX signal functions on this system, wxApp::OnFatalException will not be called") + wx_option_force_value(wxUSE_ON_FATAL_EXCEPTION OFF) + endif() + endif() + + if(wxUSE_ON_FATAL_EXCEPTION) + wx_check_cxx_source_compiles( + "return 0; } + extern void testSigHandler(int) { }; + int foo() { + struct sigaction sa; + sa.sa_handler = testSigHandler;" + wxTYPE_SA_HANDLER_IS_INT + signal.h + ) + if(wxTYPE_SA_HANDLER_IS_INT) + set(wxTYPE_SA_HANDLER int) + else() + set(wxTYPE_SA_HANDLER void) + endif() + endif() + + # backtrace() and backtrace_symbols() for wxStackWalker + if(wxUSE_STACKWALKER) + wx_check_cxx_source_compiles(" + void *trace[1]; + char **messages; + backtrace(trace, 1); + messages = backtrace_symbols(trace, 1);" + wxHAVE_BACKTRACE + execinfo.h) + if(NOT wxHAVE_BACKTRACE) + message(WARNING "backtrace() is not available, wxStackWalker will not be available") + wx_option_force_value(wxUSE_STACKWALKER OFF) + else() + wx_check_cxx_source_compiles( + "int rc; + __cxxabiv1::__cxa_demangle(\"foo\", 0, 0, &rc);" + HAVE_CXA_DEMANGLE + cxxabi.h) + endif() + endif() + + wx_check_funcs(mkstemp mktemp) + + # get the library function to use for wxGetDiskSpace(): it is statfs() under + # Linux and *BSD and statvfs() under Solaris + wx_check_c_source_compiles(" + return 0; } + #if defined(__BSD__) + #include + #include + #else + #include + #endif + + int foo() { + long l; + struct statfs fs; + statfs(\"/\", &fs); + l = fs.f_bsize; + l += fs.f_blocks; + l += fs.f_bavail;" + HAVE_STATFS) + if(HAVE_STATFS) + set(WX_STATFS_T "struct statfs") + wx_check_cxx_source_compiles(" + return 0; } + #if defined(__BSD__) + #include + #include + #else + #include + #endif + + int foo() { + struct statfs fs; + statfs(\"/\", &fs);" + HAVE_STATFS_DECL) + else() + # TODO: implment statvfs checks + if(HAVE_STATVFS) + set(WX_STATFS_T statvfs_t) + endif() + endif() + + if(NOT HAVE_STATFS AND NOT HAVE_STATVFS) + message(WARNING "wxGetDiskSpace() function won't work without statfs()") + endif() + + # check for fcntl() or at least flock() needed by Unix implementation of + # wxSingleInstanceChecker + if(wxUSE_SNGLINST_CHECKER) + wx_check_funcs(fcntl flock) + if(NOT HAVE_FCNTL AND NOT HAVE_FLOCK) + message(WARNING "wxSingleInstanceChecker not available") + wx_option_force_value(wxUSE_SNGLINST_CHECKER OFF) + endif() + endif() + + # look for a function to modify the environment + wx_check_funcs(setenv putenv) + if(HAVE_SETENV) + wx_check_funcs(unsetenv) + endif() + + set(HAVE_SOME_SLEEP_FUNC FALSE) + if(APPLE) + # Mac OS X/Darwin has both nanosleep and usleep + # but only usleep is defined in unistd.h + set(HAVE_USLEEP TRUE) + set(HAVE_SOME_SLEEP_FUNC TRUE) + endif() + + if(NOT HAVE_SOME_SLEEP_FUNC) + # try nanosleep() in libc and libposix4, if this fails - usleep() + check_symbol_exists(nanosleep time.h HAVE_NANOSLEEP) + + if(NOT HAVE_NANOSLEEP) + check_symbol_exists(usleep unistd.h HAVE_USLEEP) + if(NOT HAVE_USLEEP) + message(WARNING "wxSleep() function will not work") + endif() + endif() + endif() + + # check for uname (POSIX) and gethostname (BSD) + check_symbol_exists(uname sys/utsname.h HAVE_UNAME) + if(HAVE_UNAME) + wx_check_funcs(gethostname) + endif() + + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_REENTRANT) + wx_check_funcs(strtok_r) + cmake_pop_check_state() + + # check for inet_addr and inet_aton (these may live either in libc, or in + # libnsl or libresolv or libsocket) + # TODO + + wx_check_funcs(fdopen) + + if(wxUSE_TARSTREAM) + wx_check_funcs(sysconf) + + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_REENTRANT) + check_symbol_exists(getpwuid_r pwd.h HAVE_GETPWUID_R) + check_symbol_exists(getgrgid_r grp.h HAVE_GETGRGID_R) + cmake_pop_check_state() + endif() + + check_include_file(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) + + set(HAVE_UNIX98_PRINTF ON) + + if(wxUSE_SOCKETS) + # determine the type of third argument for getsockname + wx_get_socket_param_type(WX_SOCKLEN_T "getsockname(0, 0, &len);") + # Do this again for getsockopt as it may be different + wx_get_socket_param_type(SOCKOPTLEN_T "getsockopt(0, 0, 0, 0, &len);") + + check_symbol_exists(gethostbyname netdb.h HAVE_GETHOSTBYNAME) + check_symbol_exists(gethostbyname_r netdb.h HAVE_GETHOSTBYNAME_R) + if(HAVE_GETHOSTBYNAME_R) + check_prototype_definition(gethostbyname_r + "int gethostbyname_r(const char *name, struct hostent *hp, struct hostent_data *hdata)" + "0" + "netdb.h" + HAVE_FUNC_GETHOSTBYNAME_R_3) + + check_prototype_definition(gethostbyname_r + "struct hostent *gethostbyname_r(const char *name, struct hostent *hp, char *buf, size_t buflen, int *herr)" + "NULL" + "netdb.h" + HAVE_FUNC_GETHOSTBYNAME_R_5) + + check_prototype_definition(gethostbyname_r + "int gethostbyname_r(const char *name, struct hostent *hp, char *buf, size_t buflen, struct hostent **result, int *herr)" + "0" + "netdb.h" + HAVE_FUNC_GETHOSTBYNAME_R_6) + endif() + + check_symbol_exists(getservbyname netdb.h HAVE_GETSERVBYNAME) + check_symbol_exists(inet_aton arpa/inet.h HAVE_INET_ATON) + check_symbol_exists(inet_addr arpa/inet.h HAVE_INET_ADDR) + endif() # wxUSE_SOCKETS +endif() # NOT WIN32 + +if(CMAKE_USE_PTHREADS_INIT) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_LIBRARIES pthread) + wx_check_cxx_source_compiles(" + void *p; + pthread_cleanup_push(ThreadCleanupFunc, p); + pthread_cleanup_pop(0);" + wxHAVE_PTHREAD_CLEANUP + pthread.h + DEFINITION + "void ThreadCleanupFunc(void *p) { }\;" + ) + wx_check_c_source_compiles( + "pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);" + HAVE_PTHREAD_MUTEXATTR_T + pthread.h + ) + if(HAVE_PTHREAD_MUTEXATTR_T) + # check if we already have the declaration we need, it is not + # present in some systems' headers + wx_check_c_source_compiles( + "pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);" + HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL + pthread.h + ) + else() + # don't despair, there may be another way to do it + wx_check_c_source_compiles( + "pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;" + HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER + pthread.h + ) + if(NOT HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + # this may break code working elsewhere, so at least warn about it + message(WARNING "wxMutex won't be recursive on this platform") + endif() + endif() + if(wxUSE_COMPILER_TLS) + # test for compiler thread-specific variables support + wx_check_c_source_compiles(" + static __thread int n = 0; + static __thread int *p = 0;" + HAVE___THREAD_KEYWORD + pthread.h + ) + wx_check_cxx_source_compiles( + "void foo(abi::__forced_unwind&);" + HAVE_ABI_FORCEDUNWIND + cxxabi.h) + endif() + cmake_pop_check_state() +endif() # CMAKE_USE_PTHREADS_INIT + +check_symbol_exists(localtime_r time.h HAVE_LOCALTIME_R) +check_symbol_exists(gmtime_r time.h HAVE_GMTIME_R) + +if(WXMSW) + set(wxUSE_WEBVIEW_IE ON) +elseif(WXGTK OR APPLE) + set(wxUSE_WEBVIEW_WEBKIT ON) +endif() + +if(MSVC) + set(wxUSE_GRAPHICS_CONTEXT ON) +endif() + +if(MSVC_VERSION GREATER 1600 AND NOT CMAKE_VS_PLATFORM_TOOLSET MATCHES "_xp$") + set(wxUSE_WINRT ON) +endif() + +if(wxUSE_OPENGL) + set(wxUSE_GLCANVAS ON) +endif() + +# --------------------------------------------------------------------------- +# Checks for typedefs +# --------------------------------------------------------------------------- + +# check what exactly size_t is on this machine - this is necessary to avoid +# ambiguous overloads in several places, notably wx/string.h and wx/array.h + +# an obvious check like wx_check_cxx_source_compiles(struct Foo { ... };) doesn't work +# with egcs (at least) up to 1.1.1 as it allows you to compile duplicate +# methods in a local class (i.e. class inside a function) declaration +# without any objections!! +# +# hence the hack below: we must have Foo at global scope! +wx_check_cxx_source_compiles("return 0; } + + struct Foo { void foo(size_t); void foo(unsigned int); }; + + int bar() {" + wxSIZE_T_IS_NOT_UINT + stddef.h) +if(wxSIZE_T_IS_NOT_UINT) + wx_check_cxx_source_compiles("return 0; } + + struct Foo { void foo(size_t); void foo(unsigned long); }; + + int bar() {" + wxSIZE_T_IS_NOT_ULONG + stddef.h) + if(NOT wxSIZE_T_IS_NOT_ULONG) + set(wxSIZE_T_IS_ULONG YES) + endif() +else() + set(wxSIZE_T_IS_UINT YES) +endif() + +# check if wchar_t is separate type +wx_check_cxx_source_compiles("return 0; } + + struct Foo { void foo(wchar_t); + void foo(unsigned short); + void foo(unsigned int); + void foo(unsigned long); }; + + int bar() {" + wxWCHAR_T_IS_REAL_TYPE + wchar.h) + +# --------------------------------------------------------------------------- +# Checks for structures +# --------------------------------------------------------------------------- + +check_struct_has_member("struct passwd" pw_gecos pwd.h HAVE_PW_GECOS) + +# --------------------------------------------------------------------------- +# Check for functions +# --------------------------------------------------------------------------- + +# TODO: wcslen + +# Check various string symbols +foreach(func + ftime + wcsftime wprintf + putws fputws wprintf vswprintf vswscanf + wcsdup wcsnlen wcscasecmp wcsncasecmp + wcsrctombs + wcstoull + ) + string(TOUPPER ${func} func_upper) + check_symbol_exists(${func} wchar.h HAVE_${func_upper}) +endforeach() + +# Check various functions +foreach(func + fsync + snprintf vsnprintf strnlen + setpriority + ) + string(TOUPPER ${func} func_upper) + check_function_exists(${func} HAVE_${func_upper}) +endforeach() + +if(MSVC) + check_symbol_exists(vsscanf stdio.h HAVE_VSSCANF) +endif() + +# at least under IRIX with mipsPro the C99 round() function is available when +# building using the C compiler but not when using C++ one +check_cxx_symbol_exists(round math.h HAVE_ROUND) + +# Check includes +if(NOT MSVC_VERSION LESS 1600) + check_include_file_cxx(tr1/type_traits HAVE_TR1_TYPE_TRAITS) + check_include_file_cxx(type_traits HAVE_TYPE_TRAITS) +endif() +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(langinfo.h HAVE_LANGINFO_H) +check_include_file(sched.h HAVE_SCHED_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(w32api.h HAVE_W32API_H) +check_include_file(wchar.h HAVE_WCHAR_H) +check_include_file(wcstr.h HAVE_WCSTR_H) + + +wx_check_cxx_source_compiles( + "std::wstring s;" + HAVE_STD_WSTRING + string + ) + +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) + wx_check_cxx_source_compiles(" + int tz; + tz = ${timezone_def};" + wxTEST_TZ_${timezone_def} + time.h + ) + if(${wxTEST_TZ_${timezone_def}}) + set(WX_TIMEZONE ${timezone_def}) + break() + endif() + endforeach() + + check_struct_has_member("struct tm" tm_gmtoff time.h WX_GMTOFF_IN_TM) +endif() + +cmake_push_check_state(RESET) +set(CMAKE_REQUIRED_LIBRARIES dl) +check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) +cmake_pop_check_state() +if(HAVE_DLOPEN) + check_symbol_exists(dlerror dlfcn.h HAVE_DLERROR) + check_symbol_exists(dladdr dlfcn.h HAVE_DLADDR) +else() + check_symbol_exists(shl_load dl.h HAVE_SHL_LOAD) +endif() +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) + +if(APPLE) + set(wxUSE_EPOLL_DISPATCHER OFF) + set(wxUSE_SELECT_DISPATCHER ON) +else() + if(NOT WIN32) + set(wxUSE_SELECT_DISPATCHER ON) + endif() + check_include_file(sys/epoll.h wxUSE_EPOLL_DISPATCHER) +endif() +check_include_file(sys/select.h HAVE_SYS_SELECT_H) + +if(wxUSE_FSWATCHER) + check_include_file(sys/inotify.h wxHAS_INOTIFY) + if(NOT wxHAS_INOTIFY) + check_include_file(sys/event.h wxHAS_KQUEUE) + endif() +endif() + +if(wxUSE_XLOCALE) + set(CMAKE_EXTRA_INCLUDE_FILES xlocale.h locale.h) + check_type_size(locale_t LOCALE_T) + set(CMAKE_EXTRA_INCLUDE_FILES) +endif() + +# Check size and availability of various types +set(SYSTYPES + pid_t size_t + wchar_t int long short + gid_t uid_t + ) +if(NOT MSVC) + list(APPEND SYSTYPES mode_t off_t) +endif() + +foreach(SYSTYPE ${SYSTYPES}) + string(TOUPPER ${SYSTYPE} SYSTYPE_UPPER) + check_type_size(${SYSTYPE} SIZEOF_${SYSTYPE_UPPER}) + if(NOT HAVE_SIZEOF_${SYSTYPE_UPPER}) + # Add a definition if it is not available + set(${SYSTYPE} ON) + endif() +endforeach() + +check_type_size("long long" SIZEOF_LONG_LONG) +check_type_size(ssize_t SSIZE_T) + +test_big_endian(WORDS_BIGENDIAN) + +configure_file(build/cmake/setup.h.in ${wxSETUP_HEADER_FILE}) +if(DEFINED wxSETUP_HEADER_FILE_DEBUG) + # The debug version may be configured with different values in the future + configure_file(build/cmake/setup.h.in ${wxSETUP_HEADER_FILE_DEBUG}) +endif() diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in new file mode 100644 index 0000000000..444222db76 --- /dev/null +++ b/build/cmake/setup.h.in @@ -0,0 +1,1293 @@ +/* This define (__WX_SETUP_H__) is used both to ensure setup.h is included + * only once and to indicate that we are building using configure. */ +#ifndef __WX_SETUP_H__ +#define __WX_SETUP_H__ + +/* never undefine inline or const keywords for C++ compilation */ +#ifndef __cplusplus + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +#endif /* __cplusplus */ + +/* the installation location prefix from configure */ +#cmakedefine wxINSTALL_PREFIX "@wxINSTALL_PREFIX@" + +/* Define to `int' if doesn't define. */ +#cmakedefine gid_t int + +/* Define to `int' if doesn't define. */ +#cmakedefine mode_t int + +/* Define to `long' if doesn't define. */ +#cmakedefine off_t long + +/* Define to `int' if doesn't define. */ +#cmakedefine pid_t int + +/* Define to `unsigned' if doesn't define. */ +#cmakedefine size_t unsigned + +/* Define if ssize_t type is available. */ +#cmakedefine HAVE_SSIZE_T + +/* Define if you have the ANSI C header files. */ +#cmakedefine STDC_HEADERS 1 + +/* Define this to get extra features from GNU libc. */ +#ifndef _GNU_SOURCE +#cmakedefine _GNU_SOURCE 1 +#endif + +/* Define to `int' if doesn't define. */ +#cmakedefine uid_t int + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#cmakedefine WORDS_BIGENDIAN 1 + +/* Define this if your version of GTK+ is greater than 1.2.7 */ +#cmakedefine __WXGTK127__ 1 + +/* Define this if your version of GTK+ is greater than 2.0 */ +#cmakedefine __WXGTK20__ 1 + +/* Define this if your version of GTK+ is greater than 2.10 */ +#cmakedefine __WXGTK210__ 1 + +/* Define this if your version of GTK+ is greater than 2.18 */ +#cmakedefine __WXGTK218__ 1 + +/* Define this if your version of GTK+ is greater than 2.20 */ +#cmakedefine __WXGTK220__ 1 + +/* Define this if your version of GTK+ is >= 3.0 */ +#cmakedefine __WXGTK3__ 1 + +/* Define this if you want to use GPE features */ +#cmakedefine __WXGPE__ 1 + +/* Define this if your version of Motif is greater than 2.0 */ +#cmakedefine __WXMOTIF20__ 1 + +/* Define this if you are using Lesstif */ +#cmakedefine __WXLESSTIF__ 1 + +/* + * Define to 1 for Unix[-like] system + */ +#cmakedefine01 wxUSE_UNIX + +#cmakedefine __UNIX__ 1 + +#cmakedefine __AIX__ 1 +#cmakedefine __BSD__ 1 +#cmakedefine __DARWIN__ 1 +#cmakedefine __EMX__ 1 +#cmakedefine __FREEBSD__ 1 +#cmakedefine __HPUX__ 1 +#cmakedefine __LINUX__ 1 +#cmakedefine __NETBSD__ 1 +#cmakedefine __OPENBSD__ 1 +#cmakedefine __OSF__ 1 +#cmakedefine __QNX__ 1 +#cmakedefine __SGI__ 1 +#cmakedefine __SOLARIS__ 1 +#cmakedefine __SUN__ 1 +#cmakedefine __SUNOS__ 1 +#cmakedefine __SVR4__ 1 +#cmakedefine __SYSV__ 1 +#cmakedefine __ULTRIX__ 1 +#cmakedefine __UNIXWARE__ 1 +#cmakedefine __VMS__ 1 + +#undef __IA64__ +#undef __ALPHA__ + +/* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */ +#undef __Point__ + +/* Stupid hack; __WINDOWS__ clashes with wx/defs.h */ +#ifndef __WINDOWS__ +#cmakedefine __WINDOWS__ 1 +#endif + +#ifndef __WIN32__ +#cmakedefine __WIN32__ 1 +#endif +#ifndef __GNUWIN32__ +#cmakedefine __GNUWIN32__ 1 +#endif +#ifndef STRICT +#undef STRICT +#endif +#ifndef WINVER +#undef WINVER +#endif + +/* --- start common options --- */ + +#ifndef wxUSE_GUI + #cmakedefine01 wxUSE_GUI +#endif + + +#cmakedefine01 WXWIN_COMPATIBILITY_2_8 + +#cmakedefine01 WXWIN_COMPATIBILITY_3_0 + +#cmakedefine01 wxDIALOG_UNIT_COMPATIBILITY + + + +#cmakedefine01 wxUSE_ON_FATAL_EXCEPTION + +#cmakedefine01 wxUSE_STACKWALKER + +#cmakedefine01 wxUSE_DEBUGREPORT + + + +#cmakedefine01 wxUSE_DEBUG_CONTEXT + +#cmakedefine01 wxUSE_MEMORY_TRACING + +#cmakedefine01 wxUSE_GLOBAL_MEMORY_OPERATORS + +#cmakedefine01 wxUSE_DEBUG_NEW_ALWAYS + + + +#ifndef wxUSE_UNICODE + #cmakedefine01 wxUSE_UNICODE +#endif + +#cmakedefine01 wxUSE_WCHAR_T + + +#cmakedefine01 wxUSE_EXCEPTIONS + +#cmakedefine01 wxUSE_EXTENDED_RTTI + +#cmakedefine01 wxUSE_LOG + +#cmakedefine01 wxUSE_LOGWINDOW + +#cmakedefine01 wxUSE_LOGGUI + +#cmakedefine01 wxUSE_LOG_DIALOG + +#cmakedefine01 wxUSE_CMDLINE_PARSER + +#cmakedefine01 wxUSE_THREADS + +#cmakedefine01 wxUSE_STREAMS + +#cmakedefine01 wxUSE_PRINTF_POS_PARAMS + +#cmakedefine01 wxUSE_COMPILER_TLS + + +#cmakedefine01 wxUSE_STL + +#cmakedefine01 wxUSE_STD_DEFAULT + +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +#cmakedefine01 wxUSE_STD_CONTAINERS + +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +#cmakedefine01 wxUSE_IOSTREAMH + + + +#cmakedefine01 wxUSE_LONGLONG + +#cmakedefine01 wxUSE_BASE64 + +#cmakedefine01 wxUSE_CONSOLE_EVENTLOOP + +#cmakedefine01 wxUSE_FILE +#cmakedefine01 wxUSE_FFILE + +#cmakedefine01 wxUSE_FSVOLUME + +#cmakedefine01 wxUSE_SECRETSTORE + +#cmakedefine01 wxUSE_STDPATHS + +#cmakedefine01 wxUSE_TEXTBUFFER + +#cmakedefine01 wxUSE_TEXTFILE + +#cmakedefine01 wxUSE_INTL + +#cmakedefine01 wxUSE_XLOCALE + +#cmakedefine01 wxUSE_DATETIME + +#cmakedefine01 wxUSE_TIMER + +#cmakedefine01 wxUSE_STOPWATCH + +#cmakedefine01 wxUSE_FSWATCHER + +#cmakedefine01 wxUSE_CONFIG + +#cmakedefine01 wxUSE_CONFIG_NATIVE + +#cmakedefine01 wxUSE_DIALUP_MANAGER + +#cmakedefine01 wxUSE_DYNLIB_CLASS + +#cmakedefine01 wxUSE_DYNAMIC_LOADER + +#cmakedefine01 wxUSE_SOCKETS + +#cmakedefine01 wxUSE_IPV6 + +#cmakedefine01 wxUSE_FILESYSTEM + +#cmakedefine01 wxUSE_FS_ZIP + +#cmakedefine01 wxUSE_FS_ARCHIVE + +#cmakedefine01 wxUSE_FS_INET + +#cmakedefine01 wxUSE_ARCHIVE_STREAMS + +#cmakedefine01 wxUSE_ZIPSTREAM + +#cmakedefine01 wxUSE_TARSTREAM + +#cmakedefine01 wxUSE_ZLIB + +#cmakedefine01 wxUSE_APPLE_IEEE + +#cmakedefine01 wxUSE_JOYSTICK + +#cmakedefine01 wxUSE_FONTENUM + +#cmakedefine01 wxUSE_FONTMAP + +#cmakedefine01 wxUSE_MIMETYPE + +#cmakedefine01 wxUSE_PROTOCOL + +#cmakedefine01 wxUSE_PROTOCOL_FILE +#cmakedefine01 wxUSE_PROTOCOL_FTP +#cmakedefine01 wxUSE_PROTOCOL_HTTP + +#cmakedefine01 wxUSE_URL + +#cmakedefine01 wxUSE_URL_NATIVE + +#cmakedefine01 wxUSE_VARIANT + +#cmakedefine01 wxUSE_ANY + +#cmakedefine01 wxUSE_REGEX + +#cmakedefine01 wxUSE_SYSTEM_OPTIONS + +#cmakedefine01 wxUSE_SOUND + +#cmakedefine01 wxUSE_MEDIACTRL + +#cmakedefine01 wxUSE_XRC + +#define wxUSE_XML wxUSE_XRC + +#cmakedefine01 wxUSE_AUI + +#cmakedefine01 wxUSE_RIBBON + +#cmakedefine01 wxUSE_PROPGRID + +#cmakedefine01 wxUSE_STC + +#cmakedefine01 wxUSE_WEBVIEW + +#ifdef __WXMSW__ +#cmakedefine01 wxUSE_WEBVIEW_IE +#else +#cmakedefine01 wxUSE_WEBVIEW_IE +#endif + +#if defined(__WXGTK__) || defined(__WXOSX__) +#cmakedefine01 wxUSE_WEBVIEW_WEBKIT +#else +#cmakedefine01 wxUSE_WEBVIEW_WEBKIT +#endif + + +#ifdef _MSC_VER +#cmakedefine01 wxUSE_GRAPHICS_CONTEXT +#else + + + + + +#cmakedefine01 wxUSE_GRAPHICS_CONTEXT +#endif + +#cmakedefine01 wxUSE_CAIRO + + + +#cmakedefine01 wxUSE_CONTROLS + +#cmakedefine01 wxUSE_MARKUP + +#cmakedefine01 wxUSE_POPUPWIN + +#cmakedefine01 wxUSE_TIPWINDOW + +#cmakedefine01 wxUSE_ACTIVITYINDICATOR +#cmakedefine01 wxUSE_ANIMATIONCTRL +#cmakedefine01 wxUSE_BANNERWINDOW +#cmakedefine01 wxUSE_BUTTON +#cmakedefine01 wxUSE_BMPBUTTON +#cmakedefine01 wxUSE_CALENDARCTRL +#cmakedefine01 wxUSE_CHECKBOX +#cmakedefine01 wxUSE_CHECKLISTBOX +#cmakedefine01 wxUSE_CHOICE +#cmakedefine01 wxUSE_COLLPANE +#cmakedefine01 wxUSE_COLOURPICKERCTRL +#cmakedefine01 wxUSE_COMBOBOX +#cmakedefine01 wxUSE_COMMANDLINKBUTTON +#cmakedefine01 wxUSE_DATAVIEWCTRL +#cmakedefine01 wxUSE_DATEPICKCTRL +#cmakedefine01 wxUSE_DIRPICKERCTRL +#cmakedefine01 wxUSE_EDITABLELISTBOX +#cmakedefine01 wxUSE_FILECTRL +#cmakedefine01 wxUSE_FILEPICKERCTRL +#cmakedefine01 wxUSE_FONTPICKERCTRL +#cmakedefine01 wxUSE_GAUGE +#cmakedefine01 wxUSE_HEADERCTRL +#cmakedefine01 wxUSE_HYPERLINKCTRL +#cmakedefine01 wxUSE_LISTBOX +#cmakedefine01 wxUSE_LISTCTRL +#cmakedefine01 wxUSE_RADIOBOX +#cmakedefine01 wxUSE_RADIOBTN +#cmakedefine01 wxUSE_RICHMSGDLG +#cmakedefine01 wxUSE_SCROLLBAR +#cmakedefine01 wxUSE_SEARCHCTRL +#cmakedefine01 wxUSE_SLIDER +#cmakedefine01 wxUSE_SPINBTN +#cmakedefine01 wxUSE_SPINCTRL +#cmakedefine01 wxUSE_STATBOX +#cmakedefine01 wxUSE_STATLINE +#cmakedefine01 wxUSE_STATTEXT +#cmakedefine01 wxUSE_STATBMP +#cmakedefine01 wxUSE_TEXTCTRL +#cmakedefine01 wxUSE_TIMEPICKCTRL +#cmakedefine01 wxUSE_TOGGLEBTN +#cmakedefine01 wxUSE_TREECTRL +#cmakedefine01 wxUSE_TREELISTCTRL + +#cmakedefine01 wxUSE_STATUSBAR + +#cmakedefine01 wxUSE_NATIVE_STATUSBAR + +#cmakedefine01 wxUSE_TOOLBAR +#cmakedefine01 wxUSE_TOOLBAR_NATIVE + +#cmakedefine01 wxUSE_NOTEBOOK + +#cmakedefine01 wxUSE_LISTBOOK + +#cmakedefine01 wxUSE_CHOICEBOOK + +#cmakedefine01 wxUSE_TREEBOOK + +#cmakedefine01 wxUSE_TOOLBOOK + +#cmakedefine01 wxUSE_TASKBARICON + +#cmakedefine01 wxUSE_GRID + +#cmakedefine01 wxUSE_MINIFRAME + +#cmakedefine01 wxUSE_COMBOCTRL + +#cmakedefine01 wxUSE_ODCOMBOBOX + +#cmakedefine01 wxUSE_BITMAPCOMBOBOX + +#cmakedefine01 wxUSE_REARRANGECTRL + +#cmakedefine01 wxUSE_ADDREMOVECTRL + + +#cmakedefine01 wxUSE_ACCEL + +#cmakedefine01 wxUSE_ARTPROVIDER_STD + +#cmakedefine01 wxUSE_ARTPROVIDER_TANGO + +#cmakedefine01 wxUSE_HOTKEY + +#cmakedefine01 wxUSE_CARET + +#cmakedefine01 wxUSE_DISPLAY + +#cmakedefine01 wxUSE_GEOMETRY + +#cmakedefine01 wxUSE_IMAGLIST + +#cmakedefine01 wxUSE_INFOBAR + +#cmakedefine01 wxUSE_MENUS + +#cmakedefine01 wxUSE_NOTIFICATION_MESSAGE + +#cmakedefine01 wxUSE_PREFERENCES_EDITOR + +#cmakedefine01 wxUSE_RICHTOOLTIP + +#cmakedefine01 wxUSE_SASH + +#cmakedefine01 wxUSE_SPLITTER + +#cmakedefine01 wxUSE_TOOLTIPS + +#cmakedefine01 wxUSE_VALIDATORS + +#ifdef __WXMSW__ +#cmakedefine01 wxUSE_AUTOID_MANAGEMENT +#else +#cmakedefine01 wxUSE_AUTOID_MANAGEMENT +#endif + + +#cmakedefine01 wxUSE_COMMON_DIALOGS + +#cmakedefine01 wxUSE_BUSYINFO + +#cmakedefine01 wxUSE_CHOICEDLG + +#cmakedefine01 wxUSE_COLOURDLG + +#cmakedefine01 wxUSE_DIRDLG + + +#cmakedefine01 wxUSE_FILEDLG + +#cmakedefine01 wxUSE_FINDREPLDLG + +#cmakedefine01 wxUSE_FONTDLG + +#cmakedefine01 wxUSE_MSGDLG + +#cmakedefine01 wxUSE_PROGRESSDLG + +#cmakedefine01 wxUSE_NATIVE_PROGRESSDLG + +#cmakedefine01 wxUSE_STARTUP_TIPS + +#cmakedefine01 wxUSE_TEXTDLG + +#cmakedefine01 wxUSE_NUMBERDLG + +#cmakedefine01 wxUSE_SPLASH + +#cmakedefine01 wxUSE_WIZARDDLG + +#cmakedefine01 wxUSE_ABOUTDLG + +#cmakedefine01 wxUSE_FILE_HISTORY + + +#cmakedefine01 wxUSE_METAFILE +#cmakedefine01 wxUSE_ENH_METAFILE +#cmakedefine01 wxUSE_WIN_METAFILES_ALWAYS + + +#cmakedefine01 wxUSE_MDI + +#cmakedefine01 wxUSE_DOC_VIEW_ARCHITECTURE + +#cmakedefine01 wxUSE_MDI_ARCHITECTURE + +#cmakedefine01 wxUSE_PRINTING_ARCHITECTURE + +#cmakedefine01 wxUSE_HTML + +#cmakedefine01 wxUSE_GLCANVAS + +#cmakedefine01 wxUSE_RICHTEXT + + +#cmakedefine01 wxUSE_CLIPBOARD + +#cmakedefine01 wxUSE_DATAOBJ + +#cmakedefine01 wxUSE_DRAG_AND_DROP + +#ifdef __WXMSW__ +#cmakedefine01 wxUSE_ACCESSIBILITY +#else +#cmakedefine01 wxUSE_ACCESSIBILITY +#endif + + +#cmakedefine01 wxUSE_SNGLINST_CHECKER + +#cmakedefine01 wxUSE_DRAGIMAGE + +#cmakedefine01 wxUSE_IPC + +#cmakedefine01 wxUSE_HELP + + +#cmakedefine01 wxUSE_MS_HTML_HELP + + +#cmakedefine01 wxUSE_WXHTML_HELP + +#cmakedefine01 wxUSE_CONSTRAINTS + + +#cmakedefine01 wxUSE_SPLINES + + +#cmakedefine01 wxUSE_MOUSEWHEEL + + +#cmakedefine01 wxUSE_UIACTIONSIMULATOR + + +#cmakedefine01 wxUSE_POSTSCRIPT + +#cmakedefine01 wxUSE_AFM_FOR_POSTSCRIPT + +#cmakedefine01 wxUSE_SVG + +#cmakedefine01 wxUSE_DC_TRANSFORM_MATRIX + + + +#cmakedefine01 wxUSE_IMAGE + +#cmakedefine01 wxUSE_LIBPNG + +#cmakedefine01 wxUSE_LIBJPEG + +#cmakedefine01 wxUSE_LIBTIFF + +#cmakedefine01 wxUSE_TGA + +#cmakedefine01 wxUSE_GIF + +#cmakedefine01 wxUSE_PNM + +#cmakedefine01 wxUSE_PCX + +#cmakedefine01 wxUSE_IFF + +#cmakedefine01 wxUSE_XPM + +#cmakedefine01 wxUSE_ICO_CUR + +#cmakedefine01 wxUSE_PALETTE + + +#cmakedefine01 wxUSE_ALL_THEMES + +#cmakedefine01 wxUSE_THEME_GTK +#cmakedefine01 wxUSE_THEME_METAL +#cmakedefine01 wxUSE_THEME_MONO +#cmakedefine01 wxUSE_THEME_WIN32 + + +/* --- end common options --- */ + +/* + * Unix-specific options + */ +#cmakedefine01 wxUSE_SELECT_DISPATCHER +#cmakedefine01 wxUSE_EPOLL_DISPATCHER + +#cmakedefine01 wxUSE_UNICODE_UTF8 +#cmakedefine01 wxUSE_UTF8_LOCALE_ONLY + +/* + Use GStreamer for Unix. + + Default is 0 as this requires a lot of dependencies which might not be + available. + + Recommended setting: 1 (wxMediaCtrl won't work by default without it). + */ +#define wxUSE_GSTREAMER 0 + +#define wxUSE_GSTREAMER_PLAYER 0 + +/* + Use XTest extension to implement wxUIActionSimulator? + + Default is 1, it is set to 0 if the necessary headers/libraries are not + found by configure. + + Recommended setting: 1, wxUIActionSimulator won't work in wxGTK3 without it. + */ +#define wxUSE_XTEST 0 + +/* --- start MSW options --- */ + + +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #cmakedefine01 wxUSE_GRAPHICS_DIRECT2D +#endif + + +#cmakedefine01 wxUSE_OLE + +#cmakedefine01 wxUSE_OLE_AUTOMATION + +#cmakedefine01 wxUSE_ACTIVEX + +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #cmakedefine01 wxUSE_WINRT +#else + #cmakedefine01 wxUSE_WINRT +#endif + +#cmakedefine01 wxUSE_DC_CACHEING + +#cmakedefine01 wxUSE_WXDIB + +#cmakedefine01 wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW + +#cmakedefine01 wxUSE_REGKEY + +#cmakedefine01 wxUSE_RICHEDIT + +#cmakedefine01 wxUSE_RICHEDIT2 + +#cmakedefine01 wxUSE_OWNER_DRAWN + +#cmakedefine01 wxUSE_TASKBARICON_BALLOONS + +#cmakedefine01 wxUSE_TASKBARBUTTON + +#cmakedefine01 wxUSE_UXTHEME + +#cmakedefine01 wxUSE_INKEDIT + +#cmakedefine01 wxUSE_INICONF + + +#cmakedefine01 wxUSE_DATEPICKCTRL_GENERIC + +#cmakedefine01 wxUSE_TIMEPICKCTRL_GENERIC + + +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #cmakedefine01 wxUSE_DBGHELP +#else + #cmakedefine01 wxUSE_DBGHELP +#endif + +#cmakedefine01 wxUSE_CRASHREPORT +/* --- end MSW options --- */ + +/* + * Define if your compiler has C99 va_copy + */ +#cmakedefine HAVE_VA_COPY 1 + +/* + * Define if va_list type is an array + */ +#cmakedefine VA_LIST_IS_ARRAY 1 + +/* + * Define if the compiler supports variadic macros + */ +#cmakedefine HAVE_VARIADIC_MACROS 1 + +/* + * Define if you don't want variadic macros to be used even if they are + * supported by the compiler. + */ +#cmakedefine wxNO_VARIADIC_MACROS + +/* + * Define if your compiler has std::wstring + */ +#cmakedefine HAVE_STD_WSTRING 1 +/* + * Define if your compiler has compliant std::string::compare + */ +#cmakedefine HAVE_STD_STRING_COMPARE 1 +/* + * Define if your compiler has + */ +#undef HAVE_HASH_MAP +/* + * Define if your compiler has + */ +#undef HAVE_EXT_HASH_MAP +/* + * Define if your compiler has std::hash_map/hash_set + */ +#undef HAVE_STD_HASH_MAP +/* + * Define if your compiler has __gnu_cxx::hash_map/hash_set + */ +#undef HAVE_GNU_CXX_HASH_MAP + +/* + * Define if your compiler has std::unordered_map + */ +#undef HAVE_STD_UNORDERED_MAP + +/* + * Define if your compiler has std::unordered_set + */ +#undef HAVE_STD_UNORDERED_SET + +/* + * Define if your compiler has std::tr1::unordered_map + */ +#undef HAVE_TR1_UNORDERED_MAP + +/* + * Define if your compiler has std::tr1::unordered_set + */ +#undef HAVE_TR1_UNORDERED_SET + +/* + * Define if your compiler has + */ +#cmakedefine HAVE_TR1_TYPE_TRAITS 1 + +/* + * Define if your compiler has + */ +#cmakedefine HAVE_TYPE_TRAITS 1 + +/* + * Define if the compiler supports simple visibility declarations. + */ +#cmakedefine HAVE_VISIBILITY 1 + +/* + * Define if the compiler supports GCC's atomic memory access builtins + */ +#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1 + +/* + * Define if compiler's visibility support in libstdc++ is broken + */ +#undef HAVE_BROKEN_LIBSTDCXX_VISIBILITY + +/* + * The built-in regex supports advanced REs in additional to POSIX's basic + * and extended. Your system regex probably won't support this, and in this + * case WX_NO_REGEX_ADVANCED should be defined. + */ +#undef WX_NO_REGEX_ADVANCED +/* + * On GNU systems use re_search instead of regexec, since the latter does a + * strlen on the search text affecting the performance of some operations. + */ +#undef HAVE_RE_SEARCH +/* + * Use SDL for audio (Unix) + */ +#define wxUSE_LIBSDL 0 + +/* + * Compile sound backends as plugins + */ +#define wxUSE_PLUGINS 0 + +/* + * Use GTK print for printing under GTK+ 2.10+ + */ +#define wxUSE_GTKPRINT 0 +/* + * Use GNOME VFS for MIME types + */ +#define wxUSE_LIBGNOMEVFS 0 +/* + * Use libnotify library. + */ +#define wxUSE_LIBNOTIFY 0 +/* + * Use libnotify 0.7+ API. + */ +#define wxUSE_LIBNOTIFY_0_7 0 +/* + * Use libXpm + */ +#define wxHAVE_LIB_XPM 0 +/* + * Define if you have pthread_cleanup_push/pop() + */ +#cmakedefine wxHAVE_PTHREAD_CLEANUP 1 +/* + * Define if compiler has __thread keyword. + */ +#cmakedefine HAVE___THREAD_KEYWORD 1 +/* + * Define if large (64 bit file offsets) files are supported. + */ +#undef HAVE_LARGEFILE_SUPPORT + +/* + * Use OpenGL + */ +#cmakedefine01 wxUSE_OPENGL + +/* + * Use MS HTML Help via libmspack (Unix) + */ +#define wxUSE_LIBMSPACK 0 + +/* + * Matthews garbage collection (used for MrEd?) + */ +#define WXGARBAGE_COLLECTION_ON 0 + +/* + * wxWebKitCtrl + */ +#define wxUSE_WEBKIT 0 + +/* + * Objective-C class name uniquifying + */ +#define wxUSE_OBJC_UNIQUIFYING 0 + +/* + * The const keyword is being introduced more in wxWindows. + * You can use this setting to maintain backward compatibility. + * If 0: will use const wherever possible. + * If 1: will use const only where necessary + * for precompiled headers to work. + * If 2: will be totally backward compatible, but precompiled + * headers may not work and program size will be larger. + */ +#define CONST_COMPATIBILITY 0 + +/* + * use the session manager to detect KDE/GNOME + */ +#define wxUSE_DETECT_SM 0 + + +/* define with the name of timezone variable */ +#cmakedefine WX_TIMEZONE @WX_TIMEZONE@ + +/* The type of 3rd argument to getsockname() - usually size_t or int */ +#cmakedefine WX_SOCKLEN_T @WX_SOCKLEN_T@ + +/* The type of 5th argument to getsockopt() - usually size_t or int */ +#cmakedefine SOCKOPTLEN_T @SOCKOPTLEN_T@ + +/* The type of statvfs(2) argument */ +#cmakedefine WX_STATFS_T @WX_STATFS_T@ + +/* The signal handler prototype */ +#define wxTYPE_SA_HANDLER @wxTYPE_SA_HANDLER@ + +/* gettimeofday() usually takes 2 arguments, but some really old systems might + * have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */ +#undef WX_GETTIMEOFDAY_NO_TZ + +/* struct tm doesn't always have the tm_gmtoff field, define this if it does */ +#cmakedefine WX_GMTOFF_IN_TM 1 + +/* Define if you have poll(2) function */ +#undef HAVE_POLL + +/* Define if you have pw_gecos field in struct passwd */ +#cmakedefine HAVE_PW_GECOS 1 + +/* Define if you have __cxa_demangle() in */ +#cmakedefine HAVE_CXA_DEMANGLE 1 + +/* Define if you have dlopen() */ +#cmakedefine HAVE_DLOPEN 1 + +/* Define if you have gettimeofday() */ +#cmakedefine HAVE_GETTIMEOFDAY 1 + +/* Define if fsync() is available */ +#cmakedefine HAVE_FSYNC 1 + +/* Define if round() is available */ +#cmakedefine HAVE_ROUND 1 + +/* Define if you have ftime() */ +#cmakedefine HAVE_FTIME 1 + +/* Define if you have nanosleep() */ +#cmakedefine HAVE_NANOSLEEP 1 + +/* Define if you have sched_yield */ +#undef HAVE_SCHED_YIELD + +/* Define if you have pthread_mutexattr_t and functions to work with it */ +#cmakedefine HAVE_PTHREAD_MUTEXATTR_T 1 + +/* Define if you have pthread_mutexattr_settype() declaration */ +#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1 + +/* Define if you have PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */ +#cmakedefine HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER 1 + +/* Define if you have pthread_cancel */ +#undef HAVE_PTHREAD_CANCEL + +/* Define if you have pthread_mutex_timedlock */ +#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK + +/* Define if you have pthread_attr_setstacksize */ +#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE + +/* Define if you have shl_load() */ +#cmakedefine HAVE_SHL_LOAD 1 + +/* Define if you have snprintf() */ +#cmakedefine HAVE_SNPRINTF 1 + +/* Define if you have snprintf() declaration in the header */ +#undef HAVE_SNPRINTF_DECL + +/* Define if you have a snprintf() which supports positional arguments + (defined in the unix98 standard) */ +#cmakedefine HAVE_UNIX98_PRINTF 1 + +/* define if you have statfs function */ +#cmakedefine HAVE_STATFS 1 + +/* define if you have statfs prototype */ +#cmakedefine HAVE_STATFS_DECL 1 + +/* define if you have statvfs function */ +#cmakedefine HAVE_STATVFS 1 + +/* Define if you have strtoull() and strtoll() */ +#undef HAVE_STRTOULL + +/* Define if you have all functions to set thread priority */ +#undef HAVE_THREAD_PRIORITY_FUNCTIONS + +/* Define if you have vsnprintf() */ +#cmakedefine HAVE_VSNPRINTF 1 + +/* Define if you have vsnprintf() declaration in the header */ +#undef HAVE_VSNPRINTF_DECL + +/* Define if you have a _broken_ vsnprintf() declaration in the header, + * with 'char*' for the 3rd parameter instead of 'const char*' */ +#undef HAVE_BROKEN_VSNPRINTF_DECL + +/* Define if you have a _broken_ vsscanf() declaration in the header, + * with 'char*' for the 1st parameter instead of 'const char*' */ +#undef HAVE_BROKEN_VSSCANF_DECL + +/* Define if you have vsscanf() */ +#cmakedefine HAVE_VSSCANF 1 + +/* Define if you have vsscanf() declaration in the header */ +#undef HAVE_VSSCANF_DECL + +/* Define if you have usleep() */ +#cmakedefine HAVE_USLEEP 1 + +/* Define if you have wcscasecmp() function */ +#cmakedefine HAVE_WCSCASECMP 1 + +/* Define if you have wcsncasecmp() function */ +#cmakedefine HAVE_WCSNCASECMP 1 + +/* Define if you have wcslen function */ +#cmakedefine HAVE_WCSLEN 1 + +/* Define if you have wcsdup function */ +#cmakedefine HAVE_WCSDUP 1 + +/* Define if you have wcsftime() function */ +#cmakedefine HAVE_WCSFTIME 1 + +/* Define if you have strnlen() function */ +#cmakedefine HAVE_STRNLEN 1 + +/* Define if you have wcsnlen() function */ +#cmakedefine HAVE_WCSNLEN 1 + +/* Define if you have wcstoull() and wcstoll() */ +#cmakedefine HAVE_WCSTOULL 1 + +/* The number of bytes in a wchar_t. */ +@SIZEOF_WCHAR_T_CODE@ + +/* The number of bytes in a int. */ +@SIZEOF_INT_CODE@ + +/* The number of bytes in a pointer. */ +#define SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@ + +/* The number of bytes in a long. */ +@SIZEOF_LONG_CODE@ + +/* The number of bytes in a long long. */ +@SIZEOF_LONG_LONG_CODE@ + +/* The number of bytes in a short. */ +@SIZEOF_SHORT_CODE@ + +/* The number of bytes in a size_t. */ +@SIZEOF_SIZE_T_CODE@ + +/* Define if size_t on your machine is the same type as unsigned int. */ +#cmakedefine wxSIZE_T_IS_UINT 1 + +/* Define if size_t on your machine is the same type as unsigned long. */ +#cmakedefine wxSIZE_T_IS_ULONG 1 + +/* Define if wchar_t is distinct type in your compiler. */ +#cmakedefine wxWCHAR_T_IS_REAL_TYPE 1 + +/* Define if you have the dlerror function. */ +#cmakedefine HAVE_DLERROR 1 + +/* Define if you have the dladdr function. */ +#cmakedefine HAVE_DLADDR 1 + +/* Define if you have Posix fnctl() function. */ +#cmakedefine HAVE_FCNTL 1 + +/* Define if you have BSD flock() function. */ +#cmakedefine HAVE_FLOCK 1 + +/* Define if you have getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define if you have a gethostbyname_r function taking 6 arguments. */ +#cmakedefine HAVE_FUNC_GETHOSTBYNAME_R_6 1 + +/* Define if you have a gethostbyname_r function taking 5 arguments. */ +#cmakedefine HAVE_FUNC_GETHOSTBYNAME_R_5 1 + +/* Define if you have a gethostbyname_r function taking 3 arguments. */ +#cmakedefine HAVE_FUNC_GETHOSTBYNAME_R_3 1 + +/* Define if you only have a gethostbyname function */ +#cmakedefine HAVE_GETHOSTBYNAME 1 + +/* Define if you have the gethostname function. */ +#cmakedefine HAVE_GETHOSTNAME 1 + +/* Define if you have a getservbyname_r function taking 6 arguments. */ +#undef HAVE_FUNC_GETSERVBYNAME_R_6 + +/* Define if you have a getservbyname_r function taking 5 arguments. */ +#undef HAVE_FUNC_GETSERVBYNAME_R_5 + +/* Define if you have a getservbyname_r function taking 4 arguments. */ +#undef HAVE_FUNC_GETSERVBYNAME_R_4 + +/* Define if you only have a getservbyname function */ +#cmakedefine HAVE_GETSERVBYNAME 1 + +/* Define if you have the gmtime_r function. */ +#cmakedefine HAVE_GMTIME_R 1 + +/* Define if you have the inet_addr function. */ +#cmakedefine HAVE_INET_ADDR 1 + +/* Define if you have the inet_aton function. */ +#cmakedefine HAVE_INET_ATON 1 + +/* Define if you have the localtime_r function. */ +#cmakedefine HAVE_LOCALTIME_R 1 + +/* Define if you have the mktemp function. */ +#cmakedefine HAVE_MKTEMP 1 + +/* Define if you have the mkstemp function. */ +#cmakedefine HAVE_MKSTEMP 1 + +/* Define if you have the putenv function. */ +#cmakedefine HAVE_PUTENV 1 + +/* Define if you have the setenv function. */ +#cmakedefine HAVE_SETENV 1 + +/* Define if you have strtok_r function. */ +#cmakedefine HAVE_STRTOK_R 1 + +/* Define if you have thr_setconcurrency function */ +#undef HAVE_THR_SETCONCURRENCY + +/* Define if you have pthread_setconcurrency function */ +#undef HAVE_PTHREAD_SET_CONCURRENCY + +/* Define if you have the uname function. */ +#cmakedefine HAVE_UNAME 1 + +/* Define if you have the unsetenv function. */ +#cmakedefine HAVE_UNSETENV 1 + +/* Define if you have the header file. */ +#undef HAVE_X11_XKBLIB_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XF86VMODE_H + +/* Define if you have the header file. */ +#cmakedefine HAVE_SCHED_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_WCSTR_H 1 + +/* Define if you have (Solaris only) */ +#undef HAVE_WIDEC_H + +/* Define if you have the header file and iconv() symbol. */ +#cmakedefine HAVE_ICONV 1 + +/* Define as "const" if the declaration of iconv() needs const. */ +#define ICONV_CONST @ICONV_CONST@ + +/* Define if you have the header file. */ +#cmakedefine HAVE_LANGINFO_H 1 + +/* Define if you have the header file (mingw,cygwin). */ +#cmakedefine HAVE_W32API_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_SYS_SOUNDCARD_H 1 + +/* Define if you have wcsrtombs() function */ +#cmakedefine HAVE_WCSRTOMBS 1 + +/* Define this if you have putws() */ +#cmakedefine HAVE_PUTWS 1 + +/* Define this if you have fputws() */ +#cmakedefine HAVE_FPUTWS 1 + +/* Define this if you have wprintf() and related functions */ +#cmakedefine HAVE_WPRINTF 1 + +/* Define this if you have vswprintf() and related functions */ +#cmakedefine HAVE_VSWPRINTF 1 + +/* Define this if you have _vsnwprintf */ +#undef HAVE__VSNWPRINTF + +/* vswscanf() */ +#cmakedefine HAVE_VSWSCANF 1 + +/* Define if fseeko and ftello are available. */ +#undef HAVE_FSEEKO + +/* Define this if you are using gtk and gdk contains support for X11R6 XIM */ +#undef HAVE_XIM + +/* Define this if you have X11/extensions/shape.h */ +#undef HAVE_XSHAPE + +/* Define this if you have type SPBCDATA */ +#undef HAVE_SPBCDATA + +/* Define if you have pango_font_family_is_monospace() (Pango >= 1.3.3) */ +#undef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE + +/* Define if you have Pango xft support */ +#undef HAVE_PANGO_XFT + +/* Define if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H 1 + +/* Define if you have abi::__forced_unwind in your . */ +#cmakedefine HAVE_ABI_FORCEDUNWIND 1 + +/* Define if fdopen is available. */ +#cmakedefine HAVE_FDOPEN 1 + +/* Define if sysconf is available. */ +#cmakedefine HAVE_SYSCONF 1 + +/* Define if getpwuid_r is available. */ +#cmakedefine HAVE_GETPWUID_R 1 + +/* Define if getgrgid_r is available. */ +#cmakedefine HAVE_GETGRGID_R 1 + +/* Define if setpriority() is available. */ +#cmakedefine HAVE_SETPRIORITY 1 + +/* Define if locale_t is available */ +#cmakedefine HAVE_LOCALE_T 1 + +/* Define if you have inotify_xxx() functions. */ +#cmakedefine wxHAS_INOTIFY 1 + +/* Define if you have kqueu_xxx() functions. */ +#cmakedefine wxHAS_KQUEUE 1 + +/* ------------------------------------------------------------------------- + Win32 adjustments section + ------------------------------------------------------------------------- */ + +#ifdef __WIN32__ + +/* When using an external jpeg library and the Windows headers already define + * boolean, define to the type used by the jpeg library for boolean. */ +#undef wxHACK_BOOLEAN + +/* Define if the header pbt.h is missing. */ +#undef NEED_PBT_H + +#endif /* __WIN32__ */ + +/* --------------------------------------------------------* + * This stuff is static, it doesn't get modified directly + * by configure. +*/ + +/* + define some constants identifying wxWindows version in more details than + just the version number + */ + +/* wxLogChain class available */ +#define wxHAS_LOG_CHAIN + +/* define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK */ +#undef wxHAS_WORKING_GTK_DC_BLIT + +#endif /* __WX_SETUP_H__ */ + diff --git a/build/cmake/source_groups.cmake b/build/cmake/source_groups.cmake new file mode 100644 index 0000000000..d3123b48a6 --- /dev/null +++ b/build/cmake/source_groups.cmake @@ -0,0 +1,28 @@ +############################################################################# +# Name: build/cmake/main.cmake +# Purpose: CMake source groups file +# Author: Tobias Taschner +# Created: 2016-10-14 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +# Define source groups for supported IDEs +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +source_group("Common Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/.*\\.h") +source_group("Common Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/common/.*") +source_group("GTK+ Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/gtk/.*") +source_group("MSW Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/msw/.*") +source_group("OSX Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/osx/.*") +source_group("Generic Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/generic/.*") +source_group("wxUniv Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/univ/.*") +source_group("wxHTML Sources" REGULAR_EXPRESSION "${wxSOURCE_DIR}/src/html/.*") +source_group("Setup Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/.*/setup.h") +source_group("GTK+ Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/gtk/.*") +source_group("MSW Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/msw/.*") +source_group("OSX Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/osx/.*") +source_group("Generic Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/generic/.*") +source_group("wxUniv Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/univ/.*") +source_group("wxHTML Headers" REGULAR_EXPRESSION "${wxSOURCE_DIR}/include/wx/html/.*") +source_group("Setup Headers" FILES ${wxSETUP_HEADER_FILE}) +source_group("Resource Files" REGULAR_EXPRESSION "${wxSOURCE_DIR}/[^.]*.(rc|ico|png|icns)$") diff --git a/build/cmake/tests/CMakeLists.txt b/build/cmake/tests/CMakeLists.txt new file mode 100644 index 0000000000..8a59c178bf --- /dev/null +++ b/build/cmake/tests/CMakeLists.txt @@ -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=$ + /p:Platform=${CMAKE_VS_PLATFORM_NAME} + ${build_param_toolset} + INSTALL_COMMAND + ${CMAKE_COMMAND} -E copy /lib/cppunit$<$:d>.lib + COMMAND + ${CMAKE_COMMAND} -E copy_directory /include /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 /configure + --prefix= + --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) diff --git a/build/cmake/tests/base/CMakeLists.txt b/build/cmake/tests/base/CMakeLists.txt new file mode 100644 index 0000000000..66741a971f --- /dev/null +++ b/build/cmake/tests/base/CMakeLists.txt @@ -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) diff --git a/build/cmake/tests/drawing/CMakeLists.txt b/build/cmake/tests/drawing/CMakeLists.txt new file mode 100644 index 0000000000..599bbfa91e --- /dev/null +++ b/build/cmake/tests/drawing/CMakeLists.txt @@ -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 diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt new file mode 100644 index 0000000000..fe32199597 --- /dev/null +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -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) diff --git a/build/cmake/toolkit.cmake b/build/cmake/toolkit.cmake new file mode 100644 index 0000000000..6dfbe4e7f3 --- /dev/null +++ b/build/cmake/toolkit.cmake @@ -0,0 +1,97 @@ +############################################################################# +# Name: build/cmake/toolkit.cmake +# Purpose: CMake platform toolkit options +# Author: Tobias Taschner +# Created: 2016-10-03 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +# Options required for toolkit selection/detection +wx_option(wxUSE_GUI "Use GUI" ON) + +if(CMAKE_OSX_SYSROOT MATCHES iphoneos) + set(IPHONE ON) +endif() + +if(WIN32) + set(wxDEFAULT_TOOLKIT msw) + set(wxTOOLKIT_OPTIONS msw gtk2 gtk3 qt) + set(wxPLATFORM WIN32) +elseif(APPLE AND IPHONE) + set(wxDEFAULT_TOOLKIT osx_iphone) + set(wxTOOLKIT_OPTIONS osx_iphone) + set(wxPLATFORM OSX) +elseif(APPLE) + set(wxDEFAULT_TOOLKIT osx_cocoa) + set(wxTOOLKIT_OPTIONS osx_cocoa gtk2 gtk3 qt) + set(wxPLATFORM OSX) +elseif(UNIX) + set(wxDEFAULT_TOOLKIT gtk2) + set(wxTOOLKIT_OPTIONS gtk2 gtk3 motif qt) + set(wxPLATFORM UNIX) +else() + message(FATAL_ERROR "Unsupported platform") +endif() + +wx_option(wxBUILD_TOOLKIT "Toolkit used by wxWidgets" ${wxDEFAULT_TOOLKIT} + STRINGS ${wxTOOLKIT_OPTIONS}) +# TODO: set to univ for universal build +set(wxBUILD_WIDGETSET "") + +if(NOT wxUSE_GUI) + set(wxBUILD_TOOLKIT "base") +endif() + +# Create shortcut variable for easy toolkit tests +string(TOUPPER ${wxBUILD_TOOLKIT} toolkit_upper) +set(WX${toolkit_upper} ON) +if(wxBUILD_TOOLKIT MATCHES "^gtk*") + set(WXGTK ON) +elseif(wxBUILD_TOOLKIT MATCHES "^osx*") + set(WXOSX ON) +endif() + +set(wxTOOLKIT_DEFINITIONS __WX${toolkit_upper}__) + +# Initialize toolkit variables +if(wxUSE_GUI) +set(wxTOOLKIT_INCLUDE_DIRS) +set(wxTOOLKIT_LIBRARIES) +set(wxTOOLKIT_VERSION) + +if(UNIX AND NOT APPLE AND NOT WIN32) + find_package(X11 REQUIRED) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${X11_INCLUDE_DIR}) + list(APPEND wxTOOLKIT_LIBRARIES ${X11_LIBRARIES}) +endif() + +if(WXMSW) + set(wxTOOLKIT_LIBRARIES + gdi32 + comdlg32 + winspool + shell32 + comctl32 + rpcrt4 + Oleacc + ) +elseif(WXGTK) + if(WXGTK3) + set(gtk_lib GTK3) + elseif(WXGTK2) + set(gtk_lib GTK2) + endif() + + find_package(${gtk_lib} REQUIRED) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${${gtk_lib}_INCLUDE_DIRS}) + list(APPEND wxTOOLKIT_LIBRARIES ${${gtk_lib}_LIBRARIES}) + list(APPEND wxTOOLKIT_DEFINITIONS ${${gtk_lib}_DEFINITIONS}) + list(APPEND wxTOOLKIT_DEFINITIONS __WXGTK__) + set(wxTOOLKIT_VERSION ${${gtk_lib}_VERSION}) +endif() + +if(APPLE) + list(APPEND wxTOOLKIT_DEFINITIONS __WXMAC__ __WXOSX__) +endif() +endif() # wxUSE_GUI diff --git a/build/cmake/uninstall.cmake.in b/build/cmake/uninstall.cmake.in new file mode 100644 index 0000000000..b03059ad52 --- /dev/null +++ b/build/cmake/uninstall.cmake.in @@ -0,0 +1,30 @@ +############################################################################# +# Name: build/cmake/uninstall.cmake.in +# Purpose: CMake uinstall template +# Author: Tobias Taschner +# Created: 2016-10-18 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach(file) diff --git a/build/cmake/update_files.py b/build/cmake/update_files.py new file mode 100755 index 0000000000..6fe7a012d5 --- /dev/null +++ b/build/cmake/update_files.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +############################################################################# +# Name: build/cmake/update_files.py +# Purpose: Convert build/files to files.cmake +# Author: Tobias Taschner +# Created: 2016-09-20 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +import os +import re + +outpath = os.path.dirname(os.path.abspath(__file__)) + +infile = open(outpath + "/../files", "r") +outfile = open(outpath + "/files.cmake", "w") +outfile.write("# Automatically generated from build/files by " + os.path.basename(__file__) + "\n") +outfile.write("# DO NOT MODIFY MANUALLY !\n\n") + +# Compile regular expressions +var_ex = re.compile('([\w]+)[\s]*=') +comment_ex = re.compile('^[#]+') +evar_ex = re.compile('\$\(([\w]+)\)') +cmd_ex = re.compile('^<') + +files = None +var_name = None + +def write_file_list(): + # Write current list of files to output file + if not var_name: + return + + outfile.write('set(' + var_name + '\n') + for file in files: + outfile.write(' ') + vm = evar_ex.match(file) + if vm: + # Convert variable reference to cmake variable reference + outfile.write('${'+vm.group(1)+'}') + else: + outfile.write(file) + outfile.write('\n') + + outfile.write(')\n\n') + +for line in infile.readlines(): + # Ignore comment lines + m = comment_ex.match(line) + if m: + continue + m = cmd_ex.match(line.strip()) + if m: + # Ignore bake file commands but note them in the target file in + # case we might need them + line = '#TODO: ' + line + + # Check for variable declaration + m = var_ex.match(line) + if m: + write_file_list() + + var_name = m.group(1) + files = [] + else: + # Collect every file entry + file = line.strip() + if file and var_name: + files.append(file) + +# Write last variable +write_file_list() + +infile.close() +outfile.close() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt new file mode 100644 index 0000000000..bbb604e60e --- /dev/null +++ b/build/cmake/utils/CMakeLists.txt @@ -0,0 +1,21 @@ +############################################################################# +# Name: build/cmake/utils/CMakeLists.txt +# Purpose: CMake script for utilities +# Author: Tobias Taschner +# Created: 2016-10-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +if(wxUSE_XRC) + add_executable(wxrc "${wxSOURCE_DIR}/utils/wxrc/wxrc.cpp") + wx_set_common_target_properties(wxrc) + if(wxBUILD_SHARED) + target_compile_definitions(wxrc PRIVATE WXUSINGDLL) + endif() + wx_exe_link_libraries(wxrc xml base) + # TODO: install + set_target_properties(wxrc PROPERTIES FOLDER "Utilities") +endif() + +# TODO: build targets for other utils diff --git a/build/update-setup-h b/build/update-setup-h index a980a2de15..3d652474e5 100755 --- a/build/update-setup-h +++ b/build/update-setup-h @@ -39,6 +39,11 @@ cat_common_options_for() cmd="$cmd | sed -e '/^\/\//d' \ -e 's@ *//.*\$@@' \ -e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'" + elif [ $2 = "build/cmake/setup.h.in" ]; then + # The setup.h.in template for cmake needs special processing + cmd="$cmd | sed -e '/^\/\//d' \ + -e 's@ *//.*\$@@' \ + -e 's/# *define \(.\+\) \+\(1\|0\) *\$/#cmakedefine01 \1/'" fi eval $cmd @@ -97,10 +102,12 @@ update_common_setup_h include/wx/gtk/setup0.h update_common_setup_h include/wx/osx/setup0.h update_common_setup_h include/wx/univ/setup0.h update_common_setup_h setup.h.in +update_common_setup_h build/cmake/setup.h.in update_msw_setup_h include/wx/msw/setup0.h update_msw_setup_h include/wx/gtk/setup0.h update_msw_setup_h setup.h.in +update_msw_setup_h build/cmake/setup.h.in update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup0.h From e885de58eb2a842dd149928fe32296946b7d8bf4 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Tue, 4 Oct 2016 11:45:08 +0200 Subject: [PATCH 3/9] Add documentation on using CMake with wxWidgets --- docs/doxygen/Doxyfile | 2 +- docs/doxygen/mainpages/topics.h | 1 + docs/doxygen/overviews/cmake.md | 110 ++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 docs/doxygen/overviews/cmake.md diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index a5dd625c2f..5eca312e91 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -294,7 +294,7 @@ INPUT = mainpages \ overviews \ ../../interface INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.h +FILE_PATTERNS = *.h *.md RECURSIVE = YES # Default: NO EXCLUDE = EXCLUDE_SYMLINKS = NO diff --git a/docs/doxygen/mainpages/topics.h b/docs/doxygen/mainpages/topics.h index 969371b064..4ad82d7ae5 100644 --- a/docs/doxygen/mainpages/topics.h +++ b/docs/doxygen/mainpages/topics.h @@ -22,6 +22,7 @@ topics related to building applications with wxWidgets. @li @subpage overview_roughguide @li @subpage overview_helloworld @li @subpage overview_python +@li @subpage overview_cmake @section page_topics_programming Important wxWidgets Topics diff --git a/docs/doxygen/overviews/cmake.md b/docs/doxygen/overviews/cmake.md new file mode 100644 index 0000000000..62369bcd5b --- /dev/null +++ b/docs/doxygen/overviews/cmake.md @@ -0,0 +1,110 @@ +CMake Overview {#overview_cmake} +============== +[TOC] + +CMake allows building wxWidgets on various platforms with your preferred build +system. + +Most linux distributions contain CMake as a package on Windows and OS X you can +download an installer at the [CMake Page](https://cmake.org). + +Using the CMake GUI {#cmake_gui} +=================== +1. Start the CMake GUI +2. Specify the wxWidgets root as your source folder +3. Specify a path where the build files should be created. It's recommended to + use a path outside the wxWidgets root folder. +4. Press the *Configure* button and you will be asked which IDE or build system + you wish to use +5. *Optionally*: Customize any of the options +6. Press the *Generate* button +7. Open the wxWidgets project with your preferred IDE + +Using the CMake Command Line {#cmake_cli} +============================ +1. Create a folder where the build/project files should be created +2. Change into the created folder +3. Run `cmake -G "Unix Makefiles" path_to_wxWidgets_root` +4. After that you can run `cmake --build .` to start the build process or + directly use your choosen build system. + +Run `cmake --help` to see a list of available generators on your platform. +These can than be specified using the -G command line option. On Windows it +is recommended to use Visual Studio and on OS X Xcode is recommended. +Various build options can be specified using -D see +[available options](#cmake_options). + +Command Line Examples {#cmake_cli_samples} +--------------------- +Building with tests using [Ninja](https://ninja-build.org/): +~~~{.sh} + cmake -G "Ninja" ~/Downloads/wxWidgets_3.1 -DwxBUILD_TESTS=ALL + cmake --build . +~~~ + +Building the minimal sample: +~~~{.sh} + cmake ~/Downloads/wxWidgets_3.1 -DwxBUILD_SAMPLES=SOME + cmake --build . --target minimal +~~~ + +Installing static libraries to some path: +~~~{.sh} + cmake ~/Downloads/wxWidgets_3.1 \ + -DCMAKE_INSTALL_PREFIX=~/wx_install \ + -DwxBUILD_SHARED=OFF + cmake --build . --target install +~~~ + + +Build options {#cmake_options} +======================= +The following list of build options can either be configured in the CMake UI +or specified via the -D command line option when running the cmake command. + +Option Name | Type | Description +----------------------------- | ----- | ------------------------------------ +wxBUILD_SHARED | BOOL | Build shared libraries +wxBUILD_TESTS | STRING | CONSOLE_ONLY, ALL or OFF +wxBUILD_SAMPLES | STRING | SOME, ALL or OFF +wxUSE_GUI | BOOL | Build the UI libraries +wxBUILD_COMPATIBILITY | STRING | 2.8, 3.0 or 3.1 API compatibility + +Using CMake with your applications {#cmake_apps} +================================== +If you are using CMake with your own application there are various ways to use +wxWidgets: +* Using an installed, binary or compiled version of wxWidgets +using `find_package()` +* wxWidgets as a sub directory. +* CMake's [ExternalProject module](https://cmake.org/cmake/help/latest/module/ExternalProject.html). + +Using find_package {#cmake_find_package} +------------------ +You can use `find_package(wxWidgets)` to use a compiled version of wxWidgets. +Have a look at the [CMake Documentation](https://cmake.org/cmake/help/latest/module/FindwxWidgets.html) +for detailed instructions. + +Your *CMakeLists.txt* would look like this: +~~~ +... + +find_package(wxWidgets REQUIRED COMPONENTS net core base) +include(${wxWidgets_USE_FILE}) +add_executable(myapp myapp.cpp) +target_link_libraries(myapp ${wxWidgets_LIBRARIES}) +~~~ + +Using a sub directory {#cmake_subdir} +--------------------- +You can use wxWidgets as a subdirectory in your application's build tree +e.g. as a git submodule. This way the wxWidgets libraries will be part +of your applications build process. + +Your *CMakeLists.txt* would look like this: +~~~ +... +add_subdirectory(libs/wxWidgets) +add_executable(myapp myapp.cpp) +target_link_libraries(myapp net core base) +~~~ From 9338e683714392c25b02540807a76860c8b380d1 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 5 Oct 2016 10:16:30 +0200 Subject: [PATCH 4/9] Add CMake to Appveyor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build with “Visual Studio 12 (2013)” 32-bit Release DLLs Other configurations can later be added in the appveyor.yml --- appveyor.yml | 4 ++++ build/tools/appveyor.bat | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index c593022a88..0622375c72 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,6 +26,10 @@ environment: - TOOLSET: msys2 MSYSTEM: MINGW32 - TOOLSET: cygwin + - TOOLSET: cmake + GENERATOR: 'Visual Studio 12' + SHARED: ON + CONFIGURATION: Release clone_depth: 50 diff --git a/build/tools/appveyor.bat b/build/tools/appveyor.bat index ddf28794b2..592d938c19 100644 --- a/build/tools/appveyor.bat +++ b/build/tools/appveyor.bat @@ -44,3 +44,38 @@ perl -i".bak" -pe "s/^test -n \".DJDIR\"/#$&/" configure bash -lc "g++ --version" bash -lc "LDFLAGS=-L/usr/lib/w32api ./configure --disable-optimise --disable-shared && make -j3" goto :eof + +:cmake +echo --- Tools versions: +cmake --version | head -1 +echo. +echo --- Generating project files +echo. +set WX_INSTALL_PATH=%HOMEDRIVE%%HOMEPATH%\wx_install_target +mkdir %WX_INSTALL_PATH% +mkdir build_cmake_vs +pushd build_cmake_vs +cmake -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX=%WX_INSTALL_PATH% -DwxBUILD_SHARED=%SHARED% .. +echo. +echo --- Starting the build +echo. +cmake --build . --config %CONFIGURATION% +echo. +echo --- Installing +echo. +cmake --build . --config %CONFIGURATION% --target install +popd + +echo. +echo --- Test installed library +echo. +set WXWIN=%WX_INSTALL_PATH% +mkdir build_cmake_install_test +pushd build_cmake_install_test +echo --- Configure minimal sample +cmake -G "%GENERATOR%" ..\samples\minimal +echo --- Building minimal sample with installed library +cmake --build . --config %CONFIGURATION% +popd + +goto :eof From b8706dac1c1360c2d16647d4997192d4bccec150 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 3 Nov 2016 21:28:26 +0100 Subject: [PATCH 5/9] Add more CMake toolset types to appveyor.bat --- build/tools/appveyor.bat | 103 +++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 20 deletions(-) diff --git a/build/tools/appveyor.bat b/build/tools/appveyor.bat index 592d938c19..b2dd4850c8 100644 --- a/build/tools/appveyor.bat +++ b/build/tools/appveyor.bat @@ -45,37 +45,100 @@ bash -lc "g++ --version" bash -lc "LDFLAGS=-L/usr/lib/w32api ./configure --disable-optimise --disable-shared && make -j3" goto :eof +:cmake_msys +if "%MSYSTEM%"=="" set MSYSTEM=MINGW32 +path C:\msys64\%MSYSTEM%\bin;C:\msys64\usr\bin;%path% +set GENERATOR=MSYS Makefiles +set SKIPTESTS=1 +set SKIPINSTALL=1 +set CMAKE_BUILD_FLAGS=-- -j3 +goto cmake + +:cmake_cygwin +C:\cygwin\setup-x86.exe -qnNdO -R C:/cygwin -s http://cygwin.mirror.constant.com -l C:/cygwin/var/cache/setup -P libjpeg-devel -P libpng-devel -P libtiff-devel -P libexpat-devel +path c:\cygwin\bin;%path% +set GENERATOR=Unix Makefiles +set SKIPTESTS=1 +set SKIPINSTALL=1 +set CMAKE_BUILD_FLAGS=-- -j3 +goto cmake + +:cmake_mingw +:: CMake requires a path without sh (added by git on AppVeyor) +path C:\Program Files (x86)\CMake\bin;C:\MinGW\bin +set GENERATOR=MinGW Makefiles +set SKIPTESTS=1 +set CMAKE_BUILD_FLAGS=-- -j3 +goto cmake + :cmake echo --- Tools versions: -cmake --version | head -1 +cmake --version + +if "%SHARED%"=="" set SHARED=ON +if "%CONFIGURATION%"=="" set CONFIGURATION=Release + +if "%SKIPTESTS%"=="1" ( + set BUILD_TESTS=OFF +) else ( + set BUILD_TESTS=CONSOLE_ONLY +) echo. echo --- Generating project files echo. set WX_INSTALL_PATH=%HOMEDRIVE%%HOMEPATH%\wx_install_target mkdir %WX_INSTALL_PATH% -mkdir build_cmake_vs -pushd build_cmake_vs -cmake -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX=%WX_INSTALL_PATH% -DwxBUILD_SHARED=%SHARED% .. +mkdir build_cmake +pushd build_cmake +cmake -G "%GENERATOR%" -DwxBUILD_TESTS=%BUILD_TESTS% -DCMAKE_INSTALL_PREFIX=%WX_INSTALL_PATH% -DwxBUILD_SHARED=%SHARED% %CMAKE_CONFIGURE_FLAGS% .. +if ERRORLEVEL 1 goto error echo. echo --- Starting the build echo. -cmake --build . --config %CONFIGURATION% -echo. -echo --- Installing -echo. -cmake --build . --config %CONFIGURATION% --target install -popd +cmake --build . --config %CONFIGURATION% %CMAKE_BUILD_FLAGS% +if ERRORLEVEL 1 goto error -echo. -echo --- Test installed library -echo. -set WXWIN=%WX_INSTALL_PATH% -mkdir build_cmake_install_test -pushd build_cmake_install_test -echo --- Configure minimal sample -cmake -G "%GENERATOR%" ..\samples\minimal -echo --- Building minimal sample with installed library -cmake --build . --config %CONFIGURATION% +:: Package binaries as artifact +where 7z +if ERRORLEVEL 1 goto cmake_test +7z a -r wxWidgets_Binaries.zip lib/*.* +appveyor PushArtifact wxWidgets_Binaries.zip + +:cmake_test +if NOT "%SKIPTESTS%"=="1" ( + echo. + echo --- Running tests + echo. + ctest -V -C %CONFIGURATION% --interactive-debug-mode 0 . + if ERRORLEVEL 1 goto error +) +if NOT "%SKIPINSTALL%"=="1" ( + echo. + echo --- Installing + echo. + cmake --build . --config %CONFIGURATION% --target install + if ERRORLEVEL 1 goto error + popd + + echo. + echo --- Test installed library + echo. + set WXWIN=%WX_INSTALL_PATH% + mkdir build_cmake_install_test + pushd build_cmake_install_test + echo --- Configure minimal sample + cmake -G "%GENERATOR%" ..\samples\minimal + if ERRORLEVEL 1 goto error + echo --- Building minimal sample with installed library + cmake --build . --config %CONFIGURATION% + if ERRORLEVEL 1 goto error + popd +) popd goto :eof + +:error +echo. +echo --- Build failed ! +echo. From 8b6ffa40662020ae8769f62b6045d3f062e5bf01 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 6 Oct 2016 16:04:55 +0200 Subject: [PATCH 6/9] Move travis-ci script to shell file This will allow easier integration for testing other build systems --- .travis.yml | 23 +---------------------- build/tools/travis-ci.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 22 deletions(-) create mode 100755 build/tools/travis-ci.sh diff --git a/.travis.yml b/.travis.yml index b3065f5b19..6a50afe28e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,25 +37,4 @@ notifications: before_install: ./build/tools/before_install.sh -script: | - echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r' && - ./configure --disable-optimise $wxCONFIGURE_FLAGS && - echo -en 'travis_fold:end:script.1\\r' && - echo 'Building...' && echo -en 'travis_fold:start:script.2\\r' && - make && - echo -en 'travis_fold:end:script.2\\r' && - echo 'Testing...' && echo -en 'travis_fold:start:script.3\\r' && - make -C tests && - pushd tests && - ./test -t && - popd && - echo -en 'travis_fold:end:script.3\\r' && - echo 'Building the samples...' && echo -en 'travis_fold:start:script.4\\r' && - make samples && - echo -en 'travis_fold:end:script.4\\r' && - echo 'Installing...' && echo -en 'travis_fold:start:script.5\\r' && - sudo make install && - echo -en 'travis_fold:end:script.5\\r' && - echo 'Testing building with the installed version...' && echo -en 'travis_fold:start:script.6\\r' && - make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS && - echo -en 'travis_fold:end:script.6\\r' +script: bash build/tools/travis-ci.sh diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh new file mode 100755 index 0000000000..d8638a22d0 --- /dev/null +++ b/build/tools/travis-ci.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# This script is used by Travis CI to configure, build and test wxWidgets + +set -e + +echo 'travis_fold:start:configure' +echo 'Configuring...' +./configure --disable-optimise $wxCONFIGURE_FLAGS +echo 'travis_fold:end:configure' +echo 'travis_fold:start:building' +echo 'Building...' +make +echo 'travis_fold:end:building' +echo 'travis_fold:start:testing' +echo 'Testing...' +make -C tests +pushd tests +./test -t +popd +echo 'travis_fold:end:testing' +echo 'travis_fold:start:samples' +echo 'Building the samples...' +make samples +echo 'travis_fold:end:samples' +echo 'travis_fold:start:installing' +echo 'Installing...' +sudo make install +echo 'travis_fold:end:installing' +echo 'travis_fold:start:test_install' +echo 'Testing building with the installed version...' +make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS +echo 'travis_fold:end:test_install' From 8e1a4799acff54ea9e836cdd71f824b4defc5b78 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Fri, 7 Oct 2016 14:02:02 +0200 Subject: [PATCH 7/9] Add CMake to Travis-CI --- .travis.yml | 7 ++++ build/tools/travis-ci.sh | 84 +++++++++++++++++++++++++++------------- 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a50afe28e..295fed8f7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,13 @@ sudo: required matrix: include: + - dist: trusty + compiler: gcc + env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" + - os: osx + osx_image: beta-xcode6.2 + compiler: clang + env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11" - compiler: gcc - compiler: gcc env: wxCONFIGURE_FLAGS="--disable-precomp-headers --enable-monolithic" diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index d8638a22d0..c063db13bc 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -4,30 +4,60 @@ set -e -echo 'travis_fold:start:configure' -echo 'Configuring...' -./configure --disable-optimise $wxCONFIGURE_FLAGS -echo 'travis_fold:end:configure' -echo 'travis_fold:start:building' -echo 'Building...' -make -echo 'travis_fold:end:building' -echo 'travis_fold:start:testing' -echo 'Testing...' -make -C tests -pushd tests -./test -t -popd -echo 'travis_fold:end:testing' -echo 'travis_fold:start:samples' -echo 'Building the samples...' -make samples -echo 'travis_fold:end:samples' -echo 'travis_fold:start:installing' -echo 'Installing...' -sudo make install -echo 'travis_fold:end:installing' -echo 'travis_fold:start:test_install' -echo 'Testing building with the installed version...' -make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS -echo 'travis_fold:end:test_install' +case $wxTOOLSET in + cmake) + if [ `uname -s` = "Linux" ] && [ `lsb_release -cs` = "precise" ]; then + echo Updating CMake... + wget -O - https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz | tar xzf - + export PATH=`pwd`/cmake-3.6.2-Linux-x86_64/bin:$PATH + fi + + if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi + cmake --version + echo 'travis_fold:start:configure' + echo 'Configuring...' + mkdir build_cmake + pushd build_cmake + cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES -D wxBUILD_SAMPLES=SOME -D wxBUILD_TESTS=$wxCMAKE_TESTS .. + echo 'travis_fold:end:configure' + echo 'travis_fold:start:building' + echo 'Building...' + cmake --build . + echo 'travis_fold:end:building' + if [ "$wxCMAKE_TESTS" != "OFF" ]; then + echo 'travis_fold:start:testing' + echo 'Testing...' + ctest . -C Debug -V --output-on-failure + echo 'travis_fold:end:testing' + fi + ;; + *) + echo 'travis_fold:start:configure' + echo 'Configuring...' + ./configure --disable-optimise $wxCONFIGURE_FLAGS + echo 'travis_fold:end:configure' + echo 'travis_fold:start:building' + echo 'Building...' + make + echo 'travis_fold:end:building' + echo 'travis_fold:start:testing' + echo 'Testing...' + make -C tests + pushd tests + ./test -t + popd + echo 'travis_fold:end:testing' + echo 'travis_fold:start:samples' + echo 'Building the samples...' + make samples + echo 'travis_fold:end:samples' + echo 'travis_fold:start:installing' + echo 'Installing...' + sudo make install + echo 'travis_fold:end:installing' + echo 'travis_fold:start:test_install' + echo 'Testing building with the installed version...' + make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS + echo 'travis_fold:end:test_install' + ;; +esac From 4edafd8a8cf8cae7529ba10cdc4ecd977abaf695 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Sun, 23 Oct 2016 21:00:39 +0200 Subject: [PATCH 8/9] Added CMakeLists.txt for minimal sample for testing and demo --- samples/minimal/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 samples/minimal/CMakeLists.txt diff --git a/samples/minimal/CMakeLists.txt b/samples/minimal/CMakeLists.txt new file mode 100644 index 0000000000..8f64044812 --- /dev/null +++ b/samples/minimal/CMakeLists.txt @@ -0,0 +1,53 @@ +############################################################################# +# Name: samples/minimal/CMakeListst.txt +# Purpose: Sample CMake file to show usage of cmake for wxWidgets users +# Author: Tobias Taschner +# Created: 2016-10-23 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +# +# This file is just a sample to show using cmake from an application +# If you want to build the minimal and other samples please use the +# wxBUILD_SAMPLES option when using cmake on the library +# + +# Declare the minimum required CMake version +cmake_minimum_required(VERSION 2.8.12) + +# Name the project +project(minimal) + +# Request the required wxWidgets libs +find_package(wxWidgets 3.1 COMPONENTS core base REQUIRED) + +# Include the wxWidgets use file to initialize various settings +include(${wxWidgets_USE_FILE}) + +# Define a variable containing a list of source files for the project +set(SRC_FILES + minimal.cpp + ) + +if(WIN32) + # Include a RC file for windows + list(APPEND SRC_FILES ../sample.rc) +elseif(APPLE) + # Add an icon for the apple .app file + list(APPEND SRC_FILES ../../src/osx/carbon/wxmac.icns) +endif() + +# Define the build target for the executable +add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SRC_FILES}) +# Link required libraries to the executable +target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES}) + +if(APPLE) + set_target_properties(${PROJECT_NAME} PROPERTIES + RESOURCE "../../src/osx/carbon/wxmac.icns" + MACOSX_BUNDLE_ICON_FILE wxmac.icns + MACOSX_BUNDLE_COPYRIGHT "Copyright wxWidgets" + MACOSX_BUNDLE_GUI_IDENTIFIER "org.wxwidgets.minimal" + ) +endif() From 89890a346237c1e26553e86eca71e6bc57dbfe02 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Tue, 3 Jan 2017 21:33:34 +0100 Subject: [PATCH 9/9] Do not define _GNU_SOURCE on apple --- build/cmake/setup.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 5c0fd0e1c9..17a68b2f15 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -45,6 +45,9 @@ endif() if(UNIX) wx_setup_definition(wxUSE_UNIX) wx_setup_definition(__UNIX__) +endif() + +if(UNIX AND NOT APPLE) wx_setup_definition(_GNU_SOURCE) endif()