├── .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 | [![forthebadge](https://forthebadge.com/images/badges/made-with-c-plus-plus.svg)](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 | Screenshot 2022-11-12 at 9 25 49 AM 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 49 | #include 50 | #include 51 | #include 52 | 53 | //!Algorithms 54 | #include 55 | #include 56 | #include 57 | 58 | //!Added in the C++20 standard 59 | #if defined(CXX_STANDARD_20) 60 | //!Concepts 61 | #ifdef __has_include 62 | # if __has_include() 63 | # include 64 | # endif 65 | #endif 66 | #endif 67 | 68 | /*C++ Standard Library Containers*/ 69 | 70 | //!Sequence containers 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | 77 | //!Ordered associative containers 78 | #include 79 | #include 80 | 81 | //! Unordered associative containers 82 | #include 83 | #include 84 | 85 | //!Container adaptors 86 | #include 87 | #include 88 | 89 | //!Container views 90 | #if defined(CXX_STANDARD_20) 91 | #ifdef __has_include 92 | # if __has_include() 93 | # include 94 | # endif 95 | #endif 96 | #endif 97 | 98 | //!Errors and exception handling 99 | #include 100 | #include 101 | #include 102 | #include 103 | 104 | //!General utilities 105 | #include 106 | 107 | #include 108 | #include 109 | 110 | #if defined(CXX_STANDARD_20) 111 | #ifdef __has_include 112 | # if __has_include() 113 | # include 114 | # endif 115 | #endif 116 | #endif 117 | 118 | #include 119 | #include 120 | 121 | #if defined(CXX_STANDARD_20) 122 | #ifdef __has_include 123 | # if __has_include() 124 | # include 125 | # endif 126 | #endif 127 | #endif 128 | 129 | #include 130 | #include 131 | #include 132 | #include 133 | #include 134 | #include 135 | #include 136 | #include 137 | 138 | //!Multithreading 139 | #include 140 | #include 141 | #include 142 | #include 143 | #include 144 | #include 145 | 146 | //!I/O and formatting 147 | #include 148 | #include 149 | 150 | #ifdef CXX_STANDARD_20 151 | #ifdef __has_include 152 | # if __has_include() 153 | # include 154 | # endif 155 | #endif 156 | #endif 157 | 158 | #include 159 | #include 160 | #include 161 | #include 162 | #include 163 | #include 164 | #include 165 | #include 166 | #include 167 | 168 | #if defined(CXX_STANDARD_20) 169 | #ifdef __has_include 170 | # if __has_include() 171 | # include 172 | # endif 173 | #endif 174 | #endif 175 | 176 | //!Iterators 177 | #include 178 | 179 | //!Language support 180 | #include 181 | #include 182 | #include 183 | 184 | 185 | #if defined(CXX_STANDARD_20) 186 | #ifdef __has_include 187 | # if __has_include() 188 | # include 189 | # endif 190 | #endif 191 | #endif 192 | 193 | #if defined(CXX_STANDARD_20) 194 | #ifdef __has_include 195 | # if __has_include() 196 | # include 197 | # endif 198 | #endif 199 | #endif 200 | 201 | #if defined(CXX_STANDARD_20) 202 | #ifdef __has_include 203 | # if __has_include() 204 | # include 205 | # endif 206 | #endif 207 | #endif 208 | 209 | #include 210 | #include 211 | #include 212 | #include 213 | #include 214 | #include 215 | #include 216 | #include 217 | #include 218 | #include 219 | #include 220 | 221 | #if defined(CXX_STANDARD_20) 222 | #ifdef __has_include 223 | # if __has_include() 224 | # include 225 | # endif 226 | #endif 227 | #endif 228 | 229 | //!Ranges 230 | #if defined(CXX_STANDARD_20) 231 | #ifdef __has_include 232 | # if __has_include() 233 | # include 234 | # endif 235 | #endif 236 | #endif 237 | 238 | //!Regular expressions 239 | #include 240 | 241 | //!Strings and character data 242 | #include 243 | #include 244 | #include 245 | #include 246 | 247 | #if defined(CXX_STANDARD_20) 248 | #ifdef __has_include 249 | # if __has_include() 250 | # include 251 | # endif 252 | #endif 253 | #endif 254 | 255 | #include 256 | #include 257 | #include 258 | #include 259 | #include 260 | 261 | //!Time 262 | #include 263 | #include 264 | 265 | //!C-style Under C++ 266 | #include 267 | #include 268 | #include 269 | #include 270 | #include 271 | #include 272 | #include 273 | #include 274 | #include 275 | #include 276 | #include 277 | #include 278 | #include 279 | #include 280 | #include 281 | #include 282 | #include 283 | #include 284 | #include 285 | #include 286 | #include 287 | 288 | //!Localization 289 | #include 290 | #include 291 | #include 292 | 293 | //!Math and numerics 294 | #if defined(CXX_STANDARD_20) 295 | #ifdef __has_include 296 | # if __has_include() 297 | # include 298 | # endif 299 | #endif 300 | #endif 301 | #include 302 | #include 303 | #include 304 | #include 305 | #include 306 | #include 307 | #include 308 | #include 309 | #include 310 | 311 | //!Memory management 312 | #ifdef __has_include 313 | # if __has_include() 314 | # include 315 | # endif 316 | #endif 317 | #include 318 | #ifdef __has_include 319 | # if __has_include() 320 | # include 321 | # endif 322 | #endif 323 | #include 324 | #include 325 | 326 | #ifdef _MSC_VER 327 | #include 328 | #endif 329 | #endif 330 | 331 | #if __cpp_lib_json 332 | # include 333 | #else 334 | # if __has_include() 335 | # include 336 | # elif __has_include() 337 | # include 338 | #endif 339 | #endif 340 | 341 | #if __cpp_lib_format 342 | # include 343 | #else 344 | # if __has_include() 345 | # include 346 | # elif __has_include() 347 | # include 348 | #endif 349 | #endif 350 | 351 | #endif // PCH_HPP 352 | -------------------------------------------------------------------------------- /properties/Windows/app.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.hpp" 4 | ///////////////////////////////////////////////////////////////////////////// 5 | // English (United States) resources 6 | 7 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 8 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 9 | #pragma code_page(1252) 10 | 11 | ///////////////////////////////////////////////////////////////////////////// 12 | // 13 | // Version 14 | // 15 | 16 | VS_VERSION_INFO VERSIONINFO 17 | FILEVERSION 1,0,0 18 | PRODUCTVERSION 1,0,0 19 | FILEFLAGSMASK 0x3fL 20 | #ifdef _DEBUG 21 | FILEFLAGS 0x1L 22 | #else 23 | FILEFLAGS 0x0L 24 | #endif 25 | FILEOS 0x40004L 26 | FILETYPE 0x1L 27 | FILESUBTYPE 0x0L 28 | BEGIN 29 | BLOCK "StringFileInfo" 30 | BEGIN 31 | BLOCK "040904b0" 32 | BEGIN 33 | VALUE "CompanyName", "Genyleap LLC" 34 | VALUE "FileDescription", "Project-Template" 35 | VALUE "FileVersion", "1.0.0" 36 | VALUE "InternalName", "Project-Template" 37 | VALUE "LegalCopyright", "Copyright 2022 by Genyleap LLC" 38 | VALUE "OriginalFilename", "Project-Template.exe" 39 | VALUE "ProductName", "Project-Template" 40 | VALUE "ProductVersion", "1.0.0" 41 | END 42 | END 43 | BLOCK "VarFileInfo" 44 | BEGIN 45 | VALUE "Translation", 0x409, 1200 46 | END 47 | END 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Icon 53 | // 54 | 55 | // Icon with lowest ID value placed first to ensure application icon 56 | // remains consistent on all systems. 57 | IDI_ICON1 ICON "appicon.ico" 58 | 59 | #ifdef APSTUDIO_INVOKED 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // TEXTINCLUDE 63 | // 64 | 65 | 1 TEXTINCLUDE 66 | BEGIN 67 | "resource.h\0" 68 | END 69 | 70 | 2 TEXTINCLUDE 71 | BEGIN 72 | "\0" 73 | END 74 | 75 | 3 TEXTINCLUDE 76 | BEGIN 77 | "\r\n" 78 | "\0" 79 | END 80 | 81 | #endif // APSTUDIO_INVOKED 82 | 83 | #endif // English (United States) resources 84 | ///////////////////////////////////////////////////////////////////////////// 85 | 86 | 87 | 88 | #ifndef APSTUDIO_INVOKED 89 | ///////////////////////////////////////////////////////////////////////////// 90 | // 91 | // Generated from the TEXTINCLUDE 3 resource. 92 | // 93 | 94 | 95 | ///////////////////////////////////////////////////////////////////////////// 96 | #endif // not APSTUDIO_INVOKED 97 | 98 | -------------------------------------------------------------------------------- /properties/iOS/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | Created by The Genyleap tool. 11 | CFBundleSignature 12 | ???? 13 | CFBundleExecutable 14 | 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleDisplayName 18 | ${PROJECT_NAME} 19 | CFBundleName 20 | ${PROJECT_NAME} 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationPortraitUpsideDown 33 | UIInterfaceOrientationLandscapeLeft 34 | UIInterfaceOrientationLandscapeRight 35 | 36 | CFBundleDocumentTypes 37 | 38 | 39 | CFBundleTypeName 40 | Generic File 41 | CFBundleTypeRole 42 | Viewer 43 | LSHandlerRank 44 | Alternate 45 | LSItemContentTypes 46 | 47 | public.data 48 | 49 | 50 | 51 | NOTE 52 | This file was generated by Qt/QMake. 53 | CFBundleAllowMixedLocalizations 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /properties/macOS/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | Created by The Genyleap tool. 11 | CFBundleSignature 12 | ???? 13 | CFBundleExecutable 14 | 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleDisplayName 18 | ${PROJECT_NAME} 19 | CFBundleName 20 | ${PROJECT_NAME} 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationPortraitUpsideDown 33 | UIInterfaceOrientationLandscapeLeft 34 | UIInterfaceOrientationLandscapeRight 35 | 36 | CFBundleDocumentTypes 37 | 38 | 39 | CFBundleTypeName 40 | Generic File 41 | CFBundleTypeRole 42 | Viewer 43 | LSHandlerRank 44 | Alternate 45 | LSItemContentTypes 46 | 47 | public.data 48 | 49 | 50 | 51 | NOTE 52 | This file was generated by Genyleap/Cell. 53 | CFBundleAllowMixedLocalizations 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /source/attributes.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef ATTRIBUTES_HPP 8 | #define ATTRIBUTES_HPP 9 | 10 | //!Attributes in Clang 11 | #if defined(__clang__) 12 | 13 | /// The lifetimebound attribute indicates that a resource owned by a function parameter or implicit object 14 | /// parameter is retained by the return value of the annotated function (or, for a parameter of a constructor, in the value of the constructed object). 15 | /// It is only supported in C++. 16 | #if __has_attribute(lifetimebound) 17 | #define LIFETIMEBOUND [[clang::lifetimebound]] 18 | #else 19 | #define LIFETIMEBOUND 20 | #endif 21 | 22 | 23 | /// The reinitializes attribute can be applied to a non-static, non-const C++ member function to indicate 24 | /// that this member function reinitializes the entire object to a known state, independent of the previous state of the object. 25 | #if __has_attribute(reinitializes) 26 | #define REINITIALIZES [[clang::reinitializes]] 27 | #else 28 | #define REINITIALIZES 29 | #endif 30 | 31 | /// The disable_tail_calls attribute instructs the backend to not perform tail call optimization inside the marked function. 32 | #if __has_attribute(disable_tail_calls) 33 | #define DISABLE_TAIL_CALLS [[clang::disable_tail_calls]] 34 | #else 35 | #define DISABLE_TAIL_CALLS 36 | #endif 37 | 38 | /// This attribute specifies that the variable to which it is attached is intended to have a constant initializer 39 | /// according to the rules of [basic.start.static]. The variable is required to have static or thread storage duration. 40 | /// If the initialization of the variable is not a constant initializer an error will be produced. This attribute may only be used in C++. 41 | #if __has_attribute(require_constant_initialization) 42 | #define REQUIRE_CONSTANT_INITIALIZATION [[clang::require_constant_initialization]] 43 | #else 44 | #define REQUIRE_CONSTANT_INITIALIZATION 45 | #endif 46 | 47 | #endif 48 | 49 | //!Attributes in GCC 50 | #if defined(__GNUC__) 51 | 52 | #endif 53 | 54 | //!Attributes in MSVC 55 | #if defined(_MSC_VER) 56 | 57 | #endif 58 | 59 | #endif // ATTRIBUTES_HPP 60 | -------------------------------------------------------------------------------- /source/common.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef COMMON_HPP 8 | #define COMMON_HPP 9 | 10 | #ifdef __has_include 11 | # if __has_include() 12 | # include 13 | # endif 14 | #else 15 | # include 16 | #endif 17 | 18 | #ifdef __has_include 19 | # if __has_include() 20 | # include 21 | # endif 22 | #else 23 | # include 24 | #endif 25 | 26 | #ifdef __has_include 27 | # if __has_include() 28 | # include 29 | # endif 30 | #else 31 | # include 32 | #endif 33 | 34 | #ifdef __has_cpp_attribute 35 | # if __has_cpp_attribute(__cpp_modules) 36 | # pragma message("Your project is based on modern solution for componentization of C++ libraries and programs.") 37 | # endif 38 | #else 39 | # pragma message("Your project is based on classic precompiled-header system. [enable module feature in C++]") 40 | #endif 41 | 42 | #if __cplusplus > 201703 43 | #ifdef __has_include 44 | # if __has_include() 45 | # include 46 | # else 47 | # pragma message("Your project is based on classic precompiled-header system.") 48 | # endif 49 | #endif 50 | #else 51 | # include "precompiled/pch.hpp" 52 | #endif 53 | 54 | template 55 | using Scope = std::unique_ptr; 56 | 57 | template 58 | constexpr Scope CreateScope(Args&& ... args) 59 | { 60 | return std::make_unique(std::forward(args)...); 61 | } 62 | 63 | template 64 | using Ref = std::shared_ptr; 65 | 66 | template 67 | constexpr Ref CreateRef(Args&& ... args) 68 | { 69 | return std::make_shared(std::forward(args)...); 70 | } 71 | 72 | #define PROJECT_BRACE_BEGIN { 73 | #define PROJECT_BRACE_END } 74 | #define PROJECT_USING_NAMESPACE using namespace 75 | #define PROJECT_NAMESPACE_BEGIN(x) namespace x { 76 | #define PROJECT_ANONYMOUS_NAMESPACE_BEGIN namespace { 77 | #define PROJECT_NAMESPACE_END } 78 | #define PROJECT_USING using 79 | #define PROJECT_NAMESPACE namespace 80 | 81 | /* 82 | * C++11 keywords and expressions 83 | */ 84 | #ifdef PROJECT_COMPILER_NULLPTR 85 | # define __project_nullptr nullptr 86 | #else 87 | # define __project_nullptr NULL 88 | #endif 89 | 90 | # define __project_override override 91 | # define __project_final final 92 | 93 | # define __project_const const 94 | # define __project_const_noexcept const noexcept 95 | # define __project_const_noexcept_override const noexcept override 96 | # define __project_noexcept noexcept 97 | # define __project_noexcept_expr(x) noexcept(x) 98 | # define __project_constexpr_virtual virtual constexpr 99 | # define __project_constexpr constexpr 100 | # define __project_static_constexpr static constexpr 101 | # define __project_static_constexpr static constexpr 102 | # define __project_inline_static_constexpr inline static constexpr 103 | # define __project_inline_static_const inline static const 104 | # define __project_inline_static inline static 105 | 106 | #define __project_pure_const_noexcept const noexcept = 0 107 | 108 | #define __project_no_return [[noreturn]] 109 | 110 | #define __project_no_discard [[nodiscard]] 111 | #define __project_no_discard_virtual [[nodiscard]] virtual 112 | #define __project_no_discard_message(x) [[nodiscard(x)]] 113 | 114 | #define __project_maybe_unused [[maybe_unused]] 115 | 116 | #define __project_virtual virtual 117 | 118 | //! EXPORTS & EXTRA 119 | #if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ 120 | defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ 121 | defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ 122 | defined(__WIN64__) 123 | //! Microsoft Windows 124 | #define __project_export __declspec(dllexport) 125 | #define __project_import __declspec(dllimport) 126 | #elif defined(__GNUC__) 127 | //! Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... 128 | #define __project_export __attribute__((visibility("default"))) 129 | #define __project_import __attribute__((visibility("default"))) 130 | #define __project_hidden __attribute__((visibility("hidden"))) 131 | #else 132 | // do nothing and hope for the best? 133 | #define __project_export 134 | #define __project_import 135 | #pragma warning Unknown dynamic link import / export semantics. 136 | #endif 137 | 138 | #define SCOPE : 139 | #define SCOPE_LEFT ( 140 | #define SCOPE_RIGHT ) 141 | #define SCOPE_ENDS {} 142 | 143 | #define __project_extern_c extern "C" 144 | 145 | #define __project_export_pointer(Class, object)\ 146 | __project_extern_c __project_export Class* object = __project_nullptr; 147 | 148 | #define PROJECT_DEFAULT_OCTORS_WITHOUT_IMPL(Class) \ 149 | Class() = default;\ 150 | ~Class() = default; 151 | 152 | #define PROJECT_DEFAULT_INTERFACE_OCTORS_WITHOUT_IMPL(Class) \ 153 | Class() = default;\ 154 | virtual ~Class() = default; 155 | 156 | #define PROJECT_DEFAULT_OCTORS(Class) \ 157 | Class();\ 158 | ~Class(); 159 | 160 | #define PROJECT_DEFAULT_OCTORS_IMPL(Class)\ 161 | Class::Class(){}\ 162 | Class::~Class(){}\ 163 | 164 | #define PROJECT_DEFAULT_INTERFACE_OCTORS(Class) \ 165 | Class();\ 166 | virtual ~Class(); 167 | 168 | #define PROJECT_DEFAULT_INTERFACE_OCTORS_IMPL(Class)\ 169 | Class::Class() {}\ 170 | Class::~Class(){}\ 171 | 172 | /*! 173 | * \brief This struct represents a non-copyable object. 174 | */ 175 | struct NonCopyable 176 | { 177 | NonCopyable() = default; 178 | NonCopyable(NonCopyable const&) = delete; 179 | NonCopyable& operator=(NonCopyable const&) = delete; 180 | }; 181 | 182 | /*! 183 | * \brief This struct represents a non-movable object. 184 | */ 185 | struct NonMovable 186 | { 187 | NonMovable() = default; 188 | NonMovable(NonMovable&&) = delete; 189 | NonMovable& operator=(NonMovable&&) = delete; 190 | }; 191 | 192 | /*! 193 | * \brief This struct represents a non-copyable or non-movable object. 194 | */ 195 | struct NonMovableOrCopyable : private NonCopyable, NonMovable 196 | { 197 | NonMovableOrCopyable() = default; 198 | }; 199 | 200 | //!Macro version of non-copyable. 201 | #define PROJECT_DISABLE_COPY(Class) \ 202 | Class(const Class &) = delete;\ 203 | Class &operator=(const Class &) = delete; 204 | 205 | //!Macro version of non-movable. 206 | 207 | #define PROJECT_DISABLE_MOVE(Class) \ 208 | Class(Class &&) = delete; \ 209 | Class &operator=(Class &&) = delete; 210 | 211 | //!Macro version of non-copyable and non-movable. 212 | #define PROJECT_DISABLE_COPY_MOVE(Class) \ 213 | PROJECT_DISABLE_COPY(Class) \ 214 | PROJECT_DISABLE_MOVE(Class) 215 | 216 | #endif // COMMON_HPP 217 | -------------------------------------------------------------------------------- /source/defines.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | 8 | #ifndef PROJECT_DEFINES_HPP 9 | #define PROJECT_DEFINES_HPP 10 | 11 | namespace Defines { 12 | 13 | #define OK 0x1 14 | #define ON 0x1 15 | #define CANCEL 0x0 16 | #define FAILED 0x0 17 | #define SUCCESS 0x0 18 | #define OFF 0x0 19 | 20 | #define ABSTRACTS 0x1 // Abstraction 21 | 22 | #define MESSAGE_OK "OK" 23 | #define MESSAGE_FAILED "FAILED" 24 | #define MESSAGE_YES "YES" 25 | #define MESSAGE_NO "NO" 26 | #define MESSAGE_ERROR "ERROR" 27 | 28 | #define ERROR_NULL 10001 29 | #define ERROR_HANDLER 10002 30 | #define ERROR_SUBTRACK 10003 31 | #define ERROR_REFRENCE 10004 32 | #define ERROR_DLL 10005 33 | #define ERROR_NETWORK 65102 // Message for Network Error. 34 | #define ERROR_WINDOWS 12111 35 | #define ERROR_SAVED 64511 36 | #define ERROR_DB_CONNECT 64001 37 | #define ERROR_LOADING 64522 38 | 39 | //! Core defines. 40 | #undef KERNEL 41 | #define KERNEL 0x1 42 | #undef BACKEND 43 | #define BACKEND 0x1 44 | #undef VIEW 45 | #define VIEW 0x1 46 | #undef TEMPLATES 47 | #define TEMPLATES 0x1 48 | 49 | #undef MODULE 50 | #define MODULE 0x1 51 | 52 | #undef PLUGIN 53 | #define PLUGIN 0x1 54 | 55 | /*---------------------Default ports------------------------*/ 56 | // Port numbers range from 0 to 65536, but only port numbers 0 to 1024 are 57 | // reserved for privileged services and designated as well-known ports. This list 58 | // of well-known port numbers specifies the port used by the server process as 59 | // its contact port. 60 | 61 | #define PORT_TCP 1 // TCP Port Service Multiplexer (TCPMUX) 62 | #define PORT_RJE 5 // Remote Job Entry (RJE) 63 | #define PORT_ECHO 7 // ECHO 64 | #define PORT_MSP 18 // Message Send Protocol (MSP) 65 | #define PORT_FTP 20 // FTP -- Data 66 | #define PORT_FTP_CONTROL 21 // FTP Control 67 | #define PORT_SSH 22 // SSH Remote Login Protocol 68 | #define PORT_TELNET 23 // Telnet 69 | #define PORT_SMTP 25 // Simple Mail Transfer Protocol (SMTP) 70 | #define PORT_MGS_ICP 29 // MSG ICP 71 | #define PORT_TIME_P 37 // Time 72 | #define PORT_HNS 42 // Host Name Server (Nameserv) 73 | #define PORT_WHOIS 43 // WhoIs 74 | #define PORT_LHP 49 // Login Host Protocol (Login) 75 | #define PORT_DNS 53 // Domain Name System (DNS) 76 | #define PORT_TFTP 69 // Trivial File Transfer Protocol (TFTP) 77 | #define PORT_GOPHER 70 // Gopher Services 78 | #define PORT_FINGER 79 // Finger 79 | #define PORT_APACHE 80 // Apache HTTP Server 80 | #define PORT_HTTP 80 // HTTP 81 | #define PORT_X400 103 // X.400 Standard 82 | #define PORT_SNA 108 // SNA Gateway Access Server 83 | #define PORT_POP2 109 // POP2 84 | #define PORT_POP3 110 // POP3 85 | #define PORT_SFTP 115 // Simple File Transfer Protocol (SFTP) 86 | #define PORT_SQL_SERVICES 118 // SQL Services 87 | #define PORT_NNTP 119 // Newsgroup (NNTP) 88 | #define PORT_NET_BIOS 137 // NetBIOS Name Service 89 | #define PORT_NET_BIOS_DS 139 // NetBIOS Datagram Service 90 | #define PORT_IMAP 143 // Interim Mail Access Protocol (IMAP) 91 | #define PORT_NET_BIOS_SS 150 // NetBIOS Session Service 92 | #define PORT_SNMP 161 // SNMP 93 | #define PORT_BGP 179 // Border Gateway Protocol (BGP) 94 | #define PORT_GACP 190 // Gateway Access Control Protocol (GACP) 95 | #define PORT_IRC 194 // Internet Relay Chat (IRC) 96 | #define PORT_DLS 197 // Directory Location Service (DLS) 97 | #define PORT_DLAP 389 // Lightweight Directory Access Protocol (LDAP) 98 | #define PORT_NOVELL_IP 396 // Novell Netware over IP 99 | #define PORT_HHTPS 443 // HTTPS 100 | #define PORT_SNPP 444 // Simple Network Paging Protocol (SNPP) 101 | #define PORT_MICORSOFT_DS 445 // Microsoft-DS 102 | #define PORT_APPLE_Q_TIME 458 // Apple QuickTime 103 | #define PORT_DHCP_CLIENT 546 // DHCP Client 104 | #define PORT_DHCP_SERVER 547 // DHCP Server 105 | #define PORT_SNEWS 563 // SNEWS 106 | #define PORT_MSN 569 // MSN 107 | #define PORT_VPP 4643 // Virtuosso Power Panel 108 | #define PORT_SOCKS 1080 // Socks 109 | 110 | //!Database drivers 111 | #define PORT_MYSQL_DB 3306 // MySQL Database Server 112 | #define PORT_POSTGRESQL_DB 5432 // PostgreSQL Database Server 113 | #define PORT_SQL_SERVER_DB 156 // SQL Server 114 | 115 | //!Server addresses 116 | #define GENYLEAP_URL "http://genyleap.com" 117 | #define GENYLEAP_SSL_URL "https://genyleap.com" 118 | 119 | #define MICROSOFT_URL "http://microsoft.com" 120 | #define MICROSOFT_SSL_URL "https://microsoft.com" 121 | 122 | #define APPLE_NS_USA "104.154.51.7" 123 | #define APPLE_NS_EUROPE "104.155.28.90" 124 | #define APPLE_NS_ASIA "104.155.220.58" 125 | #define APPLE_NS_SOUTH_AMERICA "35.199.88.219" 126 | #define APPLE_NS_AUSTRALIA_OCEANIA "35.189.47.23" 127 | 128 | #define APPLE_URL "http://apple.com" 129 | #define APPLE_SSL_URL "https://apple.com" 130 | #define APPLE_NS_USA "104.154.51.7" 131 | #define APPLE_NS_EUROPE "104.155.28.90" 132 | #define APPLE_NS_ASIA "104.155.220.58" 133 | #define APPLE_NS_SOUTH_AMERICA "35.199.88.219" 134 | #define APPLE_NS_AUSTRALIA_OCEANIA "35.189.47.23" 135 | 136 | #define CLOUD_FLARE_NS1 "1.1.1.1" 137 | #define CLOUD_FLARE_NS2 "1.0.0.1" 138 | 139 | #define QUAD9_NS1 "9.9.9.9" 140 | #define QUAD9_NS2 "149.112.112.112" 141 | 142 | #define GOOGLE_URL "http://google.com" 143 | #define GOOGLE_SSL_URL "https://google.com" 144 | #define GOOGLE_NS1 "8.8.8.8" 145 | #define GOOGLE_NS2 "8.8.4.4" 146 | 147 | //! Protocols 148 | #define PROTOCOL_HTTPS "https://" // SECURED PROTOCOL (USING SSL , 443-PORT) 149 | #define PROTOCOL_HTTP "http://" // UNSECURTED PROTOCOL (USING PORT : 80) 150 | #define PROTOCOL_FTP "ftp://" // FTP PTOTOCOL - FTP data transfer (USING PORT : 20) 151 | 152 | //! System actions 153 | #define EXIT 0; 154 | 155 | } 156 | 157 | #endif // PROJECT_DEFINES_HPP 158 | -------------------------------------------------------------------------------- /source/entrypoint/qt/nogui/main.cpp: -------------------------------------------------------------------------------- 1 | #ifdef USE_QT 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QCoreApplication a(argc, argv); 9 | 10 | qDebug() << "Hello from Qt Console!"; 11 | 12 | return a.exec(); 13 | } 14 | 15 | #else 16 | #error Please enable USE_QT cmake variable! 17 | #endif 18 | -------------------------------------------------------------------------------- /source/entrypoint/qt/qtquick/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 7 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 8 | #endif 9 | 10 | QGuiApplication app(argc, argv); 11 | QQmlApplicationEngine engine; 12 | const QUrl url(QStringLiteral("qrc:/ui/main.qml")); 13 | // const QUrl url(u"qrc:/ui/main.qml"_qs); 14 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, 15 | &app, [url](QObject *obj, const QUrl &objUrl) { 16 | if (!obj && url == objUrl) 17 | QCoreApplication::exit(-1); 18 | }, Qt::QueuedConnection); 19 | engine.load(url); 20 | 21 | return app.exec(); 22 | } 23 | 24 | 25 | // #include 26 | // #include 27 | 28 | // int main(int argc, char *argv[]) 29 | // { 30 | // QGuiApplication app(argc, argv); 31 | 32 | // QQmlApplicationEngine engine; 33 | // QObject::connect( 34 | // &engine, 35 | // &QQmlApplicationEngine::objectCreationFailed, 36 | // &app, 37 | // []() { QCoreApplication::exit(-1); }, 38 | // Qt::QueuedConnection); 39 | // engine.loadFromModule("Rare", "Main"); 40 | 41 | // return app.exec(); 42 | // } 43 | -------------------------------------------------------------------------------- /source/entrypoint/qt/qtwidget/main.cpp: -------------------------------------------------------------------------------- 1 | #ifdef USE_QT 2 | 3 | #include "ui/widgets/mainwindow.hpp" 4 | 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QApplication a(argc, argv); 10 | MainWindow w; 11 | w.show(); 12 | return a.exec(); 13 | } 14 | #else 15 | #error Please enable the USE_QT [DUSE_QT] variable to use Qt. 16 | #endif 17 | -------------------------------------------------------------------------------- /source/entrypoint/stl/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #include 8 | #include "utilities/featuretest.hpp" 9 | 10 | //! Examples 11 | #include "examples/compilertest.hpp" 12 | #include "examples/platformtest.hpp" 13 | #include "examples/librarytest.hpp" 14 | #include "examples/languagetest.hpp" 15 | #include "examples/configtest.hpp" 16 | 17 | // #include 18 | 19 | //!JSon [Non-STL] Features 20 | #if defined(USE_JSON) && !defined(USE_BOOST) 21 | #include 22 | #else 23 | //#include 24 | #endif 25 | //!Google Test 26 | #ifdef USE_GOOGLE_TEST 27 | #include 28 | 29 | class Counter { 30 | public: 31 | // Returns the current counter value, and increments it. 32 | int Increment() { 33 | return m_counter++; 34 | } 35 | 36 | // Returns the current counter value, and decrements it. 37 | // counter can not be less than 0, return 0 in this case 38 | int Decrement() { 39 | if (m_counter == 0) { 40 | return m_counter; 41 | } else { 42 | return m_counter--; 43 | } 44 | } 45 | 46 | // Prints the current counter value to STDOUT. 47 | void Print() const { 48 | printf("%d", m_counter); 49 | } 50 | private: 51 | int m_counter; 52 | }; 53 | 54 | //TEST UNIT 55 | TEST(Counter, Increment) { 56 | Counter c; 57 | 58 | // Test that counter 0 returns 0 59 | EXPECT_EQ(0, c.Decrement()); 60 | 61 | // EXPECT_EQ() evaluates its arguments exactly once, so they 62 | // can have side effects. 63 | 64 | EXPECT_EQ(0, c.Increment()); 65 | EXPECT_EQ(1, c.Increment()); 66 | EXPECT_EQ(2, c.Increment()); 67 | 68 | EXPECT_EQ(3, c.Decrement()); 69 | } 70 | 71 | #endif 72 | 73 | //!Catch2 74 | #ifdef USE_CATCH2 75 | # include 76 | 77 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file 78 | 79 | unsigned int Factorial( unsigned int number ) { 80 | return number <= 1 ? number : Factorial(number-1)*number; 81 | } 82 | 83 | TEST_CASE( "Factorials are computed", "[factorial]" ) { 84 | REQUIRE( Factorial(1) == 1 ); 85 | REQUIRE( Factorial(2) == 2 ); 86 | REQUIRE( Factorial(3) == 6 ); 87 | REQUIRE( Factorial(10) == 3628800 ); 88 | } 89 | 90 | #endif 91 | 92 | //ThirdParty libs 93 | #include "examples/thirdpartytest.hpp" 94 | 95 | #ifdef USE_OPENMESH 96 | #include 97 | #endif 98 | 99 | 100 | #include //Project Config 101 | 102 | #include 103 | #include 104 | 105 | using namespace std; 106 | 107 | int main() { 108 | std::unique_ptr arr = std::make_unique(5); // Allocate an array of integers on the heap 109 | 110 | // Access elements of the array 111 | for (int i = 0; i < 5; ++i) { 112 | arr[i] = i; 113 | } 114 | 115 | // Memory is automatically freed when arr goes out of scope 116 | // No need for explicit delete[] 117 | 118 | // Try to access the freed memory 119 | std::cout << "Array elements after deletion: "; 120 | for (int i = 0; i < 5; ++i) { 121 | // The following line is safe, as memory is managed by unique_ptr 122 | std::cout << arr[i] << " "; 123 | } 124 | 125 | return 0; 126 | } 127 | 128 | -------------------------------------------------------------------------------- /source/examples/compilertest.cpp: -------------------------------------------------------------------------------- 1 | #include "compilertest.hpp" 2 | #include "common.hpp" 3 | #include 4 | 5 | using namespace std; 6 | 7 | CompilerTest::CompilerTest() { 8 | } 9 | 10 | void CompilerTest::getCompilerInfo() const noexcept { 11 | cout << "Compiler Name : " << COMPILER << endl; 12 | cout << "Compiler Version : " << COMPILER_VER << endl; 13 | } 14 | 15 | void CompilerTest::checkByCompiler() const noexcept { 16 | std::cout << "========COMPILER TEST========" << std::endl; 17 | //! Compiler Stataement 18 | #if defined(COMPILER_CLANG_LLVM) 19 | cout << "Clang compiler has been detected!\n"; 20 | #elif defined(COMPILER_INTEL) 21 | cout << "Intel compiler has been detected!\n"; 22 | #elif defined(COMPILER_MINGW) 23 | cout << "MinGW compiler has been detected!\n"; 24 | #elif defined(COMPILER_MINGW_64) 25 | cout << "MinGW64 compiler has been detected!\n"; 26 | #elif defined(COMPILER_GCC) 27 | cout << "GCC compiler has been detected!\n"; 28 | #elif defined(COMPILER__HEWLETT) 29 | cout << "Hewlett compiler has been detected!\n"; 30 | #elif defined(COMPILER_IBM) 31 | cout << "IBM compiler has been detected!\n"; 32 | #elif defined(COMPILER_MSVC) 33 | cout << "MSVC compiler has been detected!\n"; 34 | #elif defined(COMPILER_PGCC) 35 | cout << "PGCC compiler has been detected!\n"; 36 | #elif defined(COMPILER_ORACLE) 37 | cout << "Oracle compiler has been detected!\n"; 38 | #endif 39 | std::cout << "========COMPILER TEST========" << std::endl; 40 | } 41 | -------------------------------------------------------------------------------- /source/examples/compilertest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COMPILERTEST_HPP 2 | #define COMPILERTEST_HPP 3 | 4 | 5 | class CompilerTest 6 | { 7 | public: 8 | CompilerTest(); 9 | void getCompilerInfo() const noexcept; 10 | void checkByCompiler() const noexcept; 11 | }; 12 | 13 | #endif // COMPILERTEST_HPP 14 | -------------------------------------------------------------------------------- /source/examples/configtest.cpp: -------------------------------------------------------------------------------- 1 | #include "configtest.hpp" 2 | #include "common.hpp" 3 | #include "config.hpp" 4 | 5 | ConfigTest::ConfigTest() 6 | { 7 | 8 | } 9 | 10 | void ConfigTest::readConfig() const noexcept 11 | { 12 | std::cout << "========CONFIG TEST========" << std::endl; 13 | std::cout << "Project Name : " << PROJECT_NAME << std::endl; 14 | std::cout << "Project Description : " << PROJECT_DESCRIPTION << std::endl; 15 | std::cout << "Project Homepage Url : " << PROJECT_HOMEPAGE_URL << std::endl; 16 | std::cout << "Project Language : " << PROJECT_LANGUAGES << std::endl; 17 | std::cout << "Project Full Version : " << PROJECT_VERSION_STRING << std::endl; 18 | std::cout << "Project Creator : " << PROJECT_CREATOR << std::endl; 19 | std::cout << "Project License Type : " << PROJECT_LICENSE_TYPE << std::endl; 20 | std::cout << "========CONFIG TEST========" << std::endl; 21 | } 22 | -------------------------------------------------------------------------------- /source/examples/configtest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGTEST_HPP 2 | #define CONFIGTEST_HPP 3 | 4 | 5 | class ConfigTest 6 | { 7 | public: 8 | ConfigTest(); 9 | void readConfig() const noexcept; 10 | }; 11 | 12 | #endif // CONFIGTEST_HPP 13 | -------------------------------------------------------------------------------- /source/examples/languagetest.cpp: -------------------------------------------------------------------------------- 1 | #include "languagetest.hpp" 2 | #include "common.hpp" 3 | #include 4 | 5 | LanguageTest::LanguageTest() 6 | { 7 | 8 | } 9 | 10 | void LanguageTest::checkFeatures() const noexcept 11 | { 12 | std::cout << "========FEATURE TEST========" << std::endl; 13 | #ifdef USE_FEATURE_TEST 14 | if (print.general_features) show("C++ GENERAL", cxx); 15 | if (print.cxx11 && print.core_features) show("C++11 CORE", cxx11); 16 | if (print.cxx14 && print.core_features) show("C++14 CORE", cxx14); 17 | if (print.cxx14 && print.lib_features ) show("C++14 LIB" , cxx14lib); 18 | if (print.cxx17 && print.core_features) show("C++17 CORE", cxx17); 19 | if (print.cxx17 && print.lib_features ) show("C++17 LIB" , cxx17lib); 20 | if (print.cxx20 && print.core_features) show("C++20 CORE", cxx20); 21 | if (print.cxx20 && print.lib_features ) show("C++20 LIB" , cxx20lib); 22 | if (print.cxx23 && print.core_features) show("C++23 CORE", cxx23); 23 | if (print.cxx23 && print.lib_features ) show("C++23 LIB" , cxx23lib); 24 | if (print.attributes) show("ATTRIBUTES", attributes); 25 | #else 26 | std::cout << "Test Feature is not available.\n"; 27 | #endif 28 | std::cout << "========FEATURE TEST========" << std::endl; 29 | } 30 | -------------------------------------------------------------------------------- /source/examples/languagetest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LANGUAGETEST_HPP 2 | #define LANGUAGETEST_HPP 3 | 4 | 5 | class LanguageTest 6 | { 7 | public: 8 | LanguageTest(); 9 | void checkFeatures() const noexcept; 10 | }; 11 | 12 | #endif // LANGUAGETEST_HPP 13 | -------------------------------------------------------------------------------- /source/examples/librarytest.cpp: -------------------------------------------------------------------------------- 1 | #include "librarytest.hpp" 2 | #include "common.hpp" 3 | 4 | #ifdef USE_BOOST 5 | # include 6 | #endif 7 | 8 | #ifdef USE_OPENSSL 9 | # include 10 | # include 11 | #endif 12 | 13 | #ifdef USE_OPENCV 14 | # include 15 | # include 16 | # include 17 | #endif 18 | 19 | #ifdef USE_JWT 20 | # include 21 | #endif 22 | 23 | LibraryTest::LibraryTest() 24 | { 25 | } 26 | 27 | #ifdef USE_OPENSSL 28 | void LibraryTest::testOpenSSL() const noexcept 29 | { 30 | std::cout << "========OPENSSL TEST========" << std::endl; 31 | //!OpenSSL Library 32 | std::cout << "OpenSSL version: " << OPENSSL_VERSION_STR << std::endl; 33 | 34 | std::string str {"Hello, World!"}; 35 | // Initialize the hash context 36 | EVP_MD_CTX* ctx = EVP_MD_CTX_new(); 37 | EVP_MD_CTX_init(ctx); 38 | 39 | // Set the hash algorithm 40 | const EVP_MD* md = EVP_sha256(); 41 | 42 | // Initialize the digest buffer 43 | unsigned char digest[SHA256_DIGEST_LENGTH]; 44 | 45 | // Hash the input string 46 | EVP_DigestInit_ex(ctx, md, nullptr); 47 | EVP_DigestUpdate(ctx, str.c_str(), str.length()); 48 | EVP_DigestFinal_ex(ctx, digest, nullptr); 49 | 50 | // Convert the digest buffer to string 51 | std::stringstream ss; 52 | for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) 53 | { 54 | ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(digest[i]); 55 | } 56 | 57 | // Clean up the hash context 58 | EVP_MD_CTX_free(ctx); 59 | 60 | std::string hash = ss.str(); 61 | 62 | std::cout << "Hash of " << str << " is " << hash << std::endl; 63 | } 64 | #endif 65 | 66 | #ifdef USE_OPENCV 67 | void LibraryTest::testOpenCV() const noexcept 68 | { 69 | std::cout << "========OpenCV TEST========" << std::endl; 70 | std::string image_path = cv::samples::findFile("starry_night.jpg"); 71 | cv::Mat img = imread(image_path, cv::IMREAD_COLOR); 72 | if(img.empty()) 73 | { 74 | std::cout << "Could not read the image: " << image_path << std::endl; 75 | } 76 | imshow("Display window", img); 77 | int k = cv::waitKey(0); // Wait for a keystroke in the window 78 | if(k == 's') 79 | { 80 | imwrite("starry_night.png", img); 81 | } 82 | } 83 | #endif 84 | 85 | #ifdef USE_BOOST 86 | void LibraryTest::testBoost() const noexcept 87 | { 88 | std::cout << "========BOOST TEST========" << std::endl; 89 | std::cout << "Boost version: " << BOOST_VERSION << std::endl; 90 | std::cout << "Boost Lib Clock Test\n"; 91 | boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now(); 92 | for ( long i = 0; i < 10000000; ++i ) 93 | std::sqrt( 123.456L ); // burn some time 94 | boost::chrono::duration sec = boost::chrono::system_clock::now() - start; 95 | std::cout << "took " << sec.count() << " seconds\n"; 96 | } 97 | #endif 98 | 99 | #ifdef USE_JWT 100 | void LibraryTest::testJwt() const noexcept 101 | { 102 | // Set the secret key used to sign and verify JWTs 103 | std::string secret_key = "my_secret_key"; 104 | 105 | // Create a JWT with a payload 106 | std::string payload = R"({ 107 | "user_id": 12345, 108 | "email": "user@example.com" 109 | })"; 110 | std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); 111 | std::chrono::system_clock::time_point exp = now + std::chrono::seconds(30); // expires in 30 seconds 112 | std::string token = jwt::create() 113 | .set_issuer("my_app") 114 | .set_subject("auth_token") 115 | .set_issued_at(now) 116 | .set_expires_at(exp) 117 | .set_payload_claim("data", jwt::claim(payload)) 118 | .sign(jwt::algorithm::hs256{ secret_key }); 119 | 120 | // Print the JWT 121 | std::cout << "Token: " << token << std::endl; 122 | 123 | // Verify the JWT and extract the payload 124 | try { 125 | jwt::decoded_jwt decoded = jwt::decode(token); 126 | jwt::verify() 127 | .allow_algorithm(jwt::algorithm::hs256{ secret_key }) 128 | .with_issuer("my_app") 129 | .with_subject("auth_token") 130 | .verify(decoded); 131 | std::string payload_str = decoded.get_payload_claim("data").as_string(); 132 | std::cout << "Payload: " << payload_str << std::endl; 133 | } catch (const std::exception& e) { 134 | std::cerr << "Error: " << e.what() << std::endl; 135 | } 136 | 137 | } 138 | #endif 139 | -------------------------------------------------------------------------------- /source/examples/librarytest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LIBRARYTEST_HPP 2 | #define LIBRARYTEST_HPP 3 | 4 | class LibraryTest 5 | { 6 | public: 7 | LibraryTest(); 8 | #ifdef USE_OPENSSL 9 | void testOpenSSL() const noexcept; 10 | #endif 11 | #ifdef USE_BOOST 12 | void testBoost() const noexcept; 13 | #endif 14 | #ifdef USE_OPENCV 15 | void testOpenCV() const noexcept; 16 | #endif 17 | #ifdef USE_JWT 18 | void testJwt() const noexcept; 19 | #endif 20 | }; 21 | 22 | #endif // LIBRARYTEST_HPP 23 | -------------------------------------------------------------------------------- /source/examples/platformtest.cpp: -------------------------------------------------------------------------------- 1 | #include "platformtest.hpp" 2 | #include "common.hpp" 3 | #include 4 | 5 | using namespace std; 6 | 7 | PlatformTest::PlatformTest() 8 | { 9 | 10 | } 11 | 12 | void PlatformTest::getPlatformInfo() const noexcept 13 | { 14 | #if defined(PLATFORM_MAC) 15 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 16 | cout << "Type: " << PLATFORM_TYPE << "\n"; 17 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 18 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 19 | cout << "OS Name: " << PLATFORM_MAC << "\n"; 20 | #elif defined(PLATFORM_WINDOWS) 21 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 22 | cout << "Type: " << PLATFORM_TYPE << "\n"; 23 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 24 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 25 | cout << "OS Name: " << PLATFORM_WINDOWS << "\n"; 26 | #elif defined(PLATFORM_LINUX) 27 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 28 | cout << "Type: " << PLATFORM_TYPE << "\n"; 29 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 30 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 31 | cout << "OS Name: " << PLATFORM_LINUX << "\n"; 32 | #elif defined(PLATFORM_FREEBSD) 33 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 34 | cout << "Type: " << PLATFORM_TYPE << "\n"; 35 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 36 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 37 | cout << "OS Name: " << PLATFORM_FREEBSD << "\n"; 38 | #elif defined(PLATFORM_OPENBSD) 39 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 40 | cout << "Type: " << PLATFORM_TYPE << "\n"; 41 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 42 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 43 | cout << "OS Name: " << PLATFORM_OPENBSD << "\n"; 44 | #elif defined(PLATFORM_VXWORKS) 45 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 46 | cout << "Type: " << PLATFORM_TYPE << "\n"; 47 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 48 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 49 | cout << "OS Name: " << PLATFORM_VXWORKS << "\n"; 50 | #elif defined(PLATFORM_MOTOROLA) 51 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 52 | cout << "Type: " << PLATFORM_TYPE << "\n"; 53 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 54 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 55 | cout << "OS Name: " << PLATFORM_MOTOROLA << "\n"; 56 | #elif defined(PLATFORM_ULTRIX) 57 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 58 | cout << "Type: " << PLATFORM_TYPE << "\n"; 59 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 60 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 61 | cout << "OS Name: " << PLATFORM_ULTRIX << "\n"; 62 | #elif defined(PLATFORM_DOS) 63 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 64 | cout << "Type: " << PLATFORM_TYPE << "\n"; 65 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 66 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 67 | cout << "OS Name: " << PLATFORM_DOS << "\n"; 68 | #elif defined(PLATFORM_WINDOWS_PHONE) 69 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 70 | cout << "Type: " << PLATFORM_TYPE << "\n"; 71 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 72 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 73 | cout << "OS Name: " << PLATFORM_WINDOWS_PHONE << "\n"; 74 | #elif defined(PLATFORM_IOS_SIMULATOR) 75 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 76 | cout << "Type: " << PLATFORM_TYPE << "\n"; 77 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 78 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 79 | cout << "OS Name: " << PLATFORM_IOS_SIMULATOR << "\n"; 80 | #elif defined(PLATFORM_IOS) 81 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 82 | cout << "Type: " << PLATFORM_TYPE << "\n"; 83 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 84 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 85 | cout << "OS Name: " << PLATFORM_IOS << "\n"; 86 | #elif defined(PLATFORM_APPLE_TV) 87 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 88 | cout << "Type: " << PLATFORM_TYPE << "\n"; 89 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 90 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 91 | cout << "OS Name: " << PLATFORM_APPLE_TV << "\n"; 92 | #elif defined(PLATFORM_IWATCH) 93 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 94 | cout << "Type: " << PLATFORM_TYPE << "\n"; 95 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 96 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 97 | cout << "OS Name: " << PLATFORM_IWATCH << "\n"; 98 | #elif defined(PLATFORM_ANDROID) 99 | cout << "Device: " << PLATFORM_DEVICE << "\n"; 100 | cout << "Type: " << PLATFORM_TYPE << "\n"; 101 | cout << "Platform OS: " << PLATFORM_OS << "\n"; 102 | cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; 103 | cout << "OS Name: " << PLATFORM_ANDROID << "\n"; 104 | #endif 105 | } 106 | -------------------------------------------------------------------------------- /source/examples/platformtest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORMTEST_HPP 2 | #define PLATFORMTEST_HPP 3 | 4 | 5 | class PlatformTest 6 | { 7 | public: 8 | PlatformTest(); 9 | void getPlatformInfo() const noexcept; 10 | }; 11 | 12 | #endif // PLATFORMTEST_HPP 13 | -------------------------------------------------------------------------------- /source/examples/thirdpartytest.cpp: -------------------------------------------------------------------------------- 1 | #include "thirdpartytest.hpp" 2 | 3 | #if defined (USE_FMT) 4 | # include 5 | # include 6 | # include 7 | # include 8 | # include 9 | # include 10 | #endif 11 | 12 | #if defined (USE_CTRE) 13 | #include 14 | #include 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | ThirdPartyTest::ThirdPartyTest() 23 | { 24 | 25 | } 26 | 27 | void ThirdPartyTest::testFmt() 28 | { 29 | #if defined(USE_FMT) 30 | using namespace fmt::literals; 31 | std::cout << "========FMT TEST========" << std::endl; 32 | fmt::print("This is a great template for C++{}.\n", 20); 33 | fmt::print("I'd rather be {1} than {0}.\n", "right", "happy"); 34 | fmt::print("Hello, {name}! The answer is {number}. Goodbye, {name}.\n", fmt::arg("name", "World"), fmt::arg("number", 42)); 35 | 36 | //!9.1.0 37 | auto v = std::vector{1, 2, 3}; 38 | fmt::print("{:n}\n", v); // prints 1, 2, 3 39 | 40 | std::cout << "========FMT TEST========" << std::endl; 41 | #else 42 | std::cout << "Please enable USE_FMT!" << std::endl; 43 | #endif 44 | } 45 | 46 | #if defined(USE_CTRE) 47 | 48 | std::string_view cast_from_unicode(std::u8string_view input) noexcept { 49 | return std::string_view(reinterpret_cast(input.data()), input.size()); 50 | } 51 | 52 | constexpr auto match(std::string_view sv) noexcept { 53 | return ctre::match<"h.*">(sv); 54 | } 55 | 56 | #endif 57 | 58 | 59 | void ThirdPartyTest::testCtre() 60 | { 61 | #if defined(USE_CTRE) 62 | std::cout << "========CTRE TEST========" << std::endl; 63 | 64 | using namespace std::literals; 65 | std::u8string_view original = u8"Tu es un génie"sv; 66 | for (auto match : ctre::range<"\\p{Letter}+">(original)) 67 | std::cout << cast_from_unicode(match) << std::endl; 68 | 69 | ///// 70 | auto input = "123,456,768"sv; 71 | for (auto match : ctre::range<"([0-9]+),?">(input)) { 72 | std::cout << std::string_view{match.get<0>()} << "\n"; 73 | } 74 | 75 | std::cout << "Check the more test example from : " 76 | "https://github.com/hanickadot/compile-time-regular-expressions/tree/main/tests \n"; 77 | 78 | std::cout << "========CTRE TEST========" << std::endl; 79 | #else 80 | std::cout << "Please enable USE_CTRE!" << std::endl; 81 | #endif 82 | } 83 | -------------------------------------------------------------------------------- /source/examples/thirdpartytest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THIRDPARTYTEST_HPP 2 | #define THIRDPARTYTEST_HPP 3 | 4 | class ThirdPartyTest 5 | { 6 | public: 7 | ThirdPartyTest(); 8 | void testFmt(); 9 | void testCtre(); 10 | }; 11 | 12 | 13 | #endif // THIRDPARTYTEST_HPP 14 | -------------------------------------------------------------------------------- /source/interface.cpp: -------------------------------------------------------------------------------- 1 | #include "interface.hpp" 2 | 3 | Interface::Interface() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /source/interface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef INTERFACE_HPP 8 | #define INTERFACE_HPP 9 | 10 | #ifdef __has_include 11 | # if __has_include() 12 | # include 13 | # endif 14 | #else 15 | # include 16 | #endif 17 | 18 | class Interface 19 | { 20 | public: 21 | Interface(); 22 | }; 23 | 24 | #endif // INTERFACE_HPP 25 | -------------------------------------------------------------------------------- /ui/qtquick/main.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Window 3 | import QtQuick.Controls 4 | import QtQuick.Layouts 5 | 6 | ApplicationWindow { 7 | width: 640 8 | height: 480 9 | visible: true 10 | title: qsTr("Hello World") 11 | 12 | ColumnLayout { 13 | anchors.centerIn: parent 14 | spacing: 10 15 | Button { 16 | text: qsTr("Check State") 17 | onClicked: { 18 | result.text = "My Name is Kambiz!"; 19 | console.log("Hello, Kambiz!") 20 | } 21 | } 22 | Text { 23 | id: result 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ui/qtquick/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ui/widgets/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include "./ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) 5 | : QMainWindow(parent) 6 | , ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | MainWindow::~MainWindow() 12 | { 13 | delete ui; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /ui/widgets/mainwindow.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 Kambiz Asadzadeh 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 13 | * all 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 | */ 23 | 24 | #ifndef MAINWINDOW_HPP 25 | #define MAINWINDOW_HPP 26 | 27 | #include 28 | 29 | QT_BEGIN_NAMESPACE 30 | namespace Ui { class MainWindow; } 31 | QT_END_NAMESPACE 32 | 33 | class MainWindow : public QMainWindow 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | MainWindow(QWidget *parent = nullptr); 39 | ~MainWindow(); 40 | 41 | private: 42 | Ui::MainWindow *ui; 43 | }; 44 | #endif // MAINWINDOW_HPP 45 | -------------------------------------------------------------------------------- /ui/widgets/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /utilities/featuretest.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef FEATURETEST_HPP 8 | #define FEATURETEST_HPP 9 | 10 | #ifdef __has_include 11 | # if __has_include() 12 | # include 13 | # endif 14 | # endif 15 | 16 | #ifdef __has_include 17 | # if __has_include() 18 | # include 19 | # endif 20 | 21 | #define COMPILER_FEATURE_VALUE(value) #value 22 | #define COMPILER_FEATURE_ENTRY(name) { #name, COMPILER_FEATURE_VALUE(name) }, 23 | 24 | #ifdef __has_cpp_attribute 25 | # define COMPILER_ATTRIBUTE_VALUE_AS_STRING(s) #s 26 | # define COMPILER_ATTRIBUTE_AS_NUMBER(x) COMPILER_ATTRIBUTE_VALUE_AS_STRING(x) 27 | # define COMPILER_ATTRIBUTE_ENTRY(attr) \ 28 | { #attr, COMPILER_ATTRIBUTE_AS_NUMBER(__has_cpp_attribute(attr)) }, 29 | #else 30 | # define COMPILER_ATTRIBUTE_ENTRY(attr) { #attr, "_" }, 31 | #endif 32 | 33 | // Change these options to print out only necessary info. 34 | static struct PrintOptions { 35 | constexpr static bool titles = 1; 36 | constexpr static bool attributes = 1; 37 | constexpr static bool general_features = 1; 38 | constexpr static bool core_features = 1; 39 | constexpr static bool lib_features = 1; 40 | constexpr static bool supported_features = 1; 41 | constexpr static bool unsupported_features = 1; 42 | constexpr static bool sorted_by_value = 0; 43 | constexpr static bool cxx11 = 1; 44 | constexpr static bool cxx14 = 1; 45 | constexpr static bool cxx17 = 1; 46 | constexpr static bool cxx20 = 1; 47 | constexpr static bool cxx23 = 1; 48 | } print; 49 | 50 | struct CompilerFeature { 51 | CompilerFeature(const char* name = nullptr, const char* value = nullptr) 52 | : name(name), value(value) {} 53 | const char* name; const char* value; 54 | }; 55 | 56 | static CompilerFeature cxx[] = { 57 | COMPILER_FEATURE_ENTRY(__cplusplus) 58 | COMPILER_FEATURE_ENTRY(__cpp_exceptions) 59 | COMPILER_FEATURE_ENTRY(__cpp_rtti) 60 | #if 0 61 | COMPILER_FEATURE_ENTRY(__GNUC__) 62 | COMPILER_FEATURE_ENTRY(__GNUC_MINOR__) 63 | COMPILER_FEATURE_ENTRY(__GNUC_PATCHLEVEL__) 64 | COMPILER_FEATURE_ENTRY(__GNUG__) 65 | COMPILER_FEATURE_ENTRY(__clang__) 66 | COMPILER_FEATURE_ENTRY(__clang_major__) 67 | COMPILER_FEATURE_ENTRY(__clang_minor__) 68 | COMPILER_FEATURE_ENTRY(__clang_patchlevel__) 69 | #endif 70 | }; 71 | static CompilerFeature cxx11[] = { 72 | COMPILER_FEATURE_ENTRY(__cpp_alias_templates) 73 | COMPILER_FEATURE_ENTRY(__cpp_attributes) 74 | COMPILER_FEATURE_ENTRY(__cpp_constexpr) 75 | COMPILER_FEATURE_ENTRY(__cpp_decltype) 76 | COMPILER_FEATURE_ENTRY(__cpp_delegating_constructors) 77 | COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) 78 | COMPILER_FEATURE_ENTRY(__cpp_initializer_lists) 79 | COMPILER_FEATURE_ENTRY(__cpp_lambdas) 80 | COMPILER_FEATURE_ENTRY(__cpp_nsdmi) 81 | COMPILER_FEATURE_ENTRY(__cpp_range_based_for) 82 | COMPILER_FEATURE_ENTRY(__cpp_raw_strings) 83 | COMPILER_FEATURE_ENTRY(__cpp_ref_qualifiers) 84 | COMPILER_FEATURE_ENTRY(__cpp_rvalue_references) 85 | COMPILER_FEATURE_ENTRY(__cpp_static_assert) 86 | COMPILER_FEATURE_ENTRY(__cpp_threadsafe_static_init) 87 | COMPILER_FEATURE_ENTRY(__cpp_unicode_characters) 88 | COMPILER_FEATURE_ENTRY(__cpp_unicode_literals) 89 | COMPILER_FEATURE_ENTRY(__cpp_user_defined_literals) 90 | COMPILER_FEATURE_ENTRY(__cpp_variadic_templates) 91 | }; 92 | static CompilerFeature cxx14[] = { 93 | COMPILER_FEATURE_ENTRY(__cpp_aggregate_nsdmi) 94 | COMPILER_FEATURE_ENTRY(__cpp_binary_literals) 95 | COMPILER_FEATURE_ENTRY(__cpp_constexpr) 96 | COMPILER_FEATURE_ENTRY(__cpp_decltype_auto) 97 | COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) 98 | COMPILER_FEATURE_ENTRY(__cpp_init_captures) 99 | COMPILER_FEATURE_ENTRY(__cpp_return_type_deduction) 100 | COMPILER_FEATURE_ENTRY(__cpp_sized_deallocation) 101 | COMPILER_FEATURE_ENTRY(__cpp_variable_templates) 102 | }; 103 | static CompilerFeature cxx14lib[] = { 104 | COMPILER_FEATURE_ENTRY(__cpp_lib_chrono_udls) 105 | COMPILER_FEATURE_ENTRY(__cpp_lib_complex_udls) 106 | COMPILER_FEATURE_ENTRY(__cpp_lib_exchange_function) 107 | COMPILER_FEATURE_ENTRY(__cpp_lib_generic_associative_lookup) 108 | COMPILER_FEATURE_ENTRY(__cpp_lib_integer_sequence) 109 | COMPILER_FEATURE_ENTRY(__cpp_lib_integral_constant_callable) 110 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_final) 111 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_null_pointer) 112 | COMPILER_FEATURE_ENTRY(__cpp_lib_make_reverse_iterator) 113 | COMPILER_FEATURE_ENTRY(__cpp_lib_make_unique) 114 | COMPILER_FEATURE_ENTRY(__cpp_lib_null_iterators) 115 | COMPILER_FEATURE_ENTRY(__cpp_lib_quoted_string_io) 116 | COMPILER_FEATURE_ENTRY(__cpp_lib_result_of_sfinae) 117 | COMPILER_FEATURE_ENTRY(__cpp_lib_robust_nonmodifying_seq_ops) 118 | COMPILER_FEATURE_ENTRY(__cpp_lib_shared_timed_mutex) 119 | COMPILER_FEATURE_ENTRY(__cpp_lib_string_udls) 120 | COMPILER_FEATURE_ENTRY(__cpp_lib_transformation_trait_aliases) 121 | COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) 122 | COMPILER_FEATURE_ENTRY(__cpp_lib_tuple_element_t) 123 | COMPILER_FEATURE_ENTRY(__cpp_lib_tuples_by_type) 124 | }; 125 | 126 | static CompilerFeature cxx17[] = { 127 | COMPILER_FEATURE_ENTRY(__cpp_aggregate_bases) 128 | COMPILER_FEATURE_ENTRY(__cpp_aligned_new) 129 | COMPILER_FEATURE_ENTRY(__cpp_capture_star_this) 130 | COMPILER_FEATURE_ENTRY(__cpp_constexpr) 131 | COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) 132 | COMPILER_FEATURE_ENTRY(__cpp_enumerator_attributes) 133 | COMPILER_FEATURE_ENTRY(__cpp_fold_expressions) 134 | COMPILER_FEATURE_ENTRY(__cpp_guaranteed_copy_elision) 135 | COMPILER_FEATURE_ENTRY(__cpp_hex_float) 136 | COMPILER_FEATURE_ENTRY(__cpp_if_constexpr) 137 | COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) 138 | COMPILER_FEATURE_ENTRY(__cpp_inline_variables) 139 | COMPILER_FEATURE_ENTRY(__cpp_namespace_attributes) 140 | COMPILER_FEATURE_ENTRY(__cpp_noexcept_function_type) 141 | COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) 142 | COMPILER_FEATURE_ENTRY(__cpp_nontype_template_parameter_auto) 143 | COMPILER_FEATURE_ENTRY(__cpp_range_based_for) 144 | COMPILER_FEATURE_ENTRY(__cpp_static_assert) 145 | COMPILER_FEATURE_ENTRY(__cpp_structured_bindings) 146 | COMPILER_FEATURE_ENTRY(__cpp_template_template_args) 147 | COMPILER_FEATURE_ENTRY(__cpp_variadic_using) 148 | }; 149 | static CompilerFeature cxx17lib[] = { 150 | COMPILER_FEATURE_ENTRY(__cpp_lib_addressof_constexpr) 151 | COMPILER_FEATURE_ENTRY(__cpp_lib_allocator_traits_is_always_equal) 152 | COMPILER_FEATURE_ENTRY(__cpp_lib_any) 153 | COMPILER_FEATURE_ENTRY(__cpp_lib_apply) 154 | COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) 155 | COMPILER_FEATURE_ENTRY(__cpp_lib_as_const) 156 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_is_always_lock_free) 157 | COMPILER_FEATURE_ENTRY(__cpp_lib_bool_constant) 158 | COMPILER_FEATURE_ENTRY(__cpp_lib_boyer_moore_searcher) 159 | COMPILER_FEATURE_ENTRY(__cpp_lib_byte) 160 | COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) 161 | COMPILER_FEATURE_ENTRY(__cpp_lib_clamp) 162 | COMPILER_FEATURE_ENTRY(__cpp_lib_enable_shared_from_this) 163 | COMPILER_FEATURE_ENTRY(__cpp_lib_execution) 164 | COMPILER_FEATURE_ENTRY(__cpp_lib_filesystem) 165 | COMPILER_FEATURE_ENTRY(__cpp_lib_gcd_lcm) 166 | COMPILER_FEATURE_ENTRY(__cpp_lib_hardware_interference_size) 167 | COMPILER_FEATURE_ENTRY(__cpp_lib_has_unique_object_representations) 168 | COMPILER_FEATURE_ENTRY(__cpp_lib_hypot) 169 | COMPILER_FEATURE_ENTRY(__cpp_lib_incomplete_container_elements) 170 | COMPILER_FEATURE_ENTRY(__cpp_lib_invoke) 171 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_aggregate) 172 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_invocable) 173 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_swappable) 174 | COMPILER_FEATURE_ENTRY(__cpp_lib_launder) 175 | COMPILER_FEATURE_ENTRY(__cpp_lib_logical_traits) 176 | COMPILER_FEATURE_ENTRY(__cpp_lib_make_from_tuple) 177 | COMPILER_FEATURE_ENTRY(__cpp_lib_map_try_emplace) 178 | COMPILER_FEATURE_ENTRY(__cpp_lib_math_special_functions) 179 | COMPILER_FEATURE_ENTRY(__cpp_lib_memory_resource) 180 | COMPILER_FEATURE_ENTRY(__cpp_lib_node_extract) 181 | COMPILER_FEATURE_ENTRY(__cpp_lib_nonmember_container_access) 182 | COMPILER_FEATURE_ENTRY(__cpp_lib_not_fn) 183 | COMPILER_FEATURE_ENTRY(__cpp_lib_optional) 184 | COMPILER_FEATURE_ENTRY(__cpp_lib_parallel_algorithm) 185 | COMPILER_FEATURE_ENTRY(__cpp_lib_raw_memory_algorithms) 186 | COMPILER_FEATURE_ENTRY(__cpp_lib_sample) 187 | COMPILER_FEATURE_ENTRY(__cpp_lib_scoped_lock) 188 | COMPILER_FEATURE_ENTRY(__cpp_lib_shared_mutex) 189 | COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) 190 | COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_weak_type) 191 | COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) 192 | COMPILER_FEATURE_ENTRY(__cpp_lib_to_chars) 193 | COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) 194 | COMPILER_FEATURE_ENTRY(__cpp_lib_type_trait_variable_templates) 195 | COMPILER_FEATURE_ENTRY(__cpp_lib_uncaught_exceptions) 196 | COMPILER_FEATURE_ENTRY(__cpp_lib_unordered_map_try_emplace) 197 | COMPILER_FEATURE_ENTRY(__cpp_lib_variant) 198 | COMPILER_FEATURE_ENTRY(__cpp_lib_void_t) 199 | }; 200 | 201 | static CompilerFeature cxx20[] = { 202 | COMPILER_FEATURE_ENTRY(__cpp_aggregate_paren_init) 203 | COMPILER_FEATURE_ENTRY(__cpp_char8_t) 204 | COMPILER_FEATURE_ENTRY(__cpp_concepts) 205 | COMPILER_FEATURE_ENTRY(__cpp_conditional_explicit) 206 | COMPILER_FEATURE_ENTRY(__cpp_consteval) 207 | COMPILER_FEATURE_ENTRY(__cpp_constexpr) 208 | COMPILER_FEATURE_ENTRY(__cpp_constexpr_dynamic_alloc) 209 | COMPILER_FEATURE_ENTRY(__cpp_constexpr_in_decltype) 210 | COMPILER_FEATURE_ENTRY(__cpp_constinit) 211 | COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) 212 | COMPILER_FEATURE_ENTRY(__cpp_designated_initializers) 213 | COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) 214 | COMPILER_FEATURE_ENTRY(__cpp_impl_coroutine) 215 | COMPILER_FEATURE_ENTRY(__cpp_impl_destroying_delete) 216 | COMPILER_FEATURE_ENTRY(__cpp_impl_three_way_comparison) 217 | COMPILER_FEATURE_ENTRY(__cpp_init_captures) 218 | COMPILER_FEATURE_ENTRY(__cpp_modules) 219 | COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) 220 | COMPILER_FEATURE_ENTRY(__cpp_using_enum) 221 | }; 222 | static CompilerFeature cxx20lib[] = { 223 | COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) 224 | COMPILER_FEATURE_ENTRY(__cpp_lib_assume_aligned) 225 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_flag_test) 226 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_float) 227 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_lock_free_type_aliases) 228 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_ref) 229 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_shared_ptr) 230 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_value_initialization) 231 | COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_wait) 232 | COMPILER_FEATURE_ENTRY(__cpp_lib_barrier) 233 | COMPILER_FEATURE_ENTRY(__cpp_lib_bind_front) 234 | COMPILER_FEATURE_ENTRY(__cpp_lib_bit_cast) 235 | COMPILER_FEATURE_ENTRY(__cpp_lib_bitops) 236 | COMPILER_FEATURE_ENTRY(__cpp_lib_bounded_array_traits) 237 | COMPILER_FEATURE_ENTRY(__cpp_lib_char8_t) 238 | COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) 239 | COMPILER_FEATURE_ENTRY(__cpp_lib_concepts) 240 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_algorithms) 241 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_complex) 242 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_dynamic_alloc) 243 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_functional) 244 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_iterator) 245 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_memory) 246 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_numeric) 247 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string) 248 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string_view) 249 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_tuple) 250 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_utility) 251 | COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_vector) 252 | COMPILER_FEATURE_ENTRY(__cpp_lib_coroutine) 253 | COMPILER_FEATURE_ENTRY(__cpp_lib_destroying_delete) 254 | COMPILER_FEATURE_ENTRY(__cpp_lib_endian) 255 | COMPILER_FEATURE_ENTRY(__cpp_lib_erase_if) 256 | COMPILER_FEATURE_ENTRY(__cpp_lib_execution) 257 | COMPILER_FEATURE_ENTRY(__cpp_lib_format) 258 | COMPILER_FEATURE_ENTRY(__cpp_lib_generic_unordered_lookup) 259 | COMPILER_FEATURE_ENTRY(__cpp_lib_int_pow2) 260 | COMPILER_FEATURE_ENTRY(__cpp_lib_integer_comparison_functions) 261 | COMPILER_FEATURE_ENTRY(__cpp_lib_interpolate) 262 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_constant_evaluated) 263 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_layout_compatible) 264 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_nothrow_convertible) 265 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_pointer_interconvertible) 266 | COMPILER_FEATURE_ENTRY(__cpp_lib_jthread) 267 | COMPILER_FEATURE_ENTRY(__cpp_lib_latch) 268 | COMPILER_FEATURE_ENTRY(__cpp_lib_list_remove_return_type) 269 | COMPILER_FEATURE_ENTRY(__cpp_lib_math_constants) 270 | COMPILER_FEATURE_ENTRY(__cpp_lib_polymorphic_allocator) 271 | COMPILER_FEATURE_ENTRY(__cpp_lib_ranges) 272 | COMPILER_FEATURE_ENTRY(__cpp_lib_remove_cvref) 273 | COMPILER_FEATURE_ENTRY(__cpp_lib_semaphore) 274 | COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) 275 | COMPILER_FEATURE_ENTRY(__cpp_lib_shift) 276 | COMPILER_FEATURE_ENTRY(__cpp_lib_smart_ptr_for_overwrite) 277 | COMPILER_FEATURE_ENTRY(__cpp_lib_source_location) 278 | COMPILER_FEATURE_ENTRY(__cpp_lib_span) 279 | COMPILER_FEATURE_ENTRY(__cpp_lib_ssize) 280 | COMPILER_FEATURE_ENTRY(__cpp_lib_starts_ends_with) 281 | COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) 282 | COMPILER_FEATURE_ENTRY(__cpp_lib_syncbuf) 283 | COMPILER_FEATURE_ENTRY(__cpp_lib_three_way_comparison) 284 | COMPILER_FEATURE_ENTRY(__cpp_lib_to_address) 285 | COMPILER_FEATURE_ENTRY(__cpp_lib_to_array) 286 | COMPILER_FEATURE_ENTRY(__cpp_lib_type_identity) 287 | COMPILER_FEATURE_ENTRY(__cpp_lib_unwrap_ref) 288 | }; 289 | 290 | static CompilerFeature cxx23[] = { 291 | //< Continue to Populate 292 | COMPILER_FEATURE_ENTRY(__cpp_size_t_suffix) 293 | }; 294 | static CompilerFeature cxx23lib[] = { 295 | //< Continue to Populate 296 | COMPILER_FEATURE_ENTRY(__cpp_lib_is_scoped_enum) 297 | COMPILER_FEATURE_ENTRY(__cpp_lib_stacktrace) 298 | COMPILER_FEATURE_ENTRY(__cpp_lib_stdatomic_h) 299 | COMPILER_FEATURE_ENTRY(__cpp_lib_string_contains) 300 | COMPILER_FEATURE_ENTRY(__cpp_lib_to_underlying) 301 | COMPILER_FEATURE_ENTRY(__cpp_lib_variant) 302 | }; 303 | 304 | static CompilerFeature attributes[] = { 305 | COMPILER_ATTRIBUTE_ENTRY(carries_dependency) 306 | COMPILER_ATTRIBUTE_ENTRY(deprecated) 307 | COMPILER_ATTRIBUTE_ENTRY(fallthrough) 308 | COMPILER_ATTRIBUTE_ENTRY(likely) 309 | COMPILER_ATTRIBUTE_ENTRY(maybe_unused) 310 | COMPILER_ATTRIBUTE_ENTRY(nodiscard) 311 | COMPILER_ATTRIBUTE_ENTRY(noreturn) 312 | COMPILER_ATTRIBUTE_ENTRY(no_unique_address) 313 | COMPILER_ATTRIBUTE_ENTRY(unlikely) 314 | }; 315 | 316 | constexpr bool is_feature_supported(const CompilerFeature& x) { 317 | return x.value[0] != '_' && x.value[0] != '0' ; 318 | } 319 | 320 | inline void print_compiler_feature(const CompilerFeature& x) { 321 | constexpr static int max_name_length = 44; //< Update if necessary 322 | std::string value{ is_feature_supported(x) ? x.value : "------" }; 323 | if (value.back() == 'L') value.pop_back(); //~ 201603L -> 201603 324 | // value.insert(4, 1, '-'); //~ 201603 -> 2016-03 325 | if ( (print.supported_features && is_feature_supported(x)) 326 | or (print.unsupported_features && !is_feature_supported(x))) { 327 | std::cout << std::left << std::setw(max_name_length) 328 | << x.name << " " << value << '\n'; 329 | } 330 | } 331 | 332 | template 333 | inline void show(char const* title, CompilerFeature (&features)[N]) { 334 | if (print.titles) { 335 | std::cout << '\n' << std::left << title << '\n'; 336 | } 337 | if (print.sorted_by_value) { 338 | std::sort(std::begin(features), std::end(features), 339 | [](CompilerFeature const& lhs, CompilerFeature const& rhs) { 340 | return std::strcmp(lhs.value, rhs.value) < 0; 341 | }); 342 | } 343 | for (const CompilerFeature& x : features) { 344 | print_compiler_feature(x); 345 | } 346 | } 347 | 348 | #endif 349 | 350 | #endif // FEATURETEST_HPP 351 | -------------------------------------------------------------------------------- /utilities/prefuncs.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef PROJECT_PREFUNCS_HPP 8 | #define PROJECT_PREFUNCS_HPP 9 | 10 | #ifdef __has_include 11 | # if __has_include() 12 | # include 13 | # endif 14 | #else 15 | # include 16 | #endif 17 | 18 | namespace Prefuncs { 19 | 20 | int is_compiler_clang() { 21 | #if defined(COMPILER_CLANG_LLVM) 22 | return 1; 23 | #else 24 | return 0; 25 | #endif 26 | } 27 | 28 | int is_compiler_mingw() { 29 | #if defined(COMPILER_MINGW) 30 | return 1; 31 | #else 32 | return 0; 33 | #endif 34 | } 35 | 36 | int is_compiler_mingw64() { 37 | #if defined(COMPILER_MINGW64_32) 38 | return 1; 39 | #else 40 | return 0; 41 | #endif 42 | } 43 | 44 | int is_compiler_gcc() { 45 | #if defined(COMPILER_GCC) 46 | return 1; 47 | #else 48 | return 0; 49 | #endif 50 | } 51 | 52 | int is_compiler_hewlett() { 53 | #if defined(COMPILERHEWLETT) 54 | return 1; 55 | #else 56 | return 0; 57 | #endif 58 | } 59 | 60 | int is_compiler_ibm() { 61 | #if defined(COMPILER_IBM) 62 | return 1; 63 | #else 64 | return 0; 65 | #endif 66 | } 67 | 68 | int is_compiler_msvc() { 69 | #if defined(COMPILER_MSVC) 70 | return 1; 71 | #else 72 | return 0; 73 | #endif 74 | } 75 | 76 | int is_compiler_pgcc_pgcpp() { 77 | #if defined(COMPILER_PGCC) 78 | return 1; 79 | #else 80 | return 0; 81 | #endif 82 | } 83 | 84 | int is_compiler_oracle() { 85 | #if defined(COMPILER_ORACLE) 86 | return 1; 87 | #else 88 | return 0; 89 | #endif 90 | } 91 | 92 | int is_intel() { 93 | #if defined(INTEL) 94 | return 1; 95 | #else 96 | return 0; 97 | #endif 98 | } 99 | 100 | int is_arm() { 101 | #if defined(ARM) 102 | return 1; 103 | #else 104 | return 0; 105 | #endif 106 | } 107 | 108 | int is_amd() { 109 | #if defined(AMD) 110 | return 1; 111 | #else 112 | return 0; 113 | #endif 114 | } 115 | 116 | int is_alpha() { 117 | #if defined(ALPHA) 118 | return 1; 119 | #else 120 | return 0; 121 | #endif 122 | } 123 | 124 | int is_risc() { 125 | #if defined(PA_RISC) 126 | return 1; 127 | #else 128 | return 0; 129 | #endif 130 | } 131 | 132 | int is_epiphany() { 133 | #if defined(EPIPHANY) 134 | return 1; 135 | #else 136 | return 0; 137 | #endif 138 | } 139 | 140 | int is_motorola() { 141 | #if defined(MOTOROLA) 142 | return 1; 143 | #else 144 | return 0; 145 | #endif 146 | } 147 | 148 | int is_powerpc() { 149 | #if defined(POWER_PC) 150 | return 1; 151 | #else 152 | return 0; 153 | #endif 154 | } 155 | 156 | int is_sparc() { 157 | #if defined(SPARC) 158 | return 1; 159 | #else 160 | return 0; 161 | #endif 162 | } 163 | 164 | int is_embedded() { 165 | #if defined(EMBEDDED) 166 | return 1; 167 | #else 168 | return 0; 169 | #endif 170 | } 171 | 172 | int is_aix() { 173 | #if defined(AIX) 174 | return 1; 175 | #else 176 | return 0; 177 | #endif 178 | } 179 | 180 | int is_hpux() { 181 | #if defined(HPUX) 182 | return 1; 183 | #else 184 | return 0; 185 | #endif 186 | } 187 | 188 | int is_linux() { 189 | #if defined(PLATFORM_LINUX) 190 | return 1; 191 | #else 192 | return 0; 193 | #endif 194 | } 195 | 196 | int is_android() { 197 | #if defined(PLATFORM_IS_ANDROID) 198 | return 1; 199 | #else 200 | return 0; 201 | #endif 202 | } 203 | 204 | int is_ios_simulator() { 205 | #if defined(PLATFORM_IS_IOS_EMULATOR) 206 | return 1; 207 | #else 208 | return 0; 209 | #endif 210 | } 211 | 212 | int is_ios_iwatch() { 213 | #if defined(PLATFORM_IS_IWATCH) 214 | return 1; 215 | #else 216 | return 0; 217 | #endif 218 | } 219 | 220 | int is_ios_apple_tv() { 221 | #if defined(PLATFORM_IS_IOS_APPLE_TV) 222 | return 1; 223 | #else 224 | return 0; 225 | #endif 226 | } 227 | 228 | int is_ios() { 229 | #if defined(PLATFORM_IS_IOS) 230 | return 1; 231 | #else 232 | return 0; 233 | #endif 234 | } 235 | 236 | int is_mac() { 237 | #if defined(PLATFORM_IS_MAC) 238 | return 1; 239 | #else 240 | return 0; 241 | #endif 242 | } 243 | 244 | int is_windows() { 245 | #if defined(PLATFORM_IS_WINDOWS) 246 | return 1; 247 | #else 248 | return 0; 249 | #endif 250 | } 251 | 252 | int is_freebsd() { 253 | #if defined(PLATFORM_IS_FREEBSD) 254 | return 1; 255 | #else 256 | return 0; 257 | #endif 258 | } 259 | 260 | int is_openbsd() { 261 | #if defined(PLATFORM_IS_OPENBSD) 262 | return 1; 263 | #else 264 | return 0; 265 | #endif 266 | } 267 | 268 | int is_netbsd() { 269 | #if defined(PLATFORM_IS_NETBSD) 270 | return 1; 271 | #else 272 | return 0; 273 | #endif 274 | } 275 | 276 | int is_playstation() { 277 | #if defined(PLATFORM_IS_PLAYSTATION) 278 | return 1; 279 | #else 280 | return 0; 281 | #endif 282 | } 283 | 284 | int is_xbox() { 285 | #if defined(PLATFORM_IS_XBOX) 286 | return 1; 287 | #else 288 | return 0; 289 | #endif 290 | } 291 | 292 | int is_blackberry() { 293 | #if defined(PLATFORM_IS_BLACKBERRY) 294 | return 1; 295 | #else 296 | return 0; 297 | #endif 298 | } 299 | 300 | int is_openvms() { 301 | #if defined(PLATFORM_IS_OPENVMS) 302 | return 1; 303 | #else 304 | return 0; 305 | #endif 306 | } 307 | 308 | int is_vxworks() { 309 | #if defined(PLATFORM_IS_VXWORKS) 310 | return 1; 311 | #else 312 | return 0; 313 | #endif 314 | } 315 | 316 | int is_ultrix() { 317 | #if defined(PLATFORM_IS_ULTRIX) 318 | return 1; 319 | #else 320 | return 0; 321 | #endif 322 | } 323 | 324 | int is_msdos() { 325 | #if defined(PLATFORM_IS_MSDOS) 326 | return 1; 327 | #else 328 | return 0; 329 | #endif 330 | } 331 | 332 | int is_pc() { 333 | #if defined(PLATFORM_IS_PC) 334 | return 1; 335 | #else 336 | return 0; 337 | #endif 338 | } 339 | 340 | int is_windows_phone() { 341 | #if defined(PLATFORM_IS_WINDOWS_PHPNE) 342 | return 1; 343 | #else 344 | return 0; 345 | #endif 346 | } 347 | 348 | } 349 | 350 | #endif // PROJECT_PREFUNCS_HPP 351 | -------------------------------------------------------------------------------- /utilities/types.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Copyright (c) 2021 Kambiz Asadzadeh 4 | * Copyright (c) 2023 Genyleap 5 | */ 6 | 7 | #ifndef PROJECT_TYPES_HPP 8 | #define PROJECT_TYPES_HPP 9 | 10 | #ifdef __has_include 11 | # if __has_include() 12 | # include 13 | # endif 14 | #else 15 | # include 16 | #endif 17 | 18 | namespace Types { 19 | 20 | using schar = signed char; 21 | using uchar = unsigned char; 22 | using ushort = unsigned short; 23 | using uint = unsigned int; 24 | using ulong = unsigned long; 25 | using ullong = unsigned long long; 26 | using llong = long long; 27 | 28 | //! Fixed width integer types (since C++11) 29 | //! Signed integer type 30 | using s8 = std::int8_t; 31 | using s16 = std::int16_t; 32 | using s32 = std::int32_t; 33 | using s64 = std::int64_t; 34 | 35 | //! Fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively. 36 | using fs8 = std::int_fast8_t; 37 | using fs16 = std::int_fast16_t; 38 | using fs32 = std::int_fast32_t; 39 | using fs64 = std::int_fast64_t; 40 | 41 | //! Smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively. 42 | using ss8 = std::int_least8_t; 43 | using ss16 = std::int_least16_t; 44 | using ss32 = std::int_least32_t; 45 | using ss64 = std::int_least64_t; 46 | 47 | using smax = std::intmax_t; //! Maximum-width signed integer type. 48 | using sptr = std::intptr_t; //! Signed integer type capable of holding a pointer to void. 49 | 50 | //! Unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively. 51 | using u8 = std::uint8_t; 52 | using u16 = std::uint16_t; 53 | using u32 = std::uint32_t; 54 | using u64 = std::uint64_t; 55 | 56 | //! Fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively. 57 | using fu8 = std::uint_fast8_t; 58 | using fu16 = std::uint_fast16_t; 59 | using fu32 = std::uint_fast32_t; 60 | using fu64 = std::uint_fast64_t; 61 | 62 | //! Smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively. 63 | using su8 = std::uint_least8_t; 64 | using su16 = std::uint_least16_t; 65 | using su32 = std::uint_least32_t; 66 | using su64 = std::uint_least64_t; 67 | 68 | using f32 = float; 69 | using f64 = double; 70 | 71 | using b8 = bool; 72 | 73 | using umax = std::uintmax_t; //! Maximum-width unsigned integer type 74 | using uptr = std::uintptr_t; //! Unsigned integer type capable of holding a pointer to void. 75 | 76 | using VariantTypes = std::map>; 77 | using MapList = std::pair>; 78 | using MapVector = std::pair>; 79 | using IteratorConfig = std::map::iterator; 80 | using LanguageType = std::map; 81 | using MetaList = std::map; 82 | using ResourceType = std::map; 83 | using MapConfig = std::map; 84 | using MapString = std::map; 85 | using PairString = std::pair; 86 | using SettingType = std::map; 87 | using VectorString = std::vector; 88 | using VectorSection = std::vector; 89 | using OptionalString = std::optional; 90 | 91 | using OptionalNumeric = std::optional; 92 | using OptionalBool = std::optional; 93 | 94 | #if defined(USE_JSON) && !defined(USE_BOOST) 95 | namespace JSon = Json; 96 | # elif defined(USE_BOOST) 97 | namespace JSon = boost::json; 98 | # elif !defined(USE_JSON) && !defined(USE_BOOST) 99 | #if __cpp_lib_json 100 | namespace JSon = std::json; 101 | #endif 102 | #endif 103 | 104 | using TableNames = std::vector; 105 | using QueryType = std::vector; 106 | using TranslateType = std::string; 107 | 108 | template using Map = std::map; 109 | template using MultiMap = std::multimap; 110 | template using Pair = std::pair; 111 | 112 | template using Vector = std::vector; 113 | template using Optional = std::optional; 114 | template using Variant = std::variant; 115 | 116 | 117 | using Function = std::function; 118 | using PackagedTask = std::packaged_task; 119 | using MultiThreadVector = std::vector; 120 | using StringStream = std::basic_stringstream; 121 | using String = std::string; 122 | using IfStreamer = std::ifstream; 123 | using StringStream = std::stringstream; 124 | 125 | } 126 | 127 | #endif // PROJECT_TYPES_HPP 128 | --------------------------------------------------------------------------------