Add CMake-based build system.

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

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

View File

@@ -18,10 +18,16 @@ matrix:
- dist: trusty - dist: trusty
compiler: clang compiler: clang
env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs" env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs"
- dist: trusty
compiler: gcc
env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles"
- os: osx - os: osx
osx_image: xcode6.4 osx_image: xcode6.4
compiler: clang compiler: clang
env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1 env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1
- os: osx
compiler: clang
env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11"
branches: branches:
only: only:
@@ -37,26 +43,4 @@ notifications:
before_install: ./build/tools/before_install.sh before_install: ./build/tools/before_install.sh
script: script: bash build/tools/travis-ci.sh
- set -e && echo 'Configuring...' && echo -en 'travis_fold:start:script.configure\\r'
- ./configure --disable-optimise $wxCONFIGURE_FLAGS
- echo -en 'travis_fold:end:script.configure\\r'
- echo 'Building...' && echo -en 'travis_fold:start:script.build\\r'
- make
- echo -en 'travis_fold:end:script.build\\r'
- echo 'Building tests...' && echo -en 'travis_fold:start:script.tests\\r'
- make -C tests
- echo -en 'travis_fold:end:script.tests\\r'
- echo 'Testing...' && echo -en 'travis_fold:start:script.testing\\r'
- pushd tests && ./test && popd
- echo -en 'travis_fold:end:script.testing\\r'
- echo 'Building samples...' && echo -en 'travis_fold:start:script.samples\\r'
- (test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make samples
- echo -en 'travis_fold:end:script.samples\\r'
- echo 'Installing...' && echo -en 'travis_fold:start:script.install\\r'
- sudo make install
- echo -en 'travis_fold:end:script.install\\r'
- echo 'Testing installation...' && echo -en 'travis_fold:start:script.testinstall\\r'
- make -C samples/minimal -f makefile.unx clean
- make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS
- echo -en 'travis_fold:end:script.testinstall\\r'

57
CMakeLists.txt Normal file
View File

@@ -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()

View File

@@ -32,6 +32,10 @@ environment:
- TOOLSET: msys2 - TOOLSET: msys2
MSYSTEM: MINGW32 MSYSTEM: MINGW32
- TOOLSET: cygwin - TOOLSET: cygwin
- TOOLSET: cmake
GENERATOR: 'Visual Studio 12'
SHARED: ON
CONFIGURATION: Release
clone_depth: 50 clone_depth: 50

85
build/cmake/README.md Normal file
View File

@@ -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/

121
build/cmake/config.cmake Normal file
View File

@@ -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()

View File

@@ -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
)

3254
build/cmake/files.cmake Normal file

File diff suppressed because it is too large Load Diff

710
build/cmake/functions.cmake Normal file
View File

@@ -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(<out_var> <pref> <items...>)
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}$<$<CONFIG:Debug>: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(<target_name> [IS_BASE] <src_files>...)
# 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(<name> [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(<name> <desc> [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(<name> [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()

181
build/cmake/init.cmake Normal file
View File

@@ -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 "$<$<CONFIG:Debug>: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()

49
build/cmake/install.cmake Normal file
View File

@@ -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()

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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/jaricom.c
src/jpeg/jcapimin.c
src/jpeg/jcapistd.c
src/jpeg/jcarith.c
src/jpeg/jccoefct.c
src/jpeg/jccolor.c
src/jpeg/jcdctmgr.c
src/jpeg/jchuff.c
src/jpeg/jcinit.c
src/jpeg/jcmainct.c
src/jpeg/jcmarker.c
src/jpeg/jcmaster.c
src/jpeg/jcomapi.c
src/jpeg/jcparam.c
src/jpeg/jcprepct.c
src/jpeg/jcsample.c
src/jpeg/jctrans.c
src/jpeg/jdapimin.c
src/jpeg/jdapistd.c
src/jpeg/jdarith.c
src/jpeg/jdatadst.c
src/jpeg/jdatasrc.c
src/jpeg/jdcoefct.c
src/jpeg/jdcolor.c
src/jpeg/jddctmgr.c
src/jpeg/jdhuff.c
src/jpeg/jdinput.c
src/jpeg/jdmainct.c
src/jpeg/jdmarker.c
src/jpeg/jdmaster.c
src/jpeg/jdmerge.c
src/jpeg/jdpostct.c
src/jpeg/jdsample.c
src/jpeg/jdtrans.c
src/jpeg/jerror.c
src/jpeg/jfdctflt.c
src/jpeg/jfdctfst.c
src/jpeg/jfdctint.c
src/jpeg/jidctflt.c
src/jpeg/jidctfst.c
src/jpeg/jidctint.c
src/jpeg/jmemmgr.c
src/jpeg/jmemnobs.c
src/jpeg/jquant1.c
src/jpeg/jquant2.c
src/jpeg/jutils.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()

View File

@@ -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)

View File

@@ -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)

43
build/cmake/lib/png.cmake Normal file
View File

@@ -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()

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)

View File

@@ -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=<INSTALL_DIR>
-DBUILD_tools=OFF
-DBUILD_examples=OFF
-DBUILD_tests=OFF
-DBUILD_shared=OFF
INSTALL_COMMAND
${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIGURATION> --target install
COMMAND
${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/wxlib
COMMAND
${CMAKE_COMMAND} -E rename
<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}expat${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat$<$<CONFIG:Debug>: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$<$<CONFIG:Debug>: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)

View File

@@ -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)

View File

@@ -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()

75
build/cmake/main.cmake Normal file
View File

@@ -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}"
)

View File

@@ -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 <rakuco@webkit.org>
#
# 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})

View File

@@ -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 <rakuco@webkit.org>
# 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)

View File

@@ -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 <iconv.h>
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
)

View File

@@ -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 <rakuco@webkit.org>
#
# 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)

View File

@@ -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 <rakuco@webkit.org>
# 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)

View File

@@ -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 )

View File

@@ -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 <rpavlik@iastate.edu> <abiryan@ryand.net>
# 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)

File diff suppressed because it is too large Load Diff

371
build/cmake/options.cmake Normal file
View File

@@ -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

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)

685
build/cmake/setup.cmake Normal file
View File

@@ -0,0 +1,685 @@
#############################################################################
# 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__)
endif()
if(UNIX AND NOT APPLE)
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(<code> <var> [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(<code> <var> [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<int> moo;
std::list<int> foo;
std::vector<int>::iterator it =
std::find_if(moo.begin(), moo.end(),
std::bind2nd(std::less<int>(), 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 <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/vfs.h>
#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 <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/vfs.h>
#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()

1300
build/cmake/setup.h.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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)$")

View File

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

View File

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

View File

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

View File

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

97
build/cmake/toolkit.cmake Normal file
View File

@@ -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

View File

@@ -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)

77
build/cmake/update_files.py Executable file
View File

@@ -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()

View File

@@ -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

View File

@@ -2833,6 +2833,20 @@ WEBVIEW_CMN_HDR =
wx/webviewarchivehandler.h wx/webviewarchivehandler.h
wx/webviewfshandler.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 # wxXRC
XRC_SRC = XRC_SRC =
@@ -2998,6 +3012,9 @@ OPENGL_MSW_SRC =
OPENGL_MSW_HDR = OPENGL_MSW_HDR =
wx/msw/glcanvas.h wx/msw/glcanvas.h
OPENGL_OSX_SHARED_SRC =
src/osx/cocoa/glcanvas.mm
src/osx/glcanvas_osx.cpp
# Misc plugin sources: # Misc plugin sources:
@@ -3035,6 +3052,12 @@ AUI_MSW_SRC =
src/aui/tabartmsw.cpp src/aui/tabartmsw.cpp
src/aui/barartmsw.cpp src/aui/barartmsw.cpp
AUI_GTK_SRC =
src/aui/tabartgtk.cpp
AUI_GTK_HDR =
wx/aui/tabartgtk.h
# wxRibbon # wxRibbon
RIBBON_SRC = RIBBON_SRC =

View File

@@ -50,3 +50,101 @@ perl -i".bak" -pe "s/^test -n \".DJDIR\"/#$&/" configure
bash -lc "g++ --version" bash -lc "g++ --version"
bash -lc "LDFLAGS=-L/usr/lib/w32api ./configure --disable-optimise --disable-shared && make -j3 && make -j3 -C tests" bash -lc "LDFLAGS=-L/usr/lib/w32api ./configure --disable-optimise --disable-shared && make -j3 && make -j3 -C tests"
goto :eof 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
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
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% %CMAKE_BUILD_FLAGS%
if ERRORLEVEL 1 goto error
:: 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.

58
build/tools/travis-ci.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/sh
#
# This script is used by Travis CI to configure, build and test wxWidgets
set -e
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 'Configuring...' && echo -en 'travis_fold:start:script.configure\\r'
./configure --disable-optimise $wxCONFIGURE_FLAGS
echo -en 'travis_fold:end:script.configure\\r'
echo 'Building...' && echo -en 'travis_fold:start:script.build\\r'
make
echo -en 'travis_fold:end:script.build\\r'
echo 'Building tests...' && echo -en 'travis_fold:start:script.tests\\r'
make -C tests
echo -en 'travis_fold:end:script.tests\\r'
echo 'Testing...' && echo -en 'travis_fold:start:script.testing\\r'
pushd tests && ./test && popd
echo -en 'travis_fold:end:script.testing\\r'
echo 'Building samples...' && echo -en 'travis_fold:start:script.samples\\r'
(test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make samples
echo -en 'travis_fold:end:script.samples\\r'
echo 'Installing...' && echo -en 'travis_fold:start:script.install\\r'
sudo make install
echo -en 'travis_fold:end:script.install\\r'
echo 'Testing installation...' && echo -en 'travis_fold:start:script.testinstall\\r'
make -C samples/minimal -f makefile.unx clean
make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS
echo -en 'travis_fold:end:script.testinstall\\r'
;;
esac

View File

@@ -39,6 +39,11 @@ cat_common_options_for()
cmd="$cmd | sed -e '/^\/\//d' \ cmd="$cmd | sed -e '/^\/\//d' \
-e 's@ *//.*\$@@' \ -e 's@ *//.*\$@@' \
-e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'" -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 fi
eval $cmd eval $cmd
@@ -103,10 +108,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/osx/setup0.h
update_common_setup_h include/wx/univ/setup0.h update_common_setup_h include/wx/univ/setup0.h
update_common_setup_h setup.h.in 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/msw/setup0.h
update_msw_setup_h include/wx/gtk/setup0.h update_msw_setup_h include/wx/gtk/setup0.h
update_msw_setup_h setup.h.in update_msw_setup_h setup.h.in
update_msw_setup_h build/cmake/setup.h.in
update_osx_setup_h include/wx/osx/setup0.h update_osx_setup_h include/wx/osx/setup0.h
update_msw_setup_h setup.h.in update_msw_setup_h setup.h.in

View File

@@ -81,6 +81,7 @@ INCOMPATIBLE CHANGES SINCE 3.1.0:
All: All:
- Add CMake-based build system (Tobias Taschner).
- Add wxSecretStore for storing passwords using the OS-provided facilities. - Add wxSecretStore for storing passwords using the OS-provided facilities.
- Add support for compiling application code with wxNO_UNSAFE_WXSTRING_CONV. - Add support for compiling application code with wxNO_UNSAFE_WXSTRING_CONV.
- Add support for translating strings in different contexts (RickS). - Add support for translating strings in different contexts (RickS).

View File

@@ -294,7 +294,7 @@ INPUT = mainpages \
overviews \ overviews \
../../interface ../../interface
INPUT_ENCODING = UTF-8 INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h FILE_PATTERNS = *.h *.md
RECURSIVE = YES # Default: NO RECURSIVE = YES # Default: NO
EXCLUDE = EXCLUDE =
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO

View File

@@ -21,6 +21,7 @@ topics related to building applications with wxWidgets.
@li @subpage overview_referencenotes @li @subpage overview_referencenotes
@li @subpage overview_roughguide @li @subpage overview_roughguide
@li @subpage overview_helloworld @li @subpage overview_helloworld
@li @subpage overview_cmake
@section page_topics_programming Important wxWidgets Topics @section page_topics_programming Important wxWidgets Topics

View File

@@ -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)
~~~

View File

@@ -36,6 +36,7 @@ include:
Some of the other improvements: Some of the other improvements:
- wxWidgets can now be built with CMake too.
- Strings can now be translated differently depending on their context. - Strings can now be translated differently depending on their context.
- Converting between wxString and UTF-8 encoded std::string is now - Converting between wxString and UTF-8 encoded std::string is now
simpler and unsafe wxString can now be disabled on the opt-in basis simpler and unsafe wxString can now be disabled on the opt-in basis

View File

@@ -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()