mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
🎉 Added test back
This commit is contained in:
parent
0fd4849cc4
commit
9d8a607c4d
|
@ -3,6 +3,10 @@ include(FeatureSummary)
|
|||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_BINARY_DIR})
|
||||
|
||||
project(Chatterino2)
|
||||
|
||||
option(BUILD_APP "Build Chatterino2" ON)
|
||||
option(BUILD_TESTS "Build the tests for Chatterino2" OFF)
|
||||
option(USE_PACKAGE_MANAGER "Use conan for managing packages" OFF)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
@ -21,9 +25,7 @@ if (WIN32)
|
|||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
endif()
|
||||
|
||||
project(Chatterino2)
|
||||
endif ()
|
||||
|
||||
if (USE_PACKAGE_MANAGER)
|
||||
include(pmm)
|
||||
|
@ -41,6 +43,10 @@ else (USE_PACKAGE_MANAGER)
|
|||
find_package(Settings REQUIRED)
|
||||
find_package(Serialize REQUIRED)
|
||||
find_package(Websocketpp REQUIRED)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
find_package(GTest REQUIRED)
|
||||
endif ()
|
||||
endif (USE_PACKAGE_MANAGER)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
@ -48,8 +54,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Multimedia Svg Concurrent)
|
||||
|
||||
add_subdirectory(src)
|
||||
#add_subdirectory(tests)
|
||||
|
||||
if (BUILD_APP)
|
||||
add_subdirectory(src)
|
||||
endif ()
|
||||
if (BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif ()
|
||||
|
||||
feature_summary(WHAT ALL)
|
|
@ -1,13 +1,14 @@
|
|||
[requires]
|
||||
openssl/1.1.1d
|
||||
boost/1.75.0
|
||||
communi/3.6.0@test/test
|
||||
serialize/0.1@test/test
|
||||
gtest/1.10.0
|
||||
openssl/1.1.1d
|
||||
QtKeychain/0.12.90@test/test
|
||||
rapidjson/cci.20200410
|
||||
serialize/0.1@test/test
|
||||
settings/0.1@test/test
|
||||
signals/0.1@test/test
|
||||
WebSocketpp/0.8.1@test/test
|
||||
rapidjson/cci.20200410
|
||||
settings/0.1@test/test
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
|
|
|
@ -219,43 +219,45 @@ generate_source_groups(${SOURCE_FILES})
|
|||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO UNICODE USEWINSDK AB_CUSTOM_THEME AB_CUSTOM_SETTINGS IRC_STATIC IRC_NAMESPACE=Communi) #
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO UNICODE USEWINSDK AB_CUSTOM_THEME AB_CUSTOM_SETTINGS IRC_STATIC IRC_NAMESPACE=Communi)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_GIT_HASH=\"XD\" CHATTERINO_GIT_RELEASE=\"XD\" CHATTERINO_GIT_COMMIT=\"XD\")
|
||||
|
||||
include(WinToast)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
Qt5::Multimedia
|
||||
Qt5::Svg
|
||||
Qt5::Concurrent
|
||||
Qt5::Gui
|
||||
Qt5::Multimedia
|
||||
Qt5::Network
|
||||
Qt5::Svg
|
||||
Qt5::Widgets
|
||||
WinToast
|
||||
)
|
||||
|
||||
if (USE_PACKAGE_MANAGER)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
CONAN_PKG::boost
|
||||
CONAN_PKG::communi
|
||||
CONAN_PKG::openssl
|
||||
CONAN_PKG::QtKeychain
|
||||
CONAN_PKG::rapidjson
|
||||
CONAN_PKG::openssl
|
||||
CONAN_PKG::communi
|
||||
CONAN_PKG::serialize
|
||||
CONAN_PKG::settings
|
||||
CONAN_PKG::signals
|
||||
CONAN_PKG::WebSocketpp
|
||||
)
|
||||
else ()
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE . "${RapidJSON_INCLUDE_DIRS}")
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${RapidJSON_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Boost::Boost
|
||||
OpenSSL::OpenSSL
|
||||
LibCommuni::LibCommuni
|
||||
OpenSSL::OpenSSL
|
||||
qt5keychain
|
||||
Serialize::Serialize
|
||||
Settings::Settings
|
||||
Signals::Signals
|
||||
qt5keychain
|
||||
websocketpp::websocketpp
|
||||
)
|
||||
endif ()
|
||||
|
|
60
tests/CMakeLists.txt
Normal file
60
tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,60 @@
|
|||
include(GoogleTest)
|
||||
|
||||
project(chatterino-tests)
|
||||
|
||||
set(main_dir ${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
include_directories(${main_dir})
|
||||
|
||||
set(chatterino_SOURCES
|
||||
${main_dir}/common/NetworkRequest.cpp
|
||||
${main_dir}/common/NetworkResult.cpp
|
||||
${main_dir}/common/NetworkPrivate.cpp
|
||||
${main_dir}/common/NetworkManager.cpp
|
||||
${main_dir}/common/QLogging.cpp
|
||||
${main_dir}/common/Modes.cpp
|
||||
${main_dir}/common/ChatterinoSetting.cpp
|
||||
${main_dir}/util/DebugCount.cpp
|
||||
${main_dir}/singletons/Paths.cpp
|
||||
${main_dir}/BaseSettings.cpp
|
||||
${main_dir}/common/UsernameSet.cpp
|
||||
${main_dir}/controllers/highlights/HighlightPhrase.cpp
|
||||
)
|
||||
|
||||
message("++ Tests enabled")
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
${chatterino_SOURCES}
|
||||
src/main.cpp
|
||||
src/NetworkRequest.cpp
|
||||
src/UsernameSet.cpp
|
||||
src/HighlightPhrase.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
Qt5::Concurrent
|
||||
)
|
||||
|
||||
if (USE_PACKAGE_MANAGER)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
CONAN_PKG::gtest
|
||||
CONAN_PKG::serialize
|
||||
CONAN_PKG::settings
|
||||
CONAN_PKG::signals
|
||||
)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
gtest gtest_main
|
||||
Serialize::Serialize
|
||||
Settings::Settings
|
||||
Signals::Signals
|
||||
)
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO UNICODE USEWINSDK AB_CUSTOM_THEME AB_CUSTOM_SETTINGS IRC_STATIC IRC_NAMESPACE=Communi)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_GIT_HASH=\"XD\" CHATTERINO_GIT_RELEASE=\"XD\" CHATTERINO_GIT_COMMIT=\"XD\")
|
||||
|
||||
gtest_discover_tests(${PROJECT_NAME})
|
Loading…
Reference in a new issue