mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
208d017cc3
These can be enabled using the `SANITIZE_{ADDRESS,MEMORY,THREAD,UNDEFINED}` cmake flags
106 lines
3.1 KiB
CMake
106 lines
3.1 KiB
CMake
project(chatterino-test)
|
|
|
|
set(main_dir ${CMAKE_SOURCE_DIR}/src)
|
|
|
|
include_directories(${main_dir})
|
|
|
|
set(chatterino_SOURCES
|
|
${CMAKE_SOURCE_DIR}/src/BaseSettings.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/common/ChatterinoSetting.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/Modes.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/NetworkManager.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/NetworkPrivate.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/NetworkRequest.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/NetworkResult.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/QLogging.cpp
|
|
${CMAKE_SOURCE_DIR}/src/common/UsernameSet.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/controllers/highlights/HighlightPhrase.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/messages/Emote.cpp
|
|
${CMAKE_SOURCE_DIR}/src/messages/Image.cpp
|
|
${CMAKE_SOURCE_DIR}/src/messages/ImageSet.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/providers/emoji/Emojis.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/singletons/Paths.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/util/DebugCount.cpp
|
|
${CMAKE_SOURCE_DIR}/src/util/RapidjsonHelpers.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/resources/resources.qrc
|
|
${CMAKE_SOURCE_DIR}/resources/resources_autogenerated.qrc
|
|
)
|
|
|
|
set(test_SOURCES
|
|
${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/src/NetworkRequest.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/src/UsernameSet.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/src/HighlightPhrase.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/src/Emojis.cpp
|
|
)
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
${chatterino_SOURCES}
|
|
${test_SOURCES}
|
|
)
|
|
add_sanitizers(${PROJECT_NAME})
|
|
|
|
# Enable autogeneration of Qts MOC/RCC/UIC
|
|
set_target_properties(${PROJECT_NAME}
|
|
PROPERTIES
|
|
AUTOMOC ON
|
|
AUTORCC ON
|
|
AUTOUIC ON
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
Qt5::Core
|
|
Qt5::Widgets
|
|
Qt5::Network
|
|
Qt5::Concurrent
|
|
gtest gtest_main
|
|
Pajlada::Serialize
|
|
Pajlada::Settings
|
|
Pajlada::Signals
|
|
Threads::Threads
|
|
)
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
CHATTERINO
|
|
CHATTERINO_TEST
|
|
UNICODE
|
|
AB_CUSTOM_THEME
|
|
AB_CUSTOM_SETTINGS
|
|
IRC_STATIC
|
|
IRC_NAMESPACE=Communi
|
|
CHATTERINO_GIT_HASH=\"${GIT_HASH}\"
|
|
CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\"
|
|
CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\"
|
|
)
|
|
|
|
if (WIN32)
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
USEWINSDK
|
|
)
|
|
endif ()
|
|
|
|
set_target_properties(${PROJECT_NAME}
|
|
PROPERTIES
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
|
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
|
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
|
|
)
|
|
|
|
# gtest_add_tests manages to discover the tests because it looks through the source files
|
|
# HOWEVER, it fails to run, because we have some bug that causes the QApplication exit to stall when no network requests have been made.
|
|
# ctest runs each test individually, so for now we require that testers just run the ./bin/chatterino-test binary without any filters applied
|
|
# gtest_add_tests(
|
|
# TARGET ${PROJECT_NAME}
|
|
# SOURCES ${test_SOURCES}
|
|
# )
|