Skip to content

Commit d4ba256

Browse files
committed
Refact project structure
1 parent 112baf3 commit d4ba256

63 files changed

Lines changed: 157 additions & 158 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ jobs:
3535

3636
- name: Build
3737
run: cmake --build --preset release
38+
39+
- name: Test
40+
run: ctest --preset release

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (KEMAI_BUILD_LOCAL_DEPENDENCIES)
2929
CPMAddPackage("gh:Neargye/magic_enum#v0.9.7")
3030
CPMAddPackage("gh:catchorg/Catch2#v3.8.1")
3131
CPMAddPackage(URI "gh:gabime/spdlog#v1.17.0" OPTIONS "SPDLOG_FMT_EXTERNAL ON")
32-
CPMAddPackage(URI "gh:frankosterfeld/qtkeychain#0.15.0" OPTIONS "BUILD_WITH_QT6 ON" "BUILD_SHARED_LIBS OFF" "BUILD_TRANSLATIONS OFF")
32+
CPMAddPackage(URI "gh:frankosterfeld/qtkeychain#0.15.0" OPTIONS "BUILD_WITH_QT6 ON" "BUILD_SHARED_LIBS OFF" "BUILD_TRANSLATIONS OFF" "BUILD_TESTING OFF")
3333
endif (KEMAI_BUILD_LOCAL_DEPENDENCIES)
3434

3535
# Find dependencies
@@ -47,12 +47,7 @@ file(WRITE ${CMAKE_BINARY_DIR}/version.txt ${PROJECT_VERSION})
4747

4848
# Project code
4949
include(CTest)
50-
add_subdirectory(src)
51-
52-
# Tests (opt-in via BUILD_TESTING, default OFF)
53-
if (BUILD_TESTING)
54-
add_subdirectory(tests)
55-
endif()
50+
add_subdirectory(code)
5651

5752
# Common package configuration
5853
set(KEMAI_GUID "88815E44-85A0-469C-9740-B4887D456BAA")

CMakePresets.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,15 @@
3838
"name": "release",
3939
"configurePreset": "release"
4040
}
41+
],
42+
"testPresets": [
43+
{
44+
"name": "debug",
45+
"configurePreset": "debug"
46+
},
47+
{
48+
"name": "release",
49+
"configurePreset": "release"
50+
}
4151
]
4252
}

code/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_subdirectory(core)
2+
add_subdirectory(app)
3+
if (BUILD_TESTING)
4+
add_subdirectory(tests)
5+
endif()

code/app/CMakeLists.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
project(Kemai)
2+
3+
set(KEMAI_QML_FILES
4+
qml/Components/CurrentTimesheetSelectionItem.qml
5+
qml/Components/KemaiTextField.qml
6+
qml/Components/PrimaryEditButton.qml
7+
qml/Components/PrimaryRedButton.qml
8+
qml/Components/ProfileComboBox.qml
9+
qml/Components/ProfileEntryDelegate.qml
10+
qml/Components/ProfileForm.qml
11+
qml/Components/TimeEntryDelegate.qml
12+
qml/Components/TimesheetHistoryItem.qml
13+
qml/Views/LoginView.qml
14+
qml/Views/MainView.qml
15+
qml/Views/ProfileManagerDialog.qml
16+
qml/Main.qml
17+
qml/Theme.qml
18+
)
19+
20+
set(KEMAI_QML_SOURCES
21+
context/kemaiContext.cpp
22+
context/kemaiContext.h
23+
context/sessionContext.cpp
24+
context/sessionContext.h
25+
context/profileManager.cpp
26+
context/profileManager.h
27+
)
28+
29+
qt_add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE main.cpp)
30+
31+
set_target_properties(${PROJECT_NAME} PROPERTIES
32+
WIN32_EXECUTABLE TRUE
33+
MACOSX_BUNDLE TRUE
34+
)
35+
36+
set_source_files_properties(qml/Theme.qml
37+
PROPERTIES QT_QML_SINGLETON_TYPE TRUE
38+
)
39+
40+
qt_add_qml_module(${PROJECT_NAME}
41+
URI Kemai
42+
QML_FILES ${KEMAI_QML_FILES}
43+
SOURCES ${KEMAI_QML_SOURCES}
44+
)
45+
46+
# qt_add_translations(${PROJECT_NAME}
47+
# TS_FILE_DIR translations
48+
# )
49+
50+
qt_add_resources(
51+
${PROJECT_NAME} "assets"
52+
FILES
53+
assets/fonts/RaveoVF.ttf
54+
assets/images/kimai_logo.svg
55+
)
56+
57+
qt_add_resources(
58+
${PROJECT_NAME} "controls_conf"
59+
FILES "qtquickcontrols2.conf")
60+
61+
target_include_directories(${PROJECT_NAME}
62+
PRIVATE
63+
${CMAKE_CURRENT_SOURCE_DIR}/context)
64+
65+
target_compile_definitions(${PROJECT_NAME}
66+
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
67+
68+
target_link_libraries(${PROJECT_NAME}
69+
PRIVATE KemaiCore Qt6::Gui Qt6::Quick spdlog::spdlog)
70+
71+
install(TARGETS ${PROJECT_NAME}
72+
BUNDLE DESTINATION .
73+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
74+
)
75+
qt_generate_deploy_qml_app_script(
76+
TARGET ${PROJECT_NAME}
77+
OUTPUT_SCRIPT deploy_script
78+
)
79+
install(SCRIPT ${deploy_script})

0 commit comments

Comments
 (0)