From eef181434c0675f9cbe5ef8b8a69e13757294d9e Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Sun, 6 Nov 2022 04:49:12 +0100 Subject: [PATCH] basic setup --- CMakeLists.txt | 16 +++++----------- cmake/Finddeltachat-core.cmake | 16 ++++++++++++++++ cmake/config.cmake.in | 3 --- src/CMakeLists.txt | 14 ++++++++------ src/main.cc | 11 +++++++++-- 5 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 cmake/Finddeltachat-core.cmake delete mode 100644 cmake/config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index bbddb01..7483264 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,13 @@ cmake_minimum_required(VERSION 3.20) -project(basiccmake LANGUAGES CXX) +project(kappachat LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -# keep PUBLIC dependencies in sync with cmake/config.cmake.in -#find_package(foo REQUIRED) +find_package(deltachat-core REQUIRED) +find_package(Qt6 REQUIRED COMPONENTS Widgets) include(AddAutoformatTarget) include(GNUInstallDirs) -add_subdirectory(src) +qt_standard_project_setup() -install(DIRECTORY include TYPE INCLUDE FILES_MATCHING PATTERN *.h) -install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets) -install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: - DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}") -configure_file(cmake/config.cmake.in ${PROJECT_NAME}-config.cmake @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}") +add_subdirectory(src) diff --git a/cmake/Finddeltachat-core.cmake b/cmake/Finddeltachat-core.cmake new file mode 100644 index 0000000..ddbeefb --- /dev/null +++ b/cmake/Finddeltachat-core.cmake @@ -0,0 +1,16 @@ +find_path(libdeltachat_INCLUDE_DIR deltachat.h) +mark_as_advanced(libdeltachat_INCLUDE_DIR) + +find_library(libdeltachat_LIBRARY deltachat) +mark_as_advanced(libdeltachat_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + deltachat-core DEFAULT_MSG libdeltachat_LIBRARY libdeltachat_INCLUDE_DIR) + +if(deltachat-core_FOUND AND NOT TARGET deltachat-core::libdeltachat) + add_library(deltachat-core::libdeltachat SHARED IMPORTED) + set_target_properties(deltachat-core::libdeltachat PROPERTIES + IMPORTED_LOCATION ${libdeltachat_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${libdeltachat_INCLUDE_DIR}) +endif() diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in deleted file mode 100644 index 0c555d3..0000000 --- a/cmake/config.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -include(CMakeFindDependencyMacro) -#find_dependency(foo @foo_VERSION@ REQUIRED) -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d835b44..813f36c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,19 +3,21 @@ add_executable(${PROJECT_NAME} ) target_link_libraries(${PROJECT_NAME} PRIVATE -) -target_include_directories(${PROJECT_NAME} - PUBLIC - $ - $ + deltachat-core::libdeltachat + Qt6::Widgets ) target_compile_features(${PROJECT_NAME} - PUBLIC + PRIVATE cxx_std_20 ) target_compile_options(${PROJECT_NAME} PRIVATE $<$,$,$>:-Wall -Wextra> ) +set_target_properties(${PROJECT_NAME} PROPERTIES + WIN32_EXECUTABLE ON + MACOSX_BUNDLE ON +) +install(TARGETS ${PROJECT_NAME}) add_autoformat_target(${PROJECT_NAME}) diff --git a/src/main.cc b/src/main.cc index 4cce7f6..598b446 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,3 +1,10 @@ -int main() { - return 0; +#include +#include + +int main(int argc, char **argv) { + QApplication app{argc, argv}; + QMainWindow mainwindow; + + mainwindow.show(); + return app.exec(); }