├── .clang-format
├── .clang-tidy
├── .gitattributes
├── .github
└── workflows
│ └── sync-from-template.yml
├── .gitignore
├── .idea
├── Project-Template.iml
├── misc.xml
└── modules.xml
├── CITATION.md
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── SECURITY.md
├── cmake
├── color-message.cmake
├── compiler-options.cmake
├── cross-compile.cmake
├── packages.cmake
├── packages
│ ├── FindBoost.cmake
│ ├── FindCatch2.cmake
│ ├── FindCell.cmake
│ ├── FindCppCheck.cmake
│ ├── FindCryptopp.cmake
│ ├── FindCtre.cmake
│ ├── FindCurl.cmake
│ ├── FindDocTest.cmake
│ ├── FindEigen.cmake
│ ├── FindFmt.cmake
│ ├── FindGTest.cmake
│ ├── FindJSon.cmake
│ ├── FindJwt.cmake
│ ├── FindOpenCV.cmake
│ ├── FindOpenMesh.cmake
│ ├── FindOpenSSL.cmake
│ └── FindZlib.cmake
├── platforms-toolchain
│ ├── android-toolchain.cmake
│ ├── ios-toolchain.cmake
│ ├── linux-toolchain.cmake
│ ├── macos-toolchain.cmake
│ ├── unix-toolchain.cmake
│ ├── wasm-toolchain.cmake
│ └── windows-toolchain.cmake
└── project-setting.cmake
├── config.hpp.in
├── config
├── project.cmake
└── system-config.json
├── licenses
└── mit.txt
├── precompiled
└── pch.hpp
├── properties
├── Windows
│ ├── app.rc
│ └── resource.hpp
├── iOS
│ └── Info.plist.in
└── macOS
│ └── Info.plist.in
├── source
├── attributes.hpp
├── common.hpp
├── defines.hpp
├── entrypoint
│ ├── qt
│ │ ├── nogui
│ │ │ └── main.cpp
│ │ ├── qtquick
│ │ │ └── main.cpp
│ │ └── qtwidget
│ │ │ └── main.cpp
│ └── stl
│ │ └── main.cpp
├── examples
│ ├── compilertest.cpp
│ ├── compilertest.hpp
│ ├── configtest.cpp
│ ├── configtest.hpp
│ ├── languagetest.cpp
│ ├── languagetest.hpp
│ ├── librarytest.cpp
│ ├── librarytest.hpp
│ ├── platformtest.cpp
│ ├── platformtest.hpp
│ ├── thirdpartytest.cpp
│ └── thirdpartytest.hpp
├── interface.cpp
└── interface.hpp
├── ui
├── qtquick
│ ├── main.qml
│ └── qml.qrc
└── widgets
│ ├── mainwindow.cpp
│ ├── mainwindow.hpp
│ └── mainwindow.ui
└── utilities
├── featuretest.hpp
├── prefuncs.hpp
├── preprocessor.cppm
├── preprocessor.hpp
└── types.hpp
/.clang-format:
--------------------------------------------------------------------------------
1 | Language: Cpp
2 | AccessModifierOffset: -4
3 | AlignAfterOpenBracket: true
4 | AlignEscapedNewlinesLeft: true
5 | AlignTrailingComments: true
6 | AllowAllParametersOfDeclarationOnNextLine: true
7 | AllowShortBlocksOnASingleLine: false
8 | AllowShortCaseLabelsOnASingleLine: true
9 | AllowShortFunctionsOnASingleLine: All
10 | AllowShortIfStatementsOnASingleLine: true
11 | AllowShortLoopsOnASingleLine: false
12 | AlwaysBreakBeforeMultilineStrings: false
13 | AlwaysBreakTemplateDeclarations: true
14 | BinPackArguments: true
15 | BinPackParameters: true
16 | BreakBeforeBinaryOperators: false
17 | BreakBeforeBraces: Custom
18 | BraceWrapping:
19 | AfterClass: true
20 | AfterFunction: true
21 | BreakBeforeTernaryOperators: false
22 | BreakConstructorInitializersBeforeComma: false
23 | ColumnLimit: 0
24 | CommentPragmas: '^ IWYU pragma:'
25 | ConstructorInitializerAllOnOneLineOrOnePerLine: false
26 | ConstructorInitializerIndentWidth: 4
27 | ContinuationIndentWidth: 4
28 | Cpp11BracedListStyle: true
29 | DerivePointerAlignment: false
30 | DisableFormat: false
31 | IndentCaseLabels: false
32 | IndentFunctionDeclarationAfterType: false
33 | IndentWidth: 4
34 | KeepEmptyLinesAtTheStartOfBlocks: false
35 | MaxEmptyLinesToKeep: 2
36 | NamespaceIndentation: None
37 | PointerAlignment: Left
38 | SpaceBeforeAssignmentOperators: true
39 | SpaceBeforeParens: ControlStatements
40 | SpaceInEmptyParentheses: false
41 | SpacesBeforeTrailingComments: 1
42 | SpacesInAngles: false
43 | SpacesInContainerLiterals: true
44 | SpacesInCStyleCastParentheses: false
45 | SpacesInParentheses: false
46 | Standard: c++17
47 | UseTab: Never
48 |
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | Checks: '-*,bugprone-argument-comment'
2 | WarningsAsErrors: bugprone-argument-comment
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/workflows/sync-from-template.yml:
--------------------------------------------------------------------------------
1 | ---
2 | #
3 | # - Run this workflow to pull changes from the template repository.
4 | #
5 | # - Clone this repository. Check out a branch
6 | # - Copy files from the template onto this clone
7 | # - Push the branch to this repository
8 | # - Create a pull request in this repository
9 | #
10 |
11 | name: Sync changes from template project.
12 |
13 | on:
14 | # cronjob trigger
15 | schedule:
16 | - cron: "17 5 * * 5"
17 |
18 | # Run when this file changes
19 | push:
20 | paths:
21 | - .github/workflows/sync-from-template.yml
22 |
23 | # Run when manually triggered
24 | workflow_dispatch:
25 |
26 | env:
27 | BASE_BRANCH: main
28 | HEAD_BRANCH: chore/sync-from-template
29 | GIT_AUTHOR_NAME: ${{ github.repository_owner }}
30 | GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com
31 | REPO_TEMPLATE: KambizAsadzadeh/Project-Template
32 | THIS_REPO: ${{ github.repository }}
33 |
34 | jobs:
35 | sync-from-template:
36 | # Do not run on the template repository itself
37 | if: github.repository != 'KambizAsadzadeh/Project-Template'
38 | name: Sync changes from KambizAsadzadeh/Project-Template
39 | runs-on: ubuntu-latest
40 | continue-on-error: true
41 |
42 | steps:
43 | # Clone the template repository
44 | - name: Check out template repository
45 | uses: actions/checkout@v2
46 | with:
47 | repository: ${{ env.REPO_TEMPLATE }}
48 | token: ${{ github.token }}
49 | path: ${{ env.REPO_TEMPLATE }}
50 |
51 | # Clone the target repository. Check out a branch
52 | - name: Check out ${{ github.repository }}
53 | uses: actions/checkout@v2
54 | with:
55 | repository: ${{ github.repository }}
56 | token: ${{ github.token }}
57 | path: ${{ github.repository }}
58 | - name: Create branch in ${{ env.THIS_REPO }}
59 | run: |
60 | git -C "${THIS_REPO}" fetch origin "${HEAD_BRANCH}" || true
61 | git -C "${THIS_REPO}" branch -a
62 | git -C "${THIS_REPO}" checkout -B "${HEAD_BRANCH}" \
63 | "remotes/origin/${HEAD_BRANCH}" || \
64 | git -C "${THIS_REPO}" checkout -b "${HEAD_BRANCH}"
65 |
66 | # Copy files from the template onto the target clone
67 | - name: Copy template contents
68 | run: |
69 | _files="$(find ${REPO_TEMPLATE} \
70 | ! -path "*/.git/*" \
71 | ! -path "*/.github/workflows/*" \
72 | ! -name ".gitignore" \
73 | ! -name "README.md" \
74 | -type f \
75 | -print)"
76 | for _file in ${_files}; do
77 | _src="${_file}"
78 | _dst="${THIS_REPO}/${_file#${REPO_TEMPLATE}/}"
79 | # TODO: Find a more robust / elegant way to get this :point_down:
80 | _dst="${_dst%/*}/"
81 | mkdir -p "${_dst}"
82 | echo "INFO: Copy '${_src}' to '${_dst}'."
83 | cp "${_src}" "${_dst}"
84 | done
85 | git -C "${THIS_REPO}" diff
86 |
87 | # Commit changes, if there are any
88 | - name: Commit changes, if any
89 | run: |
90 | git -C ${THIS_REPO} config user.name "${GIT_AUTHOR_NAME}"
91 | git -C ${THIS_REPO} config \
92 | user.email "${GIT_AUTHOR_EMAIL}"
93 | git -C ${THIS_REPO} add .
94 | git -C ${THIS_REPO} commit \
95 | -m "Sync from template@${{ github.sha }}"
96 |
97 | # Push the branch to the target repository
98 | - name: Push topic branch
99 | run: git -C ${THIS_REPO} push -u origin "${HEAD_BRANCH}"
100 |
101 | # Create a pull request in the target repository
102 | - name: Create pull request
103 | env:
104 | GITHUB_TOKEN: ${{ github.token }}
105 | GITHUB_USER: ${{ github.actor }}
106 | run: |
107 | pushd ${THIS_REPO}
108 | hub pull-request \
109 | -b "${BASE_BRANCH}" \
110 | -h "${HEAD_BRANCH}" \
111 | --no-edit \
112 | -m "Pull updates from ${REPO_TEMPLATE}" \
113 | -m "Pull updates from ${REPO_TEMPLATE}"
114 | popd
115 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | #Extra
35 | .DS_Store
36 |
37 | # Final Output
38 | build/ProjectTemplate
39 |
--------------------------------------------------------------------------------
/.idea/Project-Template.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CITATION.md:
--------------------------------------------------------------------------------
1 | cff-version: 1.2.0
2 | message: "If you use this software, please cite it as below."
3 | authors:
4 | - family-names: "Asadzadeh"
5 | given-names: "Kambiz"
6 | orcid: "https://orcid.org/0009-0009-2065-3977"
7 | title: "PT"
8 | version: 1.1.222
9 | date-released: 2023-04-25
10 | url: "https://kambizasadzadeh.com"
11 | repository-code: "https://github.com/genyleap/Project-Template"
12 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # -------------------- PROJECT TEMPLATE INFO ---------------------------------------------
2 | # Title : Project Template
3 | # Version : 1.2.20
4 | # Author : Kambiz Asadzadeh (compez.eth)
5 | # License : MIT
6 | # Url : https://github.com/genyleap/Project-Template
7 | # Organization : Genyleap
8 | # ----------------------------------------------------------------------------------------
9 |
10 | cmake_minimum_required(VERSION 3.23)
11 | cmake_policy(SET CMP0048 NEW)
12 |
13 | # Add include path for cmake modules
14 | # ------ PROJECT EXTRA CMAKE ------
15 |
16 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
17 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config/")
18 |
19 | include(ExternalProject)
20 | include(FetchContent)
21 |
22 | # ------ PROJECT INFO ------
23 | # Options
24 | set(PROJECT_NAME "PT" CACHE STRING "Project Name.") #You can change "ProjectTemplate" with your project name.
25 | set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Project Target Name.")
26 |
27 | set(PROJECT_VERSION_MAJOR 1)
28 | set(PROJECT_VERSION_MINOR 0)
29 | set(PROJECT_VERSION_PATCH 6)
30 |
31 | # ---- Project settings ----
32 | set_property(GLOBAL APPEND PROPERTY USE_FOLDERS ON)
33 |
34 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
35 |
36 | if(NOT DEFINED CMAKE_CXX_STANDARD)
37 | set(CMAKE_CXX_STANDARD 23)
38 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
39 | set(CMAKE_CXX_EXTENSIONS ON)
40 | endif()
41 |
42 | set(PROJECT_CREATOR "Kambiz Asadzadeh" CACHE STRING "Creator of your project.") #Your project creator.
43 |
44 | set(PROJECT_LICENSE_TYPE "MIT" CACHE STRING "Project License Type.") #Your project license type.
45 |
46 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
47 | execute_process(
48 | COMMAND git rev-parse --short HEAD
49 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
50 | OUTPUT_VARIABLE PROJECT_VERSION_TAG
51 | OUTPUT_STRIP_TRAILING_WHITESPACE
52 | )
53 |
54 | endif()
55 | if(NOT PROJECT_VERSION_TAG)
56 | set(PROJECT_VERSION_TAG 00000000)
57 | endif()
58 | set(PROJECT_VERSION_TAG_HEX 0x${PROJECT_VERSION_TAG})
59 | set(PROJECT_VERSION_TYPE "final" CACHE STRING "Version type.")
60 | set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
61 | set(PROJECT_VERSION_STRING ${PROJECT_VERSION}-${PROJECT_VERSION_TYPE})
62 |
63 | # Supported languages include C, CXX (i.e. C++), CUDA, OBJC (i.e. Objective-C), OBJCXX, Fortran, HIP, ISPC, and ASM. By default C and CXX are enabled if no language options are given.
64 | # Specify language NONE, or use the LANGUAGES keyword and list no languages, to skip enabling any languages.
65 | set(PROJECT_LANGUAGES CXX)
66 |
67 | #Use these keys [application, library]
68 | set(PROJECT_USAGE_TYPE "application" CACHE STRING "Usage Type.")
69 |
70 | #Use these keys [stl, qt, qtwidget, qtquick]
71 | set(PROJECT_MAIN_TYPE "qtquick" CACHE STRING "Library System.")
72 |
73 | set(DEVELOPER_BUNDLE_IDENTIFIER com.kambizasadzadeh.app.${PROJECT_NAME} CACHE STRING "Developer Bundle Identifier.")
74 |
75 | #You can replace your project description with this string.
76 | set(PROJECT_DESCRIPTION "A concept mobile app UI/UX prototype based on Qt Quick technology." CACHE STRING "Project Description")
77 |
78 | #Your project website address.
79 | set(PROJECT_HOMEPAGE_URL "https://kambizasadzadeh.com" CACHE STRING "Project URL.")
80 |
81 | #Project pre-configuration system.
82 | configure_file(
83 | ${PROJECT_SOURCE_DIR}config.hpp.in
84 | ${PROJECT_SOURCE_DIR}config.hpp
85 | )
86 |
87 | project(
88 | ${PROJECT_NAME}
89 | LANGUAGES ${PROJECT_LANGUAGES}
90 | DESCRIPTION ${PROJECT_DESCRIPTION}
91 | HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL}
92 | VERSION ${PROJECT_VERSION}
93 | )
94 |
95 | # ------ PROJECT CONFIG ------
96 | include(project-setting)
97 | if(project-setting)
98 | return()
99 | endif()
100 | set(project-setting ON)
101 |
102 | # ------ CROSS-COMPILE CONFIG ------
103 | include(cross-compile)
104 | if(cross-compile)
105 | return()
106 | endif()
107 | set(cross-compile ON)
108 |
109 | # ------ PROJECT CONFIG ------
110 | include(color-message)
111 | if(color-message)
112 | return()
113 | endif()
114 | set(color-message ON)
115 |
116 | # ------ COMPILER CONFIG ------
117 | include(compiler-options)
118 | if(compiler-options)
119 | return()
120 | endif()
121 | set(compiler-options ON)
122 |
123 | # ------ PACKAGES CONFIG ------
124 | include(packages)
125 | if(packages)
126 | return()
127 | endif()
128 | set(packages ON)
129 |
130 | if(NOT PROJECT_MAIN_TYPE STREQUAL "stl")
131 | set(CMAKE_AUTOUIC ON)
132 | set(CMAKE_AUTOMOC ON)
133 | set(CMAKE_AUTORCC ON)
134 | endif()
135 |
136 | set(SUFFIX_EXTRA *.in)
137 | set(SUFFIX_HPPHEADER *.hpp)
138 | set(SUFFIX_IPPHEADER *.ipp)
139 | set(SUFFIX_INLHEADER *.inl)
140 | set(SUFFIX_SOURCE *.cpp)
141 | set(SUFFIX_CONFIG *.json)
142 |
143 | if(PROJECT_MAIN_TYPE STREQUAL "qtwidget")
144 | set(SUFFIX_WIDGET *.ui)
145 | elseif(PROJECT_MAIN_TYPE STREQUAL "qtquick")
146 | set(SUFFIX_QML *.qml)
147 | set(SUFFIX_QRC *.qrc)
148 | endif()
149 |
150 | file(GLOB PRECOMPILED precompiled/pch.hpp)
151 | file(GLOB HEADERS
152 | source/${SUFFIX_HPPHEADER}
153 | source/${SUFFIX_IPPHEADER}
154 | source/${SUFFIX_INLHEADER}
155 | )
156 | file(GLOB SOURCES source/${SUFFIX_SOURCE})
157 |
158 | #file(GLOB EXAMPLES
159 | # source/examples/${SUFFIX_HPPHEADER}
160 | # source/examples/${SUFFIX_SOURCE}
161 | #)
162 |
163 | file(GLOB UTILS
164 | utilities/${SUFFIX_HPPHEADER}
165 | utilities/${SUFFIX_SOURCE}
166 | )
167 |
168 | if(${PROJECT_MAIN_TYPE} STREQUAL "stl")
169 | set(HAS_USER_INTERFACE false)
170 | file(GLOB MAIN_ENTRY_POINT
171 | source/entrypoint/stl/${SUFFIX_HPPHEADER}
172 | source/entrypoint/stl/${SUFFIX_SOURCE}
173 | )
174 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qt")
175 | file(GLOB MAIN_ENTRY_POINT
176 | source/entrypoint/qt/nogui/${SUFFIX_HPPHEADER}
177 | source/entrypoint/qt/nogui/${SUFFIX_SOURCE}
178 | )
179 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget")
180 | file(GLOB MAIN_ENTRY_POINT
181 | source/entrypoint/qt/qtwidget/${SUFFIX_HPPHEADER}
182 | source/entrypoint/qt/qtwidget/${SUFFIX_SOURCE}
183 | ui/widgets/${SUFFIX_HPPHEADER}
184 | ui/widgets/${SUFFIX_SOURCE}
185 | )
186 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
187 | file(GLOB MAIN_ENTRY_POINT
188 | source/entrypoint/qt/qtquick/${SUFFIX_HPPHEADER}
189 | source/entrypoint/qt/qtquick/${SUFFIX_SOURCE}
190 | )
191 | endif()
192 | if(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget")
193 | file(GLOB UI_SOURCE ui/widgets/${SUFFIX_WIDGET})
194 | endif()
195 | if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
196 | file(GLOB UI_SOURCE ui/qtquick/${SUFFIX_QRC})
197 | file(GLOB UI_QML_SOURCE ui/qtquick/${SUFFIX_QML})
198 | endif()
199 |
200 | file(GLOB_RECURSE src_files ui/qtquick/${SUFFIX_QML})
201 |
202 | FOREACH(LETTER ${src_files})
203 | string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" fileList "${LETTER}")
204 | message(${fileList})
205 | list(APPEND UI_QML_FILES ${fileList})
206 | ENDFOREACH()
207 |
208 | file(GLOB CONFIGFILE config/${SUFFIX_CONFIG})
209 |
210 | file(GLOB SOURCESFILE
211 | #---C++---
212 | ${MAIN_ENTRY_POINT}
213 | ${HEADERS}
214 | ${SOURCES}
215 | ${UI_SOURCE}
216 | ${UI_QML_SOURCE}
217 | ${UTILS}
218 | ${CONFIGFILE}
219 | ${PRECOMPILED}
220 | ${EXAMPLES}
221 | )
222 |
223 | source_group("PrecompiledHeaders" FILES ${PRECOMPILED})
224 | source_group("Utilities" FILES ${UTILS})
225 | source_group("Entry Point (Main)" FILES ${MAIN_ENTRY_POINT})
226 | source_group("Base" FILES ${HEADERS} ${SOURCES})
227 | source_group("UI" FILES ${UI_SOURCE})
228 | source_group("UI/QML" FILES ${UI_QML_SOURCE})
229 | source_group("Config" FILES ${CONFIGFILE})
230 | source_group("Examples" FILES ${EXAMPLES})
231 |
232 | # ------ OUTPUTS CONFIG ------
233 | message(STATUS "${BoldRed}------ ${PROJECT_TARGET} Tools Configuration ------${ColourReset}")
234 | message(STATUS "${Bold}Language Standard${ColourReset} : C++[${CMAKE_CXX_STANDARD}]")
235 | message(STATUS "${Bold}Compiler${ColourReset} : ${CMAKE_CXX_COMPILER_ID}")
236 | message(STATUS "${Bold}Compiler Version${ColourReset} : ${CMAKE_CXX_COMPILER_VERSION}")
237 | message(STATUS "${Bold}OS Target${ColourReset} : ${CMAKE_HOST_SYSTEM}")
238 | message(STATUS "${Bold}OS Version${ColourReset} : ${CMAKE_HOST_SYSTEM_VERSION}")
239 | message(STATUS "${Bold}System Architecture${ColourReset} : ${OS_ARCHITECTURES}")
240 | message(STATUS "${Bold}Project License${ColourReset} : ${PROJECT_LICENSE_TYPE}")
241 | message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Framework Info ------${ColourReset}")
242 | message(STATUS "${Bold}Name${ColourReset} : ${CMAKE_PROJECT_NAME}")
243 | message(STATUS "${Bold}Description${ColourReset} : ${CMAKE_PROJECT_DESCRIPTION}")
244 | message(STATUS "${Bold}Version${ColourReset} : ${PROJECT_VERSION}")
245 | message(STATUS "${Bold}Full Version${ColourReset} : ${PROJECT_VERSION_STRING}")
246 | message(STATUS "${Bold}Creator${ColourReset} : ${PROJECT_CREATOR}")
247 | message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Project Configuration ------${ColourReset}")
248 | message(STATUS "${Bold}DEVELOPER${ColourReset} : ${PROJECT_CREATOR}")
249 | message(STATUS "${Bold}PROJECT_PROJECT${ColourReset} : ${PROJECT_NAME}")
250 | message(STATUS "${Bold}PROJECT_TARGET${ColourReset} : ${PROJECT_TARGET}")
251 | message(STATUS "${Bold}PROJECT_VERSION${ColourReset} : ${PROJECT_VERSION}")
252 | message(STATUS "${Bold}PROJECT_VERSION_TYPE${ColourReset} : ${Underscore}${PROJECT_VERSION_TYPE}${ColourReset}")
253 | message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Building Configuration ------${ColourReset}")
254 | message(STATUS "${Bold}PROJECT_BUILD_SHARED${ColourReset} : ${PROJECT_BUILD_SHARED}")
255 | message(STATUS "${Bold}PROJECT_VERSION_TAG_HEX${ColourReset} : ${PROJECT_VERSION_TAG_HEX}")
256 | message(STATUS "${Bold}PROJECT_FOLDER_SUFFIX${ColourReset} : ${PROJECT_FOLDER_SUFFIX}")
257 | message(STATUS "${Bold}LIBRARY_OUTPUT_PATH${ColourReset} : ${LIBRARY_OUTPUT_PATH}")
258 | message(STATUS "${Bold}CMAKE_CURRENT_SOURCE_DIR${ColourReset} : ${CMAKE_CURRENT_SOURCE_DIR}")
259 | message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} End Configuration ------${ColourReset}")
260 |
261 | if(GUI_APPLICATION AND PROJECT_MAIN_TYPE STREQUAL "qt" OR PROJECT_MAIN_TYPE STREQUAL "qtwidget" OR PROJECT_MAIN_TYPE STREQUAL "qtquick")
262 | if(USE_QT5_FEATURES)
263 | if(${PROJECT_MAIN_TYPE} STREQUAL "qt")
264 | list(APPEND QT_MODULES Core Core5Compat)
265 | list(APPEND QT_MODULES_LINK
266 | Qt${QT_VERSION_MAJOR}::Core
267 | Qt${QT_VERSION_MAJOR}::Core5Compat
268 | )
269 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Core5Compat)
270 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Core5Compat)
271 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget")
272 | list(APPEND QT_MODULES Core Widgets Core5Compat)
273 | list(APPEND QT_MODULES_LINK
274 | Qt${QT_VERSION_MAJOR}::Core
275 | Qt${QT_VERSION_MAJOR}::Widgets
276 | Qt${QT_VERSION_MAJOR}::Core5Compat
277 | )
278 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Core5Compat)
279 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Core5Compat)
280 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
281 | list(APPEND QT_MODULES Core Quick Core5Compat)
282 | list(APPEND QT_MODULES_LINK
283 | Qt${QT_VERSION_MAJOR}::Core
284 | Qt${QT_VERSION_MAJOR}::Quick
285 | Qt${QT_VERSION_MAJOR}::Core5Compat
286 | )
287 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Core5Compat)
288 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Core5Compat)
289 | else()
290 | list(APPEND QT_MODULES Core Core5Compat)
291 | list(APPEND QT_MODULES_LINK
292 | Qt${QT_VERSION_MAJOR}::Core
293 | Qt${QT_VERSION_MAJOR}::Core5Compat
294 | )
295 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Core5Compat)
296 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Core5Compat)
297 | endif()
298 | else()
299 | if(${PROJECT_MAIN_TYPE} STREQUAL "qt")
300 | list(APPEND QT_MODULES Core)
301 | list(APPEND QT_MODULES_LINK
302 | Qt${QT_VERSION_MAJOR}::Core
303 | )
304 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
305 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
306 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget")
307 | list(APPEND QT_MODULES Core Widgets)
308 | list(APPEND QT_MODULES_LINK
309 | Qt${QT_VERSION_MAJOR}::Core
310 | Qt${QT_VERSION_MAJOR}::Widgets
311 | )
312 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
313 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
314 | elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
315 | list(APPEND QT_MODULES Core${SPACE_ARG})
316 | list(APPEND QT_MODULES Quick${SPACE_ARG})
317 | list(APPEND QT_MODULES_LINK
318 | Qt${QT_VERSION_MAJOR}::Quick
319 | )
320 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick)
321 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick)
322 | endif()
323 | endif()
324 |
325 | qt_standard_project_setup(REQUIRES 6.5)
326 |
327 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
328 | if(PROJECT_USAGE_TYPE STREQUAL "library")
329 | qt_add_library(${PROJECT_NAME}
330 | MANUAL_FINALIZATION
331 | ${SOURCESFILE}
332 | )
333 | else()
334 | if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
335 | qt_add_resources(SOURCESFILE ui/qtquick/qml.qrc)
336 | endif()
337 | qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION ${SOURCESFILE})
338 | if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
339 | if(USE_QT_QUICK_COMPILER)
340 | qt_add_qml_module(${PROJECT_NAME}
341 | URI ${PROJECT_NAME}
342 | VERSION 1.0
343 | RESOURCE_PREFIX /app.genyleap.com/import
344 | OUTPUT_DIRECTORY ""
345 | QML_FILES ${UI_QML_FILES}
346 | )
347 | endif()
348 | endif()
349 | endif()
350 | else()
351 | if(ANDROID)
352 | add_library(${PROJECT_NAME} SHARED
353 | ${SOURCESFILE}
354 | )
355 | else()
356 | if(PROJECT_USAGE_TYPE STREQUAL "library")
357 | add_library(${PROJECT_NAME}
358 | ${SOURCESFILE}
359 | )
360 | else()
361 | add_executable(${PROJECT_NAME}
362 | ${SOURCESFILE}
363 | )
364 | endif()
365 | endif()
366 | endif()
367 |
368 | #Extra Targets & Modules
369 | target_link_libraries(${PROJECT_NAME} PRIVATE
370 | ${LIB_STL_MODULES_LINKER}
371 | ${LIB_MODULES}
372 | ${QT_MODULES_LINK}
373 | ${OS_LIBS}
374 | )
375 |
376 | #Extra Modules
377 | target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source PRIVATE source ${LIB_TARGET_INCLUDE_DIRECTORIES})
378 | target_link_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source ${LIB_TARGET_LINK_DIRECTORIES})
379 |
380 | set_target_properties(${PROJECT_NAME} PROPERTIES
381 | MACOSX_BUNDLE_GUI_IDENTIFIER ${DEVELOPER_BUNDLE_IDENTIFIER}
382 | MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
383 | MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
384 | MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/properties/${PLATFORM_FOLDER}/Info.plist.in"
385 | MACOSX_BUNDLE TRUE
386 | WIN32_EXECUTABLE TRUE
387 | )
388 |
389 | if(ANDROID)
390 | include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt)
391 | endif()
392 |
393 | if(QT_VERSION_MAJOR GREATER_EQUAL 6.0) #From Qt.6.0
394 | if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick")
395 | qt_import_qml_plugins(${PROJECT_NAME})
396 | endif()
397 | if(QT_VERSION GREATER_EQUAL 6.2) #From Qt6.2
398 | qt_finalize_target(${PROJECT_NAME})
399 | endif()
400 | if(WIN32)
401 | qt_disable_unicode_defines(${PROJECT_NAME})
402 | qt_allow_non_utf8_sources(${PROJECT_NAME})
403 | endif()
404 | endif()
405 |
406 | else()
407 | if(ANDROID)
408 | add_library(${PROJECT_NAME} SHARED
409 | ${SOURCESFILE}
410 | )
411 | else()
412 | if(PROJECT_USAGE_TYPE STREQUAL "library")
413 | add_library(${PROJECT_NAME}
414 | ${SOURCESFILE}
415 | )
416 | else()
417 | add_executable(${PROJECT_NAME}
418 | ${SOURCESFILE}
419 | )
420 | endif()
421 | endif()
422 |
423 | #Extra Targets & Modules
424 | target_link_libraries(${PROJECT_NAME} PRIVATE
425 | ${LIB_STL_MODULES_LINKER}
426 | ${LIB_MODULES}
427 | ${OS_LIBS}
428 | )
429 | target_include_directories(${PROJECT_NAME}
430 | PUBLIC
431 | ${CMAKE_CURRENT_SOURCE_DIR}/source PRIVATE source
432 | ${LIB_TARGET_INCLUDE_DIRECTORIES}
433 | )
434 |
435 | target_link_directories(${PROJECT_NAME}
436 | PRIVATE
437 | ${CMAKE_CURRENT_SOURCE_DIR}/source
438 | ${LIB_TARGET_LINK_DIRECTORIES}
439 | )
440 |
441 | set_target_properties(${PROJECT_NAME} PROPERTIES
442 | MACOSX_BUNDLE_GUI_IDENTIFIER ${DEVELOPER_BUNDLE_IDENTIFIER}
443 | MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
444 | MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
445 | MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/properties/${PLATFORM_FOLDER}/Info.plist.in"
446 | MACOSX_BUNDLE TRUE
447 | WIN32_EXECUTABLE TRUE
448 | )
449 |
450 | endif()
451 |
452 | target_compile_definitions(${PROJECT_NAME} PUBLIC ${LIB_TARGET_COMPILER_DEFINATION})
453 |
454 | #This command generates installation rules for a project.
455 | #Install rules specified by calls to the install() command within a source directory. are executed in order during installation.
456 | install(TARGETS ${PROJECT_NAME} DESTINATION build/bin)
457 |
458 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config/system-config.json DESTINATION ${CMAKE_BINARY_DIR}/config/)
459 |
460 | #Ignore unused files.
461 | list(APPEND CPACK_SOURCE_IGNORE_FILES /.git/ /build/ .gitignore .DS_Store)
462 |
463 | include(InstallRequiredSystemLibraries)
464 | set(CPACK_GENERATOR "TGZ;ZIP")
465 | set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
466 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A brief description of your project")
467 | include(CPack)
468 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | - Being respectful and inclusive of differing viewpoints and experiences.
12 | - Showing empathy towards others.
13 | - Using welcoming and inclusive language.
14 | - Gracefully accepting constructive criticism.
15 | - Focusing on what is best for the community.
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances.
20 | - Trolling, insulting/derogatory comments, and personal or political attacks.
21 | - Public or private harassment.
22 | - Publishing others' private information, such as physical or electronic addresses, without explicit permission.
23 | - Any other conduct that could be considered inappropriate in a professional setting.
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [opencode@genyleap.com]. All complaints will be reviewed and investigated promptly and fairly.
38 |
39 | All project team members are obligated to respect the privacy and security of the reporter of any incident.
40 |
41 | ## Enforcement Guidelines
42 |
43 | Project maintainers will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
44 |
45 | 1. **Correction**: Community members are encouraged to engage with the person(s) responsible for the unacceptable behavior to provide feedback and address the issue.
46 | 2. **Warning**: If the behavior continues, project maintainers may issue a formal warning that explains the consequences of continued unacceptable behavior.
47 | 3. **Temporary Ban**: If the behavior still continues after a warning, project maintainers may temporarily ban the person(s) responsible from participating in the project's communication channels or other project-related activities.
48 | 4. **Permanent Ban**: As a last resort, and with the approval of the project team, project maintainers may permanently ban the person(s) responsible from further participation in the project.
49 |
50 | ## Attribution
51 |
52 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
53 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Kambiz
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.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Modern Project-Template (PT)
2 | A template for modern C++ projects with useful features for developing cross-platform projects.
3 |
4 | ## Cross-Platform project structure based on CMake ##
5 | This repository is a modern project template based on C++ and CMake build tool.
6 |
7 | [](https://forthebadge.com)
8 |
9 | ## Top features:
10 | - ✅ Very easy management of dependencies.
11 | - ✅ Top level macro usage.
12 | - ✅ Customized project structure based on your program type.
13 | - ✅ Advanced microprocessors.
14 | - ✅ Cross-Platform
15 | - ✅ Adapted to latest language & compiler standards.
16 |
17 | ## Supported platforms:
18 |
19 | - [x] macOS
20 | - [x] Windows
21 | - [x] Linux
22 | - [x] freeBSD
23 | - [ ] OpenBSD
24 | - [ ] NetBSD
25 | - [x] iOS
26 | - [ ] watchOS
27 | - [x] Android
28 |
29 | ## Supported project type:
30 |
31 | - [x] Core Application
32 | - [x] Desktop Application
33 | - [x] Embedded Application
34 | - [x] Mobile Application
35 | - [x] Library
36 |
37 | ## Language Standard Support [C++2a or C++2b]
38 | - It depends on your compiler!
39 |
40 | ## Building
41 |
42 | - You need CMake tool for building source code
43 | - CMake 3.23 or higher is required.
44 |
45 | ```
46 | cd build
47 | cmake ..
48 | make
49 | ./ProjectTemplate
50 |
51 | ```
52 |
53 | > How to sync project from template source?
54 | - This feature is embedded in the project as Git Action.
55 |
56 | ## Customization options.
57 | ```
58 | cmake .. -DPROJECT_NAME="Your Project Name" -DPROJECT_CREATOR="Kambiz" -DPROJECT_VERSION_TYPE="beta" -DPROJECT_DESCRIPTION="This is my awesome project" -DPROJECT_LICENSE_TYPE="mit"
59 | ```
60 |
61 | ## Customization Note
62 | - Change PROJECT_NAME variable to your own project name.
63 | - Change PROJECT_CREATOR variable to your main project developer.
64 | - Change PROJECT_DESCRIPTION variable to your project description.
65 | - Change PROJECT_HOMEPAGE_URL variable to your project official url.
66 | - Change PROJECT_VERSION_TYPE variable to your project version based on semantic versioning.
67 |
68 | - The project output structure is based on "application" with gui by default, so if you want to change it, you should change the PROJECT_USAGE_TYPE and PROJECT_MAIN_TYPE variables.
69 | - Change the DEVELOPER_BUNDLE_IDENTIFIER variable for your own developer id, especially in Apple products, you should set it according to the bundle string in Xcode.
70 | - The language standard is based on C++17 by default, you can change it via CMAKE_CXX_STANDARD variable.
71 | - Finally, specify software version for the variables PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK.
72 | - Enjoy your project! :)
73 |
74 | ## CMake module option [Dependencies]
75 | - These features can be useful in downloading, building, and integrating prerequisites into your project.
76 | - So you can set cmake option variable for enabling them.
77 |
78 | - Include latest standard of C++
79 | ```
80 | cmake .. -DUSE_LATEST_STANDARD=true
81 | ```
82 |
83 | - Include Boost library
84 | - This option is currently usable if it's already installed on your system.
85 | - I'll work on the automatic downloader version as soon as possible.
86 | ```
87 | cmake .. -DUSE_BOOST=true
88 | ```
89 |
90 | - Include Qt Framework
91 | ```
92 | cmake .. -DGUI_APPLICATION=true
93 | ```
94 |
95 | - Force to update latest version of dependencies from repositories.
96 | ```
97 | cmake .. -DFORCE_UPGRADED_LIBS=false
98 | ```
99 |
100 |
101 | - Include UI
102 | ```
103 | cmake .. -DHAS_USER_INTERFACE=true
104 | ```
105 |
106 | - Include project main type by [stl, qt, qtwidget, qtquick]
107 | - stl (Your project will be based on stl [Default]).
108 | - qt (Your project will be based on Qt Core only [No GUI]).
109 | - qtwidget (Your project will be based on C++, QtWidget [Classic GUI]).
110 | - qtquick (Your project will be based on C++, QtQuick and QML [Modern GUI]).
111 | ```
112 | cmake .. -DPROJECT_MAIN_TYPE=stl
113 | ```
114 |
115 | - Project Type
116 | - Use these keys [application, library]
117 | ```
118 | cmake .. -DPROJECT_USAGE_TYPE=application
119 | ```
120 |
121 | - Project Type
122 | - Use these keys [application, library]
123 | ```
124 | cmake .. -DDEVELOPER_BUNDLE_IDENTIFIER=com.kambizasadzadeh.app
125 | ```
126 |
127 | - The Qt Quick Compiler is a development add-on for Qt Quick applications which allows you to compile QML source code into the final binary. When you use this add-on, the application's startup time is significantly improved and you no longer need to deploy .qml files together with the application.
128 | ```
129 | cmake .. -DUSE_QT_QUICK_COMPILER=false
130 | ```
131 |
132 | - Include Curl library
133 | ```
134 | cmake .. -DUSE_CURL=true
135 | ```
136 |
137 | - Include FMT library
138 | ```
139 | cmake .. -DUSE_FMT=true
140 | ```
141 |
142 | - Include CppCheck library
143 | ```
144 | cmake .. -DUSE_CPP_CHECK=true
145 | ```
146 |
147 | - Include Google-Test
148 | ```
149 | cmake .. -DUSE_GOOGLE_TEST=true
150 | ```
151 |
152 | - Include Doc-Test
153 | ```
154 | cmake .. -DUSE_DOC_TEST=true
155 | ```
156 |
157 | - Include Catch2
158 | ```
159 | cmake .. -DUSE_CATCH2=true
160 | ```
161 |
162 | - Include CTRE
163 | ```
164 | cmake .. -DUSE_CTRE=true
165 | ```
166 |
167 | - Include JSon library
168 | ```
169 | cmake .. -DUSE_JSON=true
170 | ```
171 |
172 | - Include OpenSSL
173 | ```
174 | cmake .. -DUSE_OPENSSL=true
175 | ```
176 |
177 | - Include ZLib
178 | ```
179 | cmake .. -DDUSE_ZLIB=true
180 | ```
181 |
182 | ## CMake module option [Compiler options]
183 |
184 | - Enabling the test of clang-tidy
185 | ```
186 | cmake .. -DENABLE_CLANG_TIDY=true
187 | ```
188 |
189 | - Build the project as minimally as possible
190 | ```
191 | cmake .. -DSIMPLE_BUILD=true
192 | ```
193 |
194 | - Enable address sanitizer
195 | ```
196 | cmake .. -DENABLE_ASAN=true
197 | ```
198 |
199 | - Enabling the build of safe codes only [check by warnings]!
200 | ```
201 | cmake .. -DENABLE_WARN_MODE=true
202 | ```
203 |
204 | - Enabling the build of safe codes only!
205 | ```
206 | cmake .. -DENABLE_SAFE_ONLY=true
207 | ```
208 |
209 | - Enable developer (debug) mode
210 | ```
211 | cmake .. -DBUILD_DEBUG_MODE=true
212 | ```
213 |
214 | - Enabling the build of debug logging
215 | ```
216 | cmake .. -DDEBUG_LOGGING=true
217 | ```
218 |
219 | - Build Static Version
220 | ```
221 | cmake .. -DENABLE_STATIC_LIB_BUILD=true
222 | ```
223 |
224 | - Developer mode
225 | ```
226 | cmake .. -DENABLE_DEVELOPER_MODE=true
227 | ```
228 |
229 | - Todo mode
230 | ```
231 | cmake .. -DENABLE_TODO_MODE=true
232 | ```
233 |
234 | - Experimental mode
235 | ```
236 | cmake .. -DENABLE_EXPERIMENTAL_MODE=true
237 | ```
238 |
239 | - Build Shared (Dynamic) Version
240 | ```
241 | cmake .. -ENABLE_SHARED_LIB_BUILD=true
242 | ```
243 |
244 | - Forcing to enable updated programming language.
245 | ```
246 | cmake .. -FORCE_LATEST_STANDARD_FEATURE=true
247 | ```
248 |
249 | - Optimization level.
250 | ```
251 | cmake .. -DOPTIMIZATION_LEVEL=0
252 | ```
253 | - O Disables optimization, no optimization, fast compilation and nicely debuggable code. (default)
254 | - 1 Some optimization. Is equivalent to 0 with no parameters. Optimization for code size and execution time, generate minimum size code.
255 | - 2 Moderate optimization, enables all standard optimizations. Optimization more for code size and execution time, optimizes code for maximum speed.
256 | - 3 Over and above 2, does aggressive optimizations that may not be compliant to language standard. Optimization more for code size and execution time
257 | - 4 Over and above 3, does aggressive optimizations that may not be compliant to language standard. Optimizations for size over optimizations for speed.
258 | - 5 O3 with fast none accurate math calculations, optimizations for speed over optimizations for size.
259 |
260 | You can set or change your project's basic information such as name, description, link, etc.
261 |
262 | ```
263 | set(PROJECT_NAME "ProjectTemplate" CACHE STRING "Project Name")
264 | set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Target Name")
265 | ```
266 |
267 | - Creator Name.
268 | ```
269 | set(PROJECT_CREATOR "Kambiz Asadzadeh")
270 | ```
271 |
272 | - Project name, language, description, url and version.
273 | ```
274 | project(
275 | ${PROJECT_NAME}
276 | LANGUAGES CXX
277 | DESCRIPTION "Description of your project."
278 | HOMEPAGE_URL "https://kambizasadzadeh.com"
279 | VERSION ${PROJECT_VERSION}
280 | )
281 | ```
282 |
283 | ## Configuration output
284 |
285 | ```bash
286 |
287 | -- The CXX compiler identification is AppleClang 12.0.0.12000032
288 | -- Detecting CXX compiler ABI info
289 | -- Detecting CXX compiler ABI info - done
290 | -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
291 | -- Detecting CXX compile features
292 | -- Detecting CXX compile features - done
293 | -- Ready for Apple Silicon.
294 | -- Performing Test COMPILER_SUPPORTS_CXX23
295 | -- Performing Test COMPILER_SUPPORTS_CXX23 - Success
296 | -- Performing Test COMPILER_SUPPORTS_CXX20
297 | -- Performing Test COMPILER_SUPPORTS_CXX20 - Success
298 | -- Performing Test COMPILER_SUPPORTS_CXX17
299 | -- Performing Test COMPILER_SUPPORTS_CXX17 - Success
300 | -- Performing Test COMPILER_SUPPORTS_CXX14
301 | -- Performing Test COMPILER_SUPPORTS_CXX14 - Success
302 | -- Performing Test COMPILER_SUPPORTS_CXX11
303 | -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
304 | -- Performing Test COMPILER_SUPPORTS_CXX0X
305 | -- Performing Test COMPILER_SUPPORTS_CXX0X - Success
306 |
307 | -- ------ ProjectTemplate Tools Configuration ------
308 | -- Language Standard : C++[20]
309 | -- Compiler : AppleClang
310 | -- Compiler Version : 12.0.0.12000032
311 | -- OS Target : Darwin-20.3.0
312 | -- OS Version :
313 | -- System Architecture : x86_64
314 | -- Project License : MIT
315 | -- ------ ProjectTemplate Framework Info ------
316 | -- Name : ProjectTemplate
317 | -- Description : Description of your project.
318 | -- Version :
319 | -- ------ ProjectTemplate Project Configuration ------
320 | -- DEVELOPER :
321 | -- PROJECT_PROJECT :
322 | -- PROJECT_TARGET : ProjectTemplate
323 | -- PROJECT_VERSION : 1.0.2.0
324 | -- PROJECT_VERSION_TYPE : final
325 | -- ------ ProjectTemplate Building Configuration ------
326 | -- PROJECT_BUILD_SHARED :
327 | -- PROJECT_VERSION_TAG_HEX : 0x00000000
328 | -- PROJECT_FOLDER_SUFFIX :
329 | -- LIBRARY_OUTPUT_PATH : .../Project-Template/build/lib
330 | -- CMAKE_CURRENT_SOURCE_DIR : .../Project-Template
331 | -- ------ ProjectTemplate End Configuration ------
332 | -- Configuring done
333 | ```
334 |
335 | ## Usage Example
336 | ```cpp
337 | #if defined(HAS_USER_INTERFACE) && defined(USE_QT)
338 | //! Qt
339 | #include
340 | #include
341 | #include
342 |
343 | int main(int argc, char *argv[])
344 | {
345 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
346 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
347 | #endif
348 |
349 | QGuiApplication app(argc, argv);
350 |
351 | QQmlApplicationEngine engine;
352 | const QUrl url(QStringLiteral("qrc:/main.qml"));
353 |
354 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
355 | &app, [url](QObject *obj, const QUrl &objUrl) {
356 | if (!obj && url == objUrl)
357 | QCoreApplication::exit(-1);
358 | }, Qt::QueuedConnection);
359 | engine.load(url);
360 |
361 | return app.exec();
362 | }
363 | #else
364 |
365 | #include
366 | #include "utilities/featuretest.hpp"
367 |
368 | //! Examples
369 | #include "examples/compilertest.hpp"
370 | #include "examples/platformtest.hpp"
371 | #include "examples/librarytest.hpp"
372 | #include "examples/languagetest.hpp"
373 | #include "examples/configtest.hpp"
374 |
375 | //!JSon [Non-STL] Features
376 | #include
377 |
378 | //!Google Test
379 | #ifdef USE_GOOGLE_TEST
380 | #include
381 |
382 | class Counter {
383 | public:
384 | // Returns the current counter value, and increments it.
385 | int Increment() {
386 | return m_counter++;
387 | }
388 |
389 | // Returns the current counter value, and decrements it.
390 | // counter can not be less than 0, return 0 in this case
391 | int Decrement() {
392 | if (m_counter == 0) {
393 | return m_counter;
394 | } else {
395 | return m_counter--;
396 | }
397 | }
398 |
399 | // Prints the current counter value to STDOUT.
400 | void Print() const {
401 | printf("%d", m_counter);
402 | }
403 | private:
404 | int m_counter;
405 | };
406 |
407 | //TEST UNIT
408 | TEST(Counter, Increment) {
409 | Counter c;
410 |
411 | // Test that counter 0 returns 0
412 | EXPECT_EQ(0, c.Decrement());
413 |
414 | // EXPECT_EQ() evaluates its arguments exactly once, so they
415 | // can have side effects.
416 |
417 | EXPECT_EQ(0, c.Increment());
418 | EXPECT_EQ(1, c.Increment());
419 | EXPECT_EQ(2, c.Increment());
420 |
421 | EXPECT_EQ(3, c.Decrement());
422 | }
423 |
424 | #endif
425 |
426 | //!Catch2
427 | #ifdef USE_CATCH2
428 | # include
429 |
430 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
431 |
432 | unsigned int Factorial( unsigned int number ) {
433 | return number <= 1 ? number : Factorial(number-1)*number;
434 | }
435 |
436 | TEST_CASE( "Factorials are computed", "[factorial]" ) {
437 | REQUIRE( Factorial(1) == 1 );
438 | REQUIRE( Factorial(2) == 2 );
439 | REQUIRE( Factorial(3) == 6 );
440 | REQUIRE( Factorial(10) == 3628800 );
441 | }
442 |
443 | #endif
444 |
445 | using namespace std;
446 |
447 | int main()
448 | {
449 | cout << "Hello World!" << endl;
450 |
451 | //!Config Test
452 | ConfigTest config;
453 | config.readSettings();
454 |
455 | //!Compiler Test
456 | CompilerTest compiler;
457 | compiler.getCompilerInfo();
458 |
459 | //!Platform Test
460 | PlatformTest platform;
461 | platform.getPlatformInfo();
462 |
463 | //!Library Test
464 | LibraryTest library;
465 | library.testBoost(); // Boost
466 |
467 | //!Language Features
468 | LanguageTest language;
469 | language.checkFeatures();
470 |
471 | //!ThirdParty Library
472 | ThirdPartyTest thirdPartyTest;
473 | thirdPartyTest.testFmt();
474 |
475 | return 0;
476 | }
477 |
478 | #endif
479 | ```
480 |
481 | ## More usage examples
482 | - Compiler Test
483 | ```cpp
484 | cout << "Compiler Name : " << __COMPILER__ << endl;
485 | cout << "Compiler Version : " << __COMPILER_VER__ << endl;
486 |
487 | #if defined(__COMPILER_CLANG_LLVM_)
488 | cout << "Clang compiler has been detected!\n";
489 | #elif defined(__COMPILER_INTEL__)
490 | cout << "Intel compiler has been detected!\n";
491 | #elif defined(__COMPILER_MINGW__)
492 | cout << "MinGW compiler has been detected!\n";
493 | #elif defined(__COMPILER_MINGW_64__)
494 | cout << "MinGW64 compiler has been detected!\n";
495 | #elif defined(__COMPILER_GCC__)
496 | cout << "GCC compiler has been detected!\n";
497 | #elif defined(__COMPILER__HEWLETT_)
498 | cout << "Hewlett compiler has been detected!\n";
499 | #elif defined(__COMPILER_IBM__)
500 | cout << "IBM compiler has been detected!\n";
501 | #elif defined(__COMPILER_MSVC__)
502 | cout << "MSVC compiler has been detected!\n";
503 | #elif defined(__COMPILER_PGCC__)
504 | cout << "PGCC compiler has been detected!\n";
505 | #elif defined(__COMPILER_ORACLE__)
506 | cout << "Oracle compiler has been detected!\n";
507 | #endif
508 |
509 | ```
510 | - Platform Test
511 | ```cpp
512 | #if defined(PLATFORM_MAC)
513 | cout << "This is macOS platform!\n";
514 | #elif defined(PLATFORM_WINDOWS)
515 | cout << "This is Windows platform!\n";
516 | #elif defined(PLATFORM_LINUX)
517 | cout << "This is Linux platform!\n";
518 | #elif defined(PLATFORM_FREEBSD)
519 | cout << "This is freeBSD platform!\n";
520 | #elif defined(PLATFORM_OPENBSD)
521 | cout << "This is openBSD platform!\n";
522 | #elif defined(PLATFORM_VXWORKS)
523 | cout << "This is VXWorks platform!\n";
524 | #elif defined(PLATFORM_MOTOROLA)
525 | cout << "This is Motorola platform!\n";
526 | #elif defined(PLATFORM_ULTRIX)
527 | cout << "This is Ultrix platform!\n";
528 | #elif defined(PLATFORM_DOS)
529 | cout << "This is Dos platform!\n";
530 | #elif defined(PLATFORM_WINDOWS_PHONE)
531 | cout << "This is Windows Phone platform!\n";
532 | #elif defined(PLATFORM_IOS_SIMULATOR)
533 | cout << "This is iOS Simulator platform!\n";
534 | #elif defined(PLATFORM_IOS)
535 | cout << "This is iOS platform!\n";
536 | #elif defined(PLATFORM_APPLE_TV)
537 | cout << "This is AppleTV platform!\n";
538 | #elif defined(PLATFORM_IWATCH)
539 | cout << "This is iWatch platform!\n";
540 | #elif defined(PLATFORM_ANDROID)
541 | cout << "This is Android platform!\n";
542 | #endif
543 | ```
544 | - Library Test
545 | ```cpp
546 | #include "include/common.hpp"
547 | #include
548 |
549 | #ifdef USE_BOOST
550 | #include
551 | #endif
552 |
553 | LibraryTest::LibraryTest()
554 | {
555 |
556 | }
557 |
558 | void LibraryTest::testBoost() const noexcept
559 | {
560 | //!Boost Library
561 | #ifdef USE_BOOST
562 | std::cout << "Boost version " << BOOST_VERSION << std::endl;
563 | std::cout << "Boost Lib Clock Test\n";
564 | boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now();
565 | for ( long i = 0; i < 10000000; ++i )
566 | std::sqrt( 123.456L ); // burn some time
567 | boost::chrono::duration sec = boost::chrono::system_clock::now() - start;
568 | std::cout << "took " << sec.count() << " seconds\n";
569 | #else
570 | std::cout << "Boost Library is not available.\n";
571 | #endif
572 |
573 | }
574 | ```
575 |
576 | - Language Test
577 | ```cpp
578 | #ifdef USE_FEATURE_TEST
579 | if (print.general_features) show("C++ GENERAL", cxx);
580 | if (print.cxx11 && print.core_features) show("C++11 CORE", cxx11);
581 | if (print.cxx14 && print.core_features) show("C++14 CORE", cxx14);
582 | if (print.cxx14 && print.lib_features ) show("C++14 LIB" , cxx14lib);
583 | if (print.cxx17 && print.core_features) show("C++17 CORE", cxx17);
584 | if (print.cxx17 && print.lib_features ) show("C++17 LIB" , cxx17lib);
585 | if (print.cxx20 && print.core_features) show("C++20 CORE", cxx20);
586 | if (print.cxx20 && print.lib_features ) show("C++20 LIB" , cxx20lib);
587 | if (print.cxx23 && print.core_features) show("C++23 CORE", cxx23);
588 | if (print.cxx23 && print.lib_features ) show("C++23 LIB" , cxx23lib);
589 | if (print.attributes) show("ATTRIBUTES", attributes);
590 | #else
591 | std::cout << "Test Feature is not available.\n";
592 | #endif
593 | ```
594 | - Config Test
595 | ```cpp
596 |
597 | #include "config.hpp"
598 | #include
599 |
600 | std::cout << "========CONFIG TEST========" << std::endl;
601 | std::cout << "Project Name : " << PROJECT_NAME << std::endl;
602 | std::cout << "Project Description : " << PROJECT_DESCRIPTION << std::endl;
603 | std::cout << "Project Homepage Url : " << PROJECT_HOMEPAGE_URL << std::endl;
604 | std::cout << "Project Language : " << PROJECT_LANGUAGES << std::endl;
605 | std::cout << "Project Full Version : " << PROJECT_VERSION_STRING << std::endl;
606 | std::cout << "Project Creator : " << PROJECT_CREATOR << std::endl;
607 | std::cout << "Project License Type : " << PROJECT_LICENSE_TYPE << std::endl;
608 | std::cout << "========CONFIG TEST========" << std::endl;
609 |
610 | ```
611 | ## If you want donate, Bitcoin address is here! <3
612 |
613 |
614 | ## TOOD
615 | - Bug fixing.
616 | - Add new exception handler.
617 | - Add new features.
618 | - Support new libraries.
619 | - Tell me your opinion about which other items should be added.
620 |
621 | ## Contribution
622 | - Bug fixes, docs, and enhancements welcome! Please let me know kambiz.ceo@gmail.com
623 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Reporting Security Issues
4 |
5 | The security of this project is of utmost importance. If you discover any security-related issues or vulnerabilities, please report them to our security team by emailing [security@genyleap.com](mailto:security@genyleap.com). Please refrain from publicly disclosing the issue until we have had a chance to address it.
6 |
7 | We appreciate your efforts in responsibly disclosing any security concerns and will make every effort to acknowledge your contributions.
8 |
9 | ## Supported Versions
10 |
11 | | Version | Supported |
12 | | ------- | ------------------ |
13 | | 1.x.x | :white_check_mark: |
14 | | 0.x.x | :x: |
15 |
16 | ## Reporting a Vulnerability
17 |
18 | If you believe you've found a vulnerability that has potential security implications, please help us by following these guidelines:
19 |
20 | - Provide a detailed description of the vulnerability, including steps to reproduce the issue.
21 | - Include information about the affected version(s) of the project.
22 | - If applicable, provide any additional resources or references that may assist in understanding and resolving the vulnerability.
23 | - If you have a suggested solution or mitigation for the vulnerability, please include it in your report.
24 |
25 | We will review and assess the vulnerability report promptly. Depending on the nature of the issue, we may reach out to you to gather more information or provide updates on the status of the vulnerability.
26 |
27 | ## Security Updates and Patching
28 |
29 | We are committed to addressing security issues promptly and providing updates and patches as necessary. After receiving a vulnerability report, our team will work diligently to investigate and address the issue.
30 |
31 | We will aim to provide regular updates on the progress of vulnerability resolution and the planned release schedule for patches or new versions.
32 |
33 | ## Acknowledgments
34 |
35 | We greatly appreciate your help in improving the security of this project.
36 |
37 | ## Responsible Disclosure
38 |
39 | We request that you follow responsible disclosure practices by not publicly disclosing any potential vulnerabilities until we have had sufficient time to address them.
40 |
41 | Please allow us a reasonable amount of time to investigate and resolve the issue before sharing any details publicly.
42 |
43 | ## Contact
44 |
45 | If you have any questions or concerns regarding the security of this project, please contact our security team at [security@genyleap.com](mailto:security@genyleap.com).
46 |
47 |
--------------------------------------------------------------------------------
/cmake/color-message.cmake:
--------------------------------------------------------------------------------
1 | # Define color codes for terminal output
2 | if(NOT WIN32)
3 | string(ASCII 27 Esc)
4 | set(ColourReset "${Esc}[m")
5 | set(Bold "${Esc}[1m")
6 | set(Underscore "${Esc}[4m")
7 | set(Red "${Esc}[31m")
8 | set(Green "${Esc}[32m")
9 | set(Yellow "${Esc}[33m")
10 | set(Blue "${Esc}[34m")
11 | set(Magenta "${Esc}[35m")
12 | set(Cyan "${Esc}[36m")
13 | set(White "${Esc}[37m")
14 | set(BoldRed "${Esc}[1;31m")
15 | set(BoldGreen "${Esc}[1;32m")
16 | set(BoldYellow "${Esc}[1;33m")
17 | set(BoldBlue "${Esc}[1;34m")
18 | set(BoldMagenta "${Esc}[1;35m")
19 | set(BoldCyan "${Esc}[1;36m")
20 | set(BoldWhite "${Esc}[1;37m")
21 | endif()
22 |
23 | # Function to print colored messages to the terminal
24 | function(ColorMessage)
25 | list(GET ARGV 0 MessageType)
26 | # Determine the message type and apply the appropriate color
27 | if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
28 | list(REMOVE_AT ARGV 0)
29 | message(${MessageType} "${BoldRed}>> ${ARGV}${ColourReset}")
30 | elseif(MessageType STREQUAL WARNING)
31 | list(REMOVE_AT ARGV 0)
32 | message(${MessageType} "${BoldYellow}>> ${ARGV}${ColourReset}")
33 | elseif(MessageType STREQUAL AUTHOR_WARNING)
34 | list(REMOVE_AT ARGV 0)
35 | message(${MessageType} "${BoldCyan}>> ${ARGV}${ColourReset}")
36 | elseif(MessageType STREQUAL STATUS)
37 | list(REMOVE_AT ARGV 0)
38 | message(${MessageType} "${Green}>> ${ARGV}${ColourReset}")
39 | elseif(MessageType STREQUAL INFO)
40 | list(REMOVE_AT ARGV 0)
41 | message("-- ${BoldBlue}>> ${ARGV}${ColourReset}")
42 | elseif(MessageType STREQUAL NOTICE)
43 | list(REMOVE_AT ARGV 0)
44 | message("-- ${Blue}>> ${ARGV}${ColourReset}")
45 | elseif(MessageType STREQUAL IMPORTANT)
46 | list(REMOVE_AT ARGV 0)
47 | message("-- ${Yellow}>> ${ARGV}${ColourReset}")
48 | elseif(MessageType STREQUAL MORE_IMPORTANT)
49 | list(REMOVE_AT ARGV 0)
50 | message("-- ${BoldYellow}>> ${ARGV}${ColourReset}")
51 | else()
52 | # Default message without color
53 | message(">> ${ARGV}")
54 | endif()
55 | endfunction()
56 |
--------------------------------------------------------------------------------
/cmake/compiler-options.cmake:
--------------------------------------------------------------------------------
1 | include(CheckCXXCompilerFlag)
2 |
3 | CHECK_CXX_COMPILER_FLAG("-std=c++26" COMPILER_SUPPORTS_CXX26)
4 | CHECK_CXX_COMPILER_FLAG("-std=c++23" COMPILER_SUPPORTS_CXX23)
5 | CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20)
6 | CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
7 | CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
8 | CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
9 | CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
10 |
11 | if(COMPILER_SUPPORTS_CXX26)
12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++26")
13 | elseif(COMPILER_SUPPORTS_CXX23)
14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23")
15 | elseif(COMPILER_SUPPORTS_CXX23)
16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
17 | elseif(COMPILER_SUPPORTS_CXX20)
18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
19 | elseif(COMPILER_SUPPORTS_CXX14)
20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
21 | elseif(COMPILER_SUPPORTS_CXX11)
22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
23 | elseif(COMPILER_SUPPORTS_CXX0X)
24 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
25 | else()
26 | message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
27 | endif()
28 |
29 | set(OPTIMIZATION_LEVEL "0" CACHE STRING "Optimization Level")
30 | if (OPTIMIZATION_LEVEL)
31 | add_definitions(-DOPTIMIZATION_LEVEL)
32 | endif()
33 |
34 | # -lstdc++: Links against the GNU Standard C++ Library.
35 | # -lc++: Links against the libc++ library (used in Clang/LLVM compiler).
36 | # -lc++abi: Links against the libc++abi library, which provides low-level support for the C++ runtime (used in Clang/LLVM compiler).
37 | # Note: Both GCC and MSVC, you generally don't need to explicitly include flags like -lc++abi or their equivalents.
38 |
39 | # C++ STL Library Features.
40 | if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
41 | set(CMAKE_CXX_STANDARD_LIBRARIES "-lstdc++")
42 | endif()
43 |
44 | # Multi-threaded DLL runtime library (/MD or /MDd)
45 | if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
46 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD")
47 | endif()
48 |
49 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
50 | set(CMAKE_CXX_STANDARD_LIBRARIES "-lc++ -lc++abi")
51 | endif()
52 |
53 |
54 | if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
55 | message("-- CMake run for msvc")
56 | if(OPTIMIZATION_LEVEL EQUAL "0")
57 | set(CMAKE_CXX_FLAGS_DEBUG "/Z7 /Od")
58 | set(CMAKE_CXX_FLAGS_RELEASE "/Od")
59 | endif()
60 | if(OPTIMIZATION_LEVEL EQUAL "1")
61 | set(CMAKE_CXX_FLAGS_DEBUG "/Zi /O1")
62 | set(CMAKE_CXX_FLAGS_RELEASE "/O1")
63 | endif()
64 | if(OPTIMIZATION_LEVEL EQUAL "2")
65 | set(CMAKE_CXX_FLAGS_DEBUG "/Zi /O2")
66 | set(CMAKE_CXX_FLAGS_RELEASE "/O2")
67 | endif()
68 | if(OPTIMIZATION_LEVEL EQUAL "3")
69 | set(CMAKE_CXX_FLAGS_DEBUG "-ZI -Oi")
70 | set(CMAKE_CXX_FLAGS_RELEASE "-Oi")
71 | endif()
72 | if(OPTIMIZATION_LEVEL EQUAL "4")
73 | set(CMAKE_CXX_FLAGS_DEBUG "-ZI /Os")
74 | set(CMAKE_CXX_FLAGS_RELEASE "/Os")
75 | endif()
76 | if(OPTIMIZATION_LEVEL EQUAL "5")
77 | set(CMAKE_CXX_FLAGS_DEBUG "-ZI /Ot")
78 | set(CMAKE_CXX_FLAGS_RELEASE "/Ot")
79 | endif()
80 | else()
81 | message("-- CMake run for GNU")
82 | if(OPTIMIZATION_LEVEL EQUAL "0")
83 | set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
84 | set(CMAKE_CXX_FLAGS_RELEASE "-O0")
85 | endif()
86 | if(OPTIMIZATION_LEVEL EQUAL "1")
87 | set(CMAKE_CXX_FLAGS_DEBUG "-g -O1")
88 | set(CMAKE_CXX_FLAGS_RELEASE "-O1")
89 | endif()
90 | if(OPTIMIZATION_LEVEL EQUAL "2")
91 | set(CMAKE_CXX_FLAGS_DEBUG "-g -O2")
92 | set(CMAKE_CXX_FLAGS_RELEASE "-O2")
93 | endif()
94 | if(OPTIMIZATION_LEVEL EQUAL "3")
95 | set(CMAKE_CXX_FLAGS_DEBUG "-g -O3")
96 | set(CMAKE_CXX_FLAGS_RELEASE "-O3")
97 | endif()
98 | if(OPTIMIZATION_LEVEL EQUAL "4")
99 | set(CMAKE_CXX_FLAGS_DEBUG "-g -Os")
100 | set(CMAKE_CXX_FLAGS_RELEASE "-Os")
101 | endif()
102 | if(OPTIMIZATION_LEVEL EQUAL "5")
103 | set(CMAKE_CXX_FLAGS_DEBUG "-g -Ofast")
104 | set(CMAKE_CXX_FLAGS_RELEASE "-Ofast")
105 | endif()
106 | endif()
107 |
108 | # Enable optional features
109 | option(ENABLE_MODULES "Enable C++20 modules" OFF)
110 | if(ENABLE_MODULES)
111 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmodules")
112 | add_definitions(-DENABLE_MODULES)
113 | endif()
114 |
115 | # Debug/Testing Modes
116 | option(ENABLE_DEBUG_LOGGING "Enable debug logging" OFF)
117 | option(ENABLE_TESTING "Enable testing mode" OFF)
118 | if(ENABLE_DEBUG_LOGGING)
119 | add_definitions(-DDEBUG_LOGGING)
120 | endif()
121 | if(ENABLE_TESTING)
122 | add_definitions(-DENABLE_TESTING)
123 | endif()
124 |
125 | #########################
126 | # --- Build Options --- #
127 | #########################
128 |
129 | # Use Feature Test library
130 | option(USE_FEATURE_TEST "Use Feature Test library" OFF)
131 | if (USE_FEATURE_TEST)
132 | add_definitions(-DUSE_FEATURE_TEST)
133 | endif()
134 |
135 | # Use Https/SSL system
136 | option(USE_SSL_METHOD "Use Https/SSL system" OFF)
137 | if (USE_SSL_METHOD)
138 | add_definitions(-DUSE_SSL_METHOD)
139 | endif()
140 |
141 | # Use test mode
142 | option(ENABLE_TESTING "Use test mode" OFF)
143 | if (ENABLE_TESTING)
144 | add_definitions(-DENABLE_TESTING)
145 | endif()
146 |
147 | # Enable the test of clang-tidy
148 | option(ENABLE_CLANG_TIDY "Enabling the test of clang-tidy" OFF)
149 | if (ENABLE_CLANG_TIDY)
150 | add_definitions(-DENABLE_CLANG_TIDY)
151 | endif()
152 |
153 | # Enable the test of cppcheck
154 | option(ENABLE_CPPCHECK "Enabling the test of cppcheck" OFF)
155 | if (ENABLE_CPPCHECK)
156 | add_definitions(-DENABLE_CPPCHECK)
157 | endif()
158 |
159 | # Build the project as minimally as possible
160 | option(SIMPLE_BUILD "Build the project as minimally as possible" OFF)
161 | if (SIMPLE_BUILD)
162 | add_definitions(-DSIMPLE_BUILD)
163 | endif()
164 |
165 | # Build the project's documentation
166 | option(BUILD_DOC "Build the project's documentation" OFF)
167 | if (BUILD_DOC)
168 | add_definitions(-DBUILD_DOC)
169 | endif()
170 |
171 | # Compile Qt Quick (QML) files
172 | option(USE_QT_QUICK_COMPILER "Compile Qt Quick (QML) files." OFF)
173 | if (USE_QT_QUICK_COMPILER)
174 | add_definitions(-DUSE_QT_QUICK_COMPILER)
175 | endif()
176 |
177 | # Developer Mode
178 | option(ENABLE_DEVELOPER_MODE "Developer Mode" ON)
179 | if (ENABLE_DEVELOPER_MODE)
180 | add_definitions(-DENABLE_DEVELOPER_MODE)
181 | endif()
182 |
183 | # Todo Mode (Not activated feature!)
184 | option(ENABLE_TODO_MODE "Todo Mode (Not activated feature!)" ON)
185 | if (ENABLE_TODO_MODE)
186 | add_definitions(-DENABLE_TODO_MODE)
187 | endif()
188 |
189 | # Experimental Mode
190 | option(ENABLE_EXPERIMENTAL_MODE "Experimental Mode" ON)
191 | if (ENABLE_EXPERIMENTAL_MODE)
192 | add_definitions(-DENABLE_EXPERIMENTAL_MODE)
193 | endif()
194 |
195 | # Always produce ANSI-colored output (GNU/Clang only).
196 | option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
197 | if (FORCE_COLORED_OUTPUT)
198 | add_definitions(-DFORCE_COLORED_OUTPUT)
199 | endif()
200 |
201 | # Enable safe codes only!
202 | option(ENABLE_SAFE_ONLY "Enable safe codes only!" OFF)
203 | if (ENABLE_SAFE_ONLY)
204 | add_definitions(-DENABLE_SAFE_ONLY)
205 | if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
206 | SET (CMAKE_CXX_FLAGS "/Wall /WX")
207 | else()
208 | SET (CMAKE_CXX_FLAGS "-Wall -Wextra -Werror")
209 | endif()
210 | endif()
211 |
212 | # Enable full warnings for the compiler!
213 | option(ENABLE_WARN_MODE "Enable full warnings for compiler!" OFF)
214 | if (ENABLE_WARN_MODE)
215 | add_definitions(-DENABLE_WARN_MODE)
216 | if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
217 | SET (CMAKE_CXX_FLAGS "/Wall")
218 | else()
219 | SET (CMAKE_CXX_FLAGS "-Wall")
220 | endif()
221 | endif()
222 |
223 | # Enable developer (debug) mode
224 | option(BUILD_DEBUG_MODE "Enable developer (debug) mode" ON)
225 | if (BUILD_DEBUG_MODE)
226 | add_definitions(-DBUILD_DEBUG_MODE)
227 | endif()
228 |
229 | # Enabling the build of debug logging
230 | option(DEBUG_LOGGING "Enabling the build of debug logging" OFF)
231 | if (DEBUG_LOGGING)
232 | add_definitions(-DDEBUG_LOGGING)
233 | endif()
234 |
235 | # Build Static Version
236 | option(ENABLE_STATIC_LIB_BUILD "Build Static Version" OFF)
237 | if (ENABLE_STATIC_LIB_BUILD)
238 | add_definitions(-DENABLE_STATIC_LIB_BUILD)
239 | endif()
240 |
241 | # Build Shared Version
242 | option(ENABLE_SHARED_LIB_BUILD "Build Shared Version" OFF)
243 | if (ENABLE_SHARED_LIB_BUILD)
244 | add_definitions(-DENABLE_SHARED_LIB_BUILD)
245 | endif()
246 |
247 | # Build Executable Version
248 | option(ENABLE_BINARY_BUILD "Build Executable Version" ON)
249 | if (ENABLE_BINARY_BUILD)
250 | add_definitions(-DENABLE_BINARY_BUILD)
251 | endif()
252 |
253 | # Header Only Version
254 | option(ENABLE_HEADER_ONLY_BUILD "Header Only Version" OFF)
255 | if (ENABLE_HEADER_ONLY_BUILD)
256 | add_definitions(-DENABLE_HEADER_ONLY_BUILD)
257 | endif()
258 |
259 | # Forcing to enable updated programming language.
260 | option(FORCE_LATEST_STANDARD_FEATURE "Forcing to enable updated programming language." OFF)
261 | if (FORCE_LATEST_STANDARD_FEATURE)
262 | add_definitions(-DFORCE_LATEST_STANDARD_FEATURE)
263 | endif()
264 |
265 | # Sanitizers Options
266 | option(ENABLE_SANITIZERS "Enable Sanitizers" OFF)
267 | option(ENABLE_ADDRESS_SANITIZER "Enable AddressSanitizer (ASan)" OFF)
268 | option(ENABLE_LEAK_SANITIZER "Enable LeakSanitizer (LSan)" OFF)
269 | option(ENABLE_MEMORY_SANITIZER "Enable MemorySanitizer" OFF)
270 | option(ENABLE_THREAD_SANITIZER "Enable ThreadSanitizer" OFF)
271 | option(ENABLE_UNDEFINED_SANITIZER "Enable UndefinedBehaviorSanitizer" OFF)
272 |
273 | if (ENABLE_SANITIZERS)
274 | add_definitions(-DENABLE_SANITIZERS)
275 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
276 | if (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
277 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
278 | else()
279 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,leak,undefined")
280 | endif()
281 | if (ENABLE_MEMORY_SANITIZER AND NOT APPLE)
282 | add_definitions(-DENABLE_MEMORY_SANITIZER)
283 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory")
284 | endif()
285 | if (ENABLE_THREAD_SANITIZER)
286 | add_definitions(-DENABLE_THREAD_SANITIZER)
287 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
288 | endif()
289 | if (ENABLE_UNDEFINED_SANITIZER)
290 | add_definitions(-DENABLE_UNDEFINED_SANITIZER)
291 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
292 | endif()
293 | if (APPLE)
294 | message(STATUS "Sanitizers are based on Clang on macOS.")
295 | endif()
296 | elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT APPLE)
297 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,leak,undefined")
298 | elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND APPLE)
299 | message(WARNING "Sanitizer is not supported with GCC on macOS. Ignoring the options.")
300 | else()
301 | message(WARNING "Unsupported compiler. Sanitizers are disabled.")
302 | endif()
303 | else()
304 | # Check and enable individual sanitizers
305 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
306 | foreach(SANITIZER IN ITEMS ADDRESS LEAK MEMORY THREAD UNDEFINED)
307 | if ("ENABLE_${SANITIZER}_SANITIZER")
308 | add_definitions(-DENABLE_${SANITIZER}_SANITIZER)
309 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZER}")
310 | endif()
311 | endforeach()
312 | elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT APPLE)
313 | foreach(SANITIZER IN ITEMS ADDRESS LEAK MEMORY THREAD UNDEFINED)
314 | if ("ENABLE_${SANITIZER}_SANITIZER")
315 | add_definitions(-DENABLE_${SANITIZER}_SANITIZER)
316 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZER}")
317 | endif()
318 | endforeach()
319 | else()
320 | message(WARNING "Unsupported compiler. Sanitizers are disabled.")
321 | endif()
322 | endif()
323 |
324 |
325 | # Summary
326 | message(STATUS "Final compiler flags: ${CMAKE_CXX_FLAGS}")
327 |
--------------------------------------------------------------------------------
/cmake/cross-compile.cmake:
--------------------------------------------------------------------------------
1 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
2 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms-toolchain/")
3 |
4 | # ------ CROSS-COMPILE CONFIG ------
5 | if (EXISTS "${CMAKE_CXX_COMPILER}")
6 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
7 | OUTPUT_VARIABLE EMCC_VERSION
8 | ERROR_VARIABLE EMCC_VERSION)
9 | if (EMCC_VERSION MATCHES "Emscripten")
10 | message(STATUS "Ready for Wasm...")
11 | set(WASM TRUE)
12 | set(PLATFORM_OS "Web")
13 | set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
14 | include(wasm-toolchain)
15 | if(wasm-toolchain)
16 | return()
17 | endif()
18 | set(wasm-toolchain ON)
19 | endif()
20 | endif()
21 |
22 | #LINUX
23 | if(LINUX AND NOT ANDROID AND NOT APPLE)
24 | message(STATUS "Ready for LINUX.")
25 | set(LINUX TRUE)
26 | set(PLATFORM_OS "Linux")
27 | set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
28 | include(linux-toolchain)
29 | set(linux-toolchain ON)
30 | if(linux-toolchain)
31 | return()
32 | endif()
33 | endif()
34 |
35 | #ANDROID
36 | if(ANDROID AND NOT APPLE)
37 | message(STATUS "Ready for Android.")
38 | set(ANDROID TRUE)
39 | set(PLATFORM_OS "Android")
40 | set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
41 | include(android-toolchain)
42 | if(android-toolchain)
43 | return()
44 | endif()
45 | set(android-toolchain ON)
46 | endif()
47 |
48 | #APPLE SILICON
49 | if(UNIX AND NOT ANDROID AND NOT LINUX AND APPLE)
50 | message(STATUS "Ready for Apple Silicon.")
51 | if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
52 | message(STATUS "Ready for macOS.")
53 | set(MACOSX TRUE)
54 | set(PLATFORM_OS "macOS")
55 | set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
56 | include(macos-toolchain)
57 | if(macos-toolchain)
58 | return()
59 | endif()
60 | set(macos-toolchain ON)
61 | endif()
62 | endif()
63 |
64 | #iOS
65 | if(UNIX AND NOT ANDROID AND NOT LINUX AND APPLE)
66 | if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
67 | message(STATUS "Ready for iOS.")
68 | set(PLATFORM_OS "iOS")
69 | set(OS_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
70 | include(ios-toolchain)
71 | if(ios-toolchain)
72 | return()
73 | endif()
74 | set(ios-toolchain ON)
75 | endif()
76 | endif()
77 |
78 | #FREEBSD
79 | if(UNIX AND NOT ANDROID AND NOT LINUX AND NOT APPLE AND NOT WASM)
80 | message(STATUS "Ready for Unix, BSDs...")
81 | set(UNIX TRUE)
82 | set(PLATFORM_OS "Unix")
83 | set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR})
84 | include(unix-toolchain)
85 | if(unix-toolchain)
86 | return()
87 | endif()
88 | set(unix-toolchain ON)
89 | endif()
90 |
91 | #Windows
92 | if(WIN32)
93 | set(WINDOWS TRUE)
94 | message(STATUS "Ready for Windows.")
95 | include(windows-toolchain)
96 | if(windows-toolchain)
97 | return()
98 | endif()
99 | set(windows-toolchain ON)
100 | endif()
101 |
--------------------------------------------------------------------------------
/cmake/packages.cmake:
--------------------------------------------------------------------------------
1 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
2 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages")
3 |
4 | set(THIRD_PARTY "third-party" CACHE STRING "3rdparty folder for project dependencies. [Don't change this variable.]")
5 |
6 | find_package(Git)
7 | if(Git_FOUND)
8 | message("Git found: ${GIT_EXECUTABLE}")
9 | endif()
10 |
11 | find_package(Boost REQUIRED)
12 | find_package(OpenSSL REQUIRED)
13 | find_package(Cryptopp REQUIRED)
14 | find_package(OpenCV REQUIRED)
15 | find_package(OpenMesh REQUIRED)
16 | find_package(GTest REQUIRED)
17 | find_package(DocTest REQUIRED)
18 | find_package(Catch2 REQUIRED)
19 | find_package(Curl REQUIRED)
20 | find_package(Fmt REQUIRED)
21 | find_package(Jwt REQUIRED)
22 | find_package(JSon REQUIRED)
23 | find_package(Ctre REQUIRED)
24 | find_package(Zlib REQUIRED)
25 | find_package(Eigen REQUIRED)
26 |
27 | if (USE_CUSTOM_ENGINE)
28 | find_package(${ENGINE_CODE_NAME} REQUIRED)
29 | endif()
30 |
--------------------------------------------------------------------------------
/cmake/packages/FindBoost.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(BOOST_NAME "Boost")
3 | set(BOOST_DESCRIPTION "The Boost project provides free peer-reviewed portable C++ source libraries.")
4 | # Pakcage option.
5 | option(USE_BOOST ${BOOST_DESCRIPTION} FALSE)
6 | if (USE_BOOST)
7 | add_definitions(-DUSE_BOOST)
8 | # Define the repository URL and tag for the Boost libraries
9 | set(BOOST_URL "https://github.com/boostorg/boost.git")
10 | if(FORCE_UPGRADED_LIBS)
11 | set(BOOST_TAG "master")
12 | else()
13 | set(BOOST_TAG "boost-1.82.0")
14 | endif()
15 | set(BOOST_LIB_LIST "Boost::system;Boost::chrono;Boost::filesystem;Boost::json" CACHE STRING "List of modules (separated by a semicolon)")
16 | endif()
17 |
18 | find_package(PkgConfig QUIET)
19 | pkg_search_module(Boost boost)
20 | # Package data repository.
21 | if(USE_BOOST)
22 | set(FETCHCONTENT_QUIET off)
23 | get_filename_component(boost_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${BOOST_NAME}"
24 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
25 | set(FETCHCONTENT_BASE_DIR ${boost_base})
26 | # Declare the Boost libraries with their submodules using FetchContent_Declare
27 | FetchContent_Declare(
28 | boost
29 | GIT_REPOSITORY ${BOOST_URL}
30 | GIT_TAG ${BOOST_TAG}
31 | GIT_PROGRESS TRUE
32 | USES_TERMINAL_DOWNLOAD TRUE
33 | )
34 | # Check if population has already been performed
35 | FetchContent_GetProperties(boost)
36 | string(TOLOWER "${BOOST_NAME}" lcName)
37 | if(NOT ${lcName}_POPULATED)
38 | FetchContent_Populate(${lcName})
39 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
40 | endif()
41 | FetchContent_MakeAvailable(boost)
42 | foreach(module IN LISTS BOOST_LIB_LIST)
43 | list(APPEND LIB_MODULES ${module})
44 | endforeach()
45 | endif()
46 | if(NOT BOOST_FOUND)
47 | return()
48 | endif()
49 |
--------------------------------------------------------------------------------
/cmake/packages/FindCatch2.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(CATCH2_NAME "Catch2")
3 | set(CATCH2_DESCRIPTION "A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch).")
4 |
5 | # Pakcage option.
6 | option(USE_CATCH2 ${CATCH2_DESCRIPTION} FALSE)
7 | if (USE_CATCH2)
8 | add_definitions(-DUSE_CATCH2)
9 | # Define the repository URL and tag for the Catch2 libraries
10 | set(CATCH2_URL "https://github.com/catchorg/Catch2.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(CATCH2_TAG "master")
13 | else()
14 | set(CATCH2_TAG "v3.3.2")
15 | endif()
16 | set(CATCH2_LIB_LIST "Catch2" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(Catch2 catch2)
21 | # Package data repository.
22 | if(USE_CATCH2)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(catch2_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/catch2"
25 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
26 | set(FETCHCONTENT_BASE_DIR ${catch2_base})
27 | FetchContent_Declare(
28 | catch2
29 | GIT_REPOSITORY ${CATCH2_URL}
30 | GIT_TAG ${CATCH2_TAG}
31 | GIT_PROGRESS TRUE
32 | USES_TERMINAL_DOWNLOAD TRUE
33 | )
34 |
35 | # Check if population has already been performed
36 | FetchContent_GetProperties(catch2)
37 | string(TOLOWER "catch2" lcName)
38 | if(NOT ${lcName}_POPULATED)
39 | FetchContent_Populate(${lcName})
40 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
41 | endif()
42 | FetchContent_MakeAvailable(catch2)
43 | foreach(module IN LISTS CATCH2_LIB_LIST)
44 | list(APPEND LIB_MODULES ${module})
45 | endforeach()
46 | endif()
47 | if(NOT CATCH2_FOUND)
48 | return()
49 | endif()
50 |
51 |
--------------------------------------------------------------------------------
/cmake/packages/FindCell.cmake:
--------------------------------------------------------------------------------
1 | #Package Info.
2 | set(ENGINE_NAME "Cell")
3 | set(ENGINE_DESCRIPTION "Cell Engine is a new and exclusive cross-platform computer application engine based on Modern C++.")
4 |
5 | message("Preparing for " ${ENGINE_NAME} "Engine")
6 |
7 | find_package(PkgConfig QUIET)
8 | pkg_search_module(${ENGINE_NAME} cell)
9 | #Package data repository.
10 |
11 | set(FETCHCONTENT_QUIET off)
12 | get_filename_component(cell_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${ENGINE_NAME}"
13 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
14 | set(FETCHCONTENT_BASE_DIR ${cell_base})
15 | FetchContent_Declare(
16 | cell
17 | GIT_REPOSITORY https://github.com/genyleap/cell.git
18 | GIT_TAG main
19 | GIT_PROGRESS TRUE
20 | )
21 | # Check if population has already been performed
22 | FetchContent_GetProperties(cell)
23 | string(TOLOWER "${ENGINE_NAME}" lcName)
24 | if(NOT ${lcName}_POPULATED)
25 | FetchContent_Populate(${lcName})
26 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
27 | endif()
28 | FetchContent_MakeAvailable(cell)
29 | include_directories(${${lcName}_INCLUDE_DIR})
30 | list(APPEND LIB_MODULES cell_lib)
31 |
32 | if(NOT CELL_FOUND)
33 | return()
34 | endif()
35 |
--------------------------------------------------------------------------------
/cmake/packages/FindCppCheck.cmake:
--------------------------------------------------------------------------------
1 | #Package Info.
2 | set(CPPCHECK_NAME "CppCheck")
3 | set(CPPCHECK_DESCRIPTION "Static analysis of C/C++ code.")
4 |
5 | #Pakcage option.
6 | option(USE_CPP_CHECK ${CPPCHECK_DESCRIPTION} FALSE)
7 | if (USE_CPP_CHECK)
8 | add_definitions(-DUSE_CPP_CHECK)
9 | endif()
10 |
11 | if(USE_CPP_CHECK)
12 | externalproject_add(${CPPCHECK_NAME}
13 | GIT_REPOSITORY "https://github.com/danmar/cppcheck.git"
14 | GIT_TAG main
15 | INSTALL_DIR "${CMAKE_BINARY_DIR}/install/${CPPCHECK_NAME}"
16 | CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${CPPCHECK_NAME}
17 | CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${CPPCHECK_NAME}
18 | UPDATE_COMMAND ""
19 | )
20 | endif()
21 | if(NOT CPPCHECK_FOUND)
22 | return()
23 | endif()
24 |
--------------------------------------------------------------------------------
/cmake/packages/FindCryptopp.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(CRYPTOPP_NAME "Cryptopp")
3 | set(CRYPTOPP_DESCRIPTION "free C++ class library of cryptographic schemes")
4 |
5 | # Pakcage option.
6 | option(USE_CRYPTOPP ${CRYPTOPP_DESCRIPTION} FALSE)
7 | if (USE_CRYPTOPP)
8 | add_definitions(-DUSE_CRYPTOPP)
9 | # Define the repository URL and tag for the CRYPTOPP libraries
10 | set(CRYPTOPP_URL "https://github.com/weidai11/cryptopp.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(CRYPTOPP_TAG "master")
13 | else()
14 | set(CRYPTOPP_TAG "CRYPTOPP_8_7_0")
15 | endif()
16 | set(CRYPTOPP_LIB_LIST "cryptopp" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | if(USE_CRYPTOPP)
20 | set(FETCHCONTENT_QUIET off)
21 | get_filename_component(cryptopp_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${CRYPTOPP_NAME}"
22 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
23 | set(FETCHCONTENT_BASE_DIR ${cryptopp_base})
24 | FetchContent_Declare(
25 | cryptopp
26 | GIT_REPOSITORY ${CRYPTOPP_URL}
27 | GIT_TAG ${CRYPTOPP_TAG}
28 | GIT_PROGRESS TRUE
29 | )
30 | # Check if population has already been performed
31 | FetchContent_GetProperties(cryptopp)
32 | string(TOLOWER "${CRYPTOPP_NAME}" lcName)
33 | if(NOT ${lcName}_POPULATED)
34 | FetchContent_Populate(${lcName})
35 | add_library(${lcName} STATIC ${${lcName}_SOURCE_DIR}/cryptlib.cpp)
36 | endif()
37 | FetchContent_MakeAvailable(cryptopp)
38 | include_directories(${${lcName}_SOURCE_DIR})
39 | foreach(module IN LISTS CRYPTOPP_LIB_LIST)
40 | list(APPEND LIB_MODULES ${module})
41 | endforeach()
42 | endif()
43 | if(NOT CRYPTOPP_FOUND)
44 | return()
45 | endif()
46 |
--------------------------------------------------------------------------------
/cmake/packages/FindCtre.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(CTRE_NAME "Ctre")
3 | set(CTRE_DESCRIPTION "A Compile time PCRE (almost) compatible regular expression matcher.")
4 |
5 | # Pakcage option.
6 | option(USE_CTRE ${CTRE_DESCRIPTION} FALSE)
7 | if (USE_CTRE)
8 | add_definitions(-DUSE_CTRE)
9 | # Define the repository URL and tag for the Ctre libraries
10 | set(CTRE_URL "https://github.com/hanickadot/compile-time-regular-expressions.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(CTRE_TAG "main")
13 | else()
14 | set(CTRE_TAG "v3.7.2")
15 | endif()
16 | set(CTRE_LIB_LIST "ctre" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(${DOCTEST_NAME} ctre)
21 | # Package data repository.
22 | if(USE_CTRE_NAME)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(ctre_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${CTRE_NAME}"
25 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
26 | set(FETCHCONTENT_BASE_DIR ${ctre_base})
27 | FetchContent_Declare(
28 | ctre
29 | GIT_REPOSITORY ${CTRE_URL}
30 | GIT_TAG ${CTRE_TAG}
31 | GIT_PROGRESS TRUE
32 | )
33 | # Check if population has already been performed
34 | FetchContent_GetProperties(ctre)
35 | string(TOLOWER "ctre" lcName)
36 | if(NOT ${lcName}_POPULATED)
37 | FetchContent_Populate(${lcName})
38 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
39 | endif()
40 | FetchContent_MakeAvailable(ctre)
41 | foreach(module IN LISTS CTRE_LIB_LIST)
42 | list(APPEND LIB_MODULES ${module})
43 | endforeach()
44 | endif()
45 | if(NOT CTRE_FOUND)
46 | return()
47 | endif()
48 |
--------------------------------------------------------------------------------
/cmake/packages/FindCurl.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(CURL_NAME "Curl")
3 | set(CURL_DESCRIPTION "A command-line tool used to transfer data from or to a server using various protocols such as HTTP, FTP, SMTP, etc. It is widely used in the development of web applications to test APIs or interact with web servers.")
4 |
5 | # Pakcage option.
6 | option(USE_CURL ${CURL_DESCRIPTION} FALSE)
7 | if (USE_CURL)
8 | add_definitions(-DUSE_CURL)
9 | endif()
10 |
11 | if(USE_CURL)
12 | # Search Curl
13 | find_package(PkgConfig REQUIRED)
14 | pkg_search_module(OPENSSL REQUIRED openssl)
15 |
16 | if(CURL_FOUND)
17 | message(STATUS "Using Curl ${CURL_VERSION}")
18 | else()
19 | # Error; with REQUIRED, pkg_search_module() will throw an error by it's own
20 | endif()
21 | list(APPEND LIB_MODULES curl)
22 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${CURL_INCLUDE_DIRS})
23 | list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${CURL_LIBRARY_DIRS})
24 | list(APPEND LIB_TARGET_LINK_DIRECTORIES ${CURL_LIBRARY_DIRS})
25 | list(APPEND LIB_TARGET_COMPILER_DEFINATION "")
26 | endif()
27 | if(NOT CURL_FOUND)
28 | return()
29 | endif()
30 |
--------------------------------------------------------------------------------
/cmake/packages/FindDocTest.cmake:
--------------------------------------------------------------------------------
1 | #Package Info.
2 | set(DOCTEST_NAME "DocTest")
3 | set(DOCTEST_DESCRIPTION "The fastest feature-rich C++11/14/17/20 single-header testing framework.")
4 |
5 | #Pakcage option.
6 | option(USE_DOC_TEST ${DOCTEST_DESCRIPTION} FALSE)
7 | if (USE_DOC_TEST)
8 | add_definitions(-DUSE_DOC_TEST)
9 | # Define the repository URL and tag for the DocTest libraries
10 | set(DOC_TEST_URL "https://github.com/onqtam/doctest")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(DOC_TEST_TAG "master")
13 | else()
14 | set(DOC_TEST_TAG "v2.4.11")
15 | endif()
16 | set(DOC_TEST_LIB_LIST "doctest" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(${DOCTEST_NAME} doctest)
21 | #Package data repository.
22 | if(USE_DOC_TEST)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(doctest_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/doctest" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
25 | set(FETCHCONTENT_BASE_DIR ${doctest_base})
26 | FetchContent_Declare(
27 | DocTest
28 | GIT_REPOSITORY ${DOC_TEST_URL}
29 | GIT_TAG ${DOC_TEST_TAG}
30 | GIT_PROGRESS TRUE
31 | USES_TERMINAL_DOWNLOAD TRUE
32 | )
33 | # Check if population has already been performed
34 | FetchContent_GetProperties(doctest)
35 | string(TOLOWER "doctest" lcName)
36 | if(NOT ${lcName}_POPULATED)
37 | FetchContent_Populate(${lcName})
38 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
39 | endif()
40 | FetchContent_MakeAvailable(DocTest)
41 | foreach(module IN LISTS DOC_TEST_LIB_LIST)
42 | list(APPEND LIB_MODULES ${module})
43 | endforeach()
44 | endif()
45 | if(NOT DOCTEST_FOUND)
46 | return()
47 | endif()
48 |
--------------------------------------------------------------------------------
/cmake/packages/FindEigen.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(EIGEN_NAME "Eigen")
3 | set(EIGEN_DESCRIPTION "Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.")
4 |
5 | # Pakcage option.
6 | option(USE_EIGEN ${EIGEN_DESCRIPTION} FALSE)
7 | if (USE_EIGEN)
8 | add_definitions(-DUSE_EIGEN)
9 | # Define the repository URL and tag for the Eigen libraries
10 | set(EIGEN_URL "https://gitlab.com/libeigen/eigen.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(EIGEN_TAG "master")
13 | else()
14 | set(EIGEN_TAG "3.4")
15 | endif()
16 | set(EIGEN_LIB_LIST "eigen" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(${EIGEN_NAME} eigen)
21 | # Package data repository.
22 | if(USE_EIGEN)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(eigen_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${EIGEN_NAME}"
25 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
26 | set(FETCHCONTENT_BASE_DIR ${eigen_base})
27 | FetchContent_Declare(
28 | eigen
29 | GIT_REPOSITORY ${EIGEN_URL}
30 | GIT_TAG ${EIGEN_TAG}
31 | GIT_PROGRESS TRUE
32 | USES_TERMINAL_DOWNLOAD TRUE
33 | )
34 |
35 | # Check if population has already been performed
36 | FetchContent_GetProperties(eigen)
37 | string(TOLOWER "${EIGEN_NAME}" lcName)
38 | if(NOT ${lcName}_POPULATED)
39 | FetchContent_Populate(${lcName})
40 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
41 | endif()
42 | FetchContent_MakeAvailable(eigen)
43 | foreach(module IN LISTS EIGEN_LIB_LIST)
44 | list(APPEND LIB_MODULES ${module})
45 | endforeach()
46 | endif()
47 | if(NOT EIGEN_FOUND)
48 | return()
49 | endif()
50 |
--------------------------------------------------------------------------------
/cmake/packages/FindFmt.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(FMT_NAME "Fmt")
3 | set(FMT_DESCRIPTION "A modern formatting library.")
4 |
5 | # Pakcage option.
6 | option(USE_FMT ${FMT_DESCRIPTION} FALSE)
7 | if (USE_FMT)
8 | add_definitions(-DUSE_FMT)
9 | # Define the repository URL and tag for the Fmt libraries
10 | set(FMT_URL "https://github.com/fmtlib/fmt.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(FMT_TAG "master")
13 | else()
14 | set(FMT_TAG "9.1.0")
15 | endif()
16 | set(FMT_LIB_LIST "fmt::fmt-header-only" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | if(USE_FMT)
20 | set(FETCHCONTENT_QUIET off)
21 | get_filename_component(fmt_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${FMT_NAME}"
22 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
23 | set(FETCHCONTENT_BASE_DIR ${fmt_base})
24 | FetchContent_Declare(
25 | fmt
26 | GIT_REPOSITORY ${FMT_URL}
27 | GIT_TAG ${FMT_TAG}
28 | GIT_PROGRESS TRUE
29 | )
30 | # Check if population has already been performed
31 | FetchContent_GetProperties(fmt)
32 | string(TOLOWER "${FMT_NAME}" lcName)
33 | if(NOT ${lcName}_POPULATED)
34 | FetchContent_Populate(${lcName})
35 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
36 | endif()
37 | FetchContent_MakeAvailable(fmt)
38 | foreach(module IN LISTS FMT_LIB_LIST)
39 | list(APPEND LIB_MODULES ${module})
40 | endforeach()
41 | endif()
42 | if(NOT FMT_FOUND)
43 | return()
44 | endif()
45 |
--------------------------------------------------------------------------------
/cmake/packages/FindGTest.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(GTEST_NAME "GTest")
3 | set(GTEST_DESCRIPTION "GoogleTest - Google Testing and Mocking Framework.")
4 |
5 | # Pakcage option.
6 | option(USE_GOOGLE_TEST ${GTEST_DESCRIPTION} FALSE)
7 | if (USE_GOOGLE_TEST)
8 | add_definitions(-DUSE_GOOGLE_TEST)
9 | # Define the repository URL and tag for the Boost libraries
10 | set(GTEST_URL "https://github.com/google/googletest.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(GTEST_TAG "master")
13 | else()
14 | set(GTEST_TAG "v1.13.0")
15 | endif()
16 | set(GTEST_LIB_LIST "gtest" CACHE STRING "List of modules (separated by a semicolon)")
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(GTest gtest)
21 | # Package data repository.
22 | if(USE_GOOGLE_TEST)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(gtest_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/gtest"
25 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
26 | set(FETCHCONTENT_BASE_DIR ${gtest_base})
27 | FetchContent_Declare(
28 | gtest
29 | GIT_REPOSITORY ${GTEST_URL}
30 | GIT_TAG ${GTEST_TAG}
31 | GIT_PROGRESS TRUE
32 | USES_TERMINAL_DOWNLOAD TRUE
33 | )
34 |
35 | # Check if population has already been performed
36 | FetchContent_GetProperties(gtest)
37 | string(TOLOWER "gtest" lcName)
38 | if(NOT ${lcName}_POPULATED)
39 | FetchContent_Populate(${lcName})
40 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
41 | endif()
42 | FetchContent_MakeAvailable(gtest)
43 | foreach(module IN LISTS GTEST_LIB_LIST)
44 | list(APPEND LIB_MODULES ${module})
45 | endforeach()
46 | endif()
47 | if(NOT GTEST_FOUND)
48 | return()
49 | endif()
50 |
--------------------------------------------------------------------------------
/cmake/packages/FindJSon.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(JSON_NAME "JSon")
3 |
4 | if(USE_BOOST)
5 | set(JSON_DESCRIPTION "A C++11 or library for parsing and serializing JSON to and from a DOM container in memory based on Boost.")
6 | else()
7 | set(JSON_DESCRIPTION "A C++ library for interacting with JSON.")
8 | endif()
9 |
10 | # Pakcage option.
11 | option(USE_JSON ${JSON_DESCRIPTION} FALSE)
12 | if (USE_JSON)
13 | add_definitions(-DUSE_JSON)
14 | # Define the repository URL and tag for the Boost libraries
15 | set(JSON_URL "https://github.com/open-source-parsers/jsoncpp.git")
16 | if(FORCE_UPGRADED_LIBS)
17 | set(JSON_TAG "master")
18 | else()
19 | set(JSON_TAG "1.9.5")
20 | endif()
21 | set(JSON_LIB_LIST "jsoncpp_lib" CACHE STRING "List of modules (separated by a semicolon)")
22 | endif()
23 |
24 | find_package(PkgConfig QUIET)
25 | pkg_search_module(${JSON_NAME} json)
26 | # Package data repository.
27 |
28 | if(USE_JSON)
29 | set(FETCHCONTENT_QUIET off)
30 | get_filename_component(json_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${JSON_NAME}"
31 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
32 | set(FETCHCONTENT_BASE_DIR ${json_base})
33 | FetchContent_Declare(
34 | json
35 | GIT_REPOSITORY ${JSON_URL}
36 | GIT_TAG ${JSON_TAG}
37 | GIT_PROGRESS TRUE
38 | )
39 | # Check if population has already been performed
40 | FetchContent_GetProperties(json)
41 | string(TOLOWER "${JSON_NAME}" lcName)
42 | if(NOT ${lcName}_POPULATED)
43 | FetchContent_Populate(${lcName})
44 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
45 | endif()
46 | FetchContent_MakeAvailable(json)
47 | include_directories(${${lcName}_INCLUDE_DIR})
48 | foreach(module IN LISTS JSON_LIB_LIST)
49 | list(APPEND LIB_MODULES ${module})
50 | endforeach()
51 | endif()
52 | if(NOT JSON_FOUND)
53 | return()
54 | endif()
55 |
--------------------------------------------------------------------------------
/cmake/packages/FindJwt.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(JWT_NAME "Jwt")
3 | set(JWT_DESCRIPTION "A header only library for creating and validating json web tokens in c++")
4 |
5 | # Pakcage option.
6 | option(USE_JWT ${JWT_DESCRIPTION} FALSE)
7 | if (USE_JWT)
8 | add_definitions(-DUSE_JWT)
9 | # Define the repository URL and tag for the JWT libraries
10 | set(JWT_URL "https://github.com/Thalhammer/jwt-cpp.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(JWT_TAG "master")
13 | else()
14 | set(JWT_TAG "v0.7.0-rc.0")
15 | endif()
16 | endif()
17 |
18 | if(USE_JWT)
19 | set(FETCHCONTENT_QUIET off)
20 | get_filename_component(jwt_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${JWT_NAME}"
21 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
22 | set(FETCHCONTENT_BASE_DIR ${jwt_base})
23 | FetchContent_Declare(
24 | jwt
25 | GIT_REPOSITORY ${JWT_URL}
26 | GIT_TAG ${JWT_TAG}
27 | GIT_PROGRESS TRUE
28 | )
29 | # Check if population has already been performed
30 | FetchContent_GetProperties(jwt)
31 | string(TOLOWER "${JWT_NAME}" lcName)
32 | if(NOT ${lcName}_POPULATED)
33 | FetchContent_Populate(${lcName})
34 | include_directories(${${lcName}_SOURCE_DIR}/include)
35 | endif()
36 | FetchContent_MakeAvailable(jwt)
37 | list(APPEND LIB_MODULES ssl crypto)
38 | endif()
39 | if(NOT JWT_FOUND)
40 | return()
41 | endif()
42 |
--------------------------------------------------------------------------------
/cmake/packages/FindOpenCV.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(OPENCV_NAME "OpenCV")
3 | set(OPENCV_DESCRIPTION "Open Source Computer Vision Library.")
4 | # Pakcage option.
5 | option(USE_OPENCV ${OPENCV_DESCRIPTION} FALSE)
6 | if (USE_OPENCV)
7 | add_definitions(-DUSE_OPENCV)
8 | # Define the repository URL and tag for the OpenCV libraries
9 | set(OPENCV_URL "https://github.com/opencv/opencv.git")
10 | if(FORCE_UPGRADED_LIBS)
11 | set(OPENCV_TAG "master")
12 | else()
13 | set(OPENCV_TAG "4.7.0")
14 | endif()
15 | set(OPENCV_LIB_LIST "opencv_core;opencv_imgproc;opencv_imgcodecs;opencv_highgui;" CACHE STRING "List of modules (separated by a semicolon)")
16 | endif()
17 |
18 | set(OPENCV_MODULES_LIST "core;calib3d;dnn;features2d;flann;gapi;highgui;imgcodecs;imgproc;java;js;ml;objc;objdetect;photo;python;stitching;ts;video;videoio;world;" CACHE STRING "List of modules (separated by a semicolon)")
19 |
20 | find_package(PkgConfig QUIET)
21 | pkg_search_module(OpenCV opencv)
22 | # Package data repository.
23 | if(USE_OPENCV)
24 | set(FETCHCONTENT_QUIET off)
25 | get_filename_component(opencv_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${OPENCV_NAME}"
26 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
27 | set(FETCHCONTENT_BASE_DIR ${opencv_base})
28 | # Declare the OPENCV libraries with their submodules using FetchContent_Declare
29 | FetchContent_Declare(
30 | OPENCV
31 | GIT_REPOSITORY ${OPENCV_URL}
32 | GIT_TAG ${OPENCV_TAG}
33 | GIT_PROGRESS TRUE
34 | USES_TERMINAL_DOWNLOAD TRUE
35 | )
36 | # Check if population has already been performed
37 | FetchContent_GetProperties(opencv)
38 | string(TOLOWER "${OPENCV_NAME}" lcName)
39 | if(NOT ${lcName}_POPULATED)
40 | FetchContent_Populate(${lcName})
41 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
42 | endif()
43 | FetchContent_MakeAvailable(opencv)
44 | include_directories(${${lcName}_SOURCE_DIR}/include)
45 | foreach(module IN LISTS OPENCV_LIB_LIST)
46 | list(APPEND LIB_MODULES ${module})
47 | endforeach()
48 | foreach(module IN LISTS OPENCV_MODULES_LIST)
49 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${${lcName}_SOURCE_DIR}/modules/${module}/include)
50 | endforeach()
51 | endif()
52 | if(NOT OPENCV_FOUND)
53 | return()
54 | endif()
55 |
--------------------------------------------------------------------------------
/cmake/packages/FindOpenMesh.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(OPENMESH_NAME "OpenMesh")
3 | set(OPENMESH_DESCRIPTION "A generic and efficient polygon mesh data structure.")
4 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
5 |
6 | # Pakcage option.
7 | option(USE_OPENMESH ${OPENMESH_DESCRIPTION} FALSE)
8 | if (USE_OPENMESH)
9 | add_definitions(-DUSE_OPENMESH)
10 | # Define the repository URL and tag for the OpenMesh libraries
11 | set(OPENMESH_URL "https://github.com/Lawrencemm/openmesh.git")
12 | if(FORCE_UPGRADED_LIBS)
13 | set(OPENMESH_TAG "master")
14 | else()
15 | set(OPENMESH_TAG "lm-minimal")
16 | endif()
17 | endif()
18 |
19 | find_package(PkgConfig QUIET)
20 | pkg_search_module(${OPENMESH_NAME} openmesh)
21 | # Package data repository.
22 | if(USE_OPENMESH)
23 | set(FETCHCONTENT_QUIET off)
24 | get_filename_component(openmesh_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${OPENMESH_NAME}"
25 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
26 | set(FETCHCONTENT_BASE_DIR ${openmesh_base})
27 | FetchContent_Declare(
28 | openmesh
29 | GIT_REPOSITORY ${OPENMESH_URL}
30 | GIT_TAG ${OPENMESH_TAG}
31 | GIT_PROGRESS TRUE
32 | USES_TERMINAL_DOWNLOAD TRUE
33 | )
34 |
35 | # Check if population has already been performed
36 | FetchContent_GetProperties(openmesh)
37 | string(TOLOWER "openmesh" lcName)
38 | if(NOT ${lcName}_POPULATED)
39 | FetchContent_Populate(${lcName})
40 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
41 | endif()
42 | FetchContent_MakeAvailable(openmesh)
43 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENMESH_INCLUDE_DIRS})
44 | list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENMESH_LIBRARY_DIRS})
45 | list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENMESH_LIBRARY_DIRS})
46 | list(APPEND LIB_MODULES ${OPENMESH_LIBRARIES})
47 | list(APPEND LIB_TARGET_COMPILER_DEFINATION -D_USE_MATH_DEFINES)
48 | endif()
49 | if(NOT OPENMESH_FOUND)
50 | return()
51 | endif()
52 |
--------------------------------------------------------------------------------
/cmake/packages/FindOpenSSL.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(OPENSSL_NAME "OpenSSL")
3 | set(OPENSSL_DESCRIPTION "TLS/SSL and crypto library.")
4 |
5 | # Pakcage option.
6 | option(USE_OPENSSL ${OPENSSL_DESCRIPTION} FALSE)
7 | if (USE_OPENSSL)
8 | add_definitions(-DUSE_OPENSSL)
9 | endif()
10 |
11 | set(OPENSSL_WASM_PATH_INCLUDE "")
12 | set(OPENSSL_WASM_PATH_LIB "")
13 |
14 | if (USE_OPENSSL)
15 | add_definitions(-DUSE_OPENSSL)
16 | endif()
17 |
18 | # Package data repository.
19 | if(USE_OPENSSL)
20 | # Search OpenSSL
21 | if(EMSCRIPTEN)
22 | message("Using emscripten!")
23 | message("Set custom emscripten lib!")
24 | list(APPEND LIB_MODULES ssl crypto)
25 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENSSL_WASM_PATH_INCLUDE})
26 | list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENSSL_WASM_PATH_LIB})
27 | list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENSSL_WASM_PATH_LIB})
28 | list(APPEND LIB_TARGET_COMPILER_DEFINATION "")
29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1 -s USE_ZLIB=1")
30 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s USE_ZLIB=1")
31 | else()
32 | find_package(PkgConfig REQUIRED)
33 | pkg_search_module(OPENSSL REQUIRED openssl)
34 | if( OPENSSL_FOUND )
35 | message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
36 | else()
37 | # Error; with REQUIRED, pkg_search_module() will throw an error by it's own
38 | endif()
39 | list(APPEND LIB_MODULES ssl crypto)
40 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIRS})
41 | list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENSSL_LIBRARY_DIRS})
42 | list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENSSL_LIBRARY_DIRS})
43 | list(APPEND LIB_TARGET_COMPILER_DEFINATION "")
44 | endif()
45 |
46 | endif()
47 | if(NOT OPENSSL_FOUND)
48 | message("Please install OpenSSL from system root first! Use [https://www.openssl.org/source/]")
49 | return()
50 | endif()
51 |
--------------------------------------------------------------------------------
/cmake/packages/FindZlib.cmake:
--------------------------------------------------------------------------------
1 | # Package Info.
2 | set(ZLIB_NAME "Zlib")
3 | set(ZLIB_DESCRIPTION "A massively spiffy yet delicately unobtrusive compression library.")
4 |
5 | # Pakcage option.
6 | option(USE_ZLIB ${ZLIB_DESCRIPTION} FALSE)
7 | if (USE_ZLIB)
8 | add_definitions(-DUSE_ZLIB)
9 | # Define the repository URL and tag for the Zlib libraries
10 | set(ZLIB_URL "https://github.com/madler/zlib.git")
11 | if(FORCE_UPGRADED_LIBS)
12 | set(ZLIB_TAG "master")
13 | else()
14 | set(ZLIB_TAG "v1.2.13")
15 | endif()
16 | endif()
17 |
18 | find_package(PkgConfig QUIET)
19 | pkg_search_module(${ZLIB_NAME} zlib)
20 | # Package data repository.
21 | if(USE_ZLIB)
22 | set(FETCHCONTENT_QUIET off)
23 | get_filename_component(zlib_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${ZLIB_NAME}"
24 | REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
25 | set(FETCHCONTENT_BASE_DIR ${zlib_base})
26 | FetchContent_Declare(
27 | zlib
28 | GIT_REPOSITORY ${ZLIB_URL}
29 | GIT_TAG ${ZLIB_TAG}
30 | GIT_PROGRESS TRUE
31 | )
32 | # Check if population has already been performed
33 | FetchContent_GetProperties(zlib)
34 | string(TOLOWER "${ZLIB_NAME}" lcName)
35 | if(NOT ${lcName}_POPULATED)
36 | FetchContent_Populate(${lcName})
37 | add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL)
38 | endif()
39 | FetchContent_MakeAvailable(zlib)
40 | list(APPEND LIB_MODULES zlib)
41 | list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS})
42 | list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${ZLIB_LIBRARY_DIRS})
43 | list(APPEND LIB_TARGET_LINK_DIRECTORIES ${ZLIB_LIBRARY_DIRS})
44 | list(APPEND LIB_TARGET_COMPILER_DEFINATION "")
45 | list(APPEND LIB_TARGET_PROPERTIES "-D_FILE_OFFSET_BITS=64")
46 | endif()
47 | if(NOT ZLIB_FOUND)
48 | return()
49 | endif()
50 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/android-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for Android
2 | set(CMAKE_SYSTEM_NAME Android)
3 | set(CMAKE_SYSTEM_VERSION 21) # Android API level (can be changed to your target version)
4 | set(CMAKE_CROSSCOMPILING TRUE)
5 | set(ANDROID TRUE)
6 | set(PLATFORM_FOLDER "Android")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory for Android
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # Set NDK path (if it's not set globally, you can also set the NDK path here)
24 | # set(ANDROID_NDK "/path/to/your/ndk") # Uncomment if needed
25 |
26 | if(ANDROID_SDK_ROOT)
27 | include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt)
28 | endif()
29 |
30 | if(ANDROID_SDK)
31 | include(${ANDROID_SDK}/android_openssl/CMakeLists.txt)
32 | endif()
33 |
34 | # Specify the Android ABIs (Architectures) to target
35 | set(ANDROID_ABI "arm64-v8a" CACHE STRING "Android ABI" FORCE) # You can use "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
36 | set(ANDROID_NATIVE_API_LEVEL 21) # Android API level, the minimum required by your app
37 |
38 | # Set Android toolchain file (you need to provide the correct path to the Android toolchain file)
39 | set(CMAKE_TOOLCHAIN_FILE ${ANDROID_NDK}/build/cmake/android.toolchain.cmake)
40 |
41 | # Android-specific libraries (Android system libraries)
42 | # You can add more libraries depending on your requirements (e.g., OpenGL, Vulkan, JNI, etc.)
43 | set(OS_LIBS
44 | "-landroid" # Basic Android library
45 | "-lEGL" # OpenGL ES library
46 | "-lGLESv2" # OpenGL ES 2.0
47 | "-ljnigraphics" # JNI Graphics interface (useful for drawing)
48 | "-llog" # Android log library (for logging in C++ code)
49 | )
50 |
51 | # Output information for debugging
52 | message("Build directory: ${dir}")
53 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
54 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
55 | message("Android NDK path: ${ANDROID_NDK}")
56 | message("Android ABI: ${ANDROID_ABI}")
57 | message("Android API Level: ${ANDROID_NATIVE_API_LEVEL}")
58 | message("Android Libraries: ${OS_LIBS}")
59 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/ios-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for iOS
2 | set(CMAKE_SYSTEM_NAME iOS)
3 | set(CMAKE_SYSTEM_VERSION 13.0) # You can adjust this to the minimum iOS version required
4 | set(CMAKE_CROSSCOMPILING TRUE)
5 | set(IOS TRUE)
6 | set(PLATFORM_FOLDER "iOS")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory for iOS
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # iOS-specific libraries and frameworks
24 | # You will need to link the appropriate iOS frameworks depending on your application's requirements.
25 | set(OS_LIBS
26 | "-framework Foundation" # Core iOS Foundation framework
27 | "-framework UIKit" # User interface components
28 | "-framework CoreGraphics" # 2D drawing framework
29 | "-framework CoreMedia" # Media and video processing
30 | "-framework AVFoundation" # Audio and video framework
31 | )
32 |
33 | # Output information for debugging
34 | message("Build directory: ${dir}")
35 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
36 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
37 | message("iOS Libraries: ${OS_LIBS}")
38 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/linux-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for Linux systems
2 | set(CMAKE_SYSTEM_NAME Linux) # Set system to Linux
3 | set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all Linux distributions
4 | set(CMAKE_CROSSCOMPILING FALSE) # Not cross-compiling
5 | set (LINUX TRUE)
6 | set(PLATFORM_FOLDER "Linux")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # Linux system libraries - Common across most Linux distributions
24 | set(OS_LIBS
25 | "-lpthread" # Pthread library for multithreading (POSIX threads)
26 | "-lm" # Math library (for common math functions like sqrt, sin, etc.)
27 | "-lstdc++" # Standard C++ library
28 | "-lc" # C standard library
29 | "-ldl" # Dynamic loading library
30 | "-lrt" # Real-time extensions for Linux systems
31 | "-lX11" # X11 library for graphical applications (if needed)
32 | "-lssl -lcrypto" # OpenSSL for encryption (if needed)
33 | )
34 |
35 | # Optional: Add other libraries depending on the specific Linux distribution or features you need
36 | # For example, for network-related features or GUI, you can add:
37 | # set(OS_LIBS ${OS_LIBS} "-lgtk-3") # If using GTK+ for GUI applications
38 | # set(OS_LIBS ${OS_LIBS} "-lboost_system -lboost_filesystem") # If using Boost
39 |
40 | # Output information for debugging
41 | message("Build directory: ${dir}")
42 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
43 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
44 | message("Linux Libraries: ${OS_LIBS}")
45 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/macos-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for macOS
2 | set(CMAKE_SYSTEM_NAME Darwin)
3 | set(CMAKE_SYSTEM_VERSION 1)
4 | set(CMAKE_CROSSCOMPILING TRUE)
5 | set(APPLE TRUE)
6 | set(PLATFORM_FOLDER "macOS")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory for macOS
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # macOS specific libraries and frameworks
24 | set(OS_LIBS
25 | "-framework IOKit"
26 | "-framework ApplicationServices"
27 | "-framework CoreServices"
28 | "-framework CoreGraphics"
29 | "-framework Foundation"
30 | )
31 |
32 | # Output information for debugging
33 | message("Build directory: ${dir}")
34 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
35 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
36 | message("macOS Frameworks: ${OS_LIBS}")
37 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/unix-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for Unix-like systems (FreeBSD, OpenBSD, etc.)
2 | set(CMAKE_SYSTEM_NAME UNIX) # Generic Unix system for FreeBSD, OpenBSD, etc.
3 | set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all Unix-like systems
4 | set(CMAKE_CROSSCOMPILING FALSE) # We are not cross-compiling
5 | set (UNIX TRUE)
6 | set(PLATFORM_FOLDER "Unix")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # Unix system libraries - Common across most BSD-like systems
24 | set(OS_LIBS
25 | "-lpthread" # Pthread library for multithreading (POSIX threads)
26 | "-lm" # Math library (for common math functions like sqrt, sin, etc.)
27 | "-lstdc++" # Standard C++ library
28 | "-lc" # C standard library
29 | "-ldl" # Dynamic loading library (for Unix-like systems)
30 | "-lrt" # Real-time extensions for Unix-like systems
31 | )
32 |
33 | # Optional: Add more libraries depending on the specific BSD system or features you need
34 | # set(OS_LIBS ${OS_LIBS} "-lX11") # If using X11 for graphical apps
35 | # set(OS_LIBS ${OS_LIBS} "-lssl -lcrypto") # If using OpenSSL for encryption
36 |
37 | # Output information for debugging
38 | message("Build directory: ${dir}")
39 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
40 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
41 | message("Unix-like Libraries: ${OS_LIBS}")
42 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/wasm-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for Wasm systems
2 | set(CMAKE_SYSTEM_NAME WASM) # Generic Wasm system for Web.
3 | set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all wasm systems
4 | set(CMAKE_CROSSCOMPILING FALSE) # We are not cross-compiling
5 | set (WASM TRUE)
6 | set(PLATFORM_FOLDER "Wasm")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # Output information for debugging
24 | message("Build directory: ${dir}")
25 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
26 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
27 | message("Unix-like Libraries: ${OS_LIBS}")
28 |
--------------------------------------------------------------------------------
/cmake/platforms-toolchain/windows-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings for Windows
2 | set(CMAKE_SYSTEM_NAME Windows)
3 | set(CMAKE_SYSTEM_VERSION 10) # Set the system version (you can adjust if needed)
4 | set(CMAKE_CROSSCOMPILING TRUE)
5 | set(WINDOWS TRUE)
6 | set(PLATFORM_FOLDER "Windows")
7 |
8 | #------ PROJECT DIRECTORIES ------
9 | # Define base build directory for Windows
10 | set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER})
11 |
12 | # Set output directories for executables, libraries, and other build files
13 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
14 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib)
15 | set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
16 | set(CMAKE_BINARY_DIR ${dir})
17 | set(CMAKE_CACHEFILE_DIR ${dir})
18 |
19 | # Ensure all output paths are unified
20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
21 | set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
22 |
23 | # Windows specific libraries and settings
24 | # For simplicity, here are some commonly used libraries on Windows.
25 | # You may need to modify this list based on your project's requirements.
26 | set(OS_LIBS
27 | "user32.lib" # Basic Windows user interface library
28 | "gdi32.lib" # Windows graphics device interface library
29 | "kernel32.lib" # Kernel-level services
30 | )
31 |
32 | # Output information for debugging
33 | message("Build directory: ${dir}")
34 | message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
35 | message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
36 | message("Windows Libraries: ${OS_LIBS}")
37 |
--------------------------------------------------------------------------------
/cmake/project-setting.cmake:
--------------------------------------------------------------------------------
1 | # ------ ADDITIONAL OPTIONS ------
2 |
3 | # Use the latest standard of C++
4 | option(USE_LATEST_STANDARD "Include the latest standard of C++" ON)
5 | if (USE_LATEST_STANDARD)
6 | add_definitions(-DUSE_LATEST_STANDARD)
7 | endif()
8 |
9 | # Include Qt5 Framework features
10 | option(USE_QT5_FEATURES "Include Qt5 Framework features" OFF)
11 | if (USE_QT5_FEATURES)
12 | add_definitions(-DUSE_QT5_FEATURES)
13 | endif()
14 |
15 | # Include full features of Qt Framework
16 | option(USE_FULL_QT_FEATURES "Include full features of Qt Framework" OFF)
17 | if (USE_FULL_QT_FEATURES)
18 | add_definitions(-DUSE_FULL_QT_FEATURES)
19 | endif()
20 |
21 | # Include User Interface
22 | option(GUI_APPLICATION "Include User Interface" ON)
23 | if (GUI_APPLICATION)
24 | add_definitions(-DGUI_APPLICATION)
25 | endif()
26 |
27 | # Force to update to the latest version of dependencies from repositories
28 | option(FORCE_UPGRADED_LIBS "Force to update to the latest version of dependencies from repositories" OFF)
29 | if (FORCE_UPGRADED_LIBS)
30 | add_definitions(-DFORCE_UPGRADED_LIBS)
31 | endif()
32 |
33 | # Include your own engine
34 | option(USE_CUSTOM_ENGINE "Include your own engine" OFF)
35 | if (USE_CUSTOM_ENGINE)
36 | add_definitions(-DUSE_CUSTOM_ENGINE)
37 | endif()
38 |
39 | # Your own engine code name as a string
40 | set(ENGINE_CODE_NAME "Cell" CACHE STRING "Your own engine code name as a string.")
41 | if (USE_CUSTOM_ENGINE)
42 | add_definitions(-DENGINE_CODE_NAME)
43 | endif()
44 |
--------------------------------------------------------------------------------
/config.hpp.in:
--------------------------------------------------------------------------------
1 | #ifndef PROJECT_CONFIG_HPP
2 | #define PROJECT_CONFIG_HPP
3 |
4 | #define PROJECT_NAME "${PROJECT_NAME}"
5 | #define PROJECT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}
6 | #define PROJECT_VERSION_MINOR ${PROJECT_VERSION_MINOR}
7 | #define PROJECT_VERSION_PATCH ${PROJECT_VERSION_PATCH}
8 | #define PROJECT_VERSION ${PROJECT_VERSION}
9 | #define PROJECT_VERSION_TYPE "${PROJECT_VERSION_TYPE}"
10 | #define PROJECT_LICENSE_TYPE "${PROJECT_LICENSE_TYPE}"
11 | #define PROJECT_VERSION_STRING "${PROJECT_VERSION}-${PROJECT_VERSION_TYPE}"
12 | #define PROJECT_CREATOR "${PROJECT_CREATOR}"
13 | #define PROJECT_ORGANIZATION "${PROJECT_ORGANIZATION}"
14 | #define PROJECT_LANGUAGES "${PROJECT_LANGUAGES}"
15 | #define PROJECT_DESCRIPTION "${PROJECT_DESCRIPTION}"
16 | #define PROJECT_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}"
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/config/project.cmake:
--------------------------------------------------------------------------------
1 | # ------ PROJECT INFO ------
2 | # You can change "ProjectTemplate" with your project name.
3 | set(PROJECT_NAME "PT" CACHE STRING "Project Name.")
4 | set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Project Target Name.")
5 | set(PROJECT_REAL_NAME "PT" CACHE STRING "Project Real Name.")
6 |
7 | # Your project version.
8 | set(PROJECT_VERSION_MAJOR 1)
9 | set(PROJECT_VERSION_MINOR 0)
10 | set(PROJECT_VERSION_PATCH 0)
11 |
12 | #Your project creator.
13 | set(PROJECT_CREATOR "Kambiz Asadzadeh" CACHE STRING "Creator of your project.")
14 |
15 | #Your project creator.
16 | set(PROJECT_ORGANIZATION "The Genyleap" CACHE STRING "Organization name.")
17 |
18 | #Your project license type.
19 | set(PROJECT_LICENSE_TYPE "MIT" CACHE STRING "Project License Type.")
20 |
21 | set(PROJECT_VERSION_TYPE "final" CACHE STRING "Version type.")
22 |
23 | #Use these keys [application, library]
24 | set(PROJECT_USAGE_TYPE "application" CACHE STRING "Usage Type.")
25 |
26 | #Use these keys [stl, qt, qtwidget, qtquick]
27 | set(PROJECT_MAIN_TYPE "qtquick" CACHE STRING "Library System.")
28 |
29 | set(DEVELOPER_BUNDLE_IDENTIFIER com.genyleap.api.${PROJECT_NAME} CACHE STRING "Developer Bundle Identifier.")
30 |
31 | #You can replace your project description with this string.
32 | set(PROJECT_DESCRIPTION "A template for modern C++ projects with useful features for developing cross-platform projects." CACHE STRING "Project Description")
33 |
34 | #Your project website address.
35 | set(PROJECT_HOMEPAGE_URL "https://github.com/genyleap/Project-Template" CACHE STRING "Project URL.")
36 |
--------------------------------------------------------------------------------
/config/system-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "language":"english",
3 | "debug": true,
4 | "system":{
5 | "codename":"Template Name",
6 | "version":"1.0.0",
7 | "last_update":"2020-01-10 07:00:00",
8 | "server_host":"127.0.0.1",
9 | "encoding":"utf-8"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/licenses/mit.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Kambiz
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.
22 |
--------------------------------------------------------------------------------
/precompiled/pch.hpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * Gen3 License
3 | *
4 | * Copyright (c) 2024 Kambiz Asadzadeh
5 | * Copyright (c) 2024 Genyleap
6 | */
7 |
8 | #ifndef PCH_HPP
9 | #define PCH_HPP
10 |
11 | #if __cpp_modules
12 | import std; // Import core language support.
13 | #ifdef ENABLE_C_FACILITIES
14 | import std.compat; //Import C++ headers for C library facilities
15 | #endif
16 | #else
17 |
18 | /*!
19 | * Creating and using precompiled headers can do two major things for you:
20 | * Can reduce the compilation time of C++ files.
21 | * Can reduce the number of lines of code that the compiler must process (in some cases, by several orders of magnitude).
22 | */
23 |
24 | #ifdef __has_include
25 | # if __has_include()
26 | # include
27 | # endif
28 | #else
29 | # include
30 | #endif
31 |
32 | //!Header files for the C++ standard library and extensions, by category.
33 |
34 | #ifdef CXX_STANDARD_98
35 | #error "C++11 or better is required"
36 | #endif
37 |
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 |
44 | //!C++ Style
45 | #include
46 | #include
47 | #include
48 | #include