diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..2c4e446 --- /dev/null +++ b/.clang-format @@ -0,0 +1,10 @@ +BasedOnStyle: Chromium +ColumnLimit: 100 +AllowShortLoopsOnASingleLine: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +BreakConstructorInitializersBeforeComma: true +AlignConsecutiveAssignments: true +AllowShortFunctionsOnASingleLine: true +BraceWrapping: + AfterControlStatement: Always +InsertBraces: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..26333e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,83 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +*.qbs.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +# Directories with generated files +.moc/ +.obj/ +.pch/ +.rcc/ +.uic/ +/build*/ +_build*/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4fc039e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "libs/GenericCore"] + path = libs/GenericCore + url = ssh://wococo1@git.working-copy.org:46100/bent/GenericQtClientCore.git +[submodule "UIs/GenericWidgets"] + path = UIs/GenericWidgets + url = ssh://wococo1@git.working-copy.org:46100/bent/GenericQtClientWidgets.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..58922ae --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.16) + +set(TARGET_APP "GenericQtClient") +project(${TARGET_APP} VERSION 0.0.1 LANGUAGES CXX) + +enable_testing() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_subdirectory(libs/GenericCore) +set (CORE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/GenericCore) + +# Frontend applications +add_subdirectory(UIs/GenericWidgets) + +### Tests +add_subdirectory(tests/GenericCoreTests) diff --git a/UIs/GenericWidgets b/UIs/GenericWidgets new file mode 160000 index 0000000..1b0e257 --- /dev/null +++ b/UIs/GenericWidgets @@ -0,0 +1 @@ +Subproject commit 1b0e2576029a3a58d789c4ab6be14552eefe8a8b diff --git a/libs/GenericCore b/libs/GenericCore new file mode 160000 index 0000000..b631f42 --- /dev/null +++ b/libs/GenericCore @@ -0,0 +1 @@ +Subproject commit b631f4200e8f756bb1f5b76e9c05fb6e7eea03c3 diff --git a/tests/GenericCoreTests/CMakeLists.txt b/tests/GenericCoreTests/CMakeLists.txt new file mode 100644 index 0000000..f07569e --- /dev/null +++ b/tests/GenericCoreTests/CMakeLists.txt @@ -0,0 +1,30 @@ +include(FetchContent) + +set(TARGET_APP "core_test") + +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.17.0 +) +FetchContent_MakeAvailable(googletest) +add_library(GTest::GTest INTERFACE IMPORTED) +target_link_libraries(GTest::GTest INTERFACE gtest_main) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core LinguistTools) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools) + +add_executable(${TARGET_APP} core_test.cpp) + +target_include_directories(${TARGET_APP} PRIVATE ${CORE_LIB_DIR}/include) + +target_link_libraries(${TARGET_APP} + PRIVATE + GTest::GTest + GenericCore) +target_link_libraries(${TARGET_APP} PUBLIC Qt${QT_VERSION_MAJOR}::Core) + +add_test(core_gtests ${TARGET_APP}) diff --git a/tests/GenericCoreTests/core_test.cpp b/tests/GenericCoreTests/core_test.cpp new file mode 100644 index 0000000..4ee7d36 --- /dev/null +++ b/tests/GenericCoreTests/core_test.cpp @@ -0,0 +1,20 @@ +#include + +#include + +#include "../../libs/GenericCore/genericcore.h" + +TEST(CoreTests, TestEqualString) { + const auto expected = "GenericCore (Version x.y.z)"; + auto core = std::make_unique(); + const auto actual = core->toString(); + // const auto actual = multiply(1, 1); + ASSERT_EQ(expected, actual); +} + +TEST(CoreTests, TestNotEqualString) { + const auto expected = "Hello from the Core!"; + auto core = std::make_unique(); + const auto actual = core->toString(); + ASSERT_NE(expected, actual); +}