cmake_minimum_required(VERSION 3.10.0) project(smolbote) include(FeatureSummary) # Options option(MercurialRepo "Get version information from .hg" ON) option(CompilerWarnings "Compiler warnings" ON) option(QtDeprecatedWarnings "Qt deprecated warnings" ON) option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF) option(Tests "Enable/disable some basic autotests" OFF) option(Plasma "Enable some fancy effects on Plasma" OFF) # Libraries find_package(Qt5 COMPONENTS Core Widgets Concurrent REQUIRED) find_package(Qt5 5.10.1 COMPONENTS WebEngineWidgets REQUIRED) find_package(Boost COMPONENTS program_options REQUIRED) if(Plasma) find_package(ECM 1.6.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) find_package(KF5 "5.6.0" COMPONENTS WindowSystem REQUIRED) endif(Plasma) # Global C++ settings set(CMAKE_CXX_STANDARD 17) if(CompilerWarnings) if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") endif() if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") endif() endif(CompilerWarnings) if(QtDeprecatedWarnings) add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900) endif(QtDeprecatedWarnings) # link to libc++ if (UseLibCpp) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") endif (UseLibCpp) # detect version and commit from mercurial if (MercurialRepo AND EXISTS "${PROJECT_SOURCE_DIR}/.hg") execute_process(COMMAND hg log -r '.' --template={latesttag}.{latesttagdistance} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerInfo OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) # remove bookmark if it's not set if(VcsBookmark STREQUAL "") unset(VcsBookmark) endif() execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) else() set(VerInfo "0.0.0.0") set(VerBookmark "unknown") set(VerCommit "00000000") set(VerRevision "0") set(VerBranch "default") endif() # configure a header file to pass version information # if repo is missing or option is turned off, version.h.in can be configured # with static values configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_BINARY_DIR}/src/version.h") add_subdirectory(3rd-party/SingleApplication) add_subdirectory(lib/about) add_subdirectory(lib/addressbar) add_subdirectory(lib/bookmarks) add_subdirectory(lib/downloads) add_subdirectory(lib/configuration) add_subdirectory(lib/web) add_subdirectory(plugins/ProfileEditor) add_subdirectory(plugins/ConfigurationEditor) # browser source code add_subdirectory(src) if (Tests) enable_testing() find_package(Qt5 COMPONENTS Test REQUIRED) add_subdirectory(test) endif() message("Version='${VerInfo}' bookmark='${VerBookmark}' commit='${VerCommit}'") feature_summary(WHAT ALL)