cmake_minimum_required(VERSION 2.8) project(webview) if(APPLE) set(WEBVIEW_COMPILE_DEFS "-DWEBVIEW_COCOA=1") set(WEBVIEW_LIBS "-framework WebKit") elseif(WIN32) set(WEBVIEW_COMPILE_DEFS "-DWEBVIEW_WINAPI=1") set(WEBVIEW_LIBS "ole32 comctl32 oleaut32 uuid") else() set(WEBVIEW_COMPILE_DEFS "-DWEBVIEW_GTK=1") find_package(PkgConfig REQUIRED) pkg_check_modules(GTK3 REQUIRED gtk+-3.0) pkg_check_modules(WEBKIT2 REQUIRED webkit2gtk-4.0) set(WEBVIEW_COMPILE_INCS ${GTK3_INCLUDE_DIRS} ${WEBKIT2_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}) set(WEBVIEW_LIBS ${GTK3_LIBRARIES} ${WEBKIT2_LIBRARIES}) endif() add_library(tauri ${CMAKE_CURRENT_BINARY_DIR}/tauri.c) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tauri.c "#define WEBVIEW_IMPLEMENTATION\n#include ") target_include_directories(tauri PUBLIC ${PROJECT_SOURCE_DIR} ${WEBVIEW_COMPILE_INCS}) target_compile_definitions(tauri PUBLIC ${WEBVIEW_COMPILE_DEFS}) target_compile_options(tauri PRIVATE ${WEBVIEW_COMPILE_OPTS}) target_link_libraries(tauri ${WEBVIEW_LIBS}) add_executable(tauri_test WIN32 MACOSX_BUNDLE tauri_test.cc) set_target_properties(tauri_test PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) find_package(Threads) target_link_libraries(tauri_test PRIVATE tauri ${CMAKE_THREAD_LIBS_INIT}) enable_testing () add_test(NAME tauri_test COMMAND tauri_test)