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) # Libraries find_package(Qt5Core REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5Concurrent REQUIRED) find_package(Qt5WebEngineWidgets REQUIRED) find_package(Boost COMPONENTS program_options 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/bookmarks) add_subdirectory(lib/downloads) add_subdirectory(plugins/ProfileEditor) # configure a header file to pass version information # if you don't have git, or are building this off the source tarball, define versions in version.h.in execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsRevision OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBranch 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" src/configuration.cpp src/configuration.h "data/resources.qrc" # main window src/mainwindow/mainwindow.cpp src/mainwindow/mainwindow.h src/mainwindow/mainwindow.ui src/mainwindow/widgets/loadingbar.cpp src/mainwindow/widgets/loadingbar.h src/mainwindow/widgets/navigationbar.cpp src/mainwindow/widgets/navigationbar.h src/mainwindow/widgets/searchform.cpp src/mainwindow/widgets/searchform.h src/mainwindow/widgets/searchform.ui # address bar src/addressbar/completer.cpp src/addressbar/completer.h src/addressbar/urllineedit.cpp src/addressbar/urllineedit.h # todo: move all to src/mainwindow "src/widgets/mainwindowmenubar.cpp" "src/widgets/mainwindowmenubar.h" "src/widgets/mainwindowtabbar.cpp" "src/widgets/mainwindowtabbar.h" # webengine src/webengine/cookieinterceptor.cpp src/webengine/cookieinterceptor.h "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" # todo: move to src/webengine #"src/forms/cookiesform.cpp" #"src/forms/cookiesform.h" #"src/forms/cookiesform.ui" # plugin interfaces plugins/interfaces.h src/commandline.cpp src/commandline.h) add_executable(poi ${SourceCode}) target_include_directories(poi PRIVATE src lib PRIVATE plugins) target_link_libraries(poi Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets) target_link_libraries(poi ${Boost_LIBRARIES}) target_link_libraries(poi bookmarks downloads) install(TARGETS poi RUNTIME DESTINATION bin CONFIGURATIONS Release)