Skip to content

Commit 2049ddf

Browse files
🎉 init: initial commit
0 parents  commit 2049ddf

Some content is hidden

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

58 files changed

+285052
-0
lines changed

.clang-format

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
TabWidth: 4
4+
UseTab: Never
5+
ColumnLimit: 100
6+
BreakBeforeBraces: Attach
7+
AllowShortIfStatementsOnASingleLine: false
8+
AllowShortLoopsOnASingleLine: false
9+
AllowShortFunctionsOnASingleLine: Empty
10+
PointerAlignment: Left
11+
ReferenceAlignment: Left
12+
SpaceAfterCStyleCast: false
13+
SpaceBeforeParens: ControlStatements
14+
IncludeBlocks: Regroup
15+
SortIncludes: true

.cmr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# cmakerun configuration file
2+
# This file contains default settings for the cmakerun script
3+
4+
# Build configuration
5+
BUILD_TYPE="Debug" # Debug, Release, RelWithDebInfo, MinSizeRel
6+
BUILD_DIR="build" # Build directory name
7+
SOURCE_DIR="." # Source directory (relative to project root)
8+
9+
# Target configuration
10+
TARGET="hq" # Executable target name (empty for auto-detect)
11+
12+
# Build options
13+
JOBS="" # Number of parallel jobs (empty for auto-detect)
14+
VERBOSE=0 # Verbose output (0 or 1)
15+
16+
# Runtime arguments (applied when using -r/--run)
17+
# ARGS="" # Default arguments to pass to executable

.github/workflows/build.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- os: windows-latest
14+
name: win
15+
backend: WebView2
16+
cpack_generator: NSIS
17+
- os: ubuntu-latest
18+
name: linux
19+
container: archlinux:base-devel
20+
backend: WebKitGtk
21+
cpack_generator: TGZ
22+
23+
name: Build on ${{ matrix.os }}
24+
runs-on: ${{ matrix.os }}
25+
container: ${{ matrix.container }}
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Setup build dependencies (Arch)
32+
if: matrix.container == 'archlinux:base-devel'
33+
run: |
34+
pacman --noconfirm -Syu cmake gcc git xorg-server-xvfb xorg-xwd openssh tmate dbus python gtk4 libadwaita webkitgtk-6.0 nodejs npm
35+
36+
- name: Setup build dependencies (Windows)
37+
if: matrix.os == 'windows-latest'
38+
run: |
39+
choco upgrade cmake --install-arguments='"ADD_CMAKE_TO_PATH=System"' -y
40+
choco install nsis -y
41+
choco install nodejs-lts -y
42+
refreshenv
43+
shell: powershell
44+
45+
- name: Build(frontend)
46+
run: |
47+
npm install -g pnpm
48+
pnpm install
49+
pnpm run build
50+
51+
- name: Configure (CMake)
52+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -Dsaucer_backend=${{ matrix.backend }}
53+
54+
- name: Build(CMake)
55+
run: cmake --build build --config Release --parallel
56+
57+
- name: Package with CPack
58+
id: cpack
59+
run: |
60+
cd build
61+
cpack -G "${{ matrix.cpack_generator }}"
62+
continue-on-error: true
63+
64+
- name: Display NSIS logs (Windows)
65+
if: matrix.os == 'windows-latest' && steps.cpack.outcome == 'failure'
66+
run: |
67+
echo "=== NSIS Output Log ==="
68+
if (Test-Path "build/_CPack_Packages/win64/NSIS/NSISOutput.log") {
69+
Write-Host "--- NSISOutput.log ---"
70+
Get-Content "build/_CPack_Packages/win64/NSIS/NSISOutput.log"
71+
} else {
72+
echo "NSISOutput.log not found"
73+
}
74+
75+
echo ""
76+
echo "=== NSIS Generated Files ==="
77+
if (Test-Path "build/_CPack_Packages/win64/NSIS") {
78+
Get-ChildItem -Recurse "build/_CPack_Packages/win64/NSIS" -File | Select-Object FullName, Length, LastWriteTime | Format-Table -AutoSize
79+
}
80+
81+
echo ""
82+
echo "=== NSIS project.nsi (first 100 lines) ==="
83+
if (Test-Path "build/_CPack_Packages/win64/NSIS/project.nsi") {
84+
Get-Content "build/_CPack_Packages/win64/NSIS/project.nsi" -TotalCount 100
85+
}
86+
shell: powershell
87+
continue-on-error: true
88+
89+
- name: Exit if cpack failed
90+
if: steps.cpack.outcome == 'failure'
91+
run: exit 1
92+
93+
- name: Upload artifacts
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: TheHQProject-${{ matrix.name }}
97+
path: |
98+
build/TheHQProject-*.exe
99+
build/TheHQProject-*.tar.gz
100+
if-no-files-found: error
101+
retention-days: 90

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
build
27+
.cache
28+
embedded

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public-hoist-pattern[]=*@heroui/*

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
dist/
3+
*.cpp
4+
*.h
5+
*.hpp

.prettierrc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tabWidth: 4
2+
printWidth: 100
3+
singleQuote: true
4+
trailingComma: none

CMakeLists.txt

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Basic config
2+
cmake_minimum_required(VERSION 4.0)
3+
4+
set(PROJECT_NAME "TheHQProject")
5+
set(PROJECT_VERSION "1.0.0")
6+
set(PROJECT_ICON "${CMAKE_SOURCE_DIR}/assets/logo.ico")
7+
set(PROJECT_DESCRIPTION "a study time tracker application")
8+
project(${PROJECT_NAME})
9+
10+
set(CMAKE_CXX_STANDARD 23)
11+
set(CMAKE_CXX_EXTENSIONS OFF)
12+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13+
14+
set(SRC_DIR backend)
15+
set(INCLUDE_DIR "include")
16+
17+
add_executable(${PROJECT_NAME} ${SRC_DIR}/main.cpp)
18+
19+
file(GLOB_RECURSE SRC_FILES ${SRC_DIR}/*.cpp)
20+
file(GLOB_RECURSE HEADER_FILES ${INCLUDE_DIR}/*.h ${INCLUDE_DIR}/*.hpp)
21+
22+
target_sources(${PROJECT_NAME} PRIVATE ${SRC_FILES} ${HEADER_FILES})
23+
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR})
24+
25+
if (WIN32)
26+
set_target_properties(${PROJECT_NAME} PROPERTIES
27+
WIN32_EXECUTABLE TRUE
28+
)
29+
endif()
30+
31+
# Optimizations
32+
if (MSVC)
33+
message(STATUS "Applying MSVC performance optimizations for all build types...")
34+
add_compile_options(/MP)
35+
36+
target_compile_options(${PROJECT_NAME} PRIVATE
37+
/O2
38+
/Oi
39+
/Ot
40+
/Gy
41+
/GL
42+
/Zc:inline
43+
/DNDEBUG
44+
)
45+
46+
target_link_options(${PROJECT_NAME} PRIVATE
47+
/LTCG
48+
/INCREMENTAL:NO
49+
/OPT:REF
50+
/OPT:ICF
51+
)
52+
53+
add_definitions(-DUNICODE -D_UNICODE)
54+
endif()
55+
56+
# Dependencies
57+
include(cmake/CPM.cmake)
58+
59+
CPMAddPackage(
60+
NAME saucer
61+
VERSION 7.0.2
62+
GIT_REPOSITORY "https://github.com/saucer/saucer"
63+
)
64+
65+
target_link_libraries(${PROJECT_NAME} PRIVATE saucer::saucer)
66+
67+
saucer_embed("dist")
68+
69+
target_link_libraries(${PROJECT_NAME} PRIVATE saucer::saucer saucer::embedded)
70+
71+
set(SQLITE3_DIR "${CMAKE_SOURCE_DIR}/external/sqlite3")
72+
set(SQLITE3_SOURCES
73+
${SQLITE3_DIR}/sqlite3.c
74+
)
75+
76+
add_library(sqlite3 STATIC ${SQLITE3_SOURCES})
77+
target_include_directories(sqlite3 PUBLIC ${SQLITE3_DIR})
78+
target_link_libraries(${PROJECT_NAME} PRIVATE sqlite3)
79+
80+
# Packaging
81+
if (WIN32)
82+
set(APP_ICON_RESOURCE "${CMAKE_SOURCE_DIR}/appIcon.rc")
83+
target_sources(${PROJECT_NAME} PRIVATE ${APP_ICON_RESOURCE})
84+
endif()
85+
86+
install(TARGETS ${PROJECT_NAME}
87+
RUNTIME DESTINATION "bin"
88+
COMPONENT application
89+
)
90+
91+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dist
92+
DESTINATION share/${PROJECT_NAME}
93+
COMPONENT resources
94+
OPTIONAL
95+
)
96+
97+
if (EXISTS "${CMAKE_SOURCE_DIR}/LICENSE")
98+
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE"
99+
DESTINATION share/licenses/${PROJECT_NAME})
100+
endif()
101+
102+
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
103+
set(CPACK_PACKAGE_VENDOR "NaviTheCoderboi")
104+
set(CPACK_PACKAGE_CONTACT "https://github.com/NaviTheCoderboi")
105+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
106+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
107+
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})
108+
set(CPACK_PACKAGE_ICON ${PROJECT_ICON})
109+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
110+
111+
if (WIN32)
112+
set(CPACK_GENERATOR "NSIS")
113+
114+
set(CPACK_COMPONENTS_ALL application resources Unspecified)
115+
116+
set(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}")
117+
set(CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}")
118+
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${PROJECT_NAME}.exe")
119+
120+
set(CPACK_NSIS_HELP_LINK "https://github.com/NaviTheCoderboi")
121+
set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/NaviTheCoderboi")
122+
set(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
123+
124+
set(CPACK_NSIS_MODIFY_PATH OFF)
125+
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
126+
127+
if(EXISTS "${PROJECT_ICON}")
128+
set(CPACK_NSIS_MUI_ICON "${PROJECT_ICON}")
129+
set(CPACK_NSIS_MUI_UNIICON "${PROJECT_ICON}")
130+
endif()
131+
132+
set(CPACK_NSIS_CREATE_ICONS_EXTRA
133+
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk' '$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe'
134+
CreateShortCut '$DESKTOP\\\\${PROJECT_NAME}.lnk' '$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe'")
135+
set(CPACK_NSIS_DELETE_ICONS_EXTRA
136+
"Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk'
137+
Delete '$DESKTOP\\\\${PROJECT_NAME}.lnk'")
138+
139+
set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "
140+
ClearErrors
141+
ReadRegStr $0 HKLM 'SOFTWARE\\\\WOW6432Node\\\\Microsoft\\\\EdgeUpdate\\\\Clients\\\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' 'pv'
142+
IfErrors webview2_missing webview2_ok
143+
webview2_missing:
144+
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION 'Warning: Microsoft Edge WebView2 Runtime is not installed.$\\\\n$\\\\n${PROJECT_NAME} requires WebView2 to run properly.$\\\\n$\\\\nDownload from: https://go.microsoft.com/fwlink/p/?LinkId=2124703$\\\\n$\\\\nClick OK to continue installation anyway.' IDOK continue IDCANCEL abort
145+
abort:
146+
Abort 'Installation cancelled by user.'
147+
continue:
148+
DetailPrint 'WebView2 not found - user chose to continue'
149+
Goto done
150+
webview2_ok:
151+
DetailPrint 'WebView2 Runtime detected (version: $0)'
152+
done:
153+
")
154+
155+
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
156+
WriteINIStr '$INSTDIR\\\\Download_WebView2.url' 'InternetShortcut' 'URL' 'https://go.microsoft.com/fwlink/p/?LinkId=2124703'
157+
CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Download WebView2 Runtime.lnk' '$INSTDIR\\\\Download_WebView2.url'
158+
")
159+
160+
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
161+
Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Download WebView2 Runtime.lnk'
162+
Delete '$INSTDIR\\\\Download_WebView2.url'
163+
")
164+
165+
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe")
166+
elseif(APPLE)
167+
set(CPACK_GENERATOR "DragNDrop")
168+
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
169+
170+
else()
171+
set(CPACK_GENERATOR "TGZ")
172+
endif()
173+
174+
include(CPack)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 NaviTheCoderboi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)