cmake_minimum_required(VERSION 3.1.0) project(smolbote) # Options option(CompilerWarnings "Compiler warnings" ON) option(QtDeprecatedWarnings "Qt deprecated warnings" ON) option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF) option(CLikeConfig "Use a C-like style for the config" ON) # Libraries find_package(Qt5Core REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5WebEngineWidgets REQUIRED) find_package(libconfig++ REQUIRED) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) # Global C++ settings set(CMAKE_CXX_STANDARD 17) if(CompilerWarnings) if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") 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) add_subdirectory(lib/settings) add_subdirectory(lib/bookmarks) add_subdirectory(lib/downloads) add_subdirectory(lib/navigation) # configure a header file to pass version information execute_process(COMMAND "git" "describe" WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GitDescribe OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND "git" "describe" "--abbrev=0" WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GitVersion OUTPUT_STRIP_TRAILING_WHITESPACE) configure_file(src/version.h.in "${PROJECT_BINARY_DIR}/version.h") set(SourceCode # main "src/main.cpp" "src/singleapplication.cpp" "src/singleapplication.h" "src/browser.cpp" "src/browser.h" # main window # todo: move all to src/mainwindow "src/mainwindow.cpp" "src/mainwindow.h" "src/mainwindow.ui" "src/widgets/loadingbar.cpp" "src/widgets/loadingbar.h" "src/widgets/mainwindowmenubar.cpp" "src/widgets/mainwindowmenubar.h" "src/widgets/mainwindowtabbar.cpp" "src/widgets/mainwindowtabbar.h" # todo: move to src/mainwindow "src/forms/searchform.cpp" "src/forms/searchform.h" "src/forms/searchform.ui" "data/resources.qrc" # webengine "src/webengine/urlinterceptor.cpp" "src/webengine/urlinterceptor.h" "src/webengine/webengineprofile.cpp" # todo: rename to profile "src/webengine/webengineprofile.h" "src/webengine/webpage.cpp" "src/webengine/webpage.h" "src/webengine/webview.cpp" "src/webengine/webview.h" # forms "src/forms/aboutdialog.cpp" "src/forms/aboutdialog.h" "src/forms/aboutdialog.ui" "src/forms/profileview.cpp" "src/forms/profileview.h" "src/forms/profileview.ui" # todo: move to src/webengine "src/forms/cookiesform.cpp" "src/forms/cookiesform.h" "src/forms/cookiesform.ui" ) add_executable(poi ${SourceCode}) target_include_directories(poi PRIVATE src lib) target_link_libraries(poi Qt5::Core Qt5::Widgets Qt5::WebEngineWidgets) target_link_libraries(poi configuration) target_link_libraries(poi bookmarks downloads navigation) install(TARGETS poi DESTINATION bin CONFIGURATIONS Release)