Skip to content

Commit

Permalink
WebKitBrowser: revist cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
bramoosterhuis committed Mar 25, 2021
1 parent d25cf60 commit 1bd797d
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 185 deletions.
36 changes: 6 additions & 30 deletions WebKitBrowser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,18 @@ set(PLUGIN_AMAZON_USERAGENT ${PLUGIN_WEBKITBROWSER_USERAGENT} CACHE STRING "User
set(PLUGIN_AMAZON_WEBINSPECTOR_ADDRESS 0.0.0.0:9999 CACHE STRING "IP:Port for WebInspector of Amazon")
set(PLUGIN_AMAZON_LOCALSTORAGE_ENABLE true CACHE STRING "Enable LocalStorage of Amazon")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
find_package(CompileSettingsDebug CONFIG REQUIRED)
find_package(GLIB REQUIRED)
find_package(WPEWebKit REQUIRED)
find_package(WPEBackend REQUIRED)
if(DEFINED WEBKIT_GLIB_API)
find_package(LibSoup REQUIRED)
endif()

set(SOURCE_LIST
add_library(${MODULE_NAME} SHARED
Module.cpp
WebKitBrowser.cpp
WebKitBrowserJsonRpc.cpp
)


add_library(${MODULE_NAME} SHARED
${SOURCE_LIST}
)

set_target_properties(${MODULE_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES)
Expand All @@ -151,29 +140,16 @@ target_link_libraries(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION}
PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${NAMESPACE}Definitions::${NAMESPACE}Definitions
${WPE_BACKEND_LIBRARIES}
${GLIB_LIBRARIES}
${WPE_WEBKIT_LIBRARIES}
WPEBackend::WPEBackend
WPEWebKit::WPEWebKit
${SECURITY_TOKEN_LIBRARY})

target_include_directories(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION}
PRIVATE
${WPE_BACKEND_INCLUDE_DIRS}
${WPE_WEBKIT_INCLUDE_DIRS}
${WPE_WEBKIT_INCLUDE_DIRS}/WPE
${GLIB_INCLUDE_DIRS}
${LIBSOUP_INCLUDE_DIRS}
)

if(WPE_WEBKIT_DEPRECATED_API)
target_compile_definitions(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE WPE_WEBKIT_DEPRECATED_API=${WPE_WEBKIT_DEPRECATED_API})
target_compile_definitions(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE WPE_WEBKIT_DEPRECATED_API)
endif()

if(DEFINED WEBKIT_GLIB_API)
target_link_libraries(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION}
PRIVATE
${LIBSOUP_LIBRARIES})
target_compile_definitions(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE WEBKIT_GLIB_API=${WEBKIT_GLIB_API})
if(WEBKIT_GLIB_API)
target_compile_definitions(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE WEBKIT_GLIB_API)
endif()

set_target_properties(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PROPERTIES
Expand Down
48 changes: 16 additions & 32 deletions WebKitBrowser/InjectedBundle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,75 +21,64 @@ set(MODULE_NAME WPE${PLUGIN_NAME})
find_package(${NAMESPACE}Plugins REQUIRED)
find_package(securityagent QUIET)
find_package(WPEWebKit REQUIRED)
if(DEFINED WEBKIT_GLIB_API)
find_package(LibSoup REQUIRED)
endif()

option(PLUGIN_AMAZON_HYBRID "Enable the Amazon Player interface (Hawaii) in the injected bundle and the creation of the Amazon tab" OFF)
option(PLUGIN_SECURITYAGENT "Enable the Security Agent Features interface in javascript." OFF)
option(PLUGIN_WEBKITBROWSER_AAMP_JSBINDINGS "Enable AAMP JS bindings." OFF)
option(PLUGIN_WEBKITBROWSER_BADGER_BRIDGE "Enable $badger support." OFF)

set(SOURCE_LIST
add_library(${MODULE_NAME} SHARED
main.cpp
WhiteListedOriginDomainsList.cpp
Tags.cpp
)

if(DEFINED WEBKIT_GLIB_API)
set(SOURCE_LIST
${SOURCE_LIST}
if(WEBKIT_GLIB_API)
target_sources(${MODULE_NAME} PRIVATE
MilestoneGLib.cpp
NotifyWPEFrameworkGLib.cpp
RequestHeadersGLib.cpp
)
RequestHeadersGLib.cpp)
else()
set(SOURCE_LIST
${SOURCE_LIST}
target_sources(${MODULE_NAME} PRIVATE
RequestHeaders.cpp
Utils.cpp
JavaScriptFunction.cpp
NotifyWPEFramework.cpp
Milestone.cpp
ClassDefinition.cpp
)
ClassDefinition.cpp)
endif()

add_library(${MODULE_NAME} SHARED
${SOURCE_LIST}
)

if(PLUGIN_AMAZON_HYBRID)
target_sources(${MODULE_NAME} PRIVATE HawaiiMessage.cpp)
endif()

if(securityagent_FOUND)
if(DEFINED WEBKIT_GLIB_API)
if(WEBKIT_GLIB_API)
target_sources(${MODULE_NAME} PRIVATE SecurityAgentGLib.cpp)
target_compile_definitions(${MODULE_NAME} PRIVATE ENABLE_SECURITY_AGENT)
else()
target_sources(${MODULE_NAME} PRIVATE SecurityAgent.cpp)
endif()
target_compile_definitions(${MODULE_NAME} PRIVATE ENABLE_SECURITY_AGENT)
target_link_libraries(${MODULE_NAME}
PRIVATE
securityagent::securityagent)
endif()

if(PLUGIN_WEBKITBROWSER_AAMP_JSBINDINGS)
find_package(AampJSBindings REQUIRED)
if(DEFINED WEBKIT_GLIB_API)
if(WEBKIT_GLIB_API)
target_sources(${MODULE_NAME} PRIVATE AAMPJSBindingsGLib.cpp)
else()
target_sources(${MODULE_NAME} PRIVATE AAMPJSBindings.cpp)
endif()
target_compile_definitions(${MODULE_NAME} PRIVATE ENABLE_AAMP_JSBINDINGS)
target_compile_definitions(${MODULE_NAME} PRIVATE ENABLE_AAMP_JSBINDINGS)
target_link_libraries(${MODULE_NAME}
PRIVATE
${AAMP_JSBINDINGS_LIBRARIES})
endif()

if(PLUGIN_WEBKITBROWSER_BADGER_BRIDGE)
if(DEFINED WEBKIT_GLIB_API)
if(WEBKIT_GLIB_API)
target_sources(${MODULE_NAME} PRIVATE BridgeObjectGLib.cpp)
else()
target_sources(${MODULE_NAME} PRIVATE BridgeObject.cpp)
Expand All @@ -104,19 +93,14 @@ set_target_properties(${MODULE_NAME} PROPERTIES
target_link_libraries(${MODULE_NAME}
PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${LIBSOUP_LIBRARIES}
${GLIB_LIBRARIES}
${WPE_WEBKIT_LIBRARIES})
WPEWebKit::WPEWebKit)

target_include_directories(${MODULE_NAME}
PRIVATE
${WPE_WEBKIT_INCLUDE_DIRS}
${WPE_WEBKIT_INCLUDE_DIRS}/WPE
${LIBSOUP_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS})
if(WPE_WEBKIT_DEPRECATED_API)
target_compile_definitions(${MODULE_NAME} PRIVATE WPE_WEBKIT_DEPRECATED_API)
endif()

if(WEBKIT_GLIB_API)
target_compile_definitions(${MODULE_NAME} PRIVATE WEBKIT_GLIB_API=${WEBKIT_GLIB_API})
target_compile_definitions(${MODULE_NAME} PRIVATE WEBKIT_GLIB_API)
endif()

install(TARGETS ${MODULE_NAME}
Expand Down
1 change: 0 additions & 1 deletion WebKitBrowser/cmake/FindGLIB.cmake

This file was deleted.

1 change: 0 additions & 1 deletion WebKitBrowser/cmake/FindLibSoup.cmake

This file was deleted.

40 changes: 0 additions & 40 deletions cmake/FindLibSoup.cmake

This file was deleted.

43 changes: 31 additions & 12 deletions cmake/FindWPEBackend.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,38 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

find_package(PkgConfig)
pkg_search_module(PC_WPE_BACKEND REQUIRED wpe-0.2 wpe-1.0)

find_path(WPE_BACKEND_INCLUDE_DIRS
NAMES wpe/wpe.h
HINTS ${PC_WPE_BACKEND_INCLUDEDIR} ${PC_WPE_BACKEND_INCLUDE_DIRS}
)
if(NOT PC_WPE_BACKEND_FOUND)
pkg_search_module(PC_WPE_BACKEND wpe-1.0)
endif()

find_library(WPE_BACKEND_LIBRARIES
NAMES wpe-0.2 wpe-1.0
HINTS ${PC_WPE_BACKEND_LIBDIR} ${PC_WPE_BACKEND_LIBRARY_DIRS}
)
if(NOT PC_WPE_BACKEND_FOUND)
pkg_search_module(PC_WPE_BACKEND wpe-0.2)
endif()

mark_as_advanced(WPE_BACKEND_INCLUDE_DIRS WPE_BACKEND_LIBRARIES)
if(PC_WPE_BACKEND_FOUND)
find_path(WPE_BACKEND_INCLUDE_DIR
NAMES wpe/wpe.h
HINTS ${PC_WPE_BACKEND_INCLUDEDIR} ${PC_WPE_BACKEND_INCLUDE_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WPEBACKEND REQUIRED_VARS WPE_BACKEND_INCLUDE_DIRS WPE_BACKEND_LIBRARIES)
find_library(WPE_BACKEND_LIBRARY
NAMES ${PC_WPE_BACKEND_LIBRARIES}
HINTS ${PC_WPE_BACKEND_LIBDIR} ${PC_WPE_BACKEND_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WPEBackend
VERSION_VAR PC_WPE_BACKEND_VERSION
REQUIRED_VARS WPE_BACKEND_LIBRARY WPE_BACKEND_INCLUDE_DIR WPE_BACKEND_LIBRARY)

if(PC_WPE_BACKEND_FOUND AND NOT TARGET WPEBackend::WPEBackend)
add_library(WPEBackend::WPEBackend SHARED IMPORTED)
set_target_properties(WPEBackend::WPEBackend PROPERTIES
IMPORTED_LOCATION "${WPE_BACKEND_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${WPE_BACKEND_INCLUDE_DIR}"
)
endif()

mark_as_advanced(WPE_BACKEND_INCLUDE_DIR WPE_BACKEND_LIBRARY)
endif()
Loading

0 comments on commit 1bd797d

Please sign in to comment.