Deltachat/CMakeLists.txt
2025-04-08 15:29:42 +07:00

81 lines
3.2 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(chat LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(QPACKAGE Core Gui Qml Quick QuickControls2 Test)
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS ${QPACKAGE} )
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QPACKAGE})
option(DEBUG "Enaable asan debug" OFF)
# lazy add file
#file(GLOB_RECURSE BASE_DIR "src/base/*.cpp" "src/base/*.h")
#file(GLOB_RECURSE INCLUDE_DIR "include/*.h" )
# file(GLOB_RECURSE CHAT_SRC "src/*.cpp")
# file(GLOB_RECURSE CHAT_HDR "include/*.h")
set(QML_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qml" CACHE STRING "Path used to locate CMake modules by Qt Creator" FORCE)
set(QML2_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qml" CACHE STRING "Path used to locate CMake modules by Qt Creator" FORCE)
set(QT_PLUGIN_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qml" )
set(QML_SOURCE_PATH "qml/")
set(QML_MODULES_PATH "qml/")
add_executable(chat
src/deltachat/account.h src/deltachat/account.cpp
src/deltachat/context.h src/deltachat/context.cpp
src/deltachat/message.h src/deltachat/message.cpp
src/deltachat/event.h src/deltachat/event.cpp
src/deltachat/contact.h src/deltachat/contact.cpp
src/deltachat/chat.h src/deltachat/chat.cpp
src/deltachat/chatlist.h src/deltachat/chatlist.cpp
src/deltachat/lot.h src/deltachat/lot.cpp
src/deltachat/eventemitter.h src/deltachat/eventemitter.cpp
src/main.cpp
src/app/msgshow.h src/app/msgshow.cpp
src/deltachat/deltacpp.h
src/app/task.h src/app/task.cpp
src/app/acc.h src/app/acc.cpp
src/app/app.h
src/app/send.h src/app/send.cpp
src/app/contactui.h src/app/contactui.cpp
src/app/chatui.h src/app/chatui.cpp
resource.qrc
src/model/chat/chatproxymodel.h src/model/chat/chatproxymodel.cpp
src/model/chat/chatlistmodel.h src/model/chat/chatlistmodel.cpp
src/model/chat/chatcore.h src/model/chat/chatcore.cpp
src/model/chat/chatroommodel.h src/model/chat/chatroommodel.cpp
src/model/chat/messagemodel.h src/model/chat/messagemodel.cpp
src/model/chat/chatmediator.h src/model/chat/chatmediator.cpp
src/model/chat/contact/chatcontact.h src/model/chat/contact/chatcontact.cpp
src/model/view/chatstack.h src/model/view/chatstack.cpp
src/model/chat/contact/sharechat.h src/model/chat/contact/sharechat.cpp
src/model/chat/contact/contactproxymodel.h src/model/chat/contact/contactproxymodel.cpp
src/model/chat/contact/contactmodel.h src/model/chat/contact/contactmodel.cpp
src/model/chat/contact/contactchecklistmodel.h src/model/chat/contact/contactchecklistmodel.cpp
)
target_include_directories(chat PRIVATE "./include" "./src")
foreach( PACK IN LISTS QPACKAGE )
target_link_libraries(chat Qt${QT_VERSION_MAJOR}::${PACK} )
endforeach()
include(GNUInstallDirs)
install(TARGETS chat
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
find_package(Deltachat REQUIRED)
target_link_libraries(chat Deltachat)
#for debug
if ( DEBUG )
# target_compile_definitions(chat PRIVATE -fsanitize=address)
list(APPEND CMAKE_C_FLAG PRIVATE -fsanitize=address -g )
target_link_libraries(chat asan)
endif()