CMake: use wx prefix in library names

Rename all library targets to start with wx. This way it does not use generic
names like base or core that could interfere with other libraries that add
include the wxWidgets project.
This commit is contained in:
Maarten Bent
2020-05-17 19:41:44 +02:00
parent 0c2d05f52f
commit 0f806ad96d
26 changed files with 198 additions and 184 deletions

View File

@@ -23,20 +23,20 @@ elseif(APPLE)
wx_append_sources(WEBVIEW_FILES WEBVIEW_OSX_SHARED)
endif()
wx_add_library(webview ${WEBVIEW_FILES})
wx_add_library(wxwebview ${WEBVIEW_FILES})
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
wx_lib_compile_definitions(wxwebview PRIVATE
-DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}"
)
endif()
if(APPLE)
wx_lib_link_libraries(webview PUBLIC "-framework WebKit")
wx_lib_link_libraries(wxwebview PUBLIC "-framework WebKit")
elseif(WXMSW)
if(wxUSE_WEBVIEW_EDGE)
wx_lib_include_directories(webview PRIVATE "${PROJECT_SOURCE_DIR}/3rdparty/webview2/build/native/include")
wx_lib_include_directories(wxwebview PRIVATE "${PROJECT_SOURCE_DIR}/3rdparty/webview2/build/native/include")
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WEBVIEW2_ARCH x86)
@@ -44,55 +44,55 @@ elseif(WXMSW)
set(WEBVIEW2_ARCH x64)
endif()
add_custom_command(TARGET webview POST_BUILD
add_custom_command(TARGET wxwebview POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/3rdparty/webview2/build/native/${WEBVIEW2_ARCH}/WebView2Loader.dll"
"$<TARGET_FILE_DIR:webview>/WebView2Loader.dll")
"$<TARGET_FILE_DIR:wxwebview>/WebView2Loader.dll")
endif()
elseif(WXGTK)
if(LIBSOUP_FOUND)
wx_lib_include_directories(webview PUBLIC ${LIBSOUP_INCLUDE_DIRS})
wx_lib_link_libraries(webview PUBLIC ${LIBSOUP_LIBRARIES})
wx_lib_include_directories(wxwebview PUBLIC ${LIBSOUP_INCLUDE_DIRS})
wx_lib_link_libraries(wxwebview 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})
wx_lib_include_directories(wxwebview PUBLIC ${WEBKIT2_INCLUDE_DIR})
wx_lib_link_libraries(wxwebview PUBLIC ${WEBKIT2_LIBRARIES})
elseif(wxUSE_WEBVIEW_WEBKIT)
wx_lib_include_directories(webview PUBLIC ${WEBKIT_INCLUDE_DIR})
wx_lib_link_libraries(webview PUBLIC ${WEBKIT_LIBRARIES})
wx_lib_include_directories(wxwebview PUBLIC ${WEBKIT_INCLUDE_DIR})
wx_lib_link_libraries(wxwebview PUBLIC ${WEBKIT_LIBRARIES})
endif()
endif()
wx_finalize_lib(webview)
wx_finalize_lib(wxwebview)
# 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)
add_library(wxwebkit2_ext SHARED ${WEBKIT2_EXT_FILES})
wx_set_target_properties(wxwebkit2_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
set_target_properties(wxwebkit2_ext PROPERTIES PREFIX "")
set_target_properties(wxwebkit2_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
target_include_directories(wxwebkit2_ext PUBLIC
${LIBSOUP_INCLUDE_DIRS}
${WEBKIT2_INCLUDE_DIR}
)
target_link_libraries(webkit2_ext PUBLIC
target_link_libraries(wxwebkit2_ext PUBLIC
${LIBSOUP_LIBRARIES}
${WEBKIT2_LIBRARIES}
)
wx_install(TARGETS webkit2_ext LIBRARY DESTINATION ${WX_WEB_EXTENSIONS_DIRECTORY})
wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION ${WX_WEB_EXTENSIONS_DIRECTORY})
add_dependencies(webview webkit2_ext)
add_dependencies(wxwebview wxwebkit2_ext)
endif()