diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 863a733a94..3f84e21ae5 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -3287,7 +3287,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - + src/unix/sound_sdl.cpp @@ -3708,7 +3708,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - $(UNIX_SOUND_SRC_SDL) + $(UNIX_SOUND_SDL_SRC) diff --git a/build/bakefiles/plugins.bkl b/build/bakefiles/plugins.bkl index b346903be1..3820980dbb 100644 --- a/build/bakefiles/plugins.bkl +++ b/build/bakefiles/plugins.bkl @@ -7,7 +7,7 @@ - $(UNIX_SOUND_SRC_SDL) + $(UNIX_SOUND_SDL_SRC) $(EXTRALIBS_SDL) diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index 04db51a020..b89cbac302 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -44,7 +44,7 @@ function(wx_write_config) # TODO: set variables set(includedir "$") - wx_string_append(libdir "{prefix}/include") + wx_string_append(includedir "{prefix}/include") set(libdir "$") wx_string_append(libdir "{exec_prefix}/lib") set(bindir "$") diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 455e2d2f11..3111a384c2 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2869,6 +2869,14 @@ set(WEBVIEW_GTK_SRC src/gtk/webview_webkit.cpp ) +set(WEBVIEW2_GTK_SRC + src/gtk/webview_webkit2.cpp +) + +set(WEBVIEW_WEBKIT2_EXTENSION_SRC + src/gtk/webview_webkit2_extension.cpp +) + set(XRC_SRC src/xrc/xh_activityindicator.cpp src/xrc/xh_animatctrl.cpp @@ -3049,7 +3057,7 @@ set(OPENGL_OSX_SHARED_SRC src/osx/glcanvas_osx.cpp ) -set(UNIX_SOUND_SRC_SDL +set(UNIX_SOUND_SDL_SRC src/unix/sound_sdl.cpp ) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 292440380f..b5b207924a 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -223,12 +223,39 @@ if(wxUSE_GUI) 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) + if(wxUSE_WEBVIEW) + if(WXGTK) + if(wxUSE_WEBVIEW_WEBKIT) + find_package(LibSoup) + if(WXGTK2) + find_package(Webkit 1.0) + elseif(WXGTK3) + find_package(Webkit2) + if(NOT WEBKIT2_FOUND) + find_package(Webkit 3.0) + endif() + endif() + endif() + set(wxUSE_WEBVIEW_WEBKIT OFF) + set(wxUSE_WEBVIEW_WEBKIT2 OFF) + if(WEBKIT_FOUND AND LIBSOUP_FOUND) + set(wxUSE_WEBVIEW_WEBKIT ON) + elseif(WEBKIT2_FOUND AND LIBSOUP_FOUND) + set(wxUSE_WEBVIEW_WEBKIT2 ON) + else() + message(WARNING "webkit not found or enabled, wxWebview won't be available") + wx_option_force_value(wxUSE_WEBVIEW OFF) + endif() + elseif(WXMSW) + if(NOT wxUSE_WEBVIEW_IE) + message(WARNING "WebviewIE not found or enabled, wxWebview won't be available") + wx_option_force_value(wxUSE_WEBVIEW OFF) + endif() + elseif(APPLE) + if(NOT wxUSE_WEBVIEW_WEBKIT) + message(WARNING "webkit not found or enabled, wxWebview won't be available") + wx_option_force_value(wxUSE_WEBVIEW OFF) + endif() endif() endif() @@ -257,4 +284,15 @@ if(wxUSE_GUI) wx_option_force_value(wxUSE_MEDIACTRL OFF) endif() endif() + + if(UNIX AND wxUSE_LIBSDL) + find_package(SDL2) + if(NOT SDL2_FOUND) + find_package(SDL) + endif() + if(NOT SDL2_FOUND AND NOT SDL_FOUND) + message(WARNING "SDL not found, SDL Audio back-end won't be available") + wx_option_force_value(wxUSE_LIBSDL OFF) + endif() + endif() endif() diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 3e038c8fcf..734a2af88a 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -20,10 +20,32 @@ if(MSVC) DIRECTORY "${wxSOURCE_DIR}/include/msvc" DESTINATION "include") endif() + +# setup header and wx-config if(MSVC OR MINGW) wx_install( DIRECTORY "${wxSETUP_HEADER_PATH}" DESTINATION "lib${wxPLATFORM_LIB_DIR}") +elseif(UNIX) + wx_install( + DIRECTORY "${wxSETUP_HEADER_PATH}" + DESTINATION "lib/wx/include") + + wx_install( + FILES "${wxOUTPUT_DIR}/wx/config/${wxBUILD_FILE_ID}" + DESTINATION "lib/wx/config" + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ + WORLD_EXECUTE WORLD_READ + ) + + install(DIRECTORY DESTINATION "bin") + install(CODE "execute_process( \ + COMMAND ${CMAKE_COMMAND} -E create_symlink \ + ${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID} \ + ${CMAKE_INSTALL_PREFIX}/bin/wx-config \ + )" + ) endif() # uninstall target @@ -34,6 +56,12 @@ else() endif() if(NOT TARGET ${UNINST_NAME}) + # these files are not added to the install manifest + set(WX_EXTRA_UNINSTALL_FILES + "${CMAKE_INSTALL_PREFIX}/bin/wx-config" + "${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + ) + configure_file( "${wxSOURCE_DIR}/build/cmake/uninstall.cmake.in" "${wxBINARY_DIR}/uninstall.cmake" diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index 0cf6a46860..8f526afebe 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -31,8 +31,8 @@ wx_add_library(base IS_BASE ${BASE_FILES}) if(NOT wxBUILD_MONOLITHIC) wx_lib_compile_definitions(base PRIVATE wxUSE_BASE=1) endif() -if(wxUSE_ZLIB) +if(wxUSE_ZLIB) wx_lib_include_directories(base PRIVATE ${ZLIB_INCLUDE_DIRS}) wx_lib_link_libraries(base PRIVATE ${ZLIB_LIBRARIES}) endif() @@ -48,7 +48,7 @@ if(UNIX AND wxUSE_SECRETSTORE) wx_lib_include_directories(base PRIVATE ${LIBSECRET_INCLUDE_DIRS}) wx_lib_link_libraries(base PRIVATE ${LIBSECRET_LIBRARIES}) endif() -if(wxUSE_LIBICONV AND ICONV_LIBRARIES) +if(wxUSE_LIBICONV AND ICONV_FOUND) wx_lib_include_directories(base PRIVATE ${ICONV_INCLUDE_DIRS}) wx_lib_link_libraries(base PRIVATE ${ICONV_LIBRARIES}) endif() diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index e0a0a2a52e..54c2810051 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -15,6 +15,9 @@ if(WIN32) wx_append_sources(CORE_SRC BASE_AND_GUI_WIN32) elseif(UNIX) wx_append_sources(CORE_SRC UNIX) + if(wxUSE_LIBSDL) + wx_append_sources(CORE_SRC UNIX_SOUND_SDL) + endif() endif() if(WXMSW) @@ -62,27 +65,26 @@ foreach(lib JPEG PNG TIFF) endforeach() if(WIN32) - wx_lib_link_libraries(core PRIVATE - winmm - ) + wx_lib_link_libraries(core PRIVATE winmm) endif() if(WXOSX_COCOA) - wx_lib_link_libraries(core PUBLIC - "-framework AudioToolbox" - ) + wx_lib_link_libraries(core PUBLIC "-framework AudioToolbox") if(wxUSE_WEBKIT) - wx_lib_link_libraries(core PUBLIC - "-framework WebKit" - ) + wx_lib_link_libraries(core PUBLIC "-framework WebKit") endif() endif() if(WXGTK AND wxUSE_PRIVATE_FONTS) - wx_lib_include_directories(core PUBLIC - ${FONTCONFIG_INCLUDE_DIR} - ) - wx_lib_link_libraries(core PUBLIC - ${FONTCONFIG_LIBRARIES} - ) + wx_lib_include_directories(core PUBLIC ${FONTCONFIG_INCLUDE_DIR}) + wx_lib_link_libraries(core PUBLIC ${FONTCONFIG_LIBRARIES}) +endif() +if(UNIX AND wxUSE_LIBSDL) + if(SDL2_FOUND) + wx_lib_include_directories(core PUBLIC ${SDL2_INCLUDE_DIR}) + wx_lib_link_libraries(core PUBLIC ${SDL2_LIBRARY}) + elseif(SDL_FOUND) + wx_lib_include_directories(core PUBLIC ${SDL_INCLUDE_DIR}) + wx_lib_link_libraries(core PUBLIC ${SDL_LIBRARY}) + endif() endif() wx_finalize_lib(core) diff --git a/build/cmake/lib/stc/CMakeLists.txt b/build/cmake/lib/stc/CMakeLists.txt index 27af21bb79..8def395466 100644 --- a/build/cmake/lib/stc/CMakeLists.txt +++ b/build/cmake/lib/stc/CMakeLists.txt @@ -167,10 +167,10 @@ target_compile_definitions(wxscintilla PUBLIC if(wxBUILD_PRECOMP) # The auto-generated header causes undefined members and identifiers in the - # standard c++ headers when using clang on macOS or Windows. + # standard c++ headers when using clang. # Do not disable precompiled headers entirely but use the main Scintilla # header as prefix header so there is at least a small speedup. - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (APPLE OR WIN32)) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(wxSCINTILLA_PREC_HEADER "${wxSOURCE_DIR}/src/stc/scintilla/include/Scintilla.h") endif() wx_target_enable_precomp(wxscintilla ${wxSCINTILLA_PREC_HEADER}) diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index 317bb1be62..ac4caca35e 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -14,25 +14,70 @@ 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) + if(wxUSE_WEBVIEW_WEBKIT2) + wx_append_sources(WEBVIEW_FILES WEBVIEW2_GTK) + elseif(wxUSE_WEBVIEW_WEBKIT) + wx_append_sources(WEBVIEW_FILES WEBVIEW_GTK) + endif() 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} + +if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) + set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") + wx_lib_compile_definitions(webview PRIVATE + -DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}" ) endif() +if(APPLE) + wx_lib_link_libraries(webview PUBLIC "-framework WebKit") +elseif(WXGTK) + if(LIBSOUP_FOUND) + wx_lib_include_directories(webview PUBLIC ${LIBSOUP_INCLUDE_DIRS}) + wx_lib_link_libraries(webview PUBLIC ${LIBSOUP_LIBRARIES}) + endif() + if(wxUSE_WEBVIEW_WEBKIT2) + wx_lib_include_directories(webview PUBLIC ${WEBKIT2_INCLUDE_DIR}) + wx_lib_link_libraries(webview PUBLIC ${WEBKIT2_LIBRARIES}) + elseif(wxUSE_WEBVIEW_WEBKIT) + wx_lib_include_directories(webview PUBLIC ${WEBKIT_INCLUDE_DIR}) + wx_lib_link_libraries(webview PUBLIC ${WEBKIT_LIBRARIES}) + endif() +endif() + wx_finalize_lib(webview) + +# webkit extension plugin +# we can't use (all of the) macros and functions because this library should +# always be build as a shared libary, and not included in the monolithic build. +if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) + wx_append_sources(WEBKIT2_EXT_FILES WEBVIEW_WEBKIT2_EXTENSION) + add_library(webkit2_ext SHARED ${WEBKIT2_EXT_FILES}) + wx_set_target_properties(webkit2_ext false) + + # Change output name to match expected name in webview_webkit2.cpp: webkit2_ext* + if(wxUSE_UNICODE) + set(lib_unicode u) + endif() + set_target_properties(webkit2_ext PROPERTIES PREFIX "") + set_target_properties(webkit2_ext PROPERTIES + OUTPUT_NAME "webkit2_ext${lib_unicode}-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + OUTPUT_NAME_DEBUG "webkit2_ext${lib_unicode}d-${wxMAJOR_VERSION}.${wxMINOR_VERSION}" + ) + + target_include_directories(webkit2_ext PUBLIC + ${LIBSOUP_INCLUDE_DIRS} + ${WEBKIT2_INCLUDE_DIR} + ) + target_link_libraries(webkit2_ext PUBLIC + ${LIBSOUP_LIBRARIES} + ${WEBKIT2_LIBRARIES} + ) + + wx_install(TARGETS webkit2_ext LIBRARY DESTINATION ${WX_WEB_EXTENSIONS_DIRECTORY}) + + add_dependencies(webview webkit2_ext) +endif() diff --git a/build/cmake/lib/xml/CMakeLists.txt b/build/cmake/lib/xml/CMakeLists.txt index 21173c5ad1..3eaae0b5d1 100644 --- a/build/cmake/lib/xml/CMakeLists.txt +++ b/build/cmake/lib/xml/CMakeLists.txt @@ -11,9 +11,7 @@ include(../../source_groups.cmake) wx_append_sources(XML_FILES XML) wx_add_library(xml IS_BASE ${XML_FILES}) -wx_lib_link_libraries(xml - PRIVATE ${EXPAT_LIBRARIES} - ) +wx_lib_link_libraries(xml PRIVATE ${EXPAT_LIBRARIES}) wx_lib_include_directories(xml PRIVATE ${EXPAT_INCLUDE_DIRS}) wx_finalize_lib(xml) diff --git a/build/cmake/modules/FindSDL2.cmake b/build/cmake/modules/FindSDL2.cmake new file mode 100644 index 0000000000..3878427d8c --- /dev/null +++ b/build/cmake/modules/FindSDL2.cmake @@ -0,0 +1,175 @@ + +# This module defines +# SDL2_LIBRARY, the name of the library to link against +# SDL2_FOUND, if false, do not try to link to SDL2 +# SDL2_INCLUDE_DIR, where to find SDL.h +# +# This module responds to the the flag: +# SDL2_BUILDING_LIBRARY +# If this is defined, then no SDL2main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the the proper link flags +# as part of the returned SDL2_LIBRARY variable. +# +# Don't forget to include SDLmain.h and SDLmain.m your project for the +# OS X framework based version. (Other versions link to -lSDL2main which +# this module will try to find on your behalf.) Also for OS X, this +# module will automatically add the -framework Cocoa on your behalf. +# +# +# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration +# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library +# (SDL2.dll, libsdl2.so, SDL2.framework, etc). +# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. +# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value +# as appropriate. These values are used to generate the final SDL2_LIBRARY +# variable, but when these values are unset, SDL2_LIBRARY does not get created. +# +# +# $SDL2DIR is an environment variable that would +# correspond to the ./configure --prefix=$SDL2DIR +# used in building SDL2. +# l.e.galup 9-20-02 +# +# Modified by Eric Wing. +# Added code to assist with automated building by using environmental variables +# and providing a more controlled/consistent search behavior. +# Added new modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). +# Also corrected the header search path to follow "proper" SDL guidelines. +# Added a search for SDL2main which is needed by some platforms. +# Added a search for threads which is needed by some platforms. +# Added needed compile switches for MinGW. +# +# On OSX, this will prefer the Framework version (if found) over others. +# People will have to manually change the cache values of +# SDL2_LIBRARY to override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. +# +# Note that the header path has changed from SDL2/SDL.h to just SDL.h +# This needed to change because "proper" SDL convention +# is #include "SDL.h", not . This is done for portability +# reasons because not all systems place things in SDL2/ (see FreeBSD). + +#============================================================================= +# Copyright 2003-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# message("") + +SET(SDL2_SEARCH_PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + ${SDL2_PATH} +) + +FIND_PATH(SDL2_INCLUDE_DIR SDL.h + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES include/SDL2 include + PATHS ${SDL2_SEARCH_PATHS} +) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PATH_SUFFIXES lib64 lib/x64 lib) +else() + set(PATH_SUFFIXES lib/x86 lib) +endif() + +FIND_LIBRARY(SDL2_LIBRARY_TEMP + NAMES SDL2 + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES ${PATH_SUFFIXES} + PATHS ${SDL2_SEARCH_PATHS} +) + +IF(NOT SDL2_BUILDING_LIBRARY) + IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") + # Non-OS X framework versions expect you to also dynamically link to + # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms + # seem to provide SDL2main for compatibility even though they don't + # necessarily need it. + FIND_LIBRARY(SDL2MAIN_LIBRARY + NAMES SDL2main + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES ${PATH_SUFFIXES} + PATHS ${SDL2_SEARCH_PATHS} + ) + ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") +ENDIF(NOT SDL2_BUILDING_LIBRARY) + +# SDL2 may require threads on your system. +# The Apple build may not need an explicit flag because one of the +# frameworks may already provide it. +# But for non-OSX systems, I will use the CMake Threads package. +IF(NOT APPLE) + FIND_PACKAGE(Threads) +ENDIF(NOT APPLE) + +# MinGW needs an additional link flag, -mwindows +# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows +IF(MINGW) + SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW") +ENDIF(MINGW) + +IF(SDL2_LIBRARY_TEMP) + # For SDL2main + IF(NOT SDL2_BUILDING_LIBRARY) + IF(SDL2MAIN_LIBRARY) + SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) + ENDIF(SDL2MAIN_LIBRARY) + ENDIF(NOT SDL2_BUILDING_LIBRARY) + + # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. + # CMake doesn't display the -framework Cocoa string in the UI even + # though it actually is there if I modify a pre-used variable. + # I think it has something to do with the CACHE STRING. + # So I use a temporary variable until the end so I can set the + # "real" variable in one-shot. + IF(APPLE) + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") + ENDIF(APPLE) + + # For threads, as mentioned Apple doesn't need this. + # In fact, there seems to be a problem if I used the Threads package + # and try using this line, so I'm just skipping it entirely for OS X. + IF(NOT APPLE) + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) + ENDIF(NOT APPLE) + + # For MinGW library + IF(MINGW) + SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP}) + ENDIF(MINGW) + + # Set the final string here so the GUI reflects the final state. + SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") + # Set the temp variable to INTERNAL so it is not seen in the CMake GUI + SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") +ENDIF(SDL2_LIBRARY_TEMP) + +# message("") + +INCLUDE(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) + +MARK_AS_ADVANCED(SDL2MAIN_LIBRARY SDL2_LIBRARY SDL2_INCLUDE_DIR) diff --git a/build/cmake/modules/FindWebkit.cmake b/build/cmake/modules/FindWebkit.cmake index 1bb331cf69..8b6e6ccef7 100644 --- a/build/cmake/modules/FindWebkit.cmake +++ b/build/cmake/modules/FindWebkit.cmake @@ -1,16 +1,18 @@ -# - Find Webkit-3.0 -# Find the Webkit-3.0 includes and library +# - Find Webkit +# Find the Webkit 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. +# WEBKIT_LIBRARIES - List of libraries when using Webkit. +# WEBKIT_FOUND - True if Webkit found. -SET( WEBKIT_VERSION "1.0") +SET(WEBKIT_VERSION 1.0) +if(DEFINED Webkit_FIND_VERSION) + SET(WEBKIT_VERSION ${Webkit_FIND_VERSION}) +endif() -IF (WEBKIT_INCLUDE_DIR) - # Already in cache, be silent. - SET(WEBKIT_FIND_QUIETLY TRUE) -ENDIF (WEBKIT_INCLUDE_DIR) +SET(WEBKIT_INCLUDE_DIR WEBKIT_INCLUDE_DIR-NOTFOUND) +SET(WEBKIT_LIBRARY WEBKIT_LIBRARY-NOTFOUND) +SET(WEBKIT_LIBRARIES WEBKIT_LIBRARIES-NOTFOUND) FIND_PATH(WEBKIT_INCLUDE_DIR webkit/webkit.h PATH_SUFFIXES "webkitgtk-${WEBKIT_VERSION}" @@ -35,4 +37,4 @@ ELSE(WEBKIT_FOUND) SET( WEBKIT_LIBRARIES ) ENDIF(WEBKIT_FOUND) -MARK_AS_ADVANCED( WEBKIT_LIBRARY WEBKIT_INCLUDE_DIR ) +MARK_AS_ADVANCED(WEBKIT_LIBRARY WEBKIT_LIBRARIES WEBKIT_INCLUDE_DIR) diff --git a/build/cmake/modules/FindWebkit2.cmake b/build/cmake/modules/FindWebkit2.cmake new file mode 100644 index 0000000000..33a8e4a863 --- /dev/null +++ b/build/cmake/modules/FindWebkit2.cmake @@ -0,0 +1,37 @@ +# - Find Webkit2 +# Find the Webkit2 includes and library +# +# WEBKIT2_INCLUDE_DIR - Where to find Webkit2 include sub-directory. +# WEBKIT2_LIBRARIES - List of libraries when using Webkit2. +# WEBKIT2_FOUND - True if Webkit2 found. + +SET( WEBKIT2_VERSION 4.0) + +set(WEBKIT2_INCLUDE_DIR WEBKIT2_INCLUDE_DIR-NOTFOUND) +set(WEBKIT2_LIBRARY WEBKIT2_LIBRARY-NOTFOUND) +set(WEBKIT2_LIBRARIES WEBKIT2_LIBRARIES-NOTFOUND) + +FIND_PATH(WEBKIT2_INCLUDE_DIR webkit2/webkit2.h + PATH_SUFFIXES "webkitgtk-${WEBKIT2_VERSION}" +) + +SET(WEBKIT2_NAMES "webkit2gtk-${WEBKIT2_VERSION}") +FIND_LIBRARY(WEBKIT2_LIBRARY + NAMES ${WEBKIT2_NAMES} +) + +# Handle the QUIETLY and REQUIRED arguments and set WEBKIT2_FOUND to +# TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + WEBKIT2 DEFAULT_MSG + WEBKIT2_LIBRARY WEBKIT2_INCLUDE_DIR +) + +IF(WEBKIT2_FOUND) + SET( WEBKIT2_LIBRARIES ${WEBKIT2_LIBRARY} ) +ELSE(WEBKIT2_FOUND) + SET( WEBKIT2_LIBRARIES ) +ENDIF(WEBKIT2_FOUND) + +MARK_AS_ADVANCED(WEBKIT2_LIBRARY WEBKIT2_LIBRARIES WEBKIT2_INCLUDE_DIR) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 0cf3740002..1ea8458bda 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -74,6 +74,7 @@ wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF) set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression") wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") +wx_option(wxUSE_LIBSDL "use SDL for audio on Unix") if(NOT WIN32) wx_option(wxUSE_LIBICONV "use libiconv (character conversion)") @@ -356,7 +357,6 @@ wx_option(wxUSE_DRAGIMAGE "use wxDragImage") 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") -# TODO: wxUSE_WEBVIEW_WEBKIT2 if(WIN32 OR APPLE) set(wxUSE_PRIVATE_FONTS_DEFAULT ON) else() diff --git a/build/cmake/policies.cmake b/build/cmake/policies.cmake index 46c35011a4..496aae7507 100644 --- a/build/cmake/policies.cmake +++ b/build/cmake/policies.cmake @@ -53,3 +53,8 @@ if(POLICY CMP0067) # Honor language standard in try_compile() source-file signature. cmake_policy(SET CMP0067 NEW) endif() + +if(POLICY CMP0072) + # FindOpenGL prefers GLVND by default when available. + cmake_policy(SET CMP0072 NEW) +endif() diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 47230283ba..2f8d28070a 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -152,7 +152,10 @@ wx_add_sample(typetest typetest.cpp typetest.h) wx_add_sample(uiaction DEPENDS wxUSE_UIACTIONSIMULATOR) wx_add_sample(validate validate.cpp validate.h DEPENDS wxUSE_VALIDATORS) wx_add_sample(vscroll vstest.cpp) -wx_add_sample(webview LIBRARIES webview stc NAME webviewsample DEPENDS wxUSE_WEBVIEW) +wx_add_sample(webview LIBRARIES webview NAME webviewsample DEPENDS wxUSE_WEBVIEW) +if(TARGET webviewsample AND wxUSE_STC) + wx_exe_link_libraries(webviewsample stc) +endif() # widgets Sample set(SAMPLE_WIDGETS_SRC activityindicator.cpp diff --git a/build/cmake/uninstall.cmake.in b/build/cmake/uninstall.cmake.in index b03059ad52..7d21a385d9 100644 --- a/build/cmake/uninstall.cmake.in +++ b/build/cmake/uninstall.cmake.in @@ -13,6 +13,7 @@ endif() file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") +list(APPEND files @WX_EXTRA_UNINSTALL_FILES@) foreach(file ${files}) message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index bf29f72156..a242fdec66 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -17,8 +17,24 @@ if(wxUSE_XRC) wx_exe_link_libraries(wxrc xml) endif() wx_exe_link_libraries(wxrc base) - # TODO: install + set_target_properties(wxrc PROPERTIES FOLDER "Utilities") + + if(UNIX) + wx_install(TARGETS wxrc RUNTIME DESTINATION "bin") + install(CODE "execute_process( \ + COMMAND ${CMAKE_COMMAND} -E rename \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION} \ + )" + ) + install(CODE "execute_process( \ + COMMAND ${CMAKE_COMMAND} -E create_symlink \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION} \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc \ + )" + ) + endif() endif() # TODO: build targets for other utils diff --git a/build/files b/build/files index 93c9fec7dd..d774633b94 100644 --- a/build/files +++ b/build/files @@ -2812,6 +2812,12 @@ WEBVIEW_GTK_HDR = WEBVIEW_GTK_SRC = src/gtk/webview_webkit.cpp +WEBVIEW2_GTK_SRC = + src/gtk/webview_webkit2.cpp + +WEBVIEW_WEBKIT2_EXTENSION_SRC = + src/gtk/webview_webkit2_extension.cpp + # wxXRC XRC_SRC = @@ -2991,7 +2997,7 @@ OPENGL_OSX_SHARED_SRC = # Misc plugin sources: -UNIX_SOUND_SRC_SDL = +UNIX_SOUND_SDL_SRC = src/unix/sound_sdl.cpp # wxAUI diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 81f9a9a667..656a10f778 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -407,13 +407,14 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context, GVariant *user_data = g_variant_new("(s)", address); // The first value is the location in which the extension is supposed to be - // normally installed, while the other two are used as fallbacks to allow + // normally installed, while the other three are used as fallbacks to allow // running the tests and sample using wxWebView before installing it. const char* const directories[] = { WX_WEB_EXTENSIONS_DIRECTORY, "..", "../..", + "lib", }; const char* dir = NULL;