diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..791b3b8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,47 @@ +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: true +AlignEscapedNewlinesLeft: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: false +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: false +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterFunction: true +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +IndentCaseLabels: false +IndentFunctionDeclarationAfterType: false +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +PointerAlignment: Left +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +Standard: c++17 +UseTab: Never diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..27616ad --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,2 @@ +Checks: '-*,bugprone-argument-comment' +WarningsAsErrors: bugprone-argument-comment diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/workflows/sync-from-template.yml b/.github/workflows/sync-from-template.yml new file mode 100644 index 0000000..912e419 --- /dev/null +++ b/.github/workflows/sync-from-template.yml @@ -0,0 +1,114 @@ +--- +# +# - Run this workflow to pull changes from the template repository. +# +# - Clone this repository. Check out a branch +# - Copy files from the template onto this clone +# - Push the branch to this repository +# - Create a pull request in this repository +# + +name: Sync changes from template project. + +on: + # cronjob trigger + schedule: + - cron: "17 5 * * 5" + + # Run when this file changes + push: + paths: + - .github/workflows/sync-from-template.yml + + # Run when manually triggered + workflow_dispatch: + +env: + BASE_BRANCH: main + HEAD_BRANCH: chore/sync-from-template + GIT_AUTHOR_NAME: ${{ github.repository_owner }} + GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com + REPO_TEMPLATE: KambizAsadzadeh/Project-Template + THIS_REPO: ${{ github.repository }} + +jobs: + sync-from-template: + # Do not run on the template repository itself + if: github.repository != 'KambizAsadzadeh/Project-Template' + name: Sync changes from KambizAsadzadeh/Project-Template + runs-on: ubuntu-latest + continue-on-error: true + + steps: + # Clone the template repository + - name: Check out template repository + uses: actions/checkout@v2 + with: + repository: ${{ env.REPO_TEMPLATE }} + token: ${{ github.token }} + path: ${{ env.REPO_TEMPLATE }} + + # Clone the target repository. Check out a branch + - name: Check out ${{ github.repository }} + uses: actions/checkout@v2 + with: + repository: ${{ github.repository }} + token: ${{ github.token }} + path: ${{ github.repository }} + - name: Create branch in ${{ env.THIS_REPO }} + run: | + git -C "${THIS_REPO}" fetch origin "${HEAD_BRANCH}" || true + git -C "${THIS_REPO}" branch -a + git -C "${THIS_REPO}" checkout -B "${HEAD_BRANCH}" \ + "remotes/origin/${HEAD_BRANCH}" || \ + git -C "${THIS_REPO}" checkout -b "${HEAD_BRANCH}" + + # Copy files from the template onto the target clone + - name: Copy template contents + run: | + _files="$(find ${REPO_TEMPLATE} \ + ! -path "*/.git/*" \ + ! -path "*/.github/workflows/*" \ + ! -name ".gitignore" \ + ! -name "README.md" \ + -type f \ + -print)" + for _file in ${_files}; do + _src="${_file}" + _dst="${THIS_REPO}/${_file#${REPO_TEMPLATE}/}" + # TODO: Find a more robust / elegant way to get this :point_down: + _dst="${_dst%/*}/" + mkdir -p "${_dst}" + echo "INFO: Copy '${_src}' to '${_dst}'." + cp "${_src}" "${_dst}" + done + git -C "${THIS_REPO}" diff + + # Commit changes, if there are any + - name: Commit changes, if any + run: | + git -C ${THIS_REPO} config user.name "${GIT_AUTHOR_NAME}" + git -C ${THIS_REPO} config \ + user.email "${GIT_AUTHOR_EMAIL}" + git -C ${THIS_REPO} add . + git -C ${THIS_REPO} commit \ + -m "Sync from template@${{ github.sha }}" + + # Push the branch to the target repository + - name: Push topic branch + run: git -C ${THIS_REPO} push -u origin "${HEAD_BRANCH}" + + # Create a pull request in the target repository + - name: Create pull request + env: + GITHUB_TOKEN: ${{ github.token }} + GITHUB_USER: ${{ github.actor }} + run: | + pushd ${THIS_REPO} + hub pull-request \ + -b "${BASE_BRANCH}" \ + -h "${HEAD_BRANCH}" \ + --no-edit \ + -m "Pull updates from ${REPO_TEMPLATE}" \ + -m "Pull updates from ${REPO_TEMPLATE}" + popd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8cbee4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +#Extra +.DS_Store + +# Final Output +build/ProjectTemplate diff --git a/.idea/Project-Template.iml b/.idea/Project-Template.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/Project-Template.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5ecf0a8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CITATION.md b/CITATION.md new file mode 100644 index 0000000..4e57050 --- /dev/null +++ b/CITATION.md @@ -0,0 +1,11 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Asadzadeh" + given-names: "Kambiz" + orcid: "https://orcid.org/0009-0009-2065-3977" +title: "PT" +version: 1.1.222 +date-released: 2023-04-25 +url: "https://kambizasadzadeh.com" +repository-code: "https://github.com/genyleap/Project-Template" diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3382e97 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,467 @@ +# -------------------- PROJECT TEMPLATE INFO --------------------------------------------- +# Title : Project Template +# Version : 1.2.20 +# Author : Kambiz Asadzadeh (compez.eth) +# License : MIT +# Url : https://github.com/genyleap/Project-Template +# Organization : Genyleap +# ---------------------------------------------------------------------------------------- + +cmake_minimum_required(VERSION 3.23) +cmake_policy(SET CMP0048 NEW) + +# Add include path for cmake modules +# ------ PROJECT EXTRA CMAKE ------ + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config/") + +include(ExternalProject) +include(FetchContent) + +# ------ PROJECT INFO ------ +# Options +set(PROJECT_NAME "PT" CACHE STRING "Project Name.") #You can change "ProjectTemplate" with your project name. +set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Project Target Name.") + +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 0) +set(PROJECT_VERSION_PATCH 6) + +# ---- Project settings ---- +set_property(GLOBAL APPEND PROPERTY USE_FOLDERS ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 23) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS ON) +endif() + +set(PROJECT_CREATOR "Kambiz Asadzadeh" CACHE STRING "Creator of your project.") #Your project creator. + +set(PROJECT_LICENSE_TYPE "MIT" CACHE STRING "Project License Type.") #Your project license type. + +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE PROJECT_VERSION_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +endif() +if(NOT PROJECT_VERSION_TAG) + set(PROJECT_VERSION_TAG 00000000) +endif() +set(PROJECT_VERSION_TAG_HEX 0x${PROJECT_VERSION_TAG}) +set(PROJECT_VERSION_TYPE "final" CACHE STRING "Version type.") +set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) +set(PROJECT_VERSION_STRING ${PROJECT_VERSION}-${PROJECT_VERSION_TYPE}) + +# 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. +# Specify language NONE, or use the LANGUAGES keyword and list no languages, to skip enabling any languages. +set(PROJECT_LANGUAGES CXX) + +#Use these keys [application, library] +set(PROJECT_USAGE_TYPE "application" CACHE STRING "Usage Type.") + +#Use these keys [stl, qt, qtwidget, qtquick] +set(PROJECT_MAIN_TYPE "qtquick" CACHE STRING "Library System.") + +set(DEVELOPER_BUNDLE_IDENTIFIER com.kambizasadzadeh.app.${PROJECT_NAME} CACHE STRING "Developer Bundle Identifier.") + +#You can replace your project description with this string. +set(PROJECT_DESCRIPTION "A concept mobile app UI/UX prototype based on Qt Quick technology." CACHE STRING "Project Description") + +#Your project website address. +set(PROJECT_HOMEPAGE_URL "https://kambizasadzadeh.com" CACHE STRING "Project URL.") + +#Project pre-configuration system. +configure_file( + ${PROJECT_SOURCE_DIR}config.hpp.in + ${PROJECT_SOURCE_DIR}config.hpp +) + +project( + ${PROJECT_NAME} + LANGUAGES ${PROJECT_LANGUAGES} + DESCRIPTION ${PROJECT_DESCRIPTION} + HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL} + VERSION ${PROJECT_VERSION} + ) + +# ------ PROJECT CONFIG ------ +include(project-setting) +if(project-setting) + return() +endif() +set(project-setting ON) + +# ------ CROSS-COMPILE CONFIG ------ +include(cross-compile) +if(cross-compile) + return() +endif() +set(cross-compile ON) + +# ------ PROJECT CONFIG ------ +include(color-message) +if(color-message) + return() +endif() +set(color-message ON) + +# ------ COMPILER CONFIG ------ +include(compiler-options) +if(compiler-options) + return() +endif() +set(compiler-options ON) + +# ------ PACKAGES CONFIG ------ +include(packages) +if(packages) + return() +endif() +set(packages ON) + +if(NOT PROJECT_MAIN_TYPE STREQUAL "stl") + set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) +endif() + +set(SUFFIX_EXTRA *.in) +set(SUFFIX_HPPHEADER *.hpp) +set(SUFFIX_IPPHEADER *.ipp) +set(SUFFIX_INLHEADER *.inl) +set(SUFFIX_SOURCE *.cpp) +set(SUFFIX_CONFIG *.json) + +if(PROJECT_MAIN_TYPE STREQUAL "qtwidget") + set(SUFFIX_WIDGET *.ui) +elseif(PROJECT_MAIN_TYPE STREQUAL "qtquick") + set(SUFFIX_QML *.qml) + set(SUFFIX_QRC *.qrc) +endif() + +file(GLOB PRECOMPILED precompiled/pch.hpp) +file(GLOB HEADERS + source/${SUFFIX_HPPHEADER} + source/${SUFFIX_IPPHEADER} + source/${SUFFIX_INLHEADER} +) +file(GLOB SOURCES source/${SUFFIX_SOURCE}) + +#file(GLOB EXAMPLES +# source/examples/${SUFFIX_HPPHEADER} +# source/examples/${SUFFIX_SOURCE} +#) + +file(GLOB UTILS + utilities/${SUFFIX_HPPHEADER} + utilities/${SUFFIX_SOURCE} +) + +if(${PROJECT_MAIN_TYPE} STREQUAL "stl") + set(HAS_USER_INTERFACE false) + file(GLOB MAIN_ENTRY_POINT + source/entrypoint/stl/${SUFFIX_HPPHEADER} + source/entrypoint/stl/${SUFFIX_SOURCE} + ) +elseif(${PROJECT_MAIN_TYPE} STREQUAL "qt") + file(GLOB MAIN_ENTRY_POINT + source/entrypoint/qt/nogui/${SUFFIX_HPPHEADER} + source/entrypoint/qt/nogui/${SUFFIX_SOURCE} + ) +elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget") + file(GLOB MAIN_ENTRY_POINT + source/entrypoint/qt/qtwidget/${SUFFIX_HPPHEADER} + source/entrypoint/qt/qtwidget/${SUFFIX_SOURCE} + ui/widgets/${SUFFIX_HPPHEADER} + ui/widgets/${SUFFIX_SOURCE} + ) +elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + file(GLOB MAIN_ENTRY_POINT + source/entrypoint/qt/qtquick/${SUFFIX_HPPHEADER} + source/entrypoint/qt/qtquick/${SUFFIX_SOURCE} + ) +endif() +if(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget") + file(GLOB UI_SOURCE ui/widgets/${SUFFIX_WIDGET}) +endif() +if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + file(GLOB UI_SOURCE ui/qtquick/${SUFFIX_QRC}) + file(GLOB UI_QML_SOURCE ui/qtquick/${SUFFIX_QML}) +endif() + +file(GLOB_RECURSE src_files ui/qtquick/${SUFFIX_QML}) + +FOREACH(LETTER ${src_files}) + string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" fileList "${LETTER}") + message(${fileList}) + list(APPEND UI_QML_FILES ${fileList}) +ENDFOREACH() + +file(GLOB CONFIGFILE config/${SUFFIX_CONFIG}) + +file(GLOB SOURCESFILE + #---C++--- + ${MAIN_ENTRY_POINT} + ${HEADERS} + ${SOURCES} + ${UI_SOURCE} + ${UI_QML_SOURCE} + ${UTILS} + ${CONFIGFILE} + ${PRECOMPILED} + ${EXAMPLES} + ) + +source_group("PrecompiledHeaders" FILES ${PRECOMPILED}) +source_group("Utilities" FILES ${UTILS}) +source_group("Entry Point (Main)" FILES ${MAIN_ENTRY_POINT}) +source_group("Base" FILES ${HEADERS} ${SOURCES}) +source_group("UI" FILES ${UI_SOURCE}) +source_group("UI/QML" FILES ${UI_QML_SOURCE}) +source_group("Config" FILES ${CONFIGFILE}) +source_group("Examples" FILES ${EXAMPLES}) + +# ------ OUTPUTS CONFIG ------ +message(STATUS "${BoldRed}------ ${PROJECT_TARGET} Tools Configuration ------${ColourReset}") +message(STATUS "${Bold}Language Standard${ColourReset} : C++[${CMAKE_CXX_STANDARD}]") +message(STATUS "${Bold}Compiler${ColourReset} : ${CMAKE_CXX_COMPILER_ID}") +message(STATUS "${Bold}Compiler Version${ColourReset} : ${CMAKE_CXX_COMPILER_VERSION}") +message(STATUS "${Bold}OS Target${ColourReset} : ${CMAKE_HOST_SYSTEM}") +message(STATUS "${Bold}OS Version${ColourReset} : ${CMAKE_HOST_SYSTEM_VERSION}") +message(STATUS "${Bold}System Architecture${ColourReset} : ${OS_ARCHITECTURES}") +message(STATUS "${Bold}Project License${ColourReset} : ${PROJECT_LICENSE_TYPE}") +message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Framework Info ------${ColourReset}") +message(STATUS "${Bold}Name${ColourReset} : ${CMAKE_PROJECT_NAME}") +message(STATUS "${Bold}Description${ColourReset} : ${CMAKE_PROJECT_DESCRIPTION}") +message(STATUS "${Bold}Version${ColourReset} : ${PROJECT_VERSION}") +message(STATUS "${Bold}Full Version${ColourReset} : ${PROJECT_VERSION_STRING}") +message(STATUS "${Bold}Creator${ColourReset} : ${PROJECT_CREATOR}") +message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Project Configuration ------${ColourReset}") +message(STATUS "${Bold}DEVELOPER${ColourReset} : ${PROJECT_CREATOR}") +message(STATUS "${Bold}PROJECT_PROJECT${ColourReset} : ${PROJECT_NAME}") +message(STATUS "${Bold}PROJECT_TARGET${ColourReset} : ${PROJECT_TARGET}") +message(STATUS "${Bold}PROJECT_VERSION${ColourReset} : ${PROJECT_VERSION}") +message(STATUS "${Bold}PROJECT_VERSION_TYPE${ColourReset} : ${Underscore}${PROJECT_VERSION_TYPE}${ColourReset}") +message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} Building Configuration ------${ColourReset}") +message(STATUS "${Bold}PROJECT_BUILD_SHARED${ColourReset} : ${PROJECT_BUILD_SHARED}") +message(STATUS "${Bold}PROJECT_VERSION_TAG_HEX${ColourReset} : ${PROJECT_VERSION_TAG_HEX}") +message(STATUS "${Bold}PROJECT_FOLDER_SUFFIX${ColourReset} : ${PROJECT_FOLDER_SUFFIX}") +message(STATUS "${Bold}LIBRARY_OUTPUT_PATH${ColourReset} : ${LIBRARY_OUTPUT_PATH}") +message(STATUS "${Bold}CMAKE_CURRENT_SOURCE_DIR${ColourReset} : ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "${BoldBlue}------ ${PROJECT_TARGET} End Configuration ------${ColourReset}") + +if(GUI_APPLICATION AND PROJECT_MAIN_TYPE STREQUAL "qt" OR PROJECT_MAIN_TYPE STREQUAL "qtwidget" OR PROJECT_MAIN_TYPE STREQUAL "qtquick") + if(USE_QT5_FEATURES) + if(${PROJECT_MAIN_TYPE} STREQUAL "qt") + list(APPEND QT_MODULES Core Core5Compat) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Core5Compat + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Core5Compat) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Core5Compat) + elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget") + list(APPEND QT_MODULES Core Widgets Core5Compat) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Core5Compat + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Core5Compat) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Core5Compat) + elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + list(APPEND QT_MODULES Core Quick Core5Compat) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Core5Compat + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Core5Compat) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Core5Compat) + else() + list(APPEND QT_MODULES Core Core5Compat) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Core5Compat + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Core5Compat) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Core5Compat) + endif() + else() + if(${PROJECT_MAIN_TYPE} STREQUAL "qt") + list(APPEND QT_MODULES Core) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) + elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtwidget") + list(APPEND QT_MODULES Core Widgets) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) + elseif(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + list(APPEND QT_MODULES Core${SPACE_ARG}) + list(APPEND QT_MODULES Quick${SPACE_ARG}) + list(APPEND QT_MODULES_LINK + Qt${QT_VERSION_MAJOR}::Quick + ) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick) + endif() + endif() + + qt_standard_project_setup(REQUIRES 6.5) + + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + if(PROJECT_USAGE_TYPE STREQUAL "library") + qt_add_library(${PROJECT_NAME} + MANUAL_FINALIZATION + ${SOURCESFILE} + ) + else() + if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + qt_add_resources(SOURCESFILE ui/qtquick/qml.qrc) + endif() + qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION ${SOURCESFILE}) + if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + if(USE_QT_QUICK_COMPILER) + qt_add_qml_module(${PROJECT_NAME} + URI ${PROJECT_NAME} + VERSION 1.0 + RESOURCE_PREFIX /app.genyleap.com/import + OUTPUT_DIRECTORY "" + QML_FILES ${UI_QML_FILES} + ) + endif() + endif() + endif() + else() + if(ANDROID) + add_library(${PROJECT_NAME} SHARED + ${SOURCESFILE} + ) + else() + if(PROJECT_USAGE_TYPE STREQUAL "library") + add_library(${PROJECT_NAME} + ${SOURCESFILE} + ) + else() + add_executable(${PROJECT_NAME} + ${SOURCESFILE} + ) + endif() + endif() + endif() + + #Extra Targets & Modules + target_link_libraries(${PROJECT_NAME} PRIVATE + ${LIB_STL_MODULES_LINKER} + ${LIB_MODULES} + ${QT_MODULES_LINK} + ${OS_LIBS} + ) + + #Extra Modules + target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source PRIVATE source ${LIB_TARGET_INCLUDE_DIRECTORIES}) + target_link_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source ${LIB_TARGET_LINK_DIRECTORIES}) + + set_target_properties(${PROJECT_NAME} PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER ${DEVELOPER_BUNDLE_IDENTIFIER} + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/properties/${PLATFORM_FOLDER}/Info.plist.in" + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE + ) + +if(ANDROID) + include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt) +endif() + +if(QT_VERSION_MAJOR GREATER_EQUAL 6.0) #From Qt.6.0 + if(${PROJECT_MAIN_TYPE} STREQUAL "qtquick") + qt_import_qml_plugins(${PROJECT_NAME}) + endif() + if(QT_VERSION GREATER_EQUAL 6.2) #From Qt6.2 + qt_finalize_target(${PROJECT_NAME}) + endif() + if(WIN32) + qt_disable_unicode_defines(${PROJECT_NAME}) + qt_allow_non_utf8_sources(${PROJECT_NAME}) + endif() +endif() + +else() + if(ANDROID) + add_library(${PROJECT_NAME} SHARED + ${SOURCESFILE} + ) + else() + if(PROJECT_USAGE_TYPE STREQUAL "library") + add_library(${PROJECT_NAME} + ${SOURCESFILE} + ) + else() + add_executable(${PROJECT_NAME} + ${SOURCESFILE} + ) + endif() + endif() + + #Extra Targets & Modules + target_link_libraries(${PROJECT_NAME} PRIVATE + ${LIB_STL_MODULES_LINKER} + ${LIB_MODULES} + ${OS_LIBS} + ) + target_include_directories(${PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/source PRIVATE source + ${LIB_TARGET_INCLUDE_DIRECTORIES} + ) + + target_link_directories(${PROJECT_NAME} + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/source + ${LIB_TARGET_LINK_DIRECTORIES} + ) + + set_target_properties(${PROJECT_NAME} PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER ${DEVELOPER_BUNDLE_IDENTIFIER} + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/properties/${PLATFORM_FOLDER}/Info.plist.in" + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE + ) + +endif() + +target_compile_definitions(${PROJECT_NAME} PUBLIC ${LIB_TARGET_COMPILER_DEFINATION}) + +#This command generates installation rules for a project. +#Install rules specified by calls to the install() command within a source directory. are executed in order during installation. +install(TARGETS ${PROJECT_NAME} DESTINATION build/bin) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config/system-config.json DESTINATION ${CMAKE_BINARY_DIR}/config/) + +#Ignore unused files. +list(APPEND CPACK_SOURCE_IGNORE_FILES /.git/ /build/ .gitignore .DS_Store) + +include(InstallRequiredSystemLibraries) +set(CPACK_GENERATOR "TGZ;ZIP") +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A brief description of your project") +include(CPack) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0e46853 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,52 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +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. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Being respectful and inclusive of differing viewpoints and experiences. +- Showing empathy towards others. +- Using welcoming and inclusive language. +- Gracefully accepting constructive criticism. +- Focusing on what is best for the community. + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances. +- Trolling, insulting/derogatory comments, and personal or political attacks. +- Public or private harassment. +- Publishing others' private information, such as physical or electronic addresses, without explicit permission. +- Any other conduct that could be considered inappropriate in a professional setting. + +## Our Responsibilities + +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. + +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. + +## Scope + +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. + +## Enforcement + +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. + +All project team members are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Project maintainers will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +1. **Correction**: Community members are encouraged to engage with the person(s) responsible for the unacceptable behavior to provide feedback and address the issue. +2. **Warning**: If the behavior continues, project maintainers may issue a formal warning that explains the consequences of continued unacceptable behavior. +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. +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. + +## Attribution + +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). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f4bb8fc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Kambiz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7eed2eb --- /dev/null +++ b/README.md @@ -0,0 +1,622 @@ +# Modern Project-Template (PT) +A template for modern C++ projects with useful features for developing cross-platform projects. + +## Cross-Platform project structure based on CMake ## +This repository is a modern project template based on C++ and CMake build tool. + +[![forthebadge](https://forthebadge.com/images/badges/made-with-c-plus-plus.svg)](https://forthebadge.com) + +## Top features: +- ✅ Very easy management of dependencies. +- ✅ Top level macro usage. +- ✅ Customized project structure based on your program type. +- ✅ Advanced microprocessors. +- ✅ Cross-Platform +- ✅ Adapted to latest language & compiler standards. + +## Supported platforms: + +- [x] macOS +- [x] Windows +- [x] Linux +- [x] freeBSD +- [ ] OpenBSD +- [ ] NetBSD +- [x] iOS +- [ ] watchOS +- [x] Android + +## Supported project type: + +- [x] Core Application +- [x] Desktop Application +- [x] Embedded Application +- [x] Mobile Application +- [x] Library + +## Language Standard Support [C++2a or C++2b] +- It depends on your compiler! + +## Building + +- You need CMake tool for building source code +- CMake 3.23 or higher is required. + +``` +cd build +cmake .. +make +./ProjectTemplate + +``` + +> How to sync project from template source? +- This feature is embedded in the project as Git Action. + +## Customization options. +``` +cmake .. -DPROJECT_NAME="Your Project Name" -DPROJECT_CREATOR="Kambiz" -DPROJECT_VERSION_TYPE="beta" -DPROJECT_DESCRIPTION="This is my awesome project" -DPROJECT_LICENSE_TYPE="mit" +``` + +## Customization Note +- Change PROJECT_NAME variable to your own project name. +- Change PROJECT_CREATOR variable to your main project developer. +- Change PROJECT_DESCRIPTION variable to your project description. +- Change PROJECT_HOMEPAGE_URL variable to your project official url. +- Change PROJECT_VERSION_TYPE variable to your project version based on semantic versioning. + +- 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. +- 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. +- The language standard is based on C++17 by default, you can change it via CMAKE_CXX_STANDARD variable. +- Finally, specify software version for the variables PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK. +- Enjoy your project! :) + +## CMake module option [Dependencies] +- These features can be useful in downloading, building, and integrating prerequisites into your project. +- So you can set cmake option variable for enabling them. + +- Include latest standard of C++ +``` +cmake .. -DUSE_LATEST_STANDARD=true +``` + +- Include Boost library +- This option is currently usable if it's already installed on your system. +- I'll work on the automatic downloader version as soon as possible. +``` +cmake .. -DUSE_BOOST=true +``` + +- Include Qt Framework +``` +cmake .. -DGUI_APPLICATION=true +``` + +- Force to update latest version of dependencies from repositories. +``` +cmake .. -DFORCE_UPGRADED_LIBS=false +``` + + +- Include UI +``` +cmake .. -DHAS_USER_INTERFACE=true +``` + +- Include project main type by [stl, qt, qtwidget, qtquick] +- stl (Your project will be based on stl [Default]). +- qt (Your project will be based on Qt Core only [No GUI]). +- qtwidget (Your project will be based on C++, QtWidget [Classic GUI]). +- qtquick (Your project will be based on C++, QtQuick and QML [Modern GUI]). +``` +cmake .. -DPROJECT_MAIN_TYPE=stl +``` + +- Project Type +- Use these keys [application, library] +``` +cmake .. -DPROJECT_USAGE_TYPE=application +``` + +- Project Type +- Use these keys [application, library] +``` +cmake .. -DDEVELOPER_BUNDLE_IDENTIFIER=com.kambizasadzadeh.app +``` + +- 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. +``` +cmake .. -DUSE_QT_QUICK_COMPILER=false +``` + +- Include Curl library +``` +cmake .. -DUSE_CURL=true +``` + +- Include FMT library +``` +cmake .. -DUSE_FMT=true +``` + +- Include CppCheck library +``` +cmake .. -DUSE_CPP_CHECK=true +``` + +- Include Google-Test +``` +cmake .. -DUSE_GOOGLE_TEST=true +``` + +- Include Doc-Test +``` +cmake .. -DUSE_DOC_TEST=true +``` + +- Include Catch2 +``` +cmake .. -DUSE_CATCH2=true +``` + +- Include CTRE +``` +cmake .. -DUSE_CTRE=true +``` + +- Include JSon library +``` +cmake .. -DUSE_JSON=true +``` + +- Include OpenSSL +``` +cmake .. -DUSE_OPENSSL=true +``` + +- Include ZLib +``` +cmake .. -DDUSE_ZLIB=true +``` + +## CMake module option [Compiler options] + +- Enabling the test of clang-tidy +``` +cmake .. -DENABLE_CLANG_TIDY=true +``` + +- Build the project as minimally as possible +``` +cmake .. -DSIMPLE_BUILD=true +``` + +- Enable address sanitizer +``` +cmake .. -DENABLE_ASAN=true +``` + +- Enabling the build of safe codes only [check by warnings]! +``` +cmake .. -DENABLE_WARN_MODE=true +``` + +- Enabling the build of safe codes only! +``` +cmake .. -DENABLE_SAFE_ONLY=true +``` + +- Enable developer (debug) mode +``` +cmake .. -DBUILD_DEBUG_MODE=true +``` + +- Enabling the build of debug logging +``` +cmake .. -DDEBUG_LOGGING=true +``` + +- Build Static Version +``` +cmake .. -DENABLE_STATIC_LIB_BUILD=true +``` + +- Developer mode +``` +cmake .. -DENABLE_DEVELOPER_MODE=true +``` + +- Todo mode +``` +cmake .. -DENABLE_TODO_MODE=true +``` + +- Experimental mode +``` +cmake .. -DENABLE_EXPERIMENTAL_MODE=true +``` + +- Build Shared (Dynamic) Version +``` +cmake .. -ENABLE_SHARED_LIB_BUILD=true +``` + +- Forcing to enable updated programming language. +``` +cmake .. -FORCE_LATEST_STANDARD_FEATURE=true +``` + +- Optimization level. +``` +cmake .. -DOPTIMIZATION_LEVEL=0 +``` +- O Disables optimization, no optimization, fast compilation and nicely debuggable code. (default) +- 1 Some optimization. Is equivalent to 0 with no parameters. Optimization for code size and execution time, generate minimum size code. +- 2 Moderate optimization, enables all standard optimizations. Optimization more for code size and execution time, optimizes code for maximum speed. +- 3 Over and above 2, does aggressive optimizations that may not be compliant to language standard. Optimization more for code size and execution time +- 4 Over and above 3, does aggressive optimizations that may not be compliant to language standard. Optimizations for size over optimizations for speed. +- 5 O3 with fast none accurate math calculations, optimizations for speed over optimizations for size. + +You can set or change your project's basic information such as name, description, link, etc. + +``` +set(PROJECT_NAME "ProjectTemplate" CACHE STRING "Project Name") +set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Target Name") +``` + +- Creator Name. +``` +set(PROJECT_CREATOR "Kambiz Asadzadeh") +``` + +- Project name, language, description, url and version. +``` +project( + ${PROJECT_NAME} + LANGUAGES CXX + DESCRIPTION "Description of your project." + HOMEPAGE_URL "https://kambizasadzadeh.com" + VERSION ${PROJECT_VERSION} +) +``` + +## Configuration output + +```bash + +-- The CXX compiler identification is AppleClang 12.0.0.12000032 +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Ready for Apple Silicon. +-- Performing Test COMPILER_SUPPORTS_CXX23 +-- Performing Test COMPILER_SUPPORTS_CXX23 - Success +-- Performing Test COMPILER_SUPPORTS_CXX20 +-- Performing Test COMPILER_SUPPORTS_CXX20 - Success +-- Performing Test COMPILER_SUPPORTS_CXX17 +-- Performing Test COMPILER_SUPPORTS_CXX17 - Success +-- Performing Test COMPILER_SUPPORTS_CXX14 +-- Performing Test COMPILER_SUPPORTS_CXX14 - Success +-- Performing Test COMPILER_SUPPORTS_CXX11 +-- Performing Test COMPILER_SUPPORTS_CXX11 - Success +-- Performing Test COMPILER_SUPPORTS_CXX0X +-- Performing Test COMPILER_SUPPORTS_CXX0X - Success + +-- ------ ProjectTemplate Tools Configuration ------ +-- Language Standard : C++[20] +-- Compiler : AppleClang +-- Compiler Version : 12.0.0.12000032 +-- OS Target : Darwin-20.3.0 +-- OS Version : +-- System Architecture : x86_64 +-- Project License : MIT +-- ------ ProjectTemplate Framework Info ------ +-- Name : ProjectTemplate +-- Description : Description of your project. +-- Version : +-- ------ ProjectTemplate Project Configuration ------ +-- DEVELOPER : +-- PROJECT_PROJECT : +-- PROJECT_TARGET : ProjectTemplate +-- PROJECT_VERSION : 1.0.2.0 +-- PROJECT_VERSION_TYPE : final +-- ------ ProjectTemplate Building Configuration ------ +-- PROJECT_BUILD_SHARED : +-- PROJECT_VERSION_TAG_HEX : 0x00000000 +-- PROJECT_FOLDER_SUFFIX : +-- LIBRARY_OUTPUT_PATH : .../Project-Template/build/lib +-- CMAKE_CURRENT_SOURCE_DIR : .../Project-Template +-- ------ ProjectTemplate End Configuration ------ +-- Configuring done +``` + +## Usage Example +```cpp +#if defined(HAS_USER_INTERFACE) && defined(USE_QT) +//! Qt +#include +#include +#include + +int main(int argc, char *argv[]) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} +#else + +#include +#include "utilities/featuretest.hpp" + +//! Examples +#include "examples/compilertest.hpp" +#include "examples/platformtest.hpp" +#include "examples/librarytest.hpp" +#include "examples/languagetest.hpp" +#include "examples/configtest.hpp" + +//!JSon [Non-STL] Features +#include + +//!Google Test +#ifdef USE_GOOGLE_TEST +#include + +class Counter { +public: + // Returns the current counter value, and increments it. + int Increment() { + return m_counter++; + } + + // Returns the current counter value, and decrements it. + // counter can not be less than 0, return 0 in this case + int Decrement() { + if (m_counter == 0) { + return m_counter; + } else { + return m_counter--; + } + } + + // Prints the current counter value to STDOUT. + void Print() const { + printf("%d", m_counter); + } +private: + int m_counter; +}; + +//TEST UNIT +TEST(Counter, Increment) { + Counter c; + + // Test that counter 0 returns 0 + EXPECT_EQ(0, c.Decrement()); + + // EXPECT_EQ() evaluates its arguments exactly once, so they + // can have side effects. + + EXPECT_EQ(0, c.Increment()); + EXPECT_EQ(1, c.Increment()); + EXPECT_EQ(2, c.Increment()); + + EXPECT_EQ(3, c.Decrement()); +} + +#endif + +//!Catch2 +#ifdef USE_CATCH2 +# include + +#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file + +unsigned int Factorial( unsigned int number ) { + return number <= 1 ? number : Factorial(number-1)*number; +} + +TEST_CASE( "Factorials are computed", "[factorial]" ) { + REQUIRE( Factorial(1) == 1 ); + REQUIRE( Factorial(2) == 2 ); + REQUIRE( Factorial(3) == 6 ); + REQUIRE( Factorial(10) == 3628800 ); +} + +#endif + +using namespace std; + +int main() +{ + cout << "Hello World!" << endl; + + //!Config Test + ConfigTest config; + config.readSettings(); + + //!Compiler Test + CompilerTest compiler; + compiler.getCompilerInfo(); + + //!Platform Test + PlatformTest platform; + platform.getPlatformInfo(); + + //!Library Test + LibraryTest library; + library.testBoost(); // Boost + + //!Language Features + LanguageTest language; + language.checkFeatures(); + + //!ThirdParty Library + ThirdPartyTest thirdPartyTest; + thirdPartyTest.testFmt(); + + return 0; +} + +#endif +``` + +## More usage examples +- Compiler Test +```cpp +cout << "Compiler Name : " << __COMPILER__ << endl; +cout << "Compiler Version : " << __COMPILER_VER__ << endl; + +#if defined(__COMPILER_CLANG_LLVM_) + cout << "Clang compiler has been detected!\n"; +#elif defined(__COMPILER_INTEL__) + cout << "Intel compiler has been detected!\n"; +#elif defined(__COMPILER_MINGW__) + cout << "MinGW compiler has been detected!\n"; +#elif defined(__COMPILER_MINGW_64__) + cout << "MinGW64 compiler has been detected!\n"; +#elif defined(__COMPILER_GCC__) + cout << "GCC compiler has been detected!\n"; +#elif defined(__COMPILER__HEWLETT_) + cout << "Hewlett compiler has been detected!\n"; +#elif defined(__COMPILER_IBM__) + cout << "IBM compiler has been detected!\n"; +#elif defined(__COMPILER_MSVC__) + cout << "MSVC compiler has been detected!\n"; +#elif defined(__COMPILER_PGCC__) + cout << "PGCC compiler has been detected!\n"; +#elif defined(__COMPILER_ORACLE__) + cout << "Oracle compiler has been detected!\n"; +#endif + +``` +- Platform Test +```cpp +#if defined(PLATFORM_MAC) + cout << "This is macOS platform!\n"; +#elif defined(PLATFORM_WINDOWS) + cout << "This is Windows platform!\n"; +#elif defined(PLATFORM_LINUX) + cout << "This is Linux platform!\n"; +#elif defined(PLATFORM_FREEBSD) + cout << "This is freeBSD platform!\n"; +#elif defined(PLATFORM_OPENBSD) + cout << "This is openBSD platform!\n"; +#elif defined(PLATFORM_VXWORKS) + cout << "This is VXWorks platform!\n"; +#elif defined(PLATFORM_MOTOROLA) + cout << "This is Motorola platform!\n"; +#elif defined(PLATFORM_ULTRIX) + cout << "This is Ultrix platform!\n"; +#elif defined(PLATFORM_DOS) + cout << "This is Dos platform!\n"; +#elif defined(PLATFORM_WINDOWS_PHONE) + cout << "This is Windows Phone platform!\n"; +#elif defined(PLATFORM_IOS_SIMULATOR) + cout << "This is iOS Simulator platform!\n"; +#elif defined(PLATFORM_IOS) + cout << "This is iOS platform!\n"; +#elif defined(PLATFORM_APPLE_TV) + cout << "This is AppleTV platform!\n"; +#elif defined(PLATFORM_IWATCH) + cout << "This is iWatch platform!\n"; +#elif defined(PLATFORM_ANDROID) + cout << "This is Android platform!\n"; +#endif +``` +- Library Test +```cpp +#include "include/common.hpp" +#include + +#ifdef USE_BOOST +#include +#endif + +LibraryTest::LibraryTest() +{ + +} + +void LibraryTest::testBoost() const noexcept +{ + //!Boost Library +#ifdef USE_BOOST + std::cout << "Boost version " << BOOST_VERSION << std::endl; + std::cout << "Boost Lib Clock Test\n"; + boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now(); + for ( long i = 0; i < 10000000; ++i ) + std::sqrt( 123.456L ); // burn some time + boost::chrono::duration sec = boost::chrono::system_clock::now() - start; + std::cout << "took " << sec.count() << " seconds\n"; +#else + std::cout << "Boost Library is not available.\n"; +#endif + +} +``` + +- Language Test +```cpp +#ifdef USE_FEATURE_TEST + if (print.general_features) show("C++ GENERAL", cxx); + if (print.cxx11 && print.core_features) show("C++11 CORE", cxx11); + if (print.cxx14 && print.core_features) show("C++14 CORE", cxx14); + if (print.cxx14 && print.lib_features ) show("C++14 LIB" , cxx14lib); + if (print.cxx17 && print.core_features) show("C++17 CORE", cxx17); + if (print.cxx17 && print.lib_features ) show("C++17 LIB" , cxx17lib); + if (print.cxx20 && print.core_features) show("C++20 CORE", cxx20); + if (print.cxx20 && print.lib_features ) show("C++20 LIB" , cxx20lib); + if (print.cxx23 && print.core_features) show("C++23 CORE", cxx23); + if (print.cxx23 && print.lib_features ) show("C++23 LIB" , cxx23lib); + if (print.attributes) show("ATTRIBUTES", attributes); +#else + std::cout << "Test Feature is not available.\n"; +#endif +``` +- Config Test +```cpp + +#include "config.hpp" +#include + + std::cout << "========CONFIG TEST========" << std::endl; + std::cout << "Project Name : " << PROJECT_NAME << std::endl; + std::cout << "Project Description : " << PROJECT_DESCRIPTION << std::endl; + std::cout << "Project Homepage Url : " << PROJECT_HOMEPAGE_URL << std::endl; + std::cout << "Project Language : " << PROJECT_LANGUAGES << std::endl; + std::cout << "Project Full Version : " << PROJECT_VERSION_STRING << std::endl; + std::cout << "Project Creator : " << PROJECT_CREATOR << std::endl; + std::cout << "Project License Type : " << PROJECT_LICENSE_TYPE << std::endl; + std::cout << "========CONFIG TEST========" << std::endl; + +``` +## If you want donate, Bitcoin address is here! <3 +Screenshot 2022-11-12 at 9 25 49 AM + +## TOOD +- Bug fixing. +- Add new exception handler. +- Add new features. +- Support new libraries. +- Tell me your opinion about which other items should be added. + +## Contribution +- Bug fixes, docs, and enhancements welcome! Please let me know kambiz.ceo@gmail.com diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..a128e08 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,46 @@ +# Security Policy + +## Reporting Security Issues + +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. + +We appreciate your efforts in responsibly disclosing any security concerns and will make every effort to acknowledge your contributions. + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 1.x.x | :white_check_mark: | +| 0.x.x | :x: | + +## Reporting a Vulnerability + +If you believe you've found a vulnerability that has potential security implications, please help us by following these guidelines: + +- Provide a detailed description of the vulnerability, including steps to reproduce the issue. +- Include information about the affected version(s) of the project. +- If applicable, provide any additional resources or references that may assist in understanding and resolving the vulnerability. +- If you have a suggested solution or mitigation for the vulnerability, please include it in your report. + +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. + +## Security Updates and Patching + +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. + +We will aim to provide regular updates on the progress of vulnerability resolution and the planned release schedule for patches or new versions. + +## Acknowledgments + +We greatly appreciate your help in improving the security of this project. + +## Responsible Disclosure + +We request that you follow responsible disclosure practices by not publicly disclosing any potential vulnerabilities until we have had sufficient time to address them. + +Please allow us a reasonable amount of time to investigate and resolve the issue before sharing any details publicly. + +## Contact + +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). + diff --git a/cmake/color-message.cmake b/cmake/color-message.cmake new file mode 100644 index 0000000..087ebf1 --- /dev/null +++ b/cmake/color-message.cmake @@ -0,0 +1,55 @@ +# Define color codes for terminal output +if(NOT WIN32) + string(ASCII 27 Esc) + set(ColourReset "${Esc}[m") + set(Bold "${Esc}[1m") + set(Underscore "${Esc}[4m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") +endif() + +# Function to print colored messages to the terminal +function(ColorMessage) + list(GET ARGV 0 MessageType) + # Determine the message type and apply the appropriate color + if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR) + list(REMOVE_AT ARGV 0) + message(${MessageType} "${BoldRed}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL WARNING) + list(REMOVE_AT ARGV 0) + message(${MessageType} "${BoldYellow}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL AUTHOR_WARNING) + list(REMOVE_AT ARGV 0) + message(${MessageType} "${BoldCyan}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL STATUS) + list(REMOVE_AT ARGV 0) + message(${MessageType} "${Green}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL INFO) + list(REMOVE_AT ARGV 0) + message("-- ${BoldBlue}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL NOTICE) + list(REMOVE_AT ARGV 0) + message("-- ${Blue}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL IMPORTANT) + list(REMOVE_AT ARGV 0) + message("-- ${Yellow}>> ${ARGV}${ColourReset}") + elseif(MessageType STREQUAL MORE_IMPORTANT) + list(REMOVE_AT ARGV 0) + message("-- ${BoldYellow}>> ${ARGV}${ColourReset}") + else() + # Default message without color + message(">> ${ARGV}") + endif() +endfunction() diff --git a/cmake/compiler-options.cmake b/cmake/compiler-options.cmake new file mode 100644 index 0000000..41aa4c8 --- /dev/null +++ b/cmake/compiler-options.cmake @@ -0,0 +1,326 @@ +include(CheckCXXCompilerFlag) + +CHECK_CXX_COMPILER_FLAG("-std=c++26" COMPILER_SUPPORTS_CXX26) +CHECK_CXX_COMPILER_FLAG("-std=c++23" COMPILER_SUPPORTS_CXX23) +CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20) +CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) +CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + +if(COMPILER_SUPPORTS_CXX26) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++26") +elseif(COMPILER_SUPPORTS_CXX23) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23") +elseif(COMPILER_SUPPORTS_CXX23) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") +elseif(COMPILER_SUPPORTS_CXX20) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +elseif(COMPILER_SUPPORTS_CXX14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +elseif(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +set(OPTIMIZATION_LEVEL "0" CACHE STRING "Optimization Level") +if (OPTIMIZATION_LEVEL) + add_definitions(-DOPTIMIZATION_LEVEL) +endif() + +# -lstdc++: Links against the GNU Standard C++ Library. +# -lc++: Links against the libc++ library (used in Clang/LLVM compiler). +# -lc++abi: Links against the libc++abi library, which provides low-level support for the C++ runtime (used in Clang/LLVM compiler). +# Note: Both GCC and MSVC, you generally don't need to explicitly include flags like -lc++abi or their equivalents. + +# C++ STL Library Features. +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_STANDARD_LIBRARIES "-lstdc++") +endif() + +# Multi-threaded DLL runtime library (/MD or /MDd) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_STANDARD_LIBRARIES "-lc++ -lc++abi") +endif() + + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + message("-- CMake run for msvc") + if(OPTIMIZATION_LEVEL EQUAL "0") + set(CMAKE_CXX_FLAGS_DEBUG "/Z7 /Od") + set(CMAKE_CXX_FLAGS_RELEASE "/Od") + endif() + if(OPTIMIZATION_LEVEL EQUAL "1") + set(CMAKE_CXX_FLAGS_DEBUG "/Zi /O1") + set(CMAKE_CXX_FLAGS_RELEASE "/O1") + endif() + if(OPTIMIZATION_LEVEL EQUAL "2") + set(CMAKE_CXX_FLAGS_DEBUG "/Zi /O2") + set(CMAKE_CXX_FLAGS_RELEASE "/O2") + endif() + if(OPTIMIZATION_LEVEL EQUAL "3") + set(CMAKE_CXX_FLAGS_DEBUG "-ZI -Oi") + set(CMAKE_CXX_FLAGS_RELEASE "-Oi") + endif() + if(OPTIMIZATION_LEVEL EQUAL "4") + set(CMAKE_CXX_FLAGS_DEBUG "-ZI /Os") + set(CMAKE_CXX_FLAGS_RELEASE "/Os") + endif() + if(OPTIMIZATION_LEVEL EQUAL "5") + set(CMAKE_CXX_FLAGS_DEBUG "-ZI /Ot") + set(CMAKE_CXX_FLAGS_RELEASE "/Ot") + endif() +else() + message("-- CMake run for GNU") + if(OPTIMIZATION_LEVEL EQUAL "0") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") + set(CMAKE_CXX_FLAGS_RELEASE "-O0") + endif() + if(OPTIMIZATION_LEVEL EQUAL "1") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O1") + set(CMAKE_CXX_FLAGS_RELEASE "-O1") + endif() + if(OPTIMIZATION_LEVEL EQUAL "2") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O2") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + endif() + if(OPTIMIZATION_LEVEL EQUAL "3") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O3") + set(CMAKE_CXX_FLAGS_RELEASE "-O3") + endif() + if(OPTIMIZATION_LEVEL EQUAL "4") + set(CMAKE_CXX_FLAGS_DEBUG "-g -Os") + set(CMAKE_CXX_FLAGS_RELEASE "-Os") + endif() + if(OPTIMIZATION_LEVEL EQUAL "5") + set(CMAKE_CXX_FLAGS_DEBUG "-g -Ofast") + set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") + endif() +endif() + +# Enable optional features +option(ENABLE_MODULES "Enable C++20 modules" OFF) +if(ENABLE_MODULES) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmodules") + add_definitions(-DENABLE_MODULES) +endif() + +# Debug/Testing Modes +option(ENABLE_DEBUG_LOGGING "Enable debug logging" OFF) +option(ENABLE_TESTING "Enable testing mode" OFF) +if(ENABLE_DEBUG_LOGGING) + add_definitions(-DDEBUG_LOGGING) +endif() +if(ENABLE_TESTING) + add_definitions(-DENABLE_TESTING) +endif() + +######################### +# --- Build Options --- # +######################### + +# Use Feature Test library +option(USE_FEATURE_TEST "Use Feature Test library" OFF) +if (USE_FEATURE_TEST) + add_definitions(-DUSE_FEATURE_TEST) +endif() + +# Use Https/SSL system +option(USE_SSL_METHOD "Use Https/SSL system" OFF) +if (USE_SSL_METHOD) + add_definitions(-DUSE_SSL_METHOD) +endif() + +# Use test mode +option(ENABLE_TESTING "Use test mode" OFF) +if (ENABLE_TESTING) + add_definitions(-DENABLE_TESTING) +endif() + +# Enable the test of clang-tidy +option(ENABLE_CLANG_TIDY "Enabling the test of clang-tidy" OFF) +if (ENABLE_CLANG_TIDY) + add_definitions(-DENABLE_CLANG_TIDY) +endif() + +# Enable the test of cppcheck +option(ENABLE_CPPCHECK "Enabling the test of cppcheck" OFF) +if (ENABLE_CPPCHECK) + add_definitions(-DENABLE_CPPCHECK) +endif() + +# Build the project as minimally as possible +option(SIMPLE_BUILD "Build the project as minimally as possible" OFF) +if (SIMPLE_BUILD) + add_definitions(-DSIMPLE_BUILD) +endif() + +# Build the project's documentation +option(BUILD_DOC "Build the project's documentation" OFF) +if (BUILD_DOC) + add_definitions(-DBUILD_DOC) +endif() + +# Compile Qt Quick (QML) files +option(USE_QT_QUICK_COMPILER "Compile Qt Quick (QML) files." OFF) +if (USE_QT_QUICK_COMPILER) + add_definitions(-DUSE_QT_QUICK_COMPILER) +endif() + +# Developer Mode +option(ENABLE_DEVELOPER_MODE "Developer Mode" ON) +if (ENABLE_DEVELOPER_MODE) + add_definitions(-DENABLE_DEVELOPER_MODE) +endif() + +# Todo Mode (Not activated feature!) +option(ENABLE_TODO_MODE "Todo Mode (Not activated feature!)" ON) +if (ENABLE_TODO_MODE) + add_definitions(-DENABLE_TODO_MODE) +endif() + +# Experimental Mode +option(ENABLE_EXPERIMENTAL_MODE "Experimental Mode" ON) +if (ENABLE_EXPERIMENTAL_MODE) + add_definitions(-DENABLE_EXPERIMENTAL_MODE) +endif() + +# Always produce ANSI-colored output (GNU/Clang only). +option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE) +if (FORCE_COLORED_OUTPUT) + add_definitions(-DFORCE_COLORED_OUTPUT) +endif() + +# Enable safe codes only! +option(ENABLE_SAFE_ONLY "Enable safe codes only!" OFF) +if (ENABLE_SAFE_ONLY) + add_definitions(-DENABLE_SAFE_ONLY) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + SET (CMAKE_CXX_FLAGS "/Wall /WX") + else() + SET (CMAKE_CXX_FLAGS "-Wall -Wextra -Werror") + endif() +endif() + +# Enable full warnings for the compiler! +option(ENABLE_WARN_MODE "Enable full warnings for compiler!" OFF) +if (ENABLE_WARN_MODE) + add_definitions(-DENABLE_WARN_MODE) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + SET (CMAKE_CXX_FLAGS "/Wall") + else() + SET (CMAKE_CXX_FLAGS "-Wall") + endif() +endif() + +# Enable developer (debug) mode +option(BUILD_DEBUG_MODE "Enable developer (debug) mode" ON) +if (BUILD_DEBUG_MODE) + add_definitions(-DBUILD_DEBUG_MODE) +endif() + +# Enabling the build of debug logging +option(DEBUG_LOGGING "Enabling the build of debug logging" OFF) +if (DEBUG_LOGGING) + add_definitions(-DDEBUG_LOGGING) +endif() + +# Build Static Version +option(ENABLE_STATIC_LIB_BUILD "Build Static Version" OFF) +if (ENABLE_STATIC_LIB_BUILD) + add_definitions(-DENABLE_STATIC_LIB_BUILD) +endif() + +# Build Shared Version +option(ENABLE_SHARED_LIB_BUILD "Build Shared Version" OFF) +if (ENABLE_SHARED_LIB_BUILD) + add_definitions(-DENABLE_SHARED_LIB_BUILD) +endif() + +# Build Executable Version +option(ENABLE_BINARY_BUILD "Build Executable Version" ON) +if (ENABLE_BINARY_BUILD) + add_definitions(-DENABLE_BINARY_BUILD) +endif() + +# Header Only Version +option(ENABLE_HEADER_ONLY_BUILD "Header Only Version" OFF) +if (ENABLE_HEADER_ONLY_BUILD) + add_definitions(-DENABLE_HEADER_ONLY_BUILD) +endif() + +# Forcing to enable updated programming language. +option(FORCE_LATEST_STANDARD_FEATURE "Forcing to enable updated programming language." OFF) +if (FORCE_LATEST_STANDARD_FEATURE) + add_definitions(-DFORCE_LATEST_STANDARD_FEATURE) +endif() + +# Sanitizers Options +option(ENABLE_SANITIZERS "Enable Sanitizers" OFF) +option(ENABLE_ADDRESS_SANITIZER "Enable AddressSanitizer (ASan)" OFF) +option(ENABLE_LEAK_SANITIZER "Enable LeakSanitizer (LSan)" OFF) +option(ENABLE_MEMORY_SANITIZER "Enable MemorySanitizer" OFF) +option(ENABLE_THREAD_SANITIZER "Enable ThreadSanitizer" OFF) +option(ENABLE_UNDEFINED_SANITIZER "Enable UndefinedBehaviorSanitizer" OFF) + +if (ENABLE_SANITIZERS) + add_definitions(-DENABLE_SANITIZERS) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,leak,undefined") + endif() + if (ENABLE_MEMORY_SANITIZER AND NOT APPLE) + add_definitions(-DENABLE_MEMORY_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory") + endif() + if (ENABLE_THREAD_SANITIZER) + add_definitions(-DENABLE_THREAD_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread") + endif() + if (ENABLE_UNDEFINED_SANITIZER) + add_definitions(-DENABLE_UNDEFINED_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") + endif() + if (APPLE) + message(STATUS "Sanitizers are based on Clang on macOS.") + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,leak,undefined") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND APPLE) + message(WARNING "Sanitizer is not supported with GCC on macOS. Ignoring the options.") + else() + message(WARNING "Unsupported compiler. Sanitizers are disabled.") + endif() +else() + # Check and enable individual sanitizers + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + foreach(SANITIZER IN ITEMS ADDRESS LEAK MEMORY THREAD UNDEFINED) + if ("ENABLE_${SANITIZER}_SANITIZER") + add_definitions(-DENABLE_${SANITIZER}_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZER}") + endif() + endforeach() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT APPLE) + foreach(SANITIZER IN ITEMS ADDRESS LEAK MEMORY THREAD UNDEFINED) + if ("ENABLE_${SANITIZER}_SANITIZER") + add_definitions(-DENABLE_${SANITIZER}_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZER}") + endif() + endforeach() + else() + message(WARNING "Unsupported compiler. Sanitizers are disabled.") + endif() +endif() + + +# Summary +message(STATUS "Final compiler flags: ${CMAKE_CXX_FLAGS}") diff --git a/cmake/cross-compile.cmake b/cmake/cross-compile.cmake new file mode 100644 index 0000000..7dc0c88 --- /dev/null +++ b/cmake/cross-compile.cmake @@ -0,0 +1,100 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms-toolchain/") + +# ------ CROSS-COMPILE CONFIG ------ +if (EXISTS "${CMAKE_CXX_COMPILER}") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE EMCC_VERSION + ERROR_VARIABLE EMCC_VERSION) + if (EMCC_VERSION MATCHES "Emscripten") + message(STATUS "Ready for Wasm...") + set(WASM TRUE) + set(PLATFORM_OS "Web") + set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR}) + include(wasm-toolchain) + if(wasm-toolchain) + return() + endif() + set(wasm-toolchain ON) + endif() +endif() + +#LINUX +if(LINUX AND NOT ANDROID AND NOT APPLE) + message(STATUS "Ready for LINUX.") + set(LINUX TRUE) + set(PLATFORM_OS "Linux") + set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR}) +include(linux-toolchain) +set(linux-toolchain ON) +if(linux-toolchain) + return() +endif() +endif() + +#ANDROID +if(ANDROID AND NOT APPLE) + message(STATUS "Ready for Android.") + set(ANDROID TRUE) + set(PLATFORM_OS "Android") + set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR}) +include(android-toolchain) +if(android-toolchain) + return() +endif() +set(android-toolchain ON) +endif() + +#APPLE SILICON +if(UNIX AND NOT ANDROID AND NOT LINUX AND APPLE) + message(STATUS "Ready for Apple Silicon.") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + message(STATUS "Ready for macOS.") + set(MACOSX TRUE) + set(PLATFORM_OS "macOS") + set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR}) + include(macos-toolchain) + if(macos-toolchain) + return() + endif() + set(macos-toolchain ON) + endif() +endif() + +#iOS +if(UNIX AND NOT ANDROID AND NOT LINUX AND APPLE) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + message(STATUS "Ready for iOS.") + set(PLATFORM_OS "iOS") + set(OS_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES}) + include(ios-toolchain) + if(ios-toolchain) + return() + endif() + set(ios-toolchain ON) + endif() +endif() + +#FREEBSD +if(UNIX AND NOT ANDROID AND NOT LINUX AND NOT APPLE AND NOT WASM) + message(STATUS "Ready for Unix, BSDs...") + set(UNIX TRUE) + set(PLATFORM_OS "Unix") + set(OS_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR}) + include(unix-toolchain) + if(unix-toolchain) + return() + endif() + set(unix-toolchain ON) +endif() + +#Windows +if(WIN32) + set(WINDOWS TRUE) + message(STATUS "Ready for Windows.") + include(windows-toolchain) + if(windows-toolchain) + return() + endif() + set(windows-toolchain ON) +endif() diff --git a/cmake/packages.cmake b/cmake/packages.cmake new file mode 100644 index 0000000..f6e1727 --- /dev/null +++ b/cmake/packages.cmake @@ -0,0 +1,29 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages") + +set(THIRD_PARTY "third-party" CACHE STRING "3rdparty folder for project dependencies. [Don't change this variable.]") + +find_package(Git) +if(Git_FOUND) + message("Git found: ${GIT_EXECUTABLE}") +endif() + +find_package(Boost REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(Cryptopp REQUIRED) +find_package(OpenCV REQUIRED) +find_package(OpenMesh REQUIRED) +find_package(GTest REQUIRED) +find_package(DocTest REQUIRED) +find_package(Catch2 REQUIRED) +find_package(Curl REQUIRED) +find_package(Fmt REQUIRED) +find_package(Jwt REQUIRED) +find_package(JSon REQUIRED) +find_package(Ctre REQUIRED) +find_package(Zlib REQUIRED) +find_package(Eigen REQUIRED) + +if (USE_CUSTOM_ENGINE) + find_package(${ENGINE_CODE_NAME} REQUIRED) +endif() diff --git a/cmake/packages/FindBoost.cmake b/cmake/packages/FindBoost.cmake new file mode 100644 index 0000000..fd502a6 --- /dev/null +++ b/cmake/packages/FindBoost.cmake @@ -0,0 +1,48 @@ +# Package Info. +set(BOOST_NAME "Boost") +set(BOOST_DESCRIPTION "The Boost project provides free peer-reviewed portable C++ source libraries.") +# Pakcage option. +option(USE_BOOST ${BOOST_DESCRIPTION} FALSE) +if (USE_BOOST) + add_definitions(-DUSE_BOOST) + # Define the repository URL and tag for the Boost libraries + set(BOOST_URL "https://github.com/boostorg/boost.git") +if(FORCE_UPGRADED_LIBS) + set(BOOST_TAG "master") +else() + set(BOOST_TAG "boost-1.82.0") +endif() + set(BOOST_LIB_LIST "Boost::system;Boost::chrono;Boost::filesystem;Boost::json" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(Boost boost) +# Package data repository. +if(USE_BOOST) + set(FETCHCONTENT_QUIET off) + get_filename_component(boost_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${BOOST_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${boost_base}) + # Declare the Boost libraries with their submodules using FetchContent_Declare + FetchContent_Declare( + boost + GIT_REPOSITORY ${BOOST_URL} + GIT_TAG ${BOOST_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(boost) + string(TOLOWER "${BOOST_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(boost) + foreach(module IN LISTS BOOST_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT BOOST_FOUND) + return() +endif() diff --git a/cmake/packages/FindCatch2.cmake b/cmake/packages/FindCatch2.cmake new file mode 100644 index 0000000..c9d5f53 --- /dev/null +++ b/cmake/packages/FindCatch2.cmake @@ -0,0 +1,50 @@ +# Package Info. +set(CATCH2_NAME "Catch2") +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).") + +# Pakcage option. +option(USE_CATCH2 ${CATCH2_DESCRIPTION} FALSE) +if (USE_CATCH2) + add_definitions(-DUSE_CATCH2) + # Define the repository URL and tag for the Catch2 libraries + set(CATCH2_URL "https://github.com/catchorg/Catch2.git") +if(FORCE_UPGRADED_LIBS) + set(CATCH2_TAG "master") +else() + set(CATCH2_TAG "v3.3.2") +endif() + set(CATCH2_LIB_LIST "Catch2" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(Catch2 catch2) +# Package data repository. +if(USE_CATCH2) + set(FETCHCONTENT_QUIET off) + get_filename_component(catch2_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/catch2" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${catch2_base}) + FetchContent_Declare( + catch2 + GIT_REPOSITORY ${CATCH2_URL} + GIT_TAG ${CATCH2_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + + # Check if population has already been performed + FetchContent_GetProperties(catch2) + string(TOLOWER "catch2" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(catch2) + foreach(module IN LISTS CATCH2_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT CATCH2_FOUND) + return() +endif() + diff --git a/cmake/packages/FindCell.cmake b/cmake/packages/FindCell.cmake new file mode 100644 index 0000000..7a3e7d6 --- /dev/null +++ b/cmake/packages/FindCell.cmake @@ -0,0 +1,34 @@ +#Package Info. +set(ENGINE_NAME "Cell") +set(ENGINE_DESCRIPTION "Cell Engine is a new and exclusive cross-platform computer application engine based on Modern C++.") + +message("Preparing for " ${ENGINE_NAME} "Engine") + +find_package(PkgConfig QUIET) +pkg_search_module(${ENGINE_NAME} cell) +#Package data repository. + + set(FETCHCONTENT_QUIET off) + get_filename_component(cell_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${ENGINE_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${cell_base}) + FetchContent_Declare( + cell + GIT_REPOSITORY https://github.com/genyleap/cell.git + GIT_TAG main + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(cell) + string(TOLOWER "${ENGINE_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(cell) + include_directories(${${lcName}_INCLUDE_DIR}) + list(APPEND LIB_MODULES cell_lib) + +if(NOT CELL_FOUND) + return() +endif() diff --git a/cmake/packages/FindCppCheck.cmake b/cmake/packages/FindCppCheck.cmake new file mode 100644 index 0000000..f3d5a4a --- /dev/null +++ b/cmake/packages/FindCppCheck.cmake @@ -0,0 +1,23 @@ +#Package Info. +set(CPPCHECK_NAME "CppCheck") +set(CPPCHECK_DESCRIPTION "Static analysis of C/C++ code.") + +#Pakcage option. +option(USE_CPP_CHECK ${CPPCHECK_DESCRIPTION} FALSE) +if (USE_CPP_CHECK) + add_definitions(-DUSE_CPP_CHECK) +endif() + +if(USE_CPP_CHECK) + externalproject_add(${CPPCHECK_NAME} + GIT_REPOSITORY "https://github.com/danmar/cppcheck.git" + GIT_TAG main + INSTALL_DIR "${CMAKE_BINARY_DIR}/install/${CPPCHECK_NAME}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${CPPCHECK_NAME} + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${CPPCHECK_NAME} + UPDATE_COMMAND "" + ) +endif() +if(NOT CPPCHECK_FOUND) + return() +endif() diff --git a/cmake/packages/FindCryptopp.cmake b/cmake/packages/FindCryptopp.cmake new file mode 100644 index 0000000..4ada83c --- /dev/null +++ b/cmake/packages/FindCryptopp.cmake @@ -0,0 +1,45 @@ +# Package Info. +set(CRYPTOPP_NAME "Cryptopp") +set(CRYPTOPP_DESCRIPTION "free C++ class library of cryptographic schemes") + +# Pakcage option. +option(USE_CRYPTOPP ${CRYPTOPP_DESCRIPTION} FALSE) +if (USE_CRYPTOPP) + add_definitions(-DUSE_CRYPTOPP) + # Define the repository URL and tag for the CRYPTOPP libraries + set(CRYPTOPP_URL "https://github.com/weidai11/cryptopp.git") +if(FORCE_UPGRADED_LIBS) + set(CRYPTOPP_TAG "master") +else() + set(CRYPTOPP_TAG "CRYPTOPP_8_7_0") +endif() + set(CRYPTOPP_LIB_LIST "cryptopp" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +if(USE_CRYPTOPP) + set(FETCHCONTENT_QUIET off) + get_filename_component(cryptopp_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${CRYPTOPP_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${cryptopp_base}) + FetchContent_Declare( + cryptopp + GIT_REPOSITORY ${CRYPTOPP_URL} + GIT_TAG ${CRYPTOPP_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(cryptopp) + string(TOLOWER "${CRYPTOPP_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_library(${lcName} STATIC ${${lcName}_SOURCE_DIR}/cryptlib.cpp) + endif() + FetchContent_MakeAvailable(cryptopp) + include_directories(${${lcName}_SOURCE_DIR}) + foreach(module IN LISTS CRYPTOPP_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT CRYPTOPP_FOUND) + return() +endif() diff --git a/cmake/packages/FindCtre.cmake b/cmake/packages/FindCtre.cmake new file mode 100644 index 0000000..4399ccd --- /dev/null +++ b/cmake/packages/FindCtre.cmake @@ -0,0 +1,47 @@ +# Package Info. +set(CTRE_NAME "Ctre") +set(CTRE_DESCRIPTION "A Compile time PCRE (almost) compatible regular expression matcher.") + +# Pakcage option. +option(USE_CTRE ${CTRE_DESCRIPTION} FALSE) +if (USE_CTRE) + add_definitions(-DUSE_CTRE) + # Define the repository URL and tag for the Ctre libraries + set(CTRE_URL "https://github.com/hanickadot/compile-time-regular-expressions.git") +if(FORCE_UPGRADED_LIBS) + set(CTRE_TAG "main") +else() + set(CTRE_TAG "v3.7.2") +endif() + set(CTRE_LIB_LIST "ctre" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${DOCTEST_NAME} ctre) +# Package data repository. +if(USE_CTRE_NAME) + set(FETCHCONTENT_QUIET off) + get_filename_component(ctre_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${CTRE_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${ctre_base}) + FetchContent_Declare( + ctre + GIT_REPOSITORY ${CTRE_URL} + GIT_TAG ${CTRE_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(ctre) + string(TOLOWER "ctre" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(ctre) + foreach(module IN LISTS CTRE_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT CTRE_FOUND) + return() +endif() diff --git a/cmake/packages/FindCurl.cmake b/cmake/packages/FindCurl.cmake new file mode 100644 index 0000000..c20208a --- /dev/null +++ b/cmake/packages/FindCurl.cmake @@ -0,0 +1,29 @@ +# Package Info. +set(CURL_NAME "Curl") +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.") + +# Pakcage option. +option(USE_CURL ${CURL_DESCRIPTION} FALSE) +if (USE_CURL) + add_definitions(-DUSE_CURL) +endif() + +if(USE_CURL) + # Search Curl + find_package(PkgConfig REQUIRED) + pkg_search_module(OPENSSL REQUIRED openssl) + + if(CURL_FOUND) + message(STATUS "Using Curl ${CURL_VERSION}") + else() + # Error; with REQUIRED, pkg_search_module() will throw an error by it's own + endif() + list(APPEND LIB_MODULES curl) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${CURL_INCLUDE_DIRS}) + list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${CURL_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_LINK_DIRECTORIES ${CURL_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_COMPILER_DEFINATION "") +endif() +if(NOT CURL_FOUND) + return() +endif() diff --git a/cmake/packages/FindDocTest.cmake b/cmake/packages/FindDocTest.cmake new file mode 100644 index 0000000..0aa9bb7 --- /dev/null +++ b/cmake/packages/FindDocTest.cmake @@ -0,0 +1,47 @@ +#Package Info. +set(DOCTEST_NAME "DocTest") +set(DOCTEST_DESCRIPTION "The fastest feature-rich C++11/14/17/20 single-header testing framework.") + +#Pakcage option. +option(USE_DOC_TEST ${DOCTEST_DESCRIPTION} FALSE) +if (USE_DOC_TEST) + add_definitions(-DUSE_DOC_TEST) + # Define the repository URL and tag for the DocTest libraries + set(DOC_TEST_URL "https://github.com/onqtam/doctest") +if(FORCE_UPGRADED_LIBS) + set(DOC_TEST_TAG "master") +else() + set(DOC_TEST_TAG "v2.4.11") +endif() + set(DOC_TEST_LIB_LIST "doctest" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${DOCTEST_NAME} doctest) +#Package data repository. +if(USE_DOC_TEST) + set(FETCHCONTENT_QUIET off) + get_filename_component(doctest_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/doctest" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${doctest_base}) + FetchContent_Declare( + DocTest + GIT_REPOSITORY ${DOC_TEST_URL} + GIT_TAG ${DOC_TEST_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(doctest) + string(TOLOWER "doctest" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(DocTest) + foreach(module IN LISTS DOC_TEST_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT DOCTEST_FOUND) + return() +endif() diff --git a/cmake/packages/FindEigen.cmake b/cmake/packages/FindEigen.cmake new file mode 100644 index 0000000..1758846 --- /dev/null +++ b/cmake/packages/FindEigen.cmake @@ -0,0 +1,49 @@ +# Package Info. +set(EIGEN_NAME "Eigen") +set(EIGEN_DESCRIPTION "Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.") + +# Pakcage option. +option(USE_EIGEN ${EIGEN_DESCRIPTION} FALSE) +if (USE_EIGEN) + add_definitions(-DUSE_EIGEN) + # Define the repository URL and tag for the Eigen libraries + set(EIGEN_URL "https://gitlab.com/libeigen/eigen.git") +if(FORCE_UPGRADED_LIBS) + set(EIGEN_TAG "master") +else() + set(EIGEN_TAG "3.4") +endif() + set(EIGEN_LIB_LIST "eigen" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${EIGEN_NAME} eigen) +# Package data repository. +if(USE_EIGEN) + set(FETCHCONTENT_QUIET off) + get_filename_component(eigen_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${EIGEN_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${eigen_base}) + FetchContent_Declare( + eigen + GIT_REPOSITORY ${EIGEN_URL} + GIT_TAG ${EIGEN_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + + # Check if population has already been performed + FetchContent_GetProperties(eigen) + string(TOLOWER "${EIGEN_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(eigen) + foreach(module IN LISTS EIGEN_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT EIGEN_FOUND) + return() +endif() diff --git a/cmake/packages/FindFmt.cmake b/cmake/packages/FindFmt.cmake new file mode 100644 index 0000000..c04b744 --- /dev/null +++ b/cmake/packages/FindFmt.cmake @@ -0,0 +1,44 @@ +# Package Info. +set(FMT_NAME "Fmt") +set(FMT_DESCRIPTION "A modern formatting library.") + +# Pakcage option. +option(USE_FMT ${FMT_DESCRIPTION} FALSE) +if (USE_FMT) + add_definitions(-DUSE_FMT) + # Define the repository URL and tag for the Fmt libraries + set(FMT_URL "https://github.com/fmtlib/fmt.git") +if(FORCE_UPGRADED_LIBS) + set(FMT_TAG "master") +else() + set(FMT_TAG "9.1.0") +endif() + set(FMT_LIB_LIST "fmt::fmt-header-only" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +if(USE_FMT) + set(FETCHCONTENT_QUIET off) + get_filename_component(fmt_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${FMT_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${fmt_base}) + FetchContent_Declare( + fmt + GIT_REPOSITORY ${FMT_URL} + GIT_TAG ${FMT_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(fmt) + string(TOLOWER "${FMT_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(fmt) + foreach(module IN LISTS FMT_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT FMT_FOUND) + return() +endif() diff --git a/cmake/packages/FindGTest.cmake b/cmake/packages/FindGTest.cmake new file mode 100644 index 0000000..e10c997 --- /dev/null +++ b/cmake/packages/FindGTest.cmake @@ -0,0 +1,49 @@ +# Package Info. +set(GTEST_NAME "GTest") +set(GTEST_DESCRIPTION "GoogleTest - Google Testing and Mocking Framework.") + +# Pakcage option. +option(USE_GOOGLE_TEST ${GTEST_DESCRIPTION} FALSE) +if (USE_GOOGLE_TEST) + add_definitions(-DUSE_GOOGLE_TEST) + # Define the repository URL and tag for the Boost libraries + set(GTEST_URL "https://github.com/google/googletest.git") +if(FORCE_UPGRADED_LIBS) + set(GTEST_TAG "master") +else() + set(GTEST_TAG "v1.13.0") +endif() + set(GTEST_LIB_LIST "gtest" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(GTest gtest) +# Package data repository. +if(USE_GOOGLE_TEST) + set(FETCHCONTENT_QUIET off) + get_filename_component(gtest_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/gtest" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${gtest_base}) + FetchContent_Declare( + gtest + GIT_REPOSITORY ${GTEST_URL} + GIT_TAG ${GTEST_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + + # Check if population has already been performed + FetchContent_GetProperties(gtest) + string(TOLOWER "gtest" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(gtest) + foreach(module IN LISTS GTEST_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT GTEST_FOUND) + return() +endif() diff --git a/cmake/packages/FindJSon.cmake b/cmake/packages/FindJSon.cmake new file mode 100644 index 0000000..27779fe --- /dev/null +++ b/cmake/packages/FindJSon.cmake @@ -0,0 +1,54 @@ +# Package Info. +set(JSON_NAME "JSon") + +if(USE_BOOST) + set(JSON_DESCRIPTION "A C++11 or library for parsing and serializing JSON to and from a DOM container in memory based on Boost.") +else() + set(JSON_DESCRIPTION "A C++ library for interacting with JSON.") +endif() + +# Pakcage option. +option(USE_JSON ${JSON_DESCRIPTION} FALSE) +if (USE_JSON) + add_definitions(-DUSE_JSON) + # Define the repository URL and tag for the Boost libraries + set(JSON_URL "https://github.com/open-source-parsers/jsoncpp.git") +if(FORCE_UPGRADED_LIBS) + set(JSON_TAG "master") +else() + set(JSON_TAG "1.9.5") +endif() + set(JSON_LIB_LIST "jsoncpp_lib" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${JSON_NAME} json) +# Package data repository. + +if(USE_JSON) + set(FETCHCONTENT_QUIET off) + get_filename_component(json_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${JSON_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${json_base}) + FetchContent_Declare( + json + GIT_REPOSITORY ${JSON_URL} + GIT_TAG ${JSON_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(json) + string(TOLOWER "${JSON_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(json) + include_directories(${${lcName}_INCLUDE_DIR}) + foreach(module IN LISTS JSON_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() +endif() +if(NOT JSON_FOUND) + return() +endif() diff --git a/cmake/packages/FindJwt.cmake b/cmake/packages/FindJwt.cmake new file mode 100644 index 0000000..a56406a --- /dev/null +++ b/cmake/packages/FindJwt.cmake @@ -0,0 +1,41 @@ +# Package Info. +set(JWT_NAME "Jwt") +set(JWT_DESCRIPTION "A header only library for creating and validating json web tokens in c++") + +# Pakcage option. +option(USE_JWT ${JWT_DESCRIPTION} FALSE) +if (USE_JWT) + add_definitions(-DUSE_JWT) + # Define the repository URL and tag for the JWT libraries + set(JWT_URL "https://github.com/Thalhammer/jwt-cpp.git") +if(FORCE_UPGRADED_LIBS) + set(JWT_TAG "master") +else() + set(JWT_TAG "v0.7.0-rc.0") +endif() +endif() + +if(USE_JWT) + set(FETCHCONTENT_QUIET off) + get_filename_component(jwt_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${JWT_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${jwt_base}) + FetchContent_Declare( + jwt + GIT_REPOSITORY ${JWT_URL} + GIT_TAG ${JWT_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(jwt) + string(TOLOWER "${JWT_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + include_directories(${${lcName}_SOURCE_DIR}/include) + endif() + FetchContent_MakeAvailable(jwt) + list(APPEND LIB_MODULES ssl crypto) +endif() +if(NOT JWT_FOUND) + return() +endif() diff --git a/cmake/packages/FindOpenCV.cmake b/cmake/packages/FindOpenCV.cmake new file mode 100644 index 0000000..7e3baaf --- /dev/null +++ b/cmake/packages/FindOpenCV.cmake @@ -0,0 +1,54 @@ +# Package Info. +set(OPENCV_NAME "OpenCV") +set(OPENCV_DESCRIPTION "Open Source Computer Vision Library.") +# Pakcage option. +option(USE_OPENCV ${OPENCV_DESCRIPTION} FALSE) +if (USE_OPENCV) + add_definitions(-DUSE_OPENCV) + # Define the repository URL and tag for the OpenCV libraries + set(OPENCV_URL "https://github.com/opencv/opencv.git") +if(FORCE_UPGRADED_LIBS) + set(OPENCV_TAG "master") +else() + set(OPENCV_TAG "4.7.0") +endif() + set(OPENCV_LIB_LIST "opencv_core;opencv_imgproc;opencv_imgcodecs;opencv_highgui;" CACHE STRING "List of modules (separated by a semicolon)") +endif() + +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)") + +find_package(PkgConfig QUIET) +pkg_search_module(OpenCV opencv) +# Package data repository. +if(USE_OPENCV) + set(FETCHCONTENT_QUIET off) + get_filename_component(opencv_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${OPENCV_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${opencv_base}) + # Declare the OPENCV libraries with their submodules using FetchContent_Declare + FetchContent_Declare( + OPENCV + GIT_REPOSITORY ${OPENCV_URL} + GIT_TAG ${OPENCV_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(opencv) + string(TOLOWER "${OPENCV_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(opencv) + include_directories(${${lcName}_SOURCE_DIR}/include) + foreach(module IN LISTS OPENCV_LIB_LIST) + list(APPEND LIB_MODULES ${module}) + endforeach() + foreach(module IN LISTS OPENCV_MODULES_LIST) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${${lcName}_SOURCE_DIR}/modules/${module}/include) + endforeach() +endif() +if(NOT OPENCV_FOUND) + return() +endif() diff --git a/cmake/packages/FindOpenMesh.cmake b/cmake/packages/FindOpenMesh.cmake new file mode 100644 index 0000000..edc952d --- /dev/null +++ b/cmake/packages/FindOpenMesh.cmake @@ -0,0 +1,51 @@ +# Package Info. +set(OPENMESH_NAME "OpenMesh") +set(OPENMESH_DESCRIPTION "A generic and efficient polygon mesh data structure.") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") + +# Pakcage option. +option(USE_OPENMESH ${OPENMESH_DESCRIPTION} FALSE) +if (USE_OPENMESH) + add_definitions(-DUSE_OPENMESH) + # Define the repository URL and tag for the OpenMesh libraries + set(OPENMESH_URL "https://github.com/Lawrencemm/openmesh.git") +if(FORCE_UPGRADED_LIBS) + set(OPENMESH_TAG "master") +else() + set(OPENMESH_TAG "lm-minimal") +endif() +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${OPENMESH_NAME} openmesh) +# Package data repository. +if(USE_OPENMESH) + set(FETCHCONTENT_QUIET off) + get_filename_component(openmesh_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${OPENMESH_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${openmesh_base}) + FetchContent_Declare( + openmesh + GIT_REPOSITORY ${OPENMESH_URL} + GIT_TAG ${OPENMESH_TAG} + GIT_PROGRESS TRUE + USES_TERMINAL_DOWNLOAD TRUE + ) + + # Check if population has already been performed + FetchContent_GetProperties(openmesh) + string(TOLOWER "openmesh" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(openmesh) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENMESH_INCLUDE_DIRS}) + list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENMESH_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENMESH_LIBRARY_DIRS}) + list(APPEND LIB_MODULES ${OPENMESH_LIBRARIES}) + list(APPEND LIB_TARGET_COMPILER_DEFINATION -D_USE_MATH_DEFINES) +endif() +if(NOT OPENMESH_FOUND) + return() +endif() diff --git a/cmake/packages/FindOpenSSL.cmake b/cmake/packages/FindOpenSSL.cmake new file mode 100644 index 0000000..fd41f06 --- /dev/null +++ b/cmake/packages/FindOpenSSL.cmake @@ -0,0 +1,50 @@ +# Package Info. +set(OPENSSL_NAME "OpenSSL") +set(OPENSSL_DESCRIPTION "TLS/SSL and crypto library.") + +# Pakcage option. +option(USE_OPENSSL ${OPENSSL_DESCRIPTION} FALSE) +if (USE_OPENSSL) + add_definitions(-DUSE_OPENSSL) +endif() + +set(OPENSSL_WASM_PATH_INCLUDE "") +set(OPENSSL_WASM_PATH_LIB "") + +if (USE_OPENSSL) + add_definitions(-DUSE_OPENSSL) +endif() + +# Package data repository. +if(USE_OPENSSL) + # Search OpenSSL + if(EMSCRIPTEN) + message("Using emscripten!") + message("Set custom emscripten lib!") + list(APPEND LIB_MODULES ssl crypto) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENSSL_WASM_PATH_INCLUDE}) + list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENSSL_WASM_PATH_LIB}) + list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENSSL_WASM_PATH_LIB}) + list(APPEND LIB_TARGET_COMPILER_DEFINATION "") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1 -s USE_ZLIB=1") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s USE_ZLIB=1") + else() + find_package(PkgConfig REQUIRED) + pkg_search_module(OPENSSL REQUIRED openssl) + if( OPENSSL_FOUND ) + message(STATUS "Using OpenSSL ${OPENSSL_VERSION}") + else() + # Error; with REQUIRED, pkg_search_module() will throw an error by it's own + endif() + list(APPEND LIB_MODULES ssl crypto) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIRS}) + list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${OPENSSL_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_LINK_DIRECTORIES ${OPENSSL_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_COMPILER_DEFINATION "") + endif() + +endif() +if(NOT OPENSSL_FOUND) + message("Please install OpenSSL from system root first! Use [https://www.openssl.org/source/]") + return() +endif() diff --git a/cmake/packages/FindZlib.cmake b/cmake/packages/FindZlib.cmake new file mode 100644 index 0000000..afcf24a --- /dev/null +++ b/cmake/packages/FindZlib.cmake @@ -0,0 +1,49 @@ +# Package Info. +set(ZLIB_NAME "Zlib") +set(ZLIB_DESCRIPTION "A massively spiffy yet delicately unobtrusive compression library.") + +# Pakcage option. +option(USE_ZLIB ${ZLIB_DESCRIPTION} FALSE) +if (USE_ZLIB) + add_definitions(-DUSE_ZLIB) + # Define the repository URL and tag for the Zlib libraries + set(ZLIB_URL "https://github.com/madler/zlib.git") +if(FORCE_UPGRADED_LIBS) + set(ZLIB_TAG "master") +else() + set(ZLIB_TAG "v1.2.13") +endif() +endif() + +find_package(PkgConfig QUIET) +pkg_search_module(${ZLIB_NAME} zlib) +# Package data repository. +if(USE_ZLIB) + set(FETCHCONTENT_QUIET off) + get_filename_component(zlib_base "${CMAKE_CURRENT_SOURCE_DIR}/${THIRD_PARTY}/${PLATFORM_FOLDER_NAME}/${ZLIB_NAME}" + REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") + set(FETCHCONTENT_BASE_DIR ${zlib_base}) + FetchContent_Declare( + zlib + GIT_REPOSITORY ${ZLIB_URL} + GIT_TAG ${ZLIB_TAG} + GIT_PROGRESS TRUE + ) + # Check if population has already been performed + FetchContent_GetProperties(zlib) + string(TOLOWER "${ZLIB_NAME}" lcName) + if(NOT ${lcName}_POPULATED) + FetchContent_Populate(${lcName}) + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() + FetchContent_MakeAvailable(zlib) + list(APPEND LIB_MODULES zlib) + list(APPEND LIB_TARGET_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS}) + list(APPEND LIB_TARGET_LIBRARY_DIRECTORIES ${ZLIB_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_LINK_DIRECTORIES ${ZLIB_LIBRARY_DIRS}) + list(APPEND LIB_TARGET_COMPILER_DEFINATION "") + list(APPEND LIB_TARGET_PROPERTIES "-D_FILE_OFFSET_BITS=64") +endif() +if(NOT ZLIB_FOUND) + return() +endif() diff --git a/cmake/platforms-toolchain/android-toolchain.cmake b/cmake/platforms-toolchain/android-toolchain.cmake new file mode 100644 index 0000000..b51530b --- /dev/null +++ b/cmake/platforms-toolchain/android-toolchain.cmake @@ -0,0 +1,58 @@ +# Standard settings for Android +set(CMAKE_SYSTEM_NAME Android) +set(CMAKE_SYSTEM_VERSION 21) # Android API level (can be changed to your target version) +set(CMAKE_CROSSCOMPILING TRUE) +set(ANDROID TRUE) +set(PLATFORM_FOLDER "Android") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory for Android +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# Set NDK path (if it's not set globally, you can also set the NDK path here) +# set(ANDROID_NDK "/path/to/your/ndk") # Uncomment if needed + +if(ANDROID_SDK_ROOT) +include(${ANDROID_SDK_ROOT}/android_openssl/CMakeLists.txt) +endif() + +if(ANDROID_SDK) +include(${ANDROID_SDK}/android_openssl/CMakeLists.txt) +endif() + +# Specify the Android ABIs (Architectures) to target +set(ANDROID_ABI "arm64-v8a" CACHE STRING "Android ABI" FORCE) # You can use "armeabi-v7a", "x86", "x86_64", "arm64-v8a" +set(ANDROID_NATIVE_API_LEVEL 21) # Android API level, the minimum required by your app + +# Set Android toolchain file (you need to provide the correct path to the Android toolchain file) +set(CMAKE_TOOLCHAIN_FILE ${ANDROID_NDK}/build/cmake/android.toolchain.cmake) + +# Android-specific libraries (Android system libraries) +# You can add more libraries depending on your requirements (e.g., OpenGL, Vulkan, JNI, etc.) +set(OS_LIBS + "-landroid" # Basic Android library + "-lEGL" # OpenGL ES library + "-lGLESv2" # OpenGL ES 2.0 + "-ljnigraphics" # JNI Graphics interface (useful for drawing) + "-llog" # Android log library (for logging in C++ code) +) + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("Android NDK path: ${ANDROID_NDK}") +message("Android ABI: ${ANDROID_ABI}") +message("Android API Level: ${ANDROID_NATIVE_API_LEVEL}") +message("Android Libraries: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/ios-toolchain.cmake b/cmake/platforms-toolchain/ios-toolchain.cmake new file mode 100644 index 0000000..ce783b4 --- /dev/null +++ b/cmake/platforms-toolchain/ios-toolchain.cmake @@ -0,0 +1,37 @@ +# Standard settings for iOS +set(CMAKE_SYSTEM_NAME iOS) +set(CMAKE_SYSTEM_VERSION 13.0) # You can adjust this to the minimum iOS version required +set(CMAKE_CROSSCOMPILING TRUE) +set(IOS TRUE) +set(PLATFORM_FOLDER "iOS") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory for iOS +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# iOS-specific libraries and frameworks +# You will need to link the appropriate iOS frameworks depending on your application's requirements. +set(OS_LIBS + "-framework Foundation" # Core iOS Foundation framework + "-framework UIKit" # User interface components + "-framework CoreGraphics" # 2D drawing framework + "-framework CoreMedia" # Media and video processing + "-framework AVFoundation" # Audio and video framework +) + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("iOS Libraries: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/linux-toolchain.cmake b/cmake/platforms-toolchain/linux-toolchain.cmake new file mode 100644 index 0000000..cc1d2f4 --- /dev/null +++ b/cmake/platforms-toolchain/linux-toolchain.cmake @@ -0,0 +1,44 @@ +# Standard settings for Linux systems +set(CMAKE_SYSTEM_NAME Linux) # Set system to Linux +set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all Linux distributions +set(CMAKE_CROSSCOMPILING FALSE) # Not cross-compiling +set (LINUX TRUE) +set(PLATFORM_FOLDER "Linux") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# Linux system libraries - Common across most Linux distributions +set(OS_LIBS + "-lpthread" # Pthread library for multithreading (POSIX threads) + "-lm" # Math library (for common math functions like sqrt, sin, etc.) + "-lstdc++" # Standard C++ library + "-lc" # C standard library + "-ldl" # Dynamic loading library + "-lrt" # Real-time extensions for Linux systems + "-lX11" # X11 library for graphical applications (if needed) + "-lssl -lcrypto" # OpenSSL for encryption (if needed) +) + +# Optional: Add other libraries depending on the specific Linux distribution or features you need +# For example, for network-related features or GUI, you can add: +# set(OS_LIBS ${OS_LIBS} "-lgtk-3") # If using GTK+ for GUI applications +# set(OS_LIBS ${OS_LIBS} "-lboost_system -lboost_filesystem") # If using Boost + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("Linux Libraries: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/macos-toolchain.cmake b/cmake/platforms-toolchain/macos-toolchain.cmake new file mode 100644 index 0000000..732db06 --- /dev/null +++ b/cmake/platforms-toolchain/macos-toolchain.cmake @@ -0,0 +1,36 @@ +# Standard settings for macOS +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_CROSSCOMPILING TRUE) +set(APPLE TRUE) +set(PLATFORM_FOLDER "macOS") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory for macOS +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# macOS specific libraries and frameworks +set(OS_LIBS + "-framework IOKit" + "-framework ApplicationServices" + "-framework CoreServices" + "-framework CoreGraphics" + "-framework Foundation" +) + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("macOS Frameworks: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/unix-toolchain.cmake b/cmake/platforms-toolchain/unix-toolchain.cmake new file mode 100644 index 0000000..701a4d7 --- /dev/null +++ b/cmake/platforms-toolchain/unix-toolchain.cmake @@ -0,0 +1,41 @@ +# Standard settings for Unix-like systems (FreeBSD, OpenBSD, etc.) +set(CMAKE_SYSTEM_NAME UNIX) # Generic Unix system for FreeBSD, OpenBSD, etc. +set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all Unix-like systems +set(CMAKE_CROSSCOMPILING FALSE) # We are not cross-compiling +set (UNIX TRUE) +set(PLATFORM_FOLDER "Unix") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# Unix system libraries - Common across most BSD-like systems +set(OS_LIBS + "-lpthread" # Pthread library for multithreading (POSIX threads) + "-lm" # Math library (for common math functions like sqrt, sin, etc.) + "-lstdc++" # Standard C++ library + "-lc" # C standard library + "-ldl" # Dynamic loading library (for Unix-like systems) + "-lrt" # Real-time extensions for Unix-like systems +) + +# Optional: Add more libraries depending on the specific BSD system or features you need +# set(OS_LIBS ${OS_LIBS} "-lX11") # If using X11 for graphical apps +# set(OS_LIBS ${OS_LIBS} "-lssl -lcrypto") # If using OpenSSL for encryption + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("Unix-like Libraries: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/wasm-toolchain.cmake b/cmake/platforms-toolchain/wasm-toolchain.cmake new file mode 100644 index 0000000..b293265 --- /dev/null +++ b/cmake/platforms-toolchain/wasm-toolchain.cmake @@ -0,0 +1,27 @@ +# Standard settings for Wasm systems +set(CMAKE_SYSTEM_NAME WASM) # Generic Wasm system for Web. +set(CMAKE_SYSTEM_VERSION 1) # Version is generic for all wasm systems +set(CMAKE_CROSSCOMPILING FALSE) # We are not cross-compiling +set (WASM TRUE) +set(PLATFORM_FOLDER "Wasm") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("Unix-like Libraries: ${OS_LIBS}") diff --git a/cmake/platforms-toolchain/windows-toolchain.cmake b/cmake/platforms-toolchain/windows-toolchain.cmake new file mode 100644 index 0000000..5898ead --- /dev/null +++ b/cmake/platforms-toolchain/windows-toolchain.cmake @@ -0,0 +1,36 @@ +# Standard settings for Windows +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_VERSION 10) # Set the system version (you can adjust if needed) +set(CMAKE_CROSSCOMPILING TRUE) +set(WINDOWS TRUE) +set(PLATFORM_FOLDER "Windows") + +#------ PROJECT DIRECTORIES ------ +# Define base build directory for Windows +set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build/${PLATFORM_FOLDER}) + +# Set output directories for executables, libraries, and other build files +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir}/lib) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BINARY_DIR ${dir}) +set(CMAKE_CACHEFILE_DIR ${dir}) + +# Ensure all output paths are unified +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +# Windows specific libraries and settings +# For simplicity, here are some commonly used libraries on Windows. +# You may need to modify this list based on your project's requirements. +set(OS_LIBS + "user32.lib" # Basic Windows user interface library + "gdi32.lib" # Windows graphics device interface library + "kernel32.lib" # Kernel-level services +) + +# Output information for debugging +message("Build directory: ${dir}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +message("Windows Libraries: ${OS_LIBS}") diff --git a/cmake/project-setting.cmake b/cmake/project-setting.cmake new file mode 100644 index 0000000..5dad25c --- /dev/null +++ b/cmake/project-setting.cmake @@ -0,0 +1,43 @@ +# ------ ADDITIONAL OPTIONS ------ + +# Use the latest standard of C++ +option(USE_LATEST_STANDARD "Include the latest standard of C++" ON) +if (USE_LATEST_STANDARD) + add_definitions(-DUSE_LATEST_STANDARD) +endif() + +# Include Qt5 Framework features +option(USE_QT5_FEATURES "Include Qt5 Framework features" OFF) +if (USE_QT5_FEATURES) + add_definitions(-DUSE_QT5_FEATURES) +endif() + +# Include full features of Qt Framework +option(USE_FULL_QT_FEATURES "Include full features of Qt Framework" OFF) +if (USE_FULL_QT_FEATURES) + add_definitions(-DUSE_FULL_QT_FEATURES) +endif() + +# Include User Interface +option(GUI_APPLICATION "Include User Interface" ON) +if (GUI_APPLICATION) + add_definitions(-DGUI_APPLICATION) +endif() + +# Force to update to the latest version of dependencies from repositories +option(FORCE_UPGRADED_LIBS "Force to update to the latest version of dependencies from repositories" OFF) +if (FORCE_UPGRADED_LIBS) + add_definitions(-DFORCE_UPGRADED_LIBS) +endif() + +# Include your own engine +option(USE_CUSTOM_ENGINE "Include your own engine" OFF) +if (USE_CUSTOM_ENGINE) + add_definitions(-DUSE_CUSTOM_ENGINE) +endif() + +# Your own engine code name as a string +set(ENGINE_CODE_NAME "Cell" CACHE STRING "Your own engine code name as a string.") +if (USE_CUSTOM_ENGINE) + add_definitions(-DENGINE_CODE_NAME) +endif() diff --git a/config.hpp.in b/config.hpp.in new file mode 100644 index 0000000..e10a414 --- /dev/null +++ b/config.hpp.in @@ -0,0 +1,18 @@ +#ifndef PROJECT_CONFIG_HPP +#define PROJECT_CONFIG_HPP + +#define PROJECT_NAME "${PROJECT_NAME}" +#define PROJECT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} +#define PROJECT_VERSION_MINOR ${PROJECT_VERSION_MINOR} +#define PROJECT_VERSION_PATCH ${PROJECT_VERSION_PATCH} +#define PROJECT_VERSION ${PROJECT_VERSION} +#define PROJECT_VERSION_TYPE "${PROJECT_VERSION_TYPE}" +#define PROJECT_LICENSE_TYPE "${PROJECT_LICENSE_TYPE}" +#define PROJECT_VERSION_STRING "${PROJECT_VERSION}-${PROJECT_VERSION_TYPE}" +#define PROJECT_CREATOR "${PROJECT_CREATOR}" +#define PROJECT_ORGANIZATION "${PROJECT_ORGANIZATION}" +#define PROJECT_LANGUAGES "${PROJECT_LANGUAGES}" +#define PROJECT_DESCRIPTION "${PROJECT_DESCRIPTION}" +#define PROJECT_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}" + +#endif diff --git a/config/project.cmake b/config/project.cmake new file mode 100644 index 0000000..c51ed4d --- /dev/null +++ b/config/project.cmake @@ -0,0 +1,35 @@ +# ------ PROJECT INFO ------ +# You can change "ProjectTemplate" with your project name. +set(PROJECT_NAME "PT" CACHE STRING "Project Name.") +set(PROJECT_TARGET ${PROJECT_NAME} CACHE STRING "Project Target Name.") +set(PROJECT_REAL_NAME "PT" CACHE STRING "Project Real Name.") + +# Your project version. +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 0) +set(PROJECT_VERSION_PATCH 0) + +#Your project creator. +set(PROJECT_CREATOR "Kambiz Asadzadeh" CACHE STRING "Creator of your project.") + +#Your project creator. +set(PROJECT_ORGANIZATION "The Genyleap" CACHE STRING "Organization name.") + +#Your project license type. +set(PROJECT_LICENSE_TYPE "MIT" CACHE STRING "Project License Type.") + +set(PROJECT_VERSION_TYPE "final" CACHE STRING "Version type.") + +#Use these keys [application, library] +set(PROJECT_USAGE_TYPE "application" CACHE STRING "Usage Type.") + +#Use these keys [stl, qt, qtwidget, qtquick] +set(PROJECT_MAIN_TYPE "qtquick" CACHE STRING "Library System.") + +set(DEVELOPER_BUNDLE_IDENTIFIER com.genyleap.api.${PROJECT_NAME} CACHE STRING "Developer Bundle Identifier.") + +#You can replace your project description with this string. +set(PROJECT_DESCRIPTION "A template for modern C++ projects with useful features for developing cross-platform projects." CACHE STRING "Project Description") + +#Your project website address. +set(PROJECT_HOMEPAGE_URL "https://github.com/genyleap/Project-Template" CACHE STRING "Project URL.") diff --git a/config/system-config.json b/config/system-config.json new file mode 100644 index 0000000..08c3435 --- /dev/null +++ b/config/system-config.json @@ -0,0 +1,11 @@ +{ + "language":"english", + "debug": true, + "system":{ + "codename":"Template Name", + "version":"1.0.0", + "last_update":"2020-01-10 07:00:00", + "server_host":"127.0.0.1", + "encoding":"utf-8" + } +} diff --git a/licenses/mit.txt b/licenses/mit.txt new file mode 100644 index 0000000..f4bb8fc --- /dev/null +++ b/licenses/mit.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Kambiz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/precompiled/pch.hpp b/precompiled/pch.hpp new file mode 100644 index 0000000..9a6de93 --- /dev/null +++ b/precompiled/pch.hpp @@ -0,0 +1,351 @@ +/*! + * Gen3 License + * + * Copyright (c) 2024 Kambiz Asadzadeh + * Copyright (c) 2024 Genyleap + */ + +#ifndef PCH_HPP +#define PCH_HPP + +#if __cpp_modules +import std; // Import core language support. +#ifdef ENABLE_C_FACILITIES +import std.compat; //Import C++ headers for C library facilities +#endif +#else + +/*! + * Creating and using precompiled headers can do two major things for you: + * Can reduce the compilation time of C++ files. + * Can reduce the number of lines of code that the compiler must process (in some cases, by several orders of magnitude). + */ + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +//!Header files for the C++ standard library and extensions, by category. + +#ifdef CXX_STANDARD_98 +#error "C++11 or better is required" +#endif + +#include +#include +#include +#include +#include + +//!C++ Style +#include +#include +#include +#include +#include +#include +#include + +//!Algorithms +#include +#include +#include + +//!Added in the C++20 standard +#if defined(CXX_STANDARD_20) +//!Concepts +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +/*C++ Standard Library Containers*/ + +//!Sequence containers +#include +#include +#include +#include +#include + +//!Ordered associative containers +#include +#include + +//! Unordered associative containers +#include +#include + +//!Container adaptors +#include +#include + +//!Container views +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +//!Errors and exception handling +#include +#include +#include +#include + +//!General utilities +#include + +#include +#include + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#include +#include + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +//!Multithreading +#include +#include +#include +#include +#include +#include + +//!I/O and formatting +#include +#include + +#ifdef CXX_STANDARD_20 +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +//!Iterators +#include + +//!Language support +#include +#include +#include + + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +//!Ranges +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +//!Regular expressions +#include + +//!Strings and character data +#include +#include +#include +#include + +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif + +#include +#include +#include +#include +#include + +//!Time +#include +#include + +//!C-style Under C++ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!Localization +#include +#include +#include + +//!Math and numerics +#if defined(CXX_STANDARD_20) +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!Memory management +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#include +#ifdef __has_include +# if __has_include() +# include +# endif +#endif +#include +#include + +#ifdef _MSC_VER +#include +#endif +#endif + +#if __cpp_lib_json +# include +#else +# if __has_include() +# include +# elif __has_include() +# include +#endif +#endif + +#if __cpp_lib_format +# include +#else +# if __has_include() +# include +# elif __has_include() +# include +#endif +#endif + +#endif // PCH_HPP diff --git a/properties/Windows/app.rc b/properties/Windows/app.rc new file mode 100644 index 0000000..56fe21e --- /dev/null +++ b/properties/Windows/app.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.hpp" +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0 + PRODUCTVERSION 1,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Genyleap LLC" + VALUE "FileDescription", "Project-Template" + VALUE "FileVersion", "1.0.0" + VALUE "InternalName", "Project-Template" + VALUE "LegalCopyright", "Copyright 2022 by Genyleap LLC" + VALUE "OriginalFilename", "Project-Template.exe" + VALUE "ProductName", "Project-Template" + VALUE "ProductVersion", "1.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "appicon.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/properties/Windows/resource.hpp b/properties/Windows/resource.hpp new file mode 100644 index 0000000..4196f3e --- /dev/null +++ b/properties/Windows/resource.hpp @@ -0,0 +1,1569 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc +// +#define SW_HIDE 0 +#define HIDE_WINDOW 0 +#define WM_NULL 0x0000 +#define WA_INACTIVE 0 +#define HTNOWHERE 0 +#define SMTO_NORMAL 0x0000 +#define ICON_SMALL 0 +#define SIZE_RESTORED 0 +#define BN_CLICKED 0 +#define BST_UNCHECKED 0x0000 +#define HDS_HORZ 0x0000 +#define TBSTYLE_BUTTON 0x0000 +#define TBS_HORZ 0x0000 +#define TBS_BOTTOM 0x0000 +#define TBS_RIGHT 0x0000 +#define LVS_ICON 0x0000 +#define LVS_ALIGNTOP 0x0000 +#define TCS_TABS 0x0000 +#define TCS_SINGLELINE 0x0000 +#define TCS_RIGHTJUSTIFY 0x0000 +#define DTS_SHORTDATEFORMAT 0x0000 +#define PGS_VERT 0x00000000 +#define LANG_NEUTRAL 0x00 +#define SUBLANG_NEUTRAL 0x00 +#define SORT_DEFAULT 0x0 +#define SORT_JAPANESE_XJIS 0x0 +#define SORT_CHINESE_BIG5 0x0 +#define SORT_CHINESE_PRCP 0x0 +#define SORT_KOREAN_KSC 0x0 +#define SORT_HUNGARIAN_DEFAULT 0x0 +#define SORT_GEORGIAN_TRADITIONAL 0x0 +#define _USE_DECLSPECS_FOR_SAL 0 +#define _USE_ATTRIBUTES_FOR_SAL 0 +#define __drv_typeConst 0 +#define WINAPI_PARTITION_APP 1 +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 +#define SW_SHOWNORMAL 1 +#define SW_NORMAL 1 +#define SHOW_OPENWINDOW 1 +#define SW_PARENTCLOSING 1 +#define VK_LBUTTON 0x01 +#define WM_CREATE 0x0001 +#define WA_ACTIVE 1 +#define PWR_OK 1 +#define PWR_SUSPENDREQUEST 1 +#define NFR_ANSI 1 +#define UIS_SET 1 +#define UISF_HIDEFOCUS 0x1 +#define XBUTTON1 0x0001 +#define WMSZ_LEFT 1 +#define HTCLIENT 1 +#define SMTO_BLOCK 0x0001 +#define MA_ACTIVATE 1 +#define ICON_BIG 1 +#define SIZE_MINIMIZED 1 +#define MK_LBUTTON 0x0001 +#define TME_HOVER 0x00000001 +#define CS_VREDRAW 0x0001 +#define CF_TEXT 1 +#define SCF_ISSECURE 0x00000001 +#define IDOK 1 +#define BN_PAINT 1 +#define BST_CHECKED 0x0001 +#define TBSTYLE_SEP 0x0001 +#define TTS_ALWAYSTIP 0x01 +#define TBS_AUTOTICKS 0x0001 +#define UDS_WRAP 0x0001 +#define PBS_SMOOTH 0x01 +#define LWS_TRANSPARENT 0x0001 +#define LVS_REPORT 0x0001 +#define TVS_HASBUTTONS 0x0001 +#define TVS_EX_NOSINGLECOLLAPSE 0x0001 +#define TCS_SCROLLOPPOSITE 0x0001 +#define ACS_CENTER 0x0001 +#define MCS_DAYSTATE 0x0001 +#define DTS_UPDOWN 0x0001 +#define PGS_HORZ 0x00000001 +#define NFS_EDIT 0x0001 +#define BCSIF_GLYPH 0x0001 +#define BCSS_NOSPLIT 0x0001 +#define LANG_ARABIC 0x01 +#define SUBLANG_DEFAULT 0x01 +#define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 +#define SUBLANG_ALBANIAN_ALBANIA 0x01 +#define SUBLANG_ALSATIAN_FRANCE 0x01 +#define SUBLANG_AMHARIC_ETHIOPIA 0x01 +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARMENIAN_ARMENIA 0x01 +#define SUBLANG_ASSAMESE_INDIA 0x01 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN 0x01 +#define SUBLANG_BANGLA_INDIA 0x01 +#define SUBLANG_BASHKIR_RUSSIA 0x01 +#define SUBLANG_BASQUE_BASQUE 0x01 +#define SUBLANG_BELARUSIAN_BELARUS 0x01 +#define SUBLANG_BENGALI_INDIA 0x01 +#define SUBLANG_BRETON_FRANCE 0x01 +#define SUBLANG_BULGARIAN_BULGARIA 0x01 +#define SUBLANG_CATALAN_CATALAN 0x01 +#define SUBLANG_CENTRAL_KURDISH_IRAQ 0x01 +#define SUBLANG_CHEROKEE_CHEROKEE 0x01 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CORSICAN_FRANCE 0x01 +#define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 +#define SUBLANG_CROATIAN_CROATIA 0x01 +#define SUBLANG_DANISH_DENMARK 0x01 +#define SUBLANG_DARI_AFGHANISTAN 0x01 +#define SUBLANG_DIVEHI_MALDIVES 0x01 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ESTONIAN_ESTONIA 0x01 +#define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 +#define SUBLANG_FILIPINO_PHILIPPINES 0x01 +#define SUBLANG_FINNISH_FINLAND 0x01 +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRISIAN_NETHERLANDS 0x01 +#define SUBLANG_GALICIAN_GALICIAN 0x01 +#define SUBLANG_GEORGIAN_GEORGIA 0x01 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GREEK_GREECE 0x01 +#define SUBLANG_GREENLANDIC_GREENLAND 0x01 +#define SUBLANG_GUJARATI_INDIA 0x01 +#define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 +#define SUBLANG_HAWAIIAN_US 0x01 +#define SUBLANG_HEBREW_ISRAEL 0x01 +#define SUBLANG_HINDI_INDIA 0x01 +#define SUBLANG_HUNGARIAN_HUNGARY 0x01 +#define SUBLANG_ICELANDIC_ICELAND 0x01 +#define SUBLANG_IGBO_NIGERIA 0x01 +#define SUBLANG_INDONESIAN_INDONESIA 0x01 +#define SUBLANG_INUKTITUT_CANADA 0x01 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_JAPANESE_JAPAN 0x01 +#define SUBLANG_KANNADA_INDIA 0x01 +#define SUBLANG_KAZAK_KAZAKHSTAN 0x01 +#define SUBLANG_KHMER_CAMBODIA 0x01 +#define SUBLANG_KICHE_GUATEMALA 0x01 +#define SUBLANG_KINYARWANDA_RWANDA 0x01 +#define SUBLANG_KONKANI_INDIA 0x01 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 +#define SUBLANG_LAO_LAO 0x01 +#define SUBLANG_LATVIAN_LATVIA 0x01 +#define SUBLANG_LITHUANIAN 0x01 +#define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 +#define SUBLANG_MACEDONIAN_MACEDONIA 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAYALAM_INDIA 0x01 +#define SUBLANG_MALTESE_MALTA 0x01 +#define SUBLANG_MAORI_NEW_ZEALAND 0x01 +#define SUBLANG_MAPUDUNGUN_CHILE 0x01 +#define SUBLANG_MARATHI_INDIA 0x01 +#define SUBLANG_MOHAWK_MOHAWK 0x01 +#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 +#define SUBLANG_NEPALI_NEPAL 0x01 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_OCCITAN_FRANCE 0x01 +#define SUBLANG_ODIA_INDIA 0x01 +#define SUBLANG_ORIYA_INDIA 0x01 +#define SUBLANG_PASHTO_AFGHANISTAN 0x01 +#define SUBLANG_PERSIAN_IRAN 0x01 +#define SUBLANG_POLISH_POLAND 0x01 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_PUNJABI_INDIA 0x01 +#define SUBLANG_QUECHUA_BOLIVIA 0x01 +#define SUBLANG_ROMANIAN_ROMANIA 0x01 +#define SUBLANG_ROMANSH_SWITZERLAND 0x01 +#define SUBLANG_RUSSIAN_RUSSIA 0x01 +#define SUBLANG_SAKHA_RUSSIA 0x01 +#define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 +#define SUBLANG_SANSKRIT_INDIA 0x01 +#define SUBLANG_SCOTTISH_GAELIC 0x01 +#define SUBLANG_SERBIAN_CROATIA 0x01 +#define SUBLANG_SINDHI_INDIA 0x01 +#define SUBLANG_SINHALESE_SRI_LANKA 0x01 +#define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01 +#define SUBLANG_SLOVAK_SLOVAKIA 0x01 +#define SUBLANG_SLOVENIAN_SLOVENIA 0x01 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SWAHILI_KENYA 0x01 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SYRIAC_SYRIA 0x01 +#define SUBLANG_TAJIK_TAJIKISTAN 0x01 +#define SUBLANG_TAMIL_INDIA 0x01 +#define SUBLANG_TATAR_RUSSIA 0x01 +#define SUBLANG_TELUGU_INDIA 0x01 +#define SUBLANG_THAI_THAILAND 0x01 +#define SUBLANG_TIBETAN_PRC 0x01 +#define SUBLANG_TIGRINYA_ETHIOPIA 0x01 +#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 +#define SUBLANG_TURKISH_TURKEY 0x01 +#define SUBLANG_TURKMEN_TURKMENISTAN 0x01 +#define SUBLANG_UIGHUR_PRC 0x01 +#define SUBLANG_UKRAINIAN_UKRAINE 0x01 +#define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_VIETNAMESE_VIETNAM 0x01 +#define SUBLANG_WELSH_UNITED_KINGDOM 0x01 +#define SUBLANG_WOLOF_SENEGAL 0x01 +#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 +#define SUBLANG_YAKUT_RUSSIA 0x01 +#define SUBLANG_YI_PRC 0x01 +#define SUBLANG_YORUBA_NIGERIA 0x01 +#define SUBLANG_ZULU_SOUTH_AFRICA 0x01 +#define SORT_INVARIANT_MATH 0x1 +#define SORT_JAPANESE_UNICODE 0x1 +#define SORT_CHINESE_UNICODE 0x1 +#define SORT_KOREAN_UNICODE 0x1 +#define SORT_GERMAN_PHONE_BOOK 0x1 +#define SORT_HUNGARIAN_TECHNICAL 0x1 +#define SORT_GEORGIAN_MODERN 0x1 +#define __drv_typeCond 1 +#define VS_VERSION_INFO 1 +#define VFFF_ISSHAREDFILE 0x0001 +#define VFF_CURNEDEST 0x0001 +#define VIFF_FORCEINSTALL 0x0001 +#define WINAPI_FAMILY_PC_APP 2 +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 +#define SW_SHOWMINIMIZED 2 +#define SHOW_ICONWINDOW 2 +#define SW_OTHERZOOM 2 +#define VK_RBUTTON 0x02 +#define WM_DESTROY 0x0002 +#define WA_CLICKACTIVE 2 +#define PWR_SUSPENDRESUME 2 +#define NFR_UNICODE 2 +#define UIS_CLEAR 2 +#define UISF_HIDEACCEL 0x2 +#define XBUTTON2 0x0002 +#define WMSZ_RIGHT 2 +#define HTCAPTION 2 +#define SMTO_ABORTIFHUNG 0x0002 +#define MA_ACTIVATEANDEAT 2 +#define ICON_SMALL2 2 +#define SIZE_MAXIMIZED 2 +#define MK_RBUTTON 0x0002 +#define TME_LEAVE 0x00000002 +#define CS_HREDRAW 0x0002 +#define CF_BITMAP 2 +#define IDCANCEL 2 +#define BN_HILITE 2 +#define BST_INDETERMINATE 0x0002 +#define HDS_BUTTONS 0x0002 +#define TBSTYLE_CHECK 0x0002 +#define TTS_NOPREFIX 0x02 +#define TBS_VERT 0x0002 +#define UDS_SETBUDDYINT 0x0002 +#define LWS_IGNORERETURN 0x0002 +#define LVS_SMALLICON 0x0002 +#define TVS_HASLINES 0x0002 +#define TVS_EX_MULTISELECT 0x0002 +#define TCS_BOTTOM 0x0002 +#define TCS_RIGHT 0x0002 +#define ACS_TRANSPARENT 0x0002 +#define MCS_MULTISELECT 0x0002 +#define DTS_SHOWNONE 0x0002 +#define PGS_AUTOSCROLL 0x00000002 +#define NFS_STATIC 0x0002 +#define BCSIF_IMAGE 0x0002 +#define BCSS_STRETCH 0x0002 +#define LANG_BULGARIAN 0x02 +#define SUBLANG_SYS_DEFAULT 0x02 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC 0x02 +#define SUBLANG_BANGLA_BANGLADESH 0x02 +#define SUBLANG_BENGALI_BANGLADESH 0x02 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FULAH_SENEGAL 0x02 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 +#define SUBLANG_IRISH_IRELAND 0x02 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_MONGOLIAN_PRC 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PULAR_SENEGAL 0x02 +#define SUBLANG_PUNJABI_PAKISTAN 0x02 +#define SUBLANG_QUECHUA_ECUADOR 0x02 +#define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SINDHI_PAKISTAN 0x02 +#define SUBLANG_SINDHI_AFGHANISTAN 0x02 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 +#define SUBLANG_TAMIL_SRI_LANKA 0x02 +#define SUBLANG_TIGRIGNA_ERITREA 0x02 +#define SUBLANG_TIGRINYA_ERITREA 0x02 +#define SUBLANG_TSWANA_BOTSWANA 0x02 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_CYRILLIC 0x02 +#define SUBLANG_VALENCIAN_VALENCIA 0x02 +#define SORT_CHINESE_PRC 0x2 +#define __drv_typeBitset 2 +#define VFF_FILEINUSE 0x0002 +#define VIFF_DONTDELETEOLD 0x0002 +#define WINAPI_FAMILY_PHONE_APP 3 +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 +#define SW_SHOWMAXIMIZED 3 +#define SW_MAXIMIZE 3 +#define SHOW_FULLSCREEN 3 +#define SW_PARENTOPENING 3 +#define VK_CANCEL 0x03 +#define WM_MOVE 0x0003 +#define PWR_CRITICALRESUME 3 +#define NF_QUERY 3 +#define UIS_INITIALIZE 3 +#define WMSZ_TOP 3 +#define HTSYSMENU 3 +#define MA_NOACTIVATE 3 +#define SIZE_MAXSHOW 3 +#define CF_METAFILEPICT 3 +#define IDABORT 3 +#define BN_UNHILITE 3 +#define LVS_LIST 0x0003 +#define LVS_TYPEMASK 0x0003 +#define LANG_CATALAN 0x03 +#define LANG_VALENCIAN 0x03 +#define SUBLANG_CUSTOM_DEFAULT 0x03 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_QUECHUA_PERU 0x03 +#define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SORT_CHINESE_BOPOMOFO 0x3 +#define __drv_typeExpr 3 +#define SW_SHOWNOACTIVATE 4 +#define SHOW_OPENNOACTIVATE 4 +#define SW_OTHERUNZOOM 4 +#define VK_MBUTTON 0x04 +#define NF_REQUERY 4 +#define UISF_ACTIVE 0x4 +#define WMSZ_TOPLEFT 4 +#define HTGROWBOX 4 +#define MA_NOACTIVATEANDEAT 4 +#define SIZE_MAXHIDE 4 +#define MK_SHIFT 0x0004 +#define CF_SYLK 4 +#define IDRETRY 4 +#define BN_DISABLE 4 +#define BST_PUSHED 0x0004 +#define HDS_HOTTRACK 0x0004 +#define TBSTYLE_GROUP 0x0004 +#define TBS_TOP 0x0004 +#define TBS_LEFT 0x0004 +#define UDS_ALIGNRIGHT 0x0004 +#define PBS_VERTICAL 0x04 +#define LWS_NOPREFIX 0x0004 +#define LVS_SINGLESEL 0x0004 +#define TVS_LINESATROOT 0x0004 +#define TVS_EX_DOUBLEBUFFER 0x0004 +#define TCS_MULTISELECT 0x0004 +#define ACS_AUTOPLAY 0x0004 +#define MCS_WEEKNUMBERS 0x0004 +#define DTS_LONGDATEFORMAT 0x0004 +#define PGS_DRAGNDROP 0x00000004 +#define NFS_LISTCOMBO 0x0004 +#define BCSIF_STYLE 0x0004 +#define BCSS_ALIGNLEFT 0x0004 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x04 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x04 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_SAMI_LULE_NORWAY 0x04 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH 0x04 +#define SORT_JAPANESE_RADICALSTROKE 0x4 +#define SORT_CHINESE_RADICALSTROKE 0x4 +#define VFF_BUFFTOOSMALL 0x0004 +#define SW_SHOW 5 +#define VK_XBUTTON1 0x05 +#define WM_SIZE 0x0005 +#define WMSZ_TOPRIGHT 5 +#define HTMENU 5 +#define CF_DIF 5 +#define IDIGNORE 5 +#define BN_DOUBLECLICKED 5 +#define LANG_CZECH 0x05 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x05 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_SAMI_LULE_SWEDEN 0x05 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SW_MINIMIZE 6 +#define VK_XBUTTON2 0x06 +#define WM_ACTIVATE 0x0006 +#define WMSZ_BOTTOM 6 +#define HTHSCROLL 6 +#define CF_TIFF 6 +#define IDYES 6 +#define BN_SETFOCUS 6 +#define LANG_DANISH 0x06 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SW_SHOWMINNOACTIVE 7 +#define WM_SETFOCUS 0x0007 +#define WMSZ_BOTTOMLEFT 7 +#define HTVSCROLL 7 +#define CF_OEMTEXT 7 +#define IDNO 7 +#define BN_KILLFOCUS 7 +#define LANG_GERMAN 0x07 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SW_SHOWNA 8 +#define VK_BACK 0x08 +#define WM_KILLFOCUS 0x0008 +#define WMSZ_BOTTOMRIGHT 8 +#define HTMINBUTTON 8 +#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008 +#define MK_CONTROL 0x0008 +#define CS_DBLCLKS 0x0008 +#define CF_DIB 8 +#define IDCLOSE 8 +#define BST_FOCUS 0x0008 +#define HDS_HIDDEN 0x0008 +#define TBSTYLE_DROPDOWN 0x0008 +#define TBS_BOTH 0x0008 +#define UDS_ALIGNLEFT 0x0008 +#define PBS_MARQUEE 0x08 +#define LWS_USEVISUALSTYLE 0x0008 +#define LVS_SHOWSELALWAYS 0x0008 +#define TVS_EDITLABELS 0x0008 +#define TVS_EX_NOINDENTSTATE 0x0008 +#define TCS_FLATBUTTONS 0x0008 +#define ACS_TIMER 0x0008 +#define MCS_NOTODAYCIRCLE 0x0008 +#define NFS_BUTTON 0x0008 +#define BCSIF_SIZE 0x0008 +#define BCSS_IMAGE 0x0008 +#define LANG_GREEK 0x08 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_SAMI_SKOLT_FINLAND 0x08 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SW_RESTORE 9 +#define VK_TAB 0x09 +#define HTMAXBUTTON 9 +#define CF_PALETTE 9 +#define IDHELP 9 +#define DTS_TIMEFORMAT 0x0009 +#define LANG_ENGLISH 0x09 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_SAMI_INARI_FINLAND 0x09 +#define SUBLANG_SERBIAN_SERBIA_LATIN 0x09 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SW_SHOWDEFAULT 10 +#define WM_ENABLE 0x000A +#define HTLEFT 10 +#define CF_PENDATA 10 +#define IDTRYAGAIN 10 +#define HELP_CONTEXTMENU 0x000a +#define LANG_SPANISH 0x0a +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_SERBIAN_SERBIA_CYRILLIC 0x0a +#define SUBLANG_SPANISH_PERU 0x0a +#define SW_FORCEMINIMIZE 11 +#define SW_MAX 11 +#define WM_SETREDRAW 0x000B +#define HTRIGHT 11 +#define CF_RIFF 11 +#define IDCONTINUE 11 +#define HELP_FINDER 0x000b +#define LANG_FINNISH 0x0b +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_SERBIAN_MONTENEGRO_LATIN 0x0b +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define VK_CLEAR 0x0C +#define WM_SETTEXT 0x000C +#define HTTOP 12 +#define CF_WAVE 12 +#define HELP_WM_HELP 0x000c +#define DTS_SHORTDATECENTURYFORMAT 0x000C +#define LANG_FRENCH 0x0c +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC 0x0c +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define VK_RETURN 0x0D +#define WM_GETTEXT 0x000D +#define HTTOPLEFT 13 +#define CF_UNICODETEXT 13 +#define HELP_SETPOPUP_POS 0x000d +#define LANG_HEBREW 0x0d +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_SPANISH_CHILE 0x0d +#define WM_GETTEXTLENGTH 0x000E +#define HTTOPRIGHT 14 +#define CF_ENHMETAFILE 14 +#define LANG_HUNGARIAN 0x0e +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define WM_PAINT 0x000F +#define HTBOTTOM 15 +#define CF_HDROP 15 +#define LANG_ICELANDIC 0x0f +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 +#define VK_SHIFT 0x10 +#define WM_CLOSE 0x0010 +#define HTBOTTOMLEFT 16 +#define WVR_ALIGNTOP 0x0010 +#define MK_MBUTTON 0x0010 +#define TME_NONCLIENT 0x00000010 +#define CF_LOCALE 16 +#define HELP_TCARD_DATA 0x0010 +#define TBSTYLE_AUTOSIZE 0x0010 +#define TTS_NOANIMATE 0x10 +#define TBS_NOTICKS 0x0010 +#define UDS_AUTOBUDDY 0x0010 +#define PBS_SMOOTHREVERSE 0x10 +#define LWS_USECUSTOMTEXT 0x0010 +#define LVS_SORTASCENDING 0x0010 +#define TVS_DISABLEDRAGDROP 0x0010 +#define TVS_EX_RICHTOOLTIP 0x0010 +#define TCS_FORCEICONLEFT 0x0010 +#define MCS_NOTODAY 0x0010 +#define DTS_APPCANPARSE 0x0010 +#define NFS_ALL 0x0010 +#define LANG_ITALIAN 0x10 +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_ENGLISH_INDIA 0x10 +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define VK_CONTROL 0x11 +#define WM_QUERYENDSESSION 0x0011 +#define HTBOTTOMRIGHT 17 +#define CF_DIBV5 17 +#define HELP_TCARD_OTHER_CALLER 0x0011 +#define LANG_JAPANESE 0x11 +#define SUBLANG_ENGLISH_MALAYSIA 0x11 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define VK_MENU 0x12 +#define WM_QUIT 0x0012 +#define HTBORDER 18 +#define CF_MAX 18 +#define LANG_KOREAN 0x12 +#define SUBLANG_ENGLISH_SINGAPORE 0x12 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define VK_PAUSE 0x13 +#define WM_QUERYOPEN 0x0013 +#define HTOBJECT 19 +#define LANG_DUTCH 0x13 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define VK_CAPITAL 0x14 +#define WM_ERASEBKGND 0x0014 +#define HTCLOSE 20 +#define LANG_NORWEGIAN 0x14 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define _SAL_VERSION 20 +#define VK_KANA 0x15 +#define VK_HANGEUL 0x15 +#define VK_HANGUL 0x15 +#define WM_SYSCOLORCHANGE 0x0015 +#define HTHELP 21 +#define LANG_POLISH 0x15 +#define SUBLANG_SPANISH_US 0x15 +#define WM_ENDSESSION 0x0016 +#define LANG_PORTUGUESE 0x16 +#define VK_JUNJA 0x17 +#define LANG_ROMANSH 0x17 +#define RT_MANIFEST 24 +#define VK_FINAL 0x18 +#define WM_SHOWWINDOW 0x0018 +#define LANG_ROMANIAN 0x18 +#define VK_HANJA 0x19 +#define VK_KANJI 0x19 +#define LANG_RUSSIAN 0x19 +#define WM_WININICHANGE 0x001A +#define LANG_BOSNIAN 0x1a +#define LANG_CROATIAN 0x1a +#define LANG_SERBIAN 0x1a +#define VK_ESCAPE 0x1B +#define WM_DEVMODECHANGE 0x001B +#define LANG_SLOVAK 0x1b +#define VK_CONVERT 0x1C +#define WM_ACTIVATEAPP 0x001C +#define LANG_ALBANIAN 0x1c +#define VK_NONCONVERT 0x1D +#define WM_FONTCHANGE 0x001D +#define LANG_SWEDISH 0x1d +#define VK_ACCEPT 0x1E +#define WM_TIMECHANGE 0x001E +#define LANG_THAI 0x1e +#define VK_MODECHANGE 0x1F +#define WM_CANCELMODE 0x001F +#define LANG_TURKISH 0x1f +#define VK_SPACE 0x20 +#define WM_SETCURSOR 0x0020 +#define SMTO_ERRORONEXIT 0x0020 +#define WVR_ALIGNLEFT 0x0020 +#define MK_XBUTTON1 0x0020 +#define CS_OWNDC 0x0020 +#define TBSTYLE_NOPREFIX 0x0020 +#define TTS_NOFADE 0x20 +#define TBS_ENABLESELRANGE 0x0020 +#define UDS_ARROWKEYS 0x0020 +#define LWS_RIGHT 0x0020 +#define LVS_SORTDESCENDING 0x0020 +#define TVS_SHOWSELALWAYS 0x0020 +#define TVS_EX_AUTOHSCROLL 0x0020 +#define TCS_FORCELABELLEFT 0x0020 +#define DTS_RIGHTALIGN 0x0020 +#define NFS_USEFONTASSOC 0x0020 +#define LANG_URDU 0x20 +#define VK_PRIOR 0x21 +#define WM_MOUSEACTIVATE 0x0021 +#define LANG_INDONESIAN 0x21 +#define VK_NEXT 0x22 +#define WM_CHILDACTIVATE 0x0022 +#define LANG_UKRAINIAN 0x22 +#define VK_END 0x23 +#define WM_QUEUESYNC 0x0023 +#define LANG_BELARUSIAN 0x23 +#define VK_HOME 0x24 +#define WM_GETMINMAXINFO 0x0024 +#define LANG_SLOVENIAN 0x24 +#define VK_LEFT 0x25 +#define LANG_ESTONIAN 0x25 +#define VK_UP 0x26 +#define WM_PAINTICON 0x0026 +#define LANG_LATVIAN 0x26 +#define VK_RIGHT 0x27 +#define WM_ICONERASEBKGND 0x0027 +#define LANG_LITHUANIAN 0x27 +#define VK_DOWN 0x28 +#define WM_NEXTDLGCTL 0x0028 +#define LANG_TAJIK 0x28 +#define VK_SELECT 0x29 +#define LANG_FARSI 0x29 +#define LANG_PERSIAN 0x29 +#define VK_PRINT 0x2A +#define WM_SPOOLERSTATUS 0x002A +#define LANG_VIETNAMESE 0x2a +#define VK_EXECUTE 0x2B +#define WM_DRAWITEM 0x002B +#define LANG_ARMENIAN 0x2b +#define VK_SNAPSHOT 0x2C +#define WM_MEASUREITEM 0x002C +#define LANG_AZERI 0x2c +#define LANG_AZERBAIJANI 0x2c +#define VK_INSERT 0x2D +#define WM_DELETEITEM 0x002D +#define LANG_BASQUE 0x2d +#define VK_DELETE 0x2E +#define WM_VKEYTOITEM 0x002E +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_UPPER_SORBIAN 0x2e +#define VK_HELP 0x2F +#define WM_CHARTOITEM 0x002F +#define LANG_MACEDONIAN 0x2f +#define WM_SETFONT 0x0030 +#define WM_GETFONT 0x0031 +#define WM_SETHOTKEY 0x0032 +#define LANG_TSWANA 0x32 +#define WM_GETHOTKEY 0x0033 +#define LANG_XHOSA 0x34 +#define LANG_ZULU 0x35 +#define LANG_AFRIKAANS 0x36 +#define WM_QUERYDRAGICON 0x0037 +#define LANG_GEORGIAN 0x37 +#define LANG_FAEROESE 0x38 +#define WM_COMPAREITEM 0x0039 +#define LANG_HINDI 0x39 +#define LANG_MALTESE 0x3a +#define LANG_SAMI 0x3b +#define LANG_IRISH 0x3c +#define WM_GETOBJECT 0x003D +#define LANG_MALAY 0x3e +#define LANG_KAZAK 0x3f +#define WVR_ALIGNBOTTOM 0x0040 +#define MK_XBUTTON2 0x0040 +#define CS_CLASSDC 0x0040 +#define HDS_DRAGDROP 0x0040 +#define BTNS_SHOWTEXT 0x0040 +#define TTS_BALLOON 0x40 +#define TBS_FIXEDLENGTH 0x0040 +#define UDS_HORZ 0x0040 +#define LVS_SHAREIMAGELISTS 0x0040 +#define TVS_RTLREADING 0x0040 +#define TVS_EX_FADEINOUTEXPANDOS 0x0040 +#define TCS_HOTTRACK 0x0040 +#define MCS_NOTRAILINGDATES 0x0040 +#define LANG_KYRGYZ 0x40 +#define WM_COMPACTING 0x0041 +#define LANG_SWAHILI 0x41 +#define LANG_TURKMEN 0x42 +#define LANG_UZBEK 0x43 +#define WM_COMMNOTIFY 0x0044 +#define LANG_TATAR 0x44 +#define LANG_BANGLA 0x45 +#define LANG_BENGALI 0x45 +#define WM_WINDOWPOSCHANGING 0x0046 +#define LANG_PUNJABI 0x46 +#define WM_WINDOWPOSCHANGED 0x0047 +#define LANG_GUJARATI 0x47 +#define WM_POWER 0x0048 +#define LANG_ODIA 0x48 +#define LANG_ORIYA 0x48 +#define LANG_TAMIL 0x49 +#define WM_COPYDATA 0x004A +#define LANG_TELUGU 0x4a +#define WM_CANCELJOURNAL 0x004B +#define LANG_KANNADA 0x4b +#define LANG_MALAYALAM 0x4c +#define LANG_ASSAMESE 0x4d +#define WM_NOTIFY 0x004E +#define LANG_MARATHI 0x4e +#define LANG_SANSKRIT 0x4f +#define WM_INPUTLANGCHANGEREQUEST 0x0050 +#define LANG_MONGOLIAN 0x50 +#define WM_INPUTLANGCHANGE 0x0051 +#define LANG_TIBETAN 0x51 +#define WM_TCARD 0x0052 +#define LANG_WELSH 0x52 +#define WM_HELP 0x0053 +#define LANG_KHMER 0x53 +#define WM_USERCHANGED 0x0054 +#define LANG_LAO 0x54 +#define WM_NOTIFYFORMAT 0x0055 +#define LANG_GALICIAN 0x56 +#define LANG_KONKANI 0x57 +#define LANG_MANIPURI 0x58 +#define LANG_SINDHI 0x59 +#define LANG_SYRIAC 0x5a +#define VK_LWIN 0x5B +#define LANG_SINHALESE 0x5b +#define VK_RWIN 0x5C +#define LANG_CHEROKEE 0x5c +#define VK_APPS 0x5D +#define LANG_INUKTITUT 0x5d +#define LANG_AMHARIC 0x5e +#define VK_SLEEP 0x5F +#define LANG_TAMAZIGHT 0x5f +#define VK_NUMPAD0 0x60 +#define LANG_KASHMIRI 0x60 +#define VK_NUMPAD1 0x61 +#define LANG_NEPALI 0x61 +#define VK_NUMPAD2 0x62 +#define LANG_FRISIAN 0x62 +#define VK_NUMPAD3 0x63 +#define LANG_PASHTO 0x63 +#define WINAPI_FAMILY_DESKTOP_APP 100 +#define VK_NUMPAD4 0x64 +#define LANG_FILIPINO 0x64 +#define VS_USER_DEFINED 100 +#define VK_NUMPAD5 0x65 +#define LANG_DIVEHI 0x65 +#define VK_NUMPAD6 0x66 +#define VK_NUMPAD7 0x67 +#define LANG_FULAH 0x67 +#define LANG_PULAR 0x67 +#define VK_NUMPAD8 0x68 +#define LANG_HAUSA 0x68 +#define VK_NUMPAD9 0x69 +#define VK_MULTIPLY 0x6A +#define LANG_YORUBA 0x6a +#define VK_ADD 0x6B +#define LANG_QUECHUA 0x6b +#define VK_SEPARATOR 0x6C +#define LANG_SOTHO 0x6c +#define VK_SUBTRACT 0x6D +#define LANG_BASHKIR 0x6d +#define VK_DECIMAL 0x6E +#define LANG_LUXEMBOURGISH 0x6e +#define VK_DIVIDE 0x6F +#define LANG_GREENLANDIC 0x6f +#define VK_F1 0x70 +#define LANG_IGBO 0x70 +#define VK_F2 0x71 +#define VK_F3 0x72 +#define VK_F4 0x73 +#define LANG_TIGRIGNA 0x73 +#define LANG_TIGRINYA 0x73 +#define VK_F5 0x74 +#define VK_F6 0x75 +#define LANG_HAWAIIAN 0x75 +#define VK_F7 0x76 +#define VK_F8 0x77 +#define VK_F9 0x78 +#define WHEEL_DELTA 120 +#define LANG_YI 0x78 +#define VK_F10 0x79 +#define VK_F11 0x7A +#define LANG_MAPUDUNGUN 0x7a +#define VK_F12 0x7B +#define WM_CONTEXTMENU 0x007B +#define VK_F13 0x7C +#define WM_STYLECHANGING 0x007C +#define LANG_MOHAWK 0x7c +#define VK_F14 0x7D +#define WM_STYLECHANGED 0x007D +#define VK_F15 0x7E +#define WM_DISPLAYCHANGE 0x007E +#define LANG_BRETON 0x7e +#define VK_F16 0x7F +#define WM_GETICON 0x007F +#define LANG_INVARIANT 0x7f +#define VK_F17 0x80 +#define WM_SETICON 0x0080 +#define WVR_ALIGNRIGHT 0x0080 +#define CS_PARENTDC 0x0080 +#define CF_OWNERDISPLAY 0x0080 +#define HDS_FULLDRAG 0x0080 +#define BTNS_WHOLEDROPDOWN 0x0080 +#define TTS_CLOSE 0x80 +#define TBS_NOTHUMB 0x0080 +#define UDS_NOTHOUSANDS 0x0080 +#define LVS_NOLABELWRAP 0x0080 +#define TVS_NOTOOLTIPS 0x0080 +#define TVS_EX_PARTIALCHECKBOXES 0x0080 +#define TCS_VERTICAL 0x0080 +#define MCS_SHORTDAYSOFWEEK 0x0080 +#define LANG_UIGHUR 0x80 +#define VK_F18 0x81 +#define WM_NCCREATE 0x0081 +#define CF_DSPTEXT 0x0081 +#define LANG_MAORI 0x81 +#define VK_F19 0x82 +#define WM_NCDESTROY 0x0082 +#define CF_DSPBITMAP 0x0082 +#define LANG_OCCITAN 0x82 +#define VK_F20 0x83 +#define WM_NCCALCSIZE 0x0083 +#define CF_DSPMETAFILEPICT 0x0083 +#define LANG_CORSICAN 0x83 +#define VK_F21 0x84 +#define WM_NCHITTEST 0x0084 +#define LANG_ALSATIAN 0x84 +#define VK_F22 0x85 +#define WM_NCPAINT 0x0085 +#define LANG_SAKHA 0x85 +#define LANG_YAKUT 0x85 +#define VK_F23 0x86 +#define WM_NCACTIVATE 0x0086 +#define LANG_KICHE 0x86 +#define VK_F24 0x87 +#define WM_GETDLGCODE 0x0087 +#define LANG_KINYARWANDA 0x87 +#define WM_SYNCPAINT 0x0088 +#define LANG_WOLOF 0x88 +#define LANG_DARI 0x8c +#define CF_DSPENHMETAFILE 0x008E +#define VK_NUMLOCK 0x90 +#define VK_SCROLL 0x91 +#define LANG_SCOTTISH_GAELIC 0x91 +#define VK_OEM_NEC_EQUAL 0x92 +#define VK_OEM_FJ_JISHO 0x92 +#define LANG_CENTRAL_KURDISH 0x92 +#define VK_OEM_FJ_MASSHOU 0x93 +#define VK_OEM_FJ_TOUROKU 0x94 +#define VK_OEM_FJ_LOYA 0x95 +#define VK_OEM_FJ_ROYA 0x96 +#define VK_LSHIFT 0xA0 +#define WM_NCMOUSEMOVE 0x00A0 +#define VK_RSHIFT 0xA1 +#define WM_NCLBUTTONDOWN 0x00A1 +#define VK_LCONTROL 0xA2 +#define WM_NCLBUTTONUP 0x00A2 +#define VK_RCONTROL 0xA3 +#define WM_NCLBUTTONDBLCLK 0x00A3 +#define VK_LMENU 0xA4 +#define WM_NCRBUTTONDOWN 0x00A4 +#define VK_RMENU 0xA5 +#define WM_NCRBUTTONUP 0x00A5 +#define VK_BROWSER_BACK 0xA6 +#define WM_NCRBUTTONDBLCLK 0x00A6 +#define VK_BROWSER_FORWARD 0xA7 +#define WM_NCMBUTTONDOWN 0x00A7 +#define VK_BROWSER_REFRESH 0xA8 +#define WM_NCMBUTTONUP 0x00A8 +#define VK_BROWSER_STOP 0xA9 +#define WM_NCMBUTTONDBLCLK 0x00A9 +#define VK_BROWSER_SEARCH 0xAA +#define VK_BROWSER_FAVORITES 0xAB +#define WM_NCXBUTTONDOWN 0x00AB +#define VK_BROWSER_HOME 0xAC +#define WM_NCXBUTTONUP 0x00AC +#define VK_VOLUME_MUTE 0xAD +#define WM_NCXBUTTONDBLCLK 0x00AD +#define VK_VOLUME_DOWN 0xAE +#define VK_VOLUME_UP 0xAF +#define VK_MEDIA_NEXT_TRACK 0xB0 +#define EM_GETSEL 0x00B0 +#define VK_MEDIA_PREV_TRACK 0xB1 +#define EM_SETSEL 0x00B1 +#define VK_MEDIA_STOP 0xB2 +#define EM_GETRECT 0x00B2 +#define VK_MEDIA_PLAY_PAUSE 0xB3 +#define EM_SETRECT 0x00B3 +#define VK_LAUNCH_MAIL 0xB4 +#define EM_SETRECTNP 0x00B4 +#define VK_LAUNCH_MEDIA_SELECT 0xB5 +#define EM_SCROLL 0x00B5 +#define VK_LAUNCH_APP1 0xB6 +#define EM_LINESCROLL 0x00B6 +#define VK_LAUNCH_APP2 0xB7 +#define EM_SCROLLCARET 0x00B7 +#define EM_GETMODIFY 0x00B8 +#define EM_SETMODIFY 0x00B9 +#define VK_OEM_1 0xBA +#define EM_GETLINECOUNT 0x00BA +#define VK_OEM_PLUS 0xBB +#define EM_LINEINDEX 0x00BB +#define VK_OEM_COMMA 0xBC +#define EM_SETHANDLE 0x00BC +#define VK_OEM_MINUS 0xBD +#define EM_GETHANDLE 0x00BD +#define VK_OEM_PERIOD 0xBE +#define EM_GETTHUMB 0x00BE +#define VK_OEM_2 0xBF +#define VK_OEM_3 0xC0 +#define EM_LINELENGTH 0x00C1 +#define EM_REPLACESEL 0x00C2 +#define EM_GETLINE 0x00C4 +#define EM_LIMITTEXT 0x00C5 +#define EM_CANUNDO 0x00C6 +#define EM_UNDO 0x00C7 +#define EM_FMTLINES 0x00C8 +#define EM_LINEFROMCHAR 0x00C9 +#define EM_SETTABSTOPS 0x00CB +#define EM_SETPASSWORDCHAR 0x00CC +#define EM_EMPTYUNDOBUFFER 0x00CD +#define EM_GETFIRSTVISIBLELINE 0x00CE +#define EM_SETREADONLY 0x00CF +#define EM_SETWORDBREAKPROC 0x00D0 +#define EM_GETWORDBREAKPROC 0x00D1 +#define EM_GETPASSWORDCHAR 0x00D2 +#define EM_SETMARGINS 0x00D3 +#define EM_GETMARGINS 0x00D4 +#define EM_GETLIMITTEXT 0x00D5 +#define EM_POSFROMCHAR 0x00D6 +#define EM_CHARFROMPOS 0x00D7 +#define EM_SETIMESTATUS 0x00D8 +#define EM_GETIMESTATUS 0x00D9 +#define VK_OEM_4 0xDB +#define VK_OEM_5 0xDC +#define VK_OEM_6 0xDD +#define VK_OEM_7 0xDE +#define VK_OEM_8 0xDF +#define VK_OEM_AX 0xE1 +#define VK_OEM_102 0xE2 +#define VK_ICO_HELP 0xE3 +#define VK_ICO_00 0xE4 +#define VK_PROCESSKEY 0xE5 +#define VK_ICO_CLEAR 0xE6 +#define VK_PACKET 0xE7 +#define VK_OEM_RESET 0xE9 +#define VK_OEM_JUMP 0xEA +#define VK_OEM_PA1 0xEB +#define VK_OEM_PA2 0xEC +#define VK_OEM_PA3 0xED +#define VK_OEM_WSCTRL 0xEE +#define VK_OEM_CUSEL 0xEF +#define VK_OEM_ATTN 0xF0 +#define BM_GETCHECK 0x00F0 +#define VK_OEM_FINISH 0xF1 +#define BM_SETCHECK 0x00F1 +#define VK_OEM_COPY 0xF2 +#define BM_GETSTATE 0x00F2 +#define VK_OEM_AUTO 0xF3 +#define BM_SETSTATE 0x00F3 +#define VK_OEM_ENLW 0xF4 +#define BM_SETSTYLE 0x00F4 +#define VK_OEM_BACKTAB 0xF5 +#define BM_CLICK 0x00F5 +#define VK_ATTN 0xF6 +#define BM_GETIMAGE 0x00F6 +#define VK_CRSEL 0xF7 +#define BM_SETIMAGE 0x00F7 +#define VK_EXSEL 0xF8 +#define BM_SETDONTCLICK 0x00F8 +#define VK_EREOF 0xF9 +#define VK_PLAY 0xFA +#define VK_ZOOM 0xFB +#define VK_NONAME 0xFC +#define VK_PA1 0xFD +#define VK_OEM_CLEAR 0xFE +#define WM_INPUT_DEVICE_CHANGE 0x00FE +#define SUBVERSION_MASK 0x000000FF +#define WM_INPUT 0x00FF +#define WM_KEYFIRST 0x0100 +#define WM_KEYDOWN 0x0100 +#define WVR_HREDRAW 0x0100 +#define HDS_FILTERBAR 0x0100 +#define TBSTYLE_TOOLTIPS 0x0100 +#define RBS_TOOLTIPS 0x00000100 +#define TTS_USEVISUALSTYLE 0x100 +#define SBARS_SIZEGRIP 0x0100 +#define TBS_TOOLTIPS 0x0100 +#define UDS_HOTTRACK 0x0100 +#define LVS_AUTOARRANGE 0x0100 +#define TVS_CHECKBOXES 0x0100 +#define TVS_EX_EXCLUSIONCHECKBOXES 0x0100 +#define TCS_BUTTONS 0x0100 +#define MCS_NOSELCHANGEONNAV 0x0100 +#define WM_KEYUP 0x0101 +#define WM_CHAR 0x0102 +#define WM_DEADCHAR 0x0103 +#define WM_SYSKEYDOWN 0x0104 +#define WM_SYSKEYUP 0x0105 +#define WM_SYSCHAR 0x0106 +#define WM_SYSDEADCHAR 0x0107 +#define WM_UNICHAR 0x0109 +#define WM_KEYLAST 0x0109 +#define WM_IME_STARTCOMPOSITION 0x010D +#define WM_IME_ENDCOMPOSITION 0x010E +#define WM_IME_COMPOSITION 0x010F +#define WM_IME_KEYLAST 0x010F +#define WM_INITDIALOG 0x0110 +#define WM_COMMAND 0x0111 +#define WM_SYSCOMMAND 0x0112 +#define WM_TIMER 0x0113 +#define WM_HSCROLL 0x0114 +#define WM_VSCROLL 0x0115 +#define WM_INITMENU 0x0116 +#define WM_INITMENUPOPUP 0x0117 +#define WM_GESTURE 0x0119 +#define WM_GESTURENOTIFY 0x011A +#define WM_MENUSELECT 0x011F +#define WM_MENUCHAR 0x0120 +#define WM_ENTERIDLE 0x0121 +#define WM_MENURBUTTONUP 0x0122 +#define WM_MENUDRAG 0x0123 +#define WM_MENUGETOBJECT 0x0124 +#define WM_UNINITMENUPOPUP 0x0125 +#define WM_MENUCOMMAND 0x0126 +#define WM_CHANGEUISTATE 0x0127 +#define WM_UPDATEUISTATE 0x0128 +#define WM_QUERYUISTATE 0x0129 +#define WM_CTLCOLORMSGBOX 0x0132 +#define WM_CTLCOLOREDIT 0x0133 +#define WM_CTLCOLORLISTBOX 0x0134 +#define WM_CTLCOLORBTN 0x0135 +#define WM_CTLCOLORDLG 0x0136 +#define WM_CTLCOLORSCROLLBAR 0x0137 +#define WM_CTLCOLORSTATIC 0x0138 +#define MN_GETHMENU 0x01E1 +#define _WIN32_IE_IE20 0x0200 +#define WM_MOUSEFIRST 0x0200 +#define WM_MOUSEMOVE 0x0200 +#define WVR_VREDRAW 0x0200 +#define CS_NOCLOSE 0x0200 +#define CF_PRIVATEFIRST 0x0200 +#define HDS_FLAT 0x0200 +#define TBSTYLE_WRAPABLE 0x0200 +#define RBS_VARHEIGHT 0x00000200 +#define TBS_REVERSED 0x0200 +#define LVS_EDITLABELS 0x0200 +#define TVS_TRACKSELECT 0x0200 +#define TVS_EX_DIMMEDCHECKBOXES 0x0200 +#define TCS_MULTILINE 0x0200 +#define WM_LBUTTONDOWN 0x0201 +#define WM_LBUTTONUP 0x0202 +#define WM_LBUTTONDBLCLK 0x0203 +#define WM_RBUTTONDOWN 0x0204 +#define WM_RBUTTONUP 0x0205 +#define WM_RBUTTONDBLCLK 0x0206 +#define WM_MBUTTONDOWN 0x0207 +#define WM_MBUTTONUP 0x0208 +#define WM_MBUTTONDBLCLK 0x0209 +#define WM_MOUSEWHEEL 0x020A +#define WM_XBUTTONDOWN 0x020B +#define WM_XBUTTONUP 0x020C +#define WM_XBUTTONDBLCLK 0x020D +#define WM_MOUSEHWHEEL 0x020E +#define WM_MOUSELAST 0x020E +#define WM_PARENTNOTIFY 0x0210 +#define WM_ENTERMENULOOP 0x0211 +#define WM_EXITMENULOOP 0x0212 +#define WM_NEXTMENU 0x0213 +#define WM_SIZING 0x0214 +#define WM_CAPTURECHANGED 0x0215 +#define WM_MOVING 0x0216 +#define WM_POWERBROADCAST 0x0218 +#define WM_DEVICECHANGE 0x0219 +#define WM_MDICREATE 0x0220 +#define WM_MDIDESTROY 0x0221 +#define WM_MDIACTIVATE 0x0222 +#define WM_MDIRESTORE 0x0223 +#define WM_MDINEXT 0x0224 +#define WM_MDIMAXIMIZE 0x0225 +#define WM_MDITILE 0x0226 +#define WM_MDICASCADE 0x0227 +#define WM_MDIICONARRANGE 0x0228 +#define WM_MDIGETACTIVE 0x0229 +#define WM_MDISETMENU 0x0230 +#define WM_ENTERSIZEMOVE 0x0231 +#define WM_EXITSIZEMOVE 0x0232 +#define WM_DROPFILES 0x0233 +#define WM_MDIREFRESHMENU 0x0234 +#define WM_POINTERDEVICECHANGE 0x238 +#define WM_POINTERDEVICEINRANGE 0x239 +#define WM_POINTERDEVICEOUTOFRANGE 0x23A +#define WM_TOUCH 0x0240 +#define WM_NCPOINTERUPDATE 0x0241 +#define WM_NCPOINTERDOWN 0x0242 +#define WM_NCPOINTERUP 0x0243 +#define WM_POINTERUPDATE 0x0245 +#define WM_POINTERDOWN 0x0246 +#define WM_POINTERUP 0x0247 +#define WM_POINTERENTER 0x0249 +#define WM_POINTERLEAVE 0x024A +#define WM_POINTERACTIVATE 0x024B +#define WM_POINTERCAPTURECHANGED 0x024C +#define WM_TOUCHHITTESTING 0x024D +#define WM_POINTERWHEEL 0x024E +#define WM_POINTERHWHEEL 0x024F +#define DM_POINTERHITTEST 0x0250 +#define WM_IME_SETCONTEXT 0x0281 +#define WM_IME_NOTIFY 0x0282 +#define WM_IME_CONTROL 0x0283 +#define WM_IME_COMPOSITIONFULL 0x0284 +#define WM_IME_SELECT 0x0285 +#define WM_IME_CHAR 0x0286 +#define WM_IME_REQUEST 0x0288 +#define WM_IME_KEYDOWN 0x0290 +#define WM_IME_KEYUP 0x0291 +#define WM_NCMOUSEHOVER 0x02A0 +#define WM_MOUSEHOVER 0x02A1 +#define WM_NCMOUSELEAVE 0x02A2 +#define WM_MOUSELEAVE 0x02A3 +#define WM_WTSSESSION_CHANGE 0x02B1 +#define WM_TABLET_FIRST 0x02c0 +#define WM_TABLET_LAST 0x02df +#define WM_DPICHANGED 0x02E0 +#define CF_PRIVATELAST 0x02FF +#define _WIN32_IE_IE30 0x0300 +#define WM_CUT 0x0300 +#define CF_GDIOBJFIRST 0x0300 +#define WM_COPY 0x0301 +#define _WIN32_IE_IE302 0x0302 +#define WM_PASTE 0x0302 +#define WM_CLEAR 0x0303 +#define WM_UNDO 0x0304 +#define WM_RENDERFORMAT 0x0305 +#define WM_RENDERALLFORMATS 0x0306 +#define WM_DESTROYCLIPBOARD 0x0307 +#define WM_DRAWCLIPBOARD 0x0308 +#define WM_PAINTCLIPBOARD 0x0309 +#define WM_VSCROLLCLIPBOARD 0x030A +#define WM_SIZECLIPBOARD 0x030B +#define WM_ASKCBFORMATNAME 0x030C +#define WM_CHANGECBCHAIN 0x030D +#define WM_HSCROLLCLIPBOARD 0x030E +#define WM_QUERYNEWPALETTE 0x030F +#define WM_PALETTEISCHANGING 0x0310 +#define WM_PALETTECHANGED 0x0311 +#define WM_HOTKEY 0x0312 +#define WM_PRINT 0x0317 +#define WM_PRINTCLIENT 0x0318 +#define WM_APPCOMMAND 0x0319 +#define WM_THEMECHANGED 0x031A +#define WM_CLIPBOARDUPDATE 0x031D +#define WM_DWMCOMPOSITIONCHANGED 0x031E +#define WM_DWMNCRENDERINGCHANGED 0x031F +#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 +#define WM_DWMWINDOWMAXIMIZEDCHANGE 0x0321 +#define WM_DWMSENDICONICTHUMBNAIL 0x0323 +#define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 +#define WM_GETTITLEBARINFOEX 0x033F +#define WM_HANDHELDFIRST 0x0358 +#define WM_HANDHELDLAST 0x035F +#define WM_AFXFIRST 0x0360 +#define WM_AFXLAST 0x037F +#define WM_PENWINFIRST 0x0380 +#define WM_PENWINLAST 0x038F +#define WM_DDE_FIRST 0x03E0 +#define CF_GDIOBJLAST 0x03FF +#define _WIN32_WINNT_NT4 0x0400 +#define _WIN32_IE_IE40 0x0400 +#define WM_USER 0x0400 +#define WVR_VALIDRECTS 0x0400 +#define HDS_CHECKBOXES 0x0400 +#define TBSTYLE_ALTDRAG 0x0400 +#define RBS_BANDBORDERS 0x00000400 +#define TBS_DOWNISLEFT 0x0400 +#define LVS_OWNERDRAWFIXED 0x0400 +#define TVS_SINGLEEXPAND 0x0400 +#define TVS_EX_DRAWIMAGEASYNC 0x0400 +#define TCS_FIXEDWIDTH 0x0400 +#define ctlFirst 0x0400 +#define psh1 0x0400 +#define _WIN32_IE_IE401 0x0401 +#define psh2 0x0401 +#define psh3 0x0402 +#define psh4 0x0403 +#define psh5 0x0404 +#define psh6 0x0405 +#define psh7 0x0406 +#define psh8 0x0407 +#define psh9 0x0408 +#define psh10 0x0409 +#define psh11 0x040a +#define psh12 0x040b +#define psh13 0x040c +#define psh14 0x040d +#define psh15 0x040e +#define psh16 0x040f +#define _WIN32_WINDOWS 0x0410 +#define chx1 0x0410 +#define chx2 0x0411 +#define chx3 0x0412 +#define chx4 0x0413 +#define chx5 0x0414 +#define chx6 0x0415 +#define chx7 0x0416 +#define chx8 0x0417 +#define chx9 0x0418 +#define chx10 0x0419 +#define chx11 0x041a +#define chx12 0x041b +#define chx13 0x041c +#define chx14 0x041d +#define chx15 0x041e +#define chx16 0x041f +#define rad1 0x0420 +#define rad2 0x0421 +#define rad3 0x0422 +#define rad4 0x0423 +#define rad5 0x0424 +#define rad6 0x0425 +#define rad7 0x0426 +#define rad8 0x0427 +#define rad9 0x0428 +#define rad10 0x0429 +#define rad11 0x042a +#define rad12 0x042b +#define rad13 0x042c +#define rad14 0x042d +#define rad15 0x042e +#define rad16 0x042f +#define grp1 0x0430 +#define grp2 0x0431 +#define grp3 0x0432 +#define grp4 0x0433 +#define frm1 0x0434 +#define frm2 0x0435 +#define frm3 0x0436 +#define frm4 0x0437 +#define rct1 0x0438 +#define rct2 0x0439 +#define rct3 0x043a +#define rct4 0x043b +#define ico1 0x043c +#define ico2 0x043d +#define ico3 0x043e +#define ico4 0x043f +#define stc1 0x0440 +#define stc2 0x0441 +#define stc3 0x0442 +#define stc4 0x0443 +#define stc5 0x0444 +#define stc6 0x0445 +#define stc7 0x0446 +#define stc8 0x0447 +#define stc9 0x0448 +#define stc10 0x0449 +#define stc11 0x044a +#define stc12 0x044b +#define stc13 0x044c +#define stc14 0x044d +#define stc15 0x044e +#define stc16 0x044f +#define stc17 0x0450 +#define stc18 0x0451 +#define stc19 0x0452 +#define stc20 0x0453 +#define stc21 0x0454 +#define stc22 0x0455 +#define stc23 0x0456 +#define stc24 0x0457 +#define stc25 0x0458 +#define stc26 0x0459 +#define stc27 0x045a +#define stc28 0x045b +#define stc29 0x045c +#define stc30 0x045d +#define stc31 0x045e +#define stc32 0x045f +#define lst1 0x0460 +#define lst2 0x0461 +#define lst3 0x0462 +#define lst4 0x0463 +#define lst5 0x0464 +#define lst6 0x0465 +#define lst7 0x0466 +#define lst8 0x0467 +#define lst9 0x0468 +#define lst10 0x0469 +#define lst11 0x046a +#define lst12 0x046b +#define lst13 0x046c +#define lst14 0x046d +#define lst15 0x046e +#define lst16 0x046f +#define cmb1 0x0470 +#define cmb2 0x0471 +#define cmb3 0x0472 +#define cmb4 0x0473 +#define cmb5 0x0474 +#define cmb6 0x0475 +#define cmb7 0x0476 +#define cmb8 0x0477 +#define cmb9 0x0478 +#define cmb10 0x0479 +#define cmb11 0x047a +#define cmb12 0x047b +#define cmb13 0x047c +#define cmb14 0x047d +#define cmb15 0x047e +#define cmb16 0x047f +#define edt1 0x0480 +#define edt2 0x0481 +#define edt3 0x0482 +#define edt4 0x0483 +#define edt5 0x0484 +#define edt6 0x0485 +#define edt7 0x0486 +#define edt8 0x0487 +#define edt9 0x0488 +#define edt10 0x0489 +#define edt11 0x048a +#define edt12 0x048b +#define edt13 0x048c +#define edt14 0x048d +#define edt15 0x048e +#define edt16 0x048f +#define scr1 0x0490 +#define scr2 0x0491 +#define scr3 0x0492 +#define scr4 0x0493 +#define scr5 0x0494 +#define scr6 0x0495 +#define scr7 0x0496 +#define scr8 0x0497 +#define ctl1 0x04A0 +#define ctlLast 0x04ff +#define _WIN32_WINNT_WIN2K 0x0500 +#define _WIN32_IE_IE50 0x0500 +#define _WIN32_WINNT_WINXP 0x0501 +#define _WIN32_IE_IE501 0x0501 +#define _WIN32_WINNT_WS03 0x0502 +#define _WIN32_IE_IE55 0x0550 +#define _WIN32_WINNT_WIN6 0x0600 +#define _WIN32_WINNT_VISTA 0x0600 +#define _WIN32_WINNT_WS08 0x0600 +#define _WIN32_WINNT_LONGHORN 0x0600 +#define _WIN32_IE_IE60 0x0600 +#define FILEOPENORD 1536 +#define _WIN32_WINNT_WIN7 0x0601 +#define _WIN32_IE_IE60SP1 0x0601 +#define MULTIFILEOPENORD 1537 +#define _WIN32_WINNT_WIN8 0x0602 +#define _WIN32_IE_WS03 0x0602 +#define PRINTDLGORD 1538 +#define _WIN32_WINNT_WINBLUE 0x0603 +#define _WIN32_IE_IE60SP2 0x0603 +#define _WIN32_WINNT 0x0603 +#define PRNSETUPDLGORD 1539 +#define FINDDLGORD 1540 +#define REPLACEDLGORD 1541 +#define FONTDLGORD 1542 +#define FORMATDLGORD31 1543 +#define FORMATDLGORD30 1544 +#define RUNDLGORD 1545 +#define PAGESETUPDLGORD 1546 +#define NEWFILEOPENORD 1547 +#define PRINTDLGEXORD 1549 +#define PAGESETUPDLGORDMOTIF 1550 +#define COLORMGMTDLGORD 1551 +#define NEWFILEOPENV2ORD 1552 +#define NEWFILEOPENV3ORD 1553 +#define NEWFORMATDLGWITHLINK 1591 +#define IDC_MANAGE_LINK 1592 +#define _WIN32_IE_IE70 0x0700 +#define _WIN32_IE_IE80 0x0800 +#define CS_SAVEBITS 0x0800 +#define HDS_NOSIZING 0x0800 +#define TBSTYLE_FLAT 0x0800 +#define RBS_FIXEDORDER 0x00000800 +#define SBARS_TOOLTIPS 0x0800 +#define SBT_TOOLTIPS 0x0800 +#define TBS_NOTIFYBEFOREMOVE 0x0800 +#define LVS_ALIGNLEFT 0x0800 +#define TVS_INFOTIP 0x0800 +#define TCS_RAGGEDRIGHT 0x0800 +#define _WIN32_IE_IE90 0x0900 +#define _WIN32_IE_IE100 0x0A00 +#define _WIN32_IE 0x0A00 +#define LVS_ALIGNMASK 0x0c00 +#define CS_BYTEALIGNCLIENT 0x1000 +#define HDS_OVERFLOW 0x1000 +#define TBSTYLE_LIST 0x1000 +#define RBS_REGISTERDROP 0x00001000 +#define TBS_TRANSPARENTBKGND 0x1000 +#define LVS_OWNERDATA 0x1000 +#define TVS_FULLROWSELECT 0x1000 +#define TCS_FOCUSONBUTTONDOWN 0x1000 +#define CS_BYTEALIGNWINDOW 0x2000 +#define TBSTYLE_CUSTOMERASE 0x2000 +#define RBS_AUTOSIZE 0x00002000 +#define LVS_NOSCROLL 0x2000 +#define TVS_NOSCROLL 0x2000 +#define TCS_OWNERDRAWFIXED 0x2000 +#define CS_GLOBALCLASS 0x4000 +#define TBSTYLE_REGISTERDROP 0x4000 +#define RBS_VERTICALGRIPPER 0x00004000 +#define LVS_NOCOLUMNHEADER 0x4000 +#define TVS_NONEVENHEIGHT 0x4000 +#define TCS_TOOLTIPS 0x4000 +#define IDH_NO_HELP 28440 +#define IDH_MISSING_CONTEXT 28441 +#define IDH_GENERIC_HELP_BUTTON 28442 +#define IDH_OK 28443 +#define IDH_CANCEL 28444 +#define IDH_HELP 28445 +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define IDTIMEOUT 32000 +#define OCR_NORMAL 32512 +#define OIC_SAMPLE 32512 +#define IDI_APPLICATION 32512 +#define OCR_IBEAM 32513 +#define OIC_HAND 32513 +#define IDI_HAND 32513 +#define OCR_WAIT 32514 +#define OIC_QUES 32514 +#define IDI_QUESTION 32514 +#define OCR_CROSS 32515 +#define OIC_BANG 32515 +#define IDI_EXCLAMATION 32515 +#define OCR_UP 32516 +#define OIC_NOTE 32516 +#define IDI_ASTERISK 32516 +#define OIC_WINLOGO 32517 +#define IDI_WINLOGO 32517 +#define OIC_SHIELD 32518 +#define IDI_SHIELD 32518 +#define OCR_SIZE 32640 +#define OCR_ICON 32641 +#define OCR_SIZENWSE 32642 +#define OCR_SIZENESW 32643 +#define OCR_SIZEWE 32644 +#define OCR_SIZENS 32645 +#define OCR_SIZEALL 32646 +#define OCR_ICOCUR 32647 +#define OCR_NO 32648 +#define OCR_HAND 32649 +#define OCR_APPSTARTING 32650 +#define OBM_LFARROWI 32734 +#define OBM_RGARROWI 32735 +#define OBM_DNARROWI 32736 +#define OBM_UPARROWI 32737 +#define OBM_COMBO 32738 +#define OBM_MNARROW 32739 +#define OBM_LFARROWD 32740 +#define OBM_RGARROWD 32741 +#define OBM_DNARROWD 32742 +#define OBM_UPARROWD 32743 +#define OBM_RESTORED 32744 +#define OBM_ZOOMD 32745 +#define OBM_REDUCED 32746 +#define OBM_RESTORE 32747 +#define OBM_ZOOM 32748 +#define OBM_REDUCE 32749 +#define OBM_LFARROW 32750 +#define OBM_RGARROW 32751 +#define OBM_DNARROW 32752 +#define OBM_UPARROW 32753 +#define OBM_CLOSE 32754 +#define OBM_OLD_RESTORE 32755 +#define OBM_OLD_ZOOM 32756 +#define OBM_OLD_REDUCE 32757 +#define OBM_BTNCORNERS 32758 +#define OBM_CHECKBOXES 32759 +#define OBM_CHECK 32760 +#define OBM_BTSIZE 32761 +#define OBM_OLD_LFARROW 32762 +#define OBM_OLD_RGARROW 32763 +#define OBM_OLD_DNARROW 32764 +#define OBM_OLD_UPARROW 32765 +#define OBM_SIZE 32766 +#define OBM_OLD_CLOSE 32767 +#define WM_APP 0x8000 +#define HELP_TCARD 0x8000 +#define TBSTYLE_TRANSPARENT 0x8000 +#define RBS_DBLCLKTOGGLE 0x00008000 +#define LVS_NOSORTHEADER 0x8000 +#define TVS_NOHSCROLL 0x8000 +#define TCS_FOCUSNEVER 0x8000 +#define SC_SIZE 0xF000 +#define SC_SEPARATOR 0xF00F +#define SC_MOVE 0xF010 +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#define SC_NEXTWINDOW 0xF040 +#define SC_PREVWINDOW 0xF050 +#define SC_CLOSE 0xF060 +#define SC_VSCROLL 0xF070 +#define SC_HSCROLL 0xF080 +#define SC_MOUSEMENU 0xF090 +#define SC_KEYMENU 0xF100 +#define SC_ARRANGE 0xF110 +#define SC_RESTORE 0xF120 +#define SC_TASKLIST 0xF130 +#define SC_SCREENSAVE 0xF140 +#define SC_HOTKEY 0xF150 +#define SC_DEFAULT 0xF160 +#define SC_MONITORPOWER 0xF170 +#define SC_CONTEXTHELP 0xF180 +#define LVS_TYPESTYLEMASK 0xfc00 +#define SPVERSION_MASK 0x0000FF00 +#define HTERROR -2 +#define PWR_FAIL -1 +#define UNICODE_NOCHAR 0xFFFF +#define HTTRANSPARENT -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/properties/iOS/Info.plist.in b/properties/iOS/Info.plist.in new file mode 100644 index 0000000..0be9b1c --- /dev/null +++ b/properties/iOS/Info.plist.in @@ -0,0 +1,56 @@ + + + + + CFBundleIconFile + + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by The Genyleap tool. + CFBundleSignature + ???? + CFBundleExecutable + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleDisplayName + ${PROJECT_NAME} + CFBundleName + ${PROJECT_NAME} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CFBundleDocumentTypes + + + CFBundleTypeName + Generic File + CFBundleTypeRole + Viewer + LSHandlerRank + Alternate + LSItemContentTypes + + public.data + + + + NOTE + This file was generated by Qt/QMake. + CFBundleAllowMixedLocalizations + + + diff --git a/properties/macOS/Info.plist.in b/properties/macOS/Info.plist.in new file mode 100644 index 0000000..3af3775 --- /dev/null +++ b/properties/macOS/Info.plist.in @@ -0,0 +1,56 @@ + + + + + CFBundleIconFile + + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by The Genyleap tool. + CFBundleSignature + ???? + CFBundleExecutable + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleDisplayName + ${PROJECT_NAME} + CFBundleName + ${PROJECT_NAME} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CFBundleDocumentTypes + + + CFBundleTypeName + Generic File + CFBundleTypeRole + Viewer + LSHandlerRank + Alternate + LSItemContentTypes + + public.data + + + + NOTE + This file was generated by Genyleap/Cell. + CFBundleAllowMixedLocalizations + + + diff --git a/source/attributes.hpp b/source/attributes.hpp new file mode 100644 index 0000000..8471edd --- /dev/null +++ b/source/attributes.hpp @@ -0,0 +1,59 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef ATTRIBUTES_HPP +#define ATTRIBUTES_HPP + +//!Attributes in Clang +#if defined(__clang__) + +/// The lifetimebound attribute indicates that a resource owned by a function parameter or implicit object +/// 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). +/// It is only supported in C++. +#if __has_attribute(lifetimebound) +#define LIFETIMEBOUND [[clang::lifetimebound]] +#else +#define LIFETIMEBOUND +#endif + + +/// The reinitializes attribute can be applied to a non-static, non-const C++ member function to indicate +/// that this member function reinitializes the entire object to a known state, independent of the previous state of the object. +#if __has_attribute(reinitializes) +#define REINITIALIZES [[clang::reinitializes]] +#else +#define REINITIALIZES +#endif + +/// The disable_tail_calls attribute instructs the backend to not perform tail call optimization inside the marked function. +#if __has_attribute(disable_tail_calls) +#define DISABLE_TAIL_CALLS [[clang::disable_tail_calls]] +#else +#define DISABLE_TAIL_CALLS +#endif + +/// This attribute specifies that the variable to which it is attached is intended to have a constant initializer +/// according to the rules of [basic.start.static]. The variable is required to have static or thread storage duration. +/// If the initialization of the variable is not a constant initializer an error will be produced. This attribute may only be used in C++. +#if __has_attribute(require_constant_initialization) +#define REQUIRE_CONSTANT_INITIALIZATION [[clang::require_constant_initialization]] +#else +#define REQUIRE_CONSTANT_INITIALIZATION +#endif + +#endif + +//!Attributes in GCC +#if defined(__GNUC__) + +#endif + +//!Attributes in MSVC +#if defined(_MSC_VER) + +#endif + +#endif // ATTRIBUTES_HPP diff --git a/source/common.hpp b/source/common.hpp new file mode 100644 index 0000000..a60e0f2 --- /dev/null +++ b/source/common.hpp @@ -0,0 +1,216 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef COMMON_HPP +#define COMMON_HPP + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +#ifdef __has_cpp_attribute +# if __has_cpp_attribute(__cpp_modules) +# pragma message("Your project is based on modern solution for componentization of C++ libraries and programs.") +# endif +#else +# pragma message("Your project is based on classic precompiled-header system. [enable module feature in C++]") +#endif + +#if __cplusplus > 201703 +#ifdef __has_include +# if __has_include() +# include +# else +# pragma message("Your project is based on classic precompiled-header system.") +# endif +#endif +#else +# include "precompiled/pch.hpp" +#endif + +template +using Scope = std::unique_ptr; + +template +constexpr Scope CreateScope(Args&& ... args) +{ + return std::make_unique(std::forward(args)...); +} + +template +using Ref = std::shared_ptr; + +template +constexpr Ref CreateRef(Args&& ... args) +{ + return std::make_shared(std::forward(args)...); +} + +#define PROJECT_BRACE_BEGIN { +#define PROJECT_BRACE_END } +#define PROJECT_USING_NAMESPACE using namespace +#define PROJECT_NAMESPACE_BEGIN(x) namespace x { +#define PROJECT_ANONYMOUS_NAMESPACE_BEGIN namespace { +#define PROJECT_NAMESPACE_END } +#define PROJECT_USING using +#define PROJECT_NAMESPACE namespace + +/* + * C++11 keywords and expressions + */ +#ifdef PROJECT_COMPILER_NULLPTR +# define __project_nullptr nullptr +#else +# define __project_nullptr NULL +#endif + +# define __project_override override +# define __project_final final + +# define __project_const const +# define __project_const_noexcept const noexcept +# define __project_const_noexcept_override const noexcept override +# define __project_noexcept noexcept +# define __project_noexcept_expr(x) noexcept(x) +# define __project_constexpr_virtual virtual constexpr +# define __project_constexpr constexpr +# define __project_static_constexpr static constexpr +# define __project_static_constexpr static constexpr +# define __project_inline_static_constexpr inline static constexpr +# define __project_inline_static_const inline static const +# define __project_inline_static inline static + +#define __project_pure_const_noexcept const noexcept = 0 + +#define __project_no_return [[noreturn]] + +#define __project_no_discard [[nodiscard]] +#define __project_no_discard_virtual [[nodiscard]] virtual +#define __project_no_discard_message(x) [[nodiscard(x)]] + +#define __project_maybe_unused [[maybe_unused]] + +#define __project_virtual virtual + +//! EXPORTS & EXTRA +#if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ +defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ + defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ + defined(__WIN64__) +//! Microsoft Windows +#define __project_export __declspec(dllexport) +#define __project_import __declspec(dllimport) +#elif defined(__GNUC__) +//! Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... +#define __project_export __attribute__((visibility("default"))) +#define __project_import __attribute__((visibility("default"))) +#define __project_hidden __attribute__((visibility("hidden"))) +#else +// do nothing and hope for the best? +#define __project_export +#define __project_import +#pragma warning Unknown dynamic link import / export semantics. +#endif + +#define SCOPE : +#define SCOPE_LEFT ( +#define SCOPE_RIGHT ) +#define SCOPE_ENDS {} + +#define __project_extern_c extern "C" + +#define __project_export_pointer(Class, object)\ +__project_extern_c __project_export Class* object = __project_nullptr; + +#define PROJECT_DEFAULT_OCTORS_WITHOUT_IMPL(Class) \ + Class() = default;\ + ~Class() = default; + +#define PROJECT_DEFAULT_INTERFACE_OCTORS_WITHOUT_IMPL(Class) \ +Class() = default;\ + virtual ~Class() = default; + +#define PROJECT_DEFAULT_OCTORS(Class) \ +Class();\ + ~Class(); + +#define PROJECT_DEFAULT_OCTORS_IMPL(Class)\ +Class::Class(){}\ + Class::~Class(){}\ + +#define PROJECT_DEFAULT_INTERFACE_OCTORS(Class) \ +Class();\ + virtual ~Class(); + +#define PROJECT_DEFAULT_INTERFACE_OCTORS_IMPL(Class)\ +Class::Class() {}\ + Class::~Class(){}\ + +/*! + * \brief This struct represents a non-copyable object. + */ +struct NonCopyable +{ + NonCopyable() = default; + NonCopyable(NonCopyable const&) = delete; + NonCopyable& operator=(NonCopyable const&) = delete; +}; + +/*! + * \brief This struct represents a non-movable object. + */ +struct NonMovable +{ + NonMovable() = default; + NonMovable(NonMovable&&) = delete; + NonMovable& operator=(NonMovable&&) = delete; +}; + +/*! + * \brief This struct represents a non-copyable or non-movable object. + */ +struct NonMovableOrCopyable : private NonCopyable, NonMovable +{ + NonMovableOrCopyable() = default; +}; + +//!Macro version of non-copyable. +#define PROJECT_DISABLE_COPY(Class) \ + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; + +//!Macro version of non-movable. + +#define PROJECT_DISABLE_MOVE(Class) \ + Class(Class &&) = delete; \ + Class &operator=(Class &&) = delete; + +//!Macro version of non-copyable and non-movable. +#define PROJECT_DISABLE_COPY_MOVE(Class) \ + PROJECT_DISABLE_COPY(Class) \ + PROJECT_DISABLE_MOVE(Class) + +#endif // COMMON_HPP diff --git a/source/defines.hpp b/source/defines.hpp new file mode 100644 index 0000000..e496079 --- /dev/null +++ b/source/defines.hpp @@ -0,0 +1,157 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + + +#ifndef PROJECT_DEFINES_HPP +#define PROJECT_DEFINES_HPP + +namespace Defines { + +#define OK 0x1 +#define ON 0x1 +#define CANCEL 0x0 +#define FAILED 0x0 +#define SUCCESS 0x0 +#define OFF 0x0 + +#define ABSTRACTS 0x1 // Abstraction + +#define MESSAGE_OK "OK" +#define MESSAGE_FAILED "FAILED" +#define MESSAGE_YES "YES" +#define MESSAGE_NO "NO" +#define MESSAGE_ERROR "ERROR" + +#define ERROR_NULL 10001 +#define ERROR_HANDLER 10002 +#define ERROR_SUBTRACK 10003 +#define ERROR_REFRENCE 10004 +#define ERROR_DLL 10005 +#define ERROR_NETWORK 65102 // Message for Network Error. +#define ERROR_WINDOWS 12111 +#define ERROR_SAVED 64511 +#define ERROR_DB_CONNECT 64001 +#define ERROR_LOADING 64522 + +//! Core defines. +#undef KERNEL +#define KERNEL 0x1 +#undef BACKEND +#define BACKEND 0x1 +#undef VIEW +#define VIEW 0x1 +#undef TEMPLATES +#define TEMPLATES 0x1 + +#undef MODULE +#define MODULE 0x1 + +#undef PLUGIN +#define PLUGIN 0x1 + +/*---------------------Default ports------------------------*/ +// Port numbers range from 0 to 65536, but only port numbers 0 to 1024 are +// reserved for privileged services and designated as well-known ports. This list +// of well-known port numbers specifies the port used by the server process as +// its contact port. + +#define PORT_TCP 1 // TCP Port Service Multiplexer (TCPMUX) +#define PORT_RJE 5 // Remote Job Entry (RJE) +#define PORT_ECHO 7 // ECHO +#define PORT_MSP 18 // Message Send Protocol (MSP) +#define PORT_FTP 20 // FTP -- Data +#define PORT_FTP_CONTROL 21 // FTP Control +#define PORT_SSH 22 // SSH Remote Login Protocol +#define PORT_TELNET 23 // Telnet +#define PORT_SMTP 25 // Simple Mail Transfer Protocol (SMTP) +#define PORT_MGS_ICP 29 // MSG ICP +#define PORT_TIME_P 37 // Time +#define PORT_HNS 42 // Host Name Server (Nameserv) +#define PORT_WHOIS 43 // WhoIs +#define PORT_LHP 49 // Login Host Protocol (Login) +#define PORT_DNS 53 // Domain Name System (DNS) +#define PORT_TFTP 69 // Trivial File Transfer Protocol (TFTP) +#define PORT_GOPHER 70 // Gopher Services +#define PORT_FINGER 79 // Finger +#define PORT_APACHE 80 // Apache HTTP Server +#define PORT_HTTP 80 // HTTP +#define PORT_X400 103 // X.400 Standard +#define PORT_SNA 108 // SNA Gateway Access Server +#define PORT_POP2 109 // POP2 +#define PORT_POP3 110 // POP3 +#define PORT_SFTP 115 // Simple File Transfer Protocol (SFTP) +#define PORT_SQL_SERVICES 118 // SQL Services +#define PORT_NNTP 119 // Newsgroup (NNTP) +#define PORT_NET_BIOS 137 // NetBIOS Name Service +#define PORT_NET_BIOS_DS 139 // NetBIOS Datagram Service +#define PORT_IMAP 143 // Interim Mail Access Protocol (IMAP) +#define PORT_NET_BIOS_SS 150 // NetBIOS Session Service +#define PORT_SNMP 161 // SNMP +#define PORT_BGP 179 // Border Gateway Protocol (BGP) +#define PORT_GACP 190 // Gateway Access Control Protocol (GACP) +#define PORT_IRC 194 // Internet Relay Chat (IRC) +#define PORT_DLS 197 // Directory Location Service (DLS) +#define PORT_DLAP 389 // Lightweight Directory Access Protocol (LDAP) +#define PORT_NOVELL_IP 396 // Novell Netware over IP +#define PORT_HHTPS 443 // HTTPS +#define PORT_SNPP 444 // Simple Network Paging Protocol (SNPP) +#define PORT_MICORSOFT_DS 445 // Microsoft-DS +#define PORT_APPLE_Q_TIME 458 // Apple QuickTime +#define PORT_DHCP_CLIENT 546 // DHCP Client +#define PORT_DHCP_SERVER 547 // DHCP Server +#define PORT_SNEWS 563 // SNEWS +#define PORT_MSN 569 // MSN +#define PORT_VPP 4643 // Virtuosso Power Panel +#define PORT_SOCKS 1080 // Socks + +//!Database drivers +#define PORT_MYSQL_DB 3306 // MySQL Database Server +#define PORT_POSTGRESQL_DB 5432 // PostgreSQL Database Server +#define PORT_SQL_SERVER_DB 156 // SQL Server + +//!Server addresses +#define GENYLEAP_URL "http://genyleap.com" +#define GENYLEAP_SSL_URL "https://genyleap.com" + +#define MICROSOFT_URL "http://microsoft.com" +#define MICROSOFT_SSL_URL "https://microsoft.com" + +#define APPLE_NS_USA "104.154.51.7" +#define APPLE_NS_EUROPE "104.155.28.90" +#define APPLE_NS_ASIA "104.155.220.58" +#define APPLE_NS_SOUTH_AMERICA "35.199.88.219" +#define APPLE_NS_AUSTRALIA_OCEANIA "35.189.47.23" + +#define APPLE_URL "http://apple.com" +#define APPLE_SSL_URL "https://apple.com" +#define APPLE_NS_USA "104.154.51.7" +#define APPLE_NS_EUROPE "104.155.28.90" +#define APPLE_NS_ASIA "104.155.220.58" +#define APPLE_NS_SOUTH_AMERICA "35.199.88.219" +#define APPLE_NS_AUSTRALIA_OCEANIA "35.189.47.23" + +#define CLOUD_FLARE_NS1 "1.1.1.1" +#define CLOUD_FLARE_NS2 "1.0.0.1" + +#define QUAD9_NS1 "9.9.9.9" +#define QUAD9_NS2 "149.112.112.112" + +#define GOOGLE_URL "http://google.com" +#define GOOGLE_SSL_URL "https://google.com" +#define GOOGLE_NS1 "8.8.8.8" +#define GOOGLE_NS2 "8.8.4.4" + +//! Protocols +#define PROTOCOL_HTTPS "https://" // SECURED PROTOCOL (USING SSL , 443-PORT) +#define PROTOCOL_HTTP "http://" // UNSECURTED PROTOCOL (USING PORT : 80) +#define PROTOCOL_FTP "ftp://" // FTP PTOTOCOL - FTP data transfer (USING PORT : 20) + +//! System actions +#define EXIT 0; + +} + +#endif // PROJECT_DEFINES_HPP diff --git a/source/entrypoint/qt/nogui/main.cpp b/source/entrypoint/qt/nogui/main.cpp new file mode 100644 index 0000000..31ccf7e --- /dev/null +++ b/source/entrypoint/qt/nogui/main.cpp @@ -0,0 +1,17 @@ +#ifdef USE_QT + +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + qDebug() << "Hello from Qt Console!"; + + return a.exec(); +} + +#else +#error Please enable USE_QT cmake variable! +#endif diff --git a/source/entrypoint/qt/qtquick/main.cpp b/source/entrypoint/qt/qtquick/main.cpp new file mode 100644 index 0000000..c717150 --- /dev/null +++ b/source/entrypoint/qt/qtquick/main.cpp @@ -0,0 +1,42 @@ +#include +#include + +int main(int argc, char *argv[]) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/ui/main.qml")); +// const QUrl url(u"qrc:/ui/main.qml"_qs); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} + + +// #include +// #include + +// int main(int argc, char *argv[]) +// { +// QGuiApplication app(argc, argv); + +// QQmlApplicationEngine engine; +// QObject::connect( +// &engine, +// &QQmlApplicationEngine::objectCreationFailed, +// &app, +// []() { QCoreApplication::exit(-1); }, +// Qt::QueuedConnection); +// engine.loadFromModule("Rare", "Main"); + +// return app.exec(); +// } diff --git a/source/entrypoint/qt/qtwidget/main.cpp b/source/entrypoint/qt/qtwidget/main.cpp new file mode 100644 index 0000000..55b1173 --- /dev/null +++ b/source/entrypoint/qt/qtwidget/main.cpp @@ -0,0 +1,16 @@ +#ifdef USE_QT + +#include "ui/widgets/mainwindow.hpp" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} +#else +#error Please enable the USE_QT [DUSE_QT] variable to use Qt. +#endif diff --git a/source/entrypoint/stl/main.cpp b/source/entrypoint/stl/main.cpp new file mode 100644 index 0000000..1001239 --- /dev/null +++ b/source/entrypoint/stl/main.cpp @@ -0,0 +1,127 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#include +#include "utilities/featuretest.hpp" + +//! Examples +#include "examples/compilertest.hpp" +#include "examples/platformtest.hpp" +#include "examples/librarytest.hpp" +#include "examples/languagetest.hpp" +#include "examples/configtest.hpp" + +// #include + +//!JSon [Non-STL] Features +#if defined(USE_JSON) && !defined(USE_BOOST) +#include +#else +//#include +#endif +//!Google Test +#ifdef USE_GOOGLE_TEST +#include + +class Counter { +public: + // Returns the current counter value, and increments it. + int Increment() { + return m_counter++; + } + + // Returns the current counter value, and decrements it. + // counter can not be less than 0, return 0 in this case + int Decrement() { + if (m_counter == 0) { + return m_counter; + } else { + return m_counter--; + } + } + + // Prints the current counter value to STDOUT. + void Print() const { + printf("%d", m_counter); + } +private: + int m_counter; +}; + +//TEST UNIT +TEST(Counter, Increment) { + Counter c; + + // Test that counter 0 returns 0 + EXPECT_EQ(0, c.Decrement()); + + // EXPECT_EQ() evaluates its arguments exactly once, so they + // can have side effects. + + EXPECT_EQ(0, c.Increment()); + EXPECT_EQ(1, c.Increment()); + EXPECT_EQ(2, c.Increment()); + + EXPECT_EQ(3, c.Decrement()); +} + +#endif + +//!Catch2 +#ifdef USE_CATCH2 +# include + +#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file + +unsigned int Factorial( unsigned int number ) { + return number <= 1 ? number : Factorial(number-1)*number; +} + +TEST_CASE( "Factorials are computed", "[factorial]" ) { + REQUIRE( Factorial(1) == 1 ); + REQUIRE( Factorial(2) == 2 ); + REQUIRE( Factorial(3) == 6 ); + REQUIRE( Factorial(10) == 3628800 ); +} + +#endif + +//ThirdParty libs +#include "examples/thirdpartytest.hpp" + +#ifdef USE_OPENMESH +#include +#endif + + +#include //Project Config + +#include +#include + +using namespace std; + +int main() { + std::unique_ptr arr = std::make_unique(5); // Allocate an array of integers on the heap + + // Access elements of the array + for (int i = 0; i < 5; ++i) { + arr[i] = i; + } + + // Memory is automatically freed when arr goes out of scope + // No need for explicit delete[] + + // Try to access the freed memory + std::cout << "Array elements after deletion: "; + for (int i = 0; i < 5; ++i) { + // The following line is safe, as memory is managed by unique_ptr + std::cout << arr[i] << " "; + } + + return 0; +} + diff --git a/source/examples/compilertest.cpp b/source/examples/compilertest.cpp new file mode 100644 index 0000000..f00041b --- /dev/null +++ b/source/examples/compilertest.cpp @@ -0,0 +1,40 @@ +#include "compilertest.hpp" +#include "common.hpp" +#include + +using namespace std; + +CompilerTest::CompilerTest() { +} + +void CompilerTest::getCompilerInfo() const noexcept { + cout << "Compiler Name : " << COMPILER << endl; + cout << "Compiler Version : " << COMPILER_VER << endl; +} + +void CompilerTest::checkByCompiler() const noexcept { + std::cout << "========COMPILER TEST========" << std::endl; + //! Compiler Stataement +#if defined(COMPILER_CLANG_LLVM) + cout << "Clang compiler has been detected!\n"; +#elif defined(COMPILER_INTEL) + cout << "Intel compiler has been detected!\n"; +#elif defined(COMPILER_MINGW) + cout << "MinGW compiler has been detected!\n"; +#elif defined(COMPILER_MINGW_64) + cout << "MinGW64 compiler has been detected!\n"; +#elif defined(COMPILER_GCC) + cout << "GCC compiler has been detected!\n"; +#elif defined(COMPILER__HEWLETT) + cout << "Hewlett compiler has been detected!\n"; +#elif defined(COMPILER_IBM) + cout << "IBM compiler has been detected!\n"; +#elif defined(COMPILER_MSVC) + cout << "MSVC compiler has been detected!\n"; +#elif defined(COMPILER_PGCC) + cout << "PGCC compiler has been detected!\n"; +#elif defined(COMPILER_ORACLE) + cout << "Oracle compiler has been detected!\n"; +#endif + std::cout << "========COMPILER TEST========" << std::endl; +} diff --git a/source/examples/compilertest.hpp b/source/examples/compilertest.hpp new file mode 100644 index 0000000..c207fef --- /dev/null +++ b/source/examples/compilertest.hpp @@ -0,0 +1,13 @@ +#ifndef COMPILERTEST_HPP +#define COMPILERTEST_HPP + + +class CompilerTest +{ +public: + CompilerTest(); + void getCompilerInfo() const noexcept; + void checkByCompiler() const noexcept; +}; + +#endif // COMPILERTEST_HPP diff --git a/source/examples/configtest.cpp b/source/examples/configtest.cpp new file mode 100644 index 0000000..155a6c7 --- /dev/null +++ b/source/examples/configtest.cpp @@ -0,0 +1,21 @@ +#include "configtest.hpp" +#include "common.hpp" +#include "config.hpp" + +ConfigTest::ConfigTest() +{ + +} + +void ConfigTest::readConfig() const noexcept +{ + std::cout << "========CONFIG TEST========" << std::endl; + std::cout << "Project Name : " << PROJECT_NAME << std::endl; + std::cout << "Project Description : " << PROJECT_DESCRIPTION << std::endl; + std::cout << "Project Homepage Url : " << PROJECT_HOMEPAGE_URL << std::endl; + std::cout << "Project Language : " << PROJECT_LANGUAGES << std::endl; + std::cout << "Project Full Version : " << PROJECT_VERSION_STRING << std::endl; + std::cout << "Project Creator : " << PROJECT_CREATOR << std::endl; + std::cout << "Project License Type : " << PROJECT_LICENSE_TYPE << std::endl; + std::cout << "========CONFIG TEST========" << std::endl; +} diff --git a/source/examples/configtest.hpp b/source/examples/configtest.hpp new file mode 100644 index 0000000..f5e1e2e --- /dev/null +++ b/source/examples/configtest.hpp @@ -0,0 +1,12 @@ +#ifndef CONFIGTEST_HPP +#define CONFIGTEST_HPP + + +class ConfigTest +{ +public: + ConfigTest(); + void readConfig() const noexcept; +}; + +#endif // CONFIGTEST_HPP diff --git a/source/examples/languagetest.cpp b/source/examples/languagetest.cpp new file mode 100644 index 0000000..d20c3e6 --- /dev/null +++ b/source/examples/languagetest.cpp @@ -0,0 +1,29 @@ +#include "languagetest.hpp" +#include "common.hpp" +#include + +LanguageTest::LanguageTest() +{ + +} + +void LanguageTest::checkFeatures() const noexcept +{ +std::cout << "========FEATURE TEST========" << std::endl; +#ifdef USE_FEATURE_TEST + if (print.general_features) show("C++ GENERAL", cxx); + if (print.cxx11 && print.core_features) show("C++11 CORE", cxx11); + if (print.cxx14 && print.core_features) show("C++14 CORE", cxx14); + if (print.cxx14 && print.lib_features ) show("C++14 LIB" , cxx14lib); + if (print.cxx17 && print.core_features) show("C++17 CORE", cxx17); + if (print.cxx17 && print.lib_features ) show("C++17 LIB" , cxx17lib); + if (print.cxx20 && print.core_features) show("C++20 CORE", cxx20); + if (print.cxx20 && print.lib_features ) show("C++20 LIB" , cxx20lib); + if (print.cxx23 && print.core_features) show("C++23 CORE", cxx23); + if (print.cxx23 && print.lib_features ) show("C++23 LIB" , cxx23lib); + if (print.attributes) show("ATTRIBUTES", attributes); +#else + std::cout << "Test Feature is not available.\n"; +#endif + std::cout << "========FEATURE TEST========" << std::endl; +} diff --git a/source/examples/languagetest.hpp b/source/examples/languagetest.hpp new file mode 100644 index 0000000..4f018db --- /dev/null +++ b/source/examples/languagetest.hpp @@ -0,0 +1,12 @@ +#ifndef LANGUAGETEST_HPP +#define LANGUAGETEST_HPP + + +class LanguageTest +{ +public: + LanguageTest(); + void checkFeatures() const noexcept; +}; + +#endif // LANGUAGETEST_HPP diff --git a/source/examples/librarytest.cpp b/source/examples/librarytest.cpp new file mode 100644 index 0000000..972afe4 --- /dev/null +++ b/source/examples/librarytest.cpp @@ -0,0 +1,138 @@ +#include "librarytest.hpp" +#include "common.hpp" + +#ifdef USE_BOOST +# include +#endif + +#ifdef USE_OPENSSL +# include +# include +#endif + +#ifdef USE_OPENCV +# include +# include +# include +#endif + +#ifdef USE_JWT +# include +#endif + +LibraryTest::LibraryTest() +{ +} + +#ifdef USE_OPENSSL +void LibraryTest::testOpenSSL() const noexcept +{ + std::cout << "========OPENSSL TEST========" << std::endl; + //!OpenSSL Library + std::cout << "OpenSSL version: " << OPENSSL_VERSION_STR << std::endl; + + std::string str {"Hello, World!"}; + // Initialize the hash context + EVP_MD_CTX* ctx = EVP_MD_CTX_new(); + EVP_MD_CTX_init(ctx); + + // Set the hash algorithm + const EVP_MD* md = EVP_sha256(); + + // Initialize the digest buffer + unsigned char digest[SHA256_DIGEST_LENGTH]; + + // Hash the input string + EVP_DigestInit_ex(ctx, md, nullptr); + EVP_DigestUpdate(ctx, str.c_str(), str.length()); + EVP_DigestFinal_ex(ctx, digest, nullptr); + + // Convert the digest buffer to string + std::stringstream ss; + for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) + { + ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(digest[i]); + } + + // Clean up the hash context + EVP_MD_CTX_free(ctx); + + std::string hash = ss.str(); + + std::cout << "Hash of " << str << " is " << hash << std::endl; +} +#endif + +#ifdef USE_OPENCV +void LibraryTest::testOpenCV() const noexcept +{ + std::cout << "========OpenCV TEST========" << std::endl; + std::string image_path = cv::samples::findFile("starry_night.jpg"); + cv::Mat img = imread(image_path, cv::IMREAD_COLOR); + if(img.empty()) + { + std::cout << "Could not read the image: " << image_path << std::endl; + } + imshow("Display window", img); + int k = cv::waitKey(0); // Wait for a keystroke in the window + if(k == 's') + { + imwrite("starry_night.png", img); + } +} +#endif + +#ifdef USE_BOOST +void LibraryTest::testBoost() const noexcept +{ + std::cout << "========BOOST TEST========" << std::endl; + std::cout << "Boost version: " << BOOST_VERSION << std::endl; + std::cout << "Boost Lib Clock Test\n"; + boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now(); + for ( long i = 0; i < 10000000; ++i ) + std::sqrt( 123.456L ); // burn some time + boost::chrono::duration sec = boost::chrono::system_clock::now() - start; + std::cout << "took " << sec.count() << " seconds\n"; +} +#endif + +#ifdef USE_JWT +void LibraryTest::testJwt() const noexcept +{ + // Set the secret key used to sign and verify JWTs + std::string secret_key = "my_secret_key"; + + // Create a JWT with a payload + std::string payload = R"({ + "user_id": 12345, + "email": "user@example.com" + })"; + std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); + std::chrono::system_clock::time_point exp = now + std::chrono::seconds(30); // expires in 30 seconds + std::string token = jwt::create() + .set_issuer("my_app") + .set_subject("auth_token") + .set_issued_at(now) + .set_expires_at(exp) + .set_payload_claim("data", jwt::claim(payload)) + .sign(jwt::algorithm::hs256{ secret_key }); + + // Print the JWT + std::cout << "Token: " << token << std::endl; + + // Verify the JWT and extract the payload + try { + jwt::decoded_jwt decoded = jwt::decode(token); + jwt::verify() + .allow_algorithm(jwt::algorithm::hs256{ secret_key }) + .with_issuer("my_app") + .with_subject("auth_token") + .verify(decoded); + std::string payload_str = decoded.get_payload_claim("data").as_string(); + std::cout << "Payload: " << payload_str << std::endl; + } catch (const std::exception& e) { + std::cerr << "Error: " << e.what() << std::endl; + } + +} +#endif diff --git a/source/examples/librarytest.hpp b/source/examples/librarytest.hpp new file mode 100644 index 0000000..2ddc9d3 --- /dev/null +++ b/source/examples/librarytest.hpp @@ -0,0 +1,22 @@ +#ifndef LIBRARYTEST_HPP +#define LIBRARYTEST_HPP + +class LibraryTest +{ +public: + LibraryTest(); +#ifdef USE_OPENSSL + void testOpenSSL() const noexcept; +#endif +#ifdef USE_BOOST + void testBoost() const noexcept; +#endif +#ifdef USE_OPENCV + void testOpenCV() const noexcept; +#endif +#ifdef USE_JWT + void testJwt() const noexcept; +#endif +}; + +#endif // LIBRARYTEST_HPP diff --git a/source/examples/platformtest.cpp b/source/examples/platformtest.cpp new file mode 100644 index 0000000..4192429 --- /dev/null +++ b/source/examples/platformtest.cpp @@ -0,0 +1,105 @@ +#include "platformtest.hpp" +#include "common.hpp" +#include + +using namespace std; + +PlatformTest::PlatformTest() +{ + +} + +void PlatformTest::getPlatformInfo() const noexcept +{ +#if defined(PLATFORM_MAC) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_MAC << "\n"; +#elif defined(PLATFORM_WINDOWS) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_WINDOWS << "\n"; +#elif defined(PLATFORM_LINUX) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_LINUX << "\n"; +#elif defined(PLATFORM_FREEBSD) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_FREEBSD << "\n"; +#elif defined(PLATFORM_OPENBSD) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_OPENBSD << "\n"; +#elif defined(PLATFORM_VXWORKS) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_VXWORKS << "\n"; +#elif defined(PLATFORM_MOTOROLA) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_MOTOROLA << "\n"; +#elif defined(PLATFORM_ULTRIX) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_ULTRIX << "\n"; +#elif defined(PLATFORM_DOS) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_DOS << "\n"; +#elif defined(PLATFORM_WINDOWS_PHONE) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_WINDOWS_PHONE << "\n"; +#elif defined(PLATFORM_IOS_SIMULATOR) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_IOS_SIMULATOR << "\n"; +#elif defined(PLATFORM_IOS) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_IOS << "\n"; +#elif defined(PLATFORM_APPLE_TV) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_APPLE_TV << "\n"; +#elif defined(PLATFORM_IWATCH) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_IWATCH << "\n"; +#elif defined(PLATFORM_ANDROID) + cout << "Device: " << PLATFORM_DEVICE << "\n"; + cout << "Type: " << PLATFORM_TYPE << "\n"; + cout << "Platform OS: " << PLATFORM_OS << "\n"; + cout << "Platform Architecture: " << PLATFORM_ARCH << "\n"; + cout << "OS Name: " << PLATFORM_ANDROID << "\n"; +#endif +} diff --git a/source/examples/platformtest.hpp b/source/examples/platformtest.hpp new file mode 100644 index 0000000..0eb4af4 --- /dev/null +++ b/source/examples/platformtest.hpp @@ -0,0 +1,12 @@ +#ifndef PLATFORMTEST_HPP +#define PLATFORMTEST_HPP + + +class PlatformTest +{ +public: + PlatformTest(); + void getPlatformInfo() const noexcept; +}; + +#endif // PLATFORMTEST_HPP diff --git a/source/examples/thirdpartytest.cpp b/source/examples/thirdpartytest.cpp new file mode 100644 index 0000000..ed49e8c --- /dev/null +++ b/source/examples/thirdpartytest.cpp @@ -0,0 +1,82 @@ +#include "thirdpartytest.hpp" + +#if defined (USE_FMT) +# include +# include +# include +# include +# include +# include +#endif + +#if defined (USE_CTRE) +#include +#include +#include +#endif + +#include +#include +#include + +ThirdPartyTest::ThirdPartyTest() +{ + +} + +void ThirdPartyTest::testFmt() +{ +#if defined(USE_FMT) + using namespace fmt::literals; + std::cout << "========FMT TEST========" << std::endl; + fmt::print("This is a great template for C++{}.\n", 20); + fmt::print("I'd rather be {1} than {0}.\n", "right", "happy"); + fmt::print("Hello, {name}! The answer is {number}. Goodbye, {name}.\n", fmt::arg("name", "World"), fmt::arg("number", 42)); + + //!9.1.0 + auto v = std::vector{1, 2, 3}; + fmt::print("{:n}\n", v); // prints 1, 2, 3 + + std::cout << "========FMT TEST========" << std::endl; +#else + std::cout << "Please enable USE_FMT!" << std::endl; +#endif +} + +#if defined(USE_CTRE) + +std::string_view cast_from_unicode(std::u8string_view input) noexcept { + return std::string_view(reinterpret_cast(input.data()), input.size()); +} + +constexpr auto match(std::string_view sv) noexcept { + return ctre::match<"h.*">(sv); +} + +#endif + + +void ThirdPartyTest::testCtre() +{ +#if defined(USE_CTRE) + std::cout << "========CTRE TEST========" << std::endl; + + using namespace std::literals; + std::u8string_view original = u8"Tu es un génie"sv; + for (auto match : ctre::range<"\\p{Letter}+">(original)) + std::cout << cast_from_unicode(match) << std::endl; + + ///// + auto input = "123,456,768"sv; + for (auto match : ctre::range<"([0-9]+),?">(input)) { + std::cout << std::string_view{match.get<0>()} << "\n"; + } + + std::cout << "Check the more test example from : " + "https://github.com/hanickadot/compile-time-regular-expressions/tree/main/tests \n"; + + std::cout << "========CTRE TEST========" << std::endl; +#else + std::cout << "Please enable USE_CTRE!" << std::endl; +#endif +} diff --git a/source/examples/thirdpartytest.hpp b/source/examples/thirdpartytest.hpp new file mode 100644 index 0000000..7f660db --- /dev/null +++ b/source/examples/thirdpartytest.hpp @@ -0,0 +1,13 @@ +#ifndef THIRDPARTYTEST_HPP +#define THIRDPARTYTEST_HPP + +class ThirdPartyTest +{ +public: + ThirdPartyTest(); + void testFmt(); + void testCtre(); +}; + + +#endif // THIRDPARTYTEST_HPP diff --git a/source/interface.cpp b/source/interface.cpp new file mode 100644 index 0000000..cf67831 --- /dev/null +++ b/source/interface.cpp @@ -0,0 +1,7 @@ +#include "interface.hpp" + +Interface::Interface() +{ + +} + diff --git a/source/interface.hpp b/source/interface.hpp new file mode 100644 index 0000000..702de08 --- /dev/null +++ b/source/interface.hpp @@ -0,0 +1,24 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef INTERFACE_HPP +#define INTERFACE_HPP + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +class Interface +{ +public: + Interface(); +}; + +#endif // INTERFACE_HPP diff --git a/ui/qtquick/main.qml b/ui/qtquick/main.qml new file mode 100644 index 0000000..d1a534a --- /dev/null +++ b/ui/qtquick/main.qml @@ -0,0 +1,27 @@ +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts + +ApplicationWindow { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + ColumnLayout { + anchors.centerIn: parent + spacing: 10 + Button { + text: qsTr("Check State") + onClicked: { + result.text = "My Name is Kambiz!"; + console.log("Hello, Kambiz!") + } + } + Text { + id: result + } + } + +} diff --git a/ui/qtquick/qml.qrc b/ui/qtquick/qml.qrc new file mode 100644 index 0000000..b341c0a --- /dev/null +++ b/ui/qtquick/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/ui/widgets/mainwindow.cpp b/ui/widgets/mainwindow.cpp new file mode 100644 index 0000000..3f7b4e9 --- /dev/null +++ b/ui/widgets/mainwindow.cpp @@ -0,0 +1,15 @@ +#include "mainwindow.hpp" +#include "./ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + diff --git a/ui/widgets/mainwindow.hpp b/ui/widgets/mainwindow.hpp new file mode 100644 index 0000000..b1c89f6 --- /dev/null +++ b/ui/widgets/mainwindow.hpp @@ -0,0 +1,44 @@ +/*! + * MIT License + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef MAINWINDOW_HPP +#define MAINWINDOW_HPP + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; +#endif // MAINWINDOW_HPP diff --git a/ui/widgets/mainwindow.ui b/ui/widgets/mainwindow.ui new file mode 100644 index 0000000..b232854 --- /dev/null +++ b/ui/widgets/mainwindow.ui @@ -0,0 +1,22 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + diff --git a/utilities/featuretest.hpp b/utilities/featuretest.hpp new file mode 100644 index 0000000..6517b68 --- /dev/null +++ b/utilities/featuretest.hpp @@ -0,0 +1,350 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef FEATURETEST_HPP +#define FEATURETEST_HPP + +#ifdef __has_include +# if __has_include() +# include +# endif +# endif + +#ifdef __has_include +# if __has_include() +# include +# endif + +#define COMPILER_FEATURE_VALUE(value) #value +#define COMPILER_FEATURE_ENTRY(name) { #name, COMPILER_FEATURE_VALUE(name) }, + +#ifdef __has_cpp_attribute +# define COMPILER_ATTRIBUTE_VALUE_AS_STRING(s) #s +# define COMPILER_ATTRIBUTE_AS_NUMBER(x) COMPILER_ATTRIBUTE_VALUE_AS_STRING(x) +# define COMPILER_ATTRIBUTE_ENTRY(attr) \ + { #attr, COMPILER_ATTRIBUTE_AS_NUMBER(__has_cpp_attribute(attr)) }, +#else +# define COMPILER_ATTRIBUTE_ENTRY(attr) { #attr, "_" }, +#endif + +// Change these options to print out only necessary info. +static struct PrintOptions { + constexpr static bool titles = 1; + constexpr static bool attributes = 1; + constexpr static bool general_features = 1; + constexpr static bool core_features = 1; + constexpr static bool lib_features = 1; + constexpr static bool supported_features = 1; + constexpr static bool unsupported_features = 1; + constexpr static bool sorted_by_value = 0; + constexpr static bool cxx11 = 1; + constexpr static bool cxx14 = 1; + constexpr static bool cxx17 = 1; + constexpr static bool cxx20 = 1; + constexpr static bool cxx23 = 1; +} print; + +struct CompilerFeature { + CompilerFeature(const char* name = nullptr, const char* value = nullptr) + : name(name), value(value) {} + const char* name; const char* value; +}; + +static CompilerFeature cxx[] = { +COMPILER_FEATURE_ENTRY(__cplusplus) +COMPILER_FEATURE_ENTRY(__cpp_exceptions) +COMPILER_FEATURE_ENTRY(__cpp_rtti) +#if 0 +COMPILER_FEATURE_ENTRY(__GNUC__) +COMPILER_FEATURE_ENTRY(__GNUC_MINOR__) +COMPILER_FEATURE_ENTRY(__GNUC_PATCHLEVEL__) +COMPILER_FEATURE_ENTRY(__GNUG__) +COMPILER_FEATURE_ENTRY(__clang__) +COMPILER_FEATURE_ENTRY(__clang_major__) +COMPILER_FEATURE_ENTRY(__clang_minor__) +COMPILER_FEATURE_ENTRY(__clang_patchlevel__) +#endif +}; +static CompilerFeature cxx11[] = { +COMPILER_FEATURE_ENTRY(__cpp_alias_templates) +COMPILER_FEATURE_ENTRY(__cpp_attributes) +COMPILER_FEATURE_ENTRY(__cpp_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_decltype) +COMPILER_FEATURE_ENTRY(__cpp_delegating_constructors) +COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) +COMPILER_FEATURE_ENTRY(__cpp_initializer_lists) +COMPILER_FEATURE_ENTRY(__cpp_lambdas) +COMPILER_FEATURE_ENTRY(__cpp_nsdmi) +COMPILER_FEATURE_ENTRY(__cpp_range_based_for) +COMPILER_FEATURE_ENTRY(__cpp_raw_strings) +COMPILER_FEATURE_ENTRY(__cpp_ref_qualifiers) +COMPILER_FEATURE_ENTRY(__cpp_rvalue_references) +COMPILER_FEATURE_ENTRY(__cpp_static_assert) +COMPILER_FEATURE_ENTRY(__cpp_threadsafe_static_init) +COMPILER_FEATURE_ENTRY(__cpp_unicode_characters) +COMPILER_FEATURE_ENTRY(__cpp_unicode_literals) +COMPILER_FEATURE_ENTRY(__cpp_user_defined_literals) +COMPILER_FEATURE_ENTRY(__cpp_variadic_templates) +}; +static CompilerFeature cxx14[] = { +COMPILER_FEATURE_ENTRY(__cpp_aggregate_nsdmi) +COMPILER_FEATURE_ENTRY(__cpp_binary_literals) +COMPILER_FEATURE_ENTRY(__cpp_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_decltype_auto) +COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) +COMPILER_FEATURE_ENTRY(__cpp_init_captures) +COMPILER_FEATURE_ENTRY(__cpp_return_type_deduction) +COMPILER_FEATURE_ENTRY(__cpp_sized_deallocation) +COMPILER_FEATURE_ENTRY(__cpp_variable_templates) +}; +static CompilerFeature cxx14lib[] = { +COMPILER_FEATURE_ENTRY(__cpp_lib_chrono_udls) +COMPILER_FEATURE_ENTRY(__cpp_lib_complex_udls) +COMPILER_FEATURE_ENTRY(__cpp_lib_exchange_function) +COMPILER_FEATURE_ENTRY(__cpp_lib_generic_associative_lookup) +COMPILER_FEATURE_ENTRY(__cpp_lib_integer_sequence) +COMPILER_FEATURE_ENTRY(__cpp_lib_integral_constant_callable) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_final) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_null_pointer) +COMPILER_FEATURE_ENTRY(__cpp_lib_make_reverse_iterator) +COMPILER_FEATURE_ENTRY(__cpp_lib_make_unique) +COMPILER_FEATURE_ENTRY(__cpp_lib_null_iterators) +COMPILER_FEATURE_ENTRY(__cpp_lib_quoted_string_io) +COMPILER_FEATURE_ENTRY(__cpp_lib_result_of_sfinae) +COMPILER_FEATURE_ENTRY(__cpp_lib_robust_nonmodifying_seq_ops) +COMPILER_FEATURE_ENTRY(__cpp_lib_shared_timed_mutex) +COMPILER_FEATURE_ENTRY(__cpp_lib_string_udls) +COMPILER_FEATURE_ENTRY(__cpp_lib_transformation_trait_aliases) +COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) +COMPILER_FEATURE_ENTRY(__cpp_lib_tuple_element_t) +COMPILER_FEATURE_ENTRY(__cpp_lib_tuples_by_type) +}; + +static CompilerFeature cxx17[] = { +COMPILER_FEATURE_ENTRY(__cpp_aggregate_bases) +COMPILER_FEATURE_ENTRY(__cpp_aligned_new) +COMPILER_FEATURE_ENTRY(__cpp_capture_star_this) +COMPILER_FEATURE_ENTRY(__cpp_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) +COMPILER_FEATURE_ENTRY(__cpp_enumerator_attributes) +COMPILER_FEATURE_ENTRY(__cpp_fold_expressions) +COMPILER_FEATURE_ENTRY(__cpp_guaranteed_copy_elision) +COMPILER_FEATURE_ENTRY(__cpp_hex_float) +COMPILER_FEATURE_ENTRY(__cpp_if_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) +COMPILER_FEATURE_ENTRY(__cpp_inline_variables) +COMPILER_FEATURE_ENTRY(__cpp_namespace_attributes) +COMPILER_FEATURE_ENTRY(__cpp_noexcept_function_type) +COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) +COMPILER_FEATURE_ENTRY(__cpp_nontype_template_parameter_auto) +COMPILER_FEATURE_ENTRY(__cpp_range_based_for) +COMPILER_FEATURE_ENTRY(__cpp_static_assert) +COMPILER_FEATURE_ENTRY(__cpp_structured_bindings) +COMPILER_FEATURE_ENTRY(__cpp_template_template_args) +COMPILER_FEATURE_ENTRY(__cpp_variadic_using) +}; +static CompilerFeature cxx17lib[] = { +COMPILER_FEATURE_ENTRY(__cpp_lib_addressof_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_lib_allocator_traits_is_always_equal) +COMPILER_FEATURE_ENTRY(__cpp_lib_any) +COMPILER_FEATURE_ENTRY(__cpp_lib_apply) +COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_lib_as_const) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_is_always_lock_free) +COMPILER_FEATURE_ENTRY(__cpp_lib_bool_constant) +COMPILER_FEATURE_ENTRY(__cpp_lib_boyer_moore_searcher) +COMPILER_FEATURE_ENTRY(__cpp_lib_byte) +COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) +COMPILER_FEATURE_ENTRY(__cpp_lib_clamp) +COMPILER_FEATURE_ENTRY(__cpp_lib_enable_shared_from_this) +COMPILER_FEATURE_ENTRY(__cpp_lib_execution) +COMPILER_FEATURE_ENTRY(__cpp_lib_filesystem) +COMPILER_FEATURE_ENTRY(__cpp_lib_gcd_lcm) +COMPILER_FEATURE_ENTRY(__cpp_lib_hardware_interference_size) +COMPILER_FEATURE_ENTRY(__cpp_lib_has_unique_object_representations) +COMPILER_FEATURE_ENTRY(__cpp_lib_hypot) +COMPILER_FEATURE_ENTRY(__cpp_lib_incomplete_container_elements) +COMPILER_FEATURE_ENTRY(__cpp_lib_invoke) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_aggregate) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_invocable) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_swappable) +COMPILER_FEATURE_ENTRY(__cpp_lib_launder) +COMPILER_FEATURE_ENTRY(__cpp_lib_logical_traits) +COMPILER_FEATURE_ENTRY(__cpp_lib_make_from_tuple) +COMPILER_FEATURE_ENTRY(__cpp_lib_map_try_emplace) +COMPILER_FEATURE_ENTRY(__cpp_lib_math_special_functions) +COMPILER_FEATURE_ENTRY(__cpp_lib_memory_resource) +COMPILER_FEATURE_ENTRY(__cpp_lib_node_extract) +COMPILER_FEATURE_ENTRY(__cpp_lib_nonmember_container_access) +COMPILER_FEATURE_ENTRY(__cpp_lib_not_fn) +COMPILER_FEATURE_ENTRY(__cpp_lib_optional) +COMPILER_FEATURE_ENTRY(__cpp_lib_parallel_algorithm) +COMPILER_FEATURE_ENTRY(__cpp_lib_raw_memory_algorithms) +COMPILER_FEATURE_ENTRY(__cpp_lib_sample) +COMPILER_FEATURE_ENTRY(__cpp_lib_scoped_lock) +COMPILER_FEATURE_ENTRY(__cpp_lib_shared_mutex) +COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) +COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_weak_type) +COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) +COMPILER_FEATURE_ENTRY(__cpp_lib_to_chars) +COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) +COMPILER_FEATURE_ENTRY(__cpp_lib_type_trait_variable_templates) +COMPILER_FEATURE_ENTRY(__cpp_lib_uncaught_exceptions) +COMPILER_FEATURE_ENTRY(__cpp_lib_unordered_map_try_emplace) +COMPILER_FEATURE_ENTRY(__cpp_lib_variant) +COMPILER_FEATURE_ENTRY(__cpp_lib_void_t) +}; + +static CompilerFeature cxx20[] = { +COMPILER_FEATURE_ENTRY(__cpp_aggregate_paren_init) +COMPILER_FEATURE_ENTRY(__cpp_char8_t) +COMPILER_FEATURE_ENTRY(__cpp_concepts) +COMPILER_FEATURE_ENTRY(__cpp_conditional_explicit) +COMPILER_FEATURE_ENTRY(__cpp_consteval) +COMPILER_FEATURE_ENTRY(__cpp_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_constexpr_dynamic_alloc) +COMPILER_FEATURE_ENTRY(__cpp_constexpr_in_decltype) +COMPILER_FEATURE_ENTRY(__cpp_constinit) +COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) +COMPILER_FEATURE_ENTRY(__cpp_designated_initializers) +COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) +COMPILER_FEATURE_ENTRY(__cpp_impl_coroutine) +COMPILER_FEATURE_ENTRY(__cpp_impl_destroying_delete) +COMPILER_FEATURE_ENTRY(__cpp_impl_three_way_comparison) +COMPILER_FEATURE_ENTRY(__cpp_init_captures) +COMPILER_FEATURE_ENTRY(__cpp_modules) +COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) +COMPILER_FEATURE_ENTRY(__cpp_using_enum) +}; +static CompilerFeature cxx20lib[] = { +COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) +COMPILER_FEATURE_ENTRY(__cpp_lib_assume_aligned) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_flag_test) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_float) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_lock_free_type_aliases) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_ref) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_shared_ptr) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_value_initialization) +COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_wait) +COMPILER_FEATURE_ENTRY(__cpp_lib_barrier) +COMPILER_FEATURE_ENTRY(__cpp_lib_bind_front) +COMPILER_FEATURE_ENTRY(__cpp_lib_bit_cast) +COMPILER_FEATURE_ENTRY(__cpp_lib_bitops) +COMPILER_FEATURE_ENTRY(__cpp_lib_bounded_array_traits) +COMPILER_FEATURE_ENTRY(__cpp_lib_char8_t) +COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) +COMPILER_FEATURE_ENTRY(__cpp_lib_concepts) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_algorithms) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_complex) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_dynamic_alloc) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_functional) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_iterator) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_memory) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_numeric) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string_view) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_tuple) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_utility) +COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_vector) +COMPILER_FEATURE_ENTRY(__cpp_lib_coroutine) +COMPILER_FEATURE_ENTRY(__cpp_lib_destroying_delete) +COMPILER_FEATURE_ENTRY(__cpp_lib_endian) +COMPILER_FEATURE_ENTRY(__cpp_lib_erase_if) +COMPILER_FEATURE_ENTRY(__cpp_lib_execution) +COMPILER_FEATURE_ENTRY(__cpp_lib_format) +COMPILER_FEATURE_ENTRY(__cpp_lib_generic_unordered_lookup) +COMPILER_FEATURE_ENTRY(__cpp_lib_int_pow2) +COMPILER_FEATURE_ENTRY(__cpp_lib_integer_comparison_functions) +COMPILER_FEATURE_ENTRY(__cpp_lib_interpolate) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_constant_evaluated) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_layout_compatible) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_nothrow_convertible) +COMPILER_FEATURE_ENTRY(__cpp_lib_is_pointer_interconvertible) +COMPILER_FEATURE_ENTRY(__cpp_lib_jthread) +COMPILER_FEATURE_ENTRY(__cpp_lib_latch) +COMPILER_FEATURE_ENTRY(__cpp_lib_list_remove_return_type) +COMPILER_FEATURE_ENTRY(__cpp_lib_math_constants) +COMPILER_FEATURE_ENTRY(__cpp_lib_polymorphic_allocator) +COMPILER_FEATURE_ENTRY(__cpp_lib_ranges) +COMPILER_FEATURE_ENTRY(__cpp_lib_remove_cvref) +COMPILER_FEATURE_ENTRY(__cpp_lib_semaphore) +COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) +COMPILER_FEATURE_ENTRY(__cpp_lib_shift) +COMPILER_FEATURE_ENTRY(__cpp_lib_smart_ptr_for_overwrite) +COMPILER_FEATURE_ENTRY(__cpp_lib_source_location) +COMPILER_FEATURE_ENTRY(__cpp_lib_span) +COMPILER_FEATURE_ENTRY(__cpp_lib_ssize) +COMPILER_FEATURE_ENTRY(__cpp_lib_starts_ends_with) +COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) +COMPILER_FEATURE_ENTRY(__cpp_lib_syncbuf) +COMPILER_FEATURE_ENTRY(__cpp_lib_three_way_comparison) +COMPILER_FEATURE_ENTRY(__cpp_lib_to_address) +COMPILER_FEATURE_ENTRY(__cpp_lib_to_array) +COMPILER_FEATURE_ENTRY(__cpp_lib_type_identity) +COMPILER_FEATURE_ENTRY(__cpp_lib_unwrap_ref) +}; + +static CompilerFeature cxx23[] = { +//< Continue to Populate +COMPILER_FEATURE_ENTRY(__cpp_size_t_suffix) +}; +static CompilerFeature cxx23lib[] = { +//< Continue to Populate +COMPILER_FEATURE_ENTRY(__cpp_lib_is_scoped_enum) +COMPILER_FEATURE_ENTRY(__cpp_lib_stacktrace) +COMPILER_FEATURE_ENTRY(__cpp_lib_stdatomic_h) +COMPILER_FEATURE_ENTRY(__cpp_lib_string_contains) +COMPILER_FEATURE_ENTRY(__cpp_lib_to_underlying) +COMPILER_FEATURE_ENTRY(__cpp_lib_variant) +}; + +static CompilerFeature attributes[] = { +COMPILER_ATTRIBUTE_ENTRY(carries_dependency) +COMPILER_ATTRIBUTE_ENTRY(deprecated) +COMPILER_ATTRIBUTE_ENTRY(fallthrough) +COMPILER_ATTRIBUTE_ENTRY(likely) +COMPILER_ATTRIBUTE_ENTRY(maybe_unused) +COMPILER_ATTRIBUTE_ENTRY(nodiscard) +COMPILER_ATTRIBUTE_ENTRY(noreturn) +COMPILER_ATTRIBUTE_ENTRY(no_unique_address) +COMPILER_ATTRIBUTE_ENTRY(unlikely) +}; + +constexpr bool is_feature_supported(const CompilerFeature& x) { + return x.value[0] != '_' && x.value[0] != '0' ; +} + +inline void print_compiler_feature(const CompilerFeature& x) { + constexpr static int max_name_length = 44; //< Update if necessary + std::string value{ is_feature_supported(x) ? x.value : "------" }; + if (value.back() == 'L') value.pop_back(); //~ 201603L -> 201603 + // value.insert(4, 1, '-'); //~ 201603 -> 2016-03 + if ( (print.supported_features && is_feature_supported(x)) + or (print.unsupported_features && !is_feature_supported(x))) { + std::cout << std::left << std::setw(max_name_length) + << x.name << " " << value << '\n'; + } +} + +template +inline void show(char const* title, CompilerFeature (&features)[N]) { + if (print.titles) { + std::cout << '\n' << std::left << title << '\n'; + } + if (print.sorted_by_value) { + std::sort(std::begin(features), std::end(features), + [](CompilerFeature const& lhs, CompilerFeature const& rhs) { + return std::strcmp(lhs.value, rhs.value) < 0; + }); + } + for (const CompilerFeature& x : features) { + print_compiler_feature(x); + } +} + +#endif + +#endif // FEATURETEST_HPP diff --git a/utilities/prefuncs.hpp b/utilities/prefuncs.hpp new file mode 100644 index 0000000..01251b6 --- /dev/null +++ b/utilities/prefuncs.hpp @@ -0,0 +1,350 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef PROJECT_PREFUNCS_HPP +#define PROJECT_PREFUNCS_HPP + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +namespace Prefuncs { + +int is_compiler_clang() { +#if defined(COMPILER_CLANG_LLVM) + return 1; +#else + return 0; +#endif +} + +int is_compiler_mingw() { +#if defined(COMPILER_MINGW) + return 1; +#else + return 0; +#endif +} + +int is_compiler_mingw64() { +#if defined(COMPILER_MINGW64_32) + return 1; +#else + return 0; +#endif +} + +int is_compiler_gcc() { +#if defined(COMPILER_GCC) + return 1; +#else + return 0; +#endif +} + +int is_compiler_hewlett() { +#if defined(COMPILERHEWLETT) + return 1; +#else + return 0; +#endif +} + +int is_compiler_ibm() { +#if defined(COMPILER_IBM) + return 1; +#else + return 0; +#endif +} + +int is_compiler_msvc() { +#if defined(COMPILER_MSVC) + return 1; +#else + return 0; +#endif +} + +int is_compiler_pgcc_pgcpp() { +#if defined(COMPILER_PGCC) + return 1; +#else + return 0; +#endif +} + +int is_compiler_oracle() { +#if defined(COMPILER_ORACLE) + return 1; +#else + return 0; +#endif +} + +int is_intel() { +#if defined(INTEL) + return 1; +#else + return 0; +#endif +} + +int is_arm() { +#if defined(ARM) + return 1; +#else + return 0; +#endif +} + +int is_amd() { +#if defined(AMD) + return 1; +#else + return 0; +#endif +} + +int is_alpha() { +#if defined(ALPHA) + return 1; +#else + return 0; +#endif +} + +int is_risc() { +#if defined(PA_RISC) + return 1; +#else + return 0; +#endif +} + +int is_epiphany() { +#if defined(EPIPHANY) + return 1; +#else + return 0; +#endif +} + +int is_motorola() { +#if defined(MOTOROLA) + return 1; +#else + return 0; +#endif +} + +int is_powerpc() { +#if defined(POWER_PC) + return 1; +#else + return 0; +#endif +} + +int is_sparc() { +#if defined(SPARC) + return 1; +#else + return 0; +#endif +} + +int is_embedded() { +#if defined(EMBEDDED) + return 1; +#else + return 0; +#endif +} + +int is_aix() { +#if defined(AIX) + return 1; +#else + return 0; +#endif +} + +int is_hpux() { +#if defined(HPUX) + return 1; +#else + return 0; +#endif +} + +int is_linux() { +#if defined(PLATFORM_LINUX) + return 1; +#else + return 0; +#endif +} + +int is_android() { +#if defined(PLATFORM_IS_ANDROID) + return 1; +#else + return 0; +#endif +} + +int is_ios_simulator() { +#if defined(PLATFORM_IS_IOS_EMULATOR) + return 1; +#else + return 0; +#endif +} + +int is_ios_iwatch() { +#if defined(PLATFORM_IS_IWATCH) + return 1; +#else + return 0; +#endif +} + +int is_ios_apple_tv() { +#if defined(PLATFORM_IS_IOS_APPLE_TV) + return 1; +#else + return 0; +#endif +} + +int is_ios() { +#if defined(PLATFORM_IS_IOS) + return 1; +#else + return 0; +#endif +} + +int is_mac() { +#if defined(PLATFORM_IS_MAC) + return 1; +#else + return 0; +#endif +} + +int is_windows() { +#if defined(PLATFORM_IS_WINDOWS) + return 1; +#else + return 0; +#endif +} + +int is_freebsd() { +#if defined(PLATFORM_IS_FREEBSD) + return 1; +#else + return 0; +#endif +} + +int is_openbsd() { +#if defined(PLATFORM_IS_OPENBSD) + return 1; +#else + return 0; +#endif +} + +int is_netbsd() { +#if defined(PLATFORM_IS_NETBSD) + return 1; +#else + return 0; +#endif +} + +int is_playstation() { +#if defined(PLATFORM_IS_PLAYSTATION) + return 1; +#else + return 0; +#endif +} + +int is_xbox() { +#if defined(PLATFORM_IS_XBOX) + return 1; +#else + return 0; +#endif +} + +int is_blackberry() { +#if defined(PLATFORM_IS_BLACKBERRY) + return 1; +#else + return 0; +#endif +} + +int is_openvms() { +#if defined(PLATFORM_IS_OPENVMS) + return 1; +#else + return 0; +#endif +} + +int is_vxworks() { +#if defined(PLATFORM_IS_VXWORKS) + return 1; +#else + return 0; +#endif +} + +int is_ultrix() { +#if defined(PLATFORM_IS_ULTRIX) + return 1; +#else + return 0; +#endif +} + +int is_msdos() { +#if defined(PLATFORM_IS_MSDOS) + return 1; +#else + return 0; +#endif +} + +int is_pc() { +#if defined(PLATFORM_IS_PC) + return 1; +#else + return 0; +#endif +} + +int is_windows_phone() { +#if defined(PLATFORM_IS_WINDOWS_PHPNE) + return 1; +#else + return 0; +#endif +} + +} + +#endif // PROJECT_PREFUNCS_HPP diff --git a/utilities/preprocessor.cppm b/utilities/preprocessor.cppm new file mode 100644 index 0000000..6771f5c --- /dev/null +++ b/utilities/preprocessor.cppm @@ -0,0 +1,1257 @@ +/*! + * + * Copyright (c) 2024 Kambiz Asadzadeh + * Copyright (c) 2024 Genyleap + */ + +export module preprocessor; + +//! COMPILERS +#if defined(__clang__) +/* Clang/LLVM. ---------------------------------------------- */ +#undef COMPILER +#define COMPILER "Clang/LLVM" +#undef COMPILER_CLANG_LLVM +#define COMPILER_CLANG_LLVM "Clang/LLVM" +#undef COMPILER_VER +#define COMPILER_VER __clang_version__ +#elif (defined(__clang__) && !defined(__llvm__)) && !defined(__GNUC__) +#elif defined(__ICC) || defined(__INTEL_COMPILER) +/* Intel ICC/ICPC. ------------------------------------------ */ +#undef COMPILER +#define COMPILER "Intel ICC/ICPC" +#undef COMPILER_INTEL +#define COMPILER_INTEL "Intel ICC/ICPC" +#define COMPILER_VER __INTEL_COMPILER_BUILD_DATE +#elif defined(__MINGW32__) && !defined(__amd64__) && !defined(__amd64) && \ + !defined(__ia64__) +/* __MINGW32__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w86 (x86) 32 Bit" +#undef COMPILER_MINGW +#define COMPILER_MINGW "MinGW-w86 (x86) 32 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION +#elif defined(__MINGW32__) +/* __MINGW64_32__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w64 (x86_64) 32-64 Bit" +#undef COMPILER_MINGW64_32 +#define COMPILER_MINGW64_32 "MinGW-w64 (x86_64) 32-64 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION +#elif defined(__MINGW64__) +/* __MINGW64__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w64 (x64) 64 Bit" +#undef COMPILER_MINGW_64 +#define COMPILER_MINGW_64 "MinGW-w64 (x64) 64 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION +#elif defined(__GNUC__) || defined(__GNUG__) && !defined(__clang__) +#define GCC_VERSION __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ +/* GNU GCC/G++. --------------------------------------------- */ +#undef COMPILER +#define COMPILER "GNU GCC/G++" +#undef COMPILER_GNU +#define COMPILER_GNU "GNU GCC/G++" +#undef COMPILER_GCC +#define COMPILER_GCC "GNU GCC/G++" +#undef COMPILER_VER +#define COMPILER_VER GCC_VERSION +#elif defined(__HP_cc) || defined(__HP_aCC) +/* Hewlett-Packard C/aC++. ---------------------------------- */ +#undef COMPILER +#define COMPILER "Hewlett-Packard C/aC++" +#undef COMPILERHEWLETT +#define COMPILERHEWLETT "Hewlett-Packard C/aC++" +#define COMPILER_VER __HP_aCC +#elif defined(__IBMC__) || defined(__IBMCPP__) +/* IBM XL C/C++. -------------------------------------------- */ +#undef COMPILER +#define COMPILER "IBM XL C/C++" +#undef COMPILER_IBM +#define COMPILER_IBM "IBM XL C/C++" +#define COMPILER_VER __xlC_ver__ +#elif defined(_MSC_VER) +/* Microsoft Visual Studio. --------------------------------- */ +#undef COMPILER +#define COMPILER "MSVC++ " +#undef COMPILER_MSVC +#define COMPILER_MSVC "MSVC++ " +#undef COMPILER_VER +#define COMPILER_VER _MSC_VER +#elif defined(__PGI) +/* Portland Group PGCC/PGCPP. ------------------------------- */ +#undef COMPILER "PGCC/PGCPP" +#define COMPILER "PGCC/PGCPP" +#undef COMPILER_PGCC "PGCC/PGCPP" +#define COMPILER_PGCC "PGCC/PGCPP" +#define COMPILER_VER __VERSION__ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +/* Oracle Solaris Studio. ----------------------------------- */ +#undef COMPILER "Oracle Solaris" +#define COMPILER "Oracle Solaris" +#undef COMPILER_ORACLE "Oracle Solaris" +#define COMPILER_ORACLE "Oracle Solaris" +#define COMPILER_VER __SUNPRO_CC +#endif + +#if defined(_MSC_VER) && _MSC_VER == 1400 +#undef MSVCPP +#define MSVCPP "MSVC++ 8.0" +#elif defined(_MSC_VER) && _MSC_VER == 1500 +#undef MSVCPP +#define MSVCPP "MSVC++ 9.0" +#elif defined(_MSC_VER) && _MSC_VER == 1600 +#undef MSVCPP +#define MSVCPP "MSVC++ 10.0" +#elif defined(_MSC_VER) && _MSC_VER == 1700 +#undef MSVCPP +#define MSVCPP "MSVC++ 11.0" +#elif defined(_MSC_VER) && _MSC_VER == 1800 +#undef MSVCPP +#define MSVCPP "MSVC++ 12.0" +#elif defined(_MSC_VER) && _MSC_VER == 1900 +#undef MSVCPP +#define MSVCPP "MSVC++ 14.0" +#elif defined(_MSC_VER) && _MSC_VER == 1910 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.0" +#elif defined(_MSC_VER) && _MSC_VER == 1911 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.3" +#elif defined(_MSC_VER) && _MSC_VER == 1912 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.5" +#elif defined(_MSC_VER) && _MSC_VER == 1913 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.6" +#elif defined(_MSC_VER) && _MSC_VER == 1914 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.7" +#elif defined(_MSC_VER) && _MSC_VER == 1915 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.8" +#elif defined(_MSC_VER) && _MSC_VER == 1915 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.8" +#elif defined(_MSC_VER) && _MSC_VER == 1916 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.9" +#elif defined(_MSC_VER) && _MSC_VER == 1920 +#undef MSVCPP +#define MSVCPP "MSVC++ RTW 16.0" +#elif defined(_MSC_VER) && _MSC_VER == 1921 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.1" +#elif defined(_MSC_VER) && _MSC_VER == 1922 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.2" +#elif defined(_MSC_VER) && _MSC_VER == 1923 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.3" +#elif defined(_MSC_VER) && _MSC_VER == 1924 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.4" +#elif defined(_MSC_VER) && _MSC_VER == 1925 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.5" +#elif defined(_MSC_VER) && _MSC_VER == 1926 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.6" +#elif defined(_MSC_VER) && _MSC_VER == 1927 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.7" +#elif defined(_MSC_VER) && _MSC_VER == 1928 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.8, 16.9" +#elif defined(_MSC_VER) && _MSC_VER == 1929 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.10" +#elif defined(_MSC_VER) && _MSC_VER == 1930 +#undef MSVCPP +#elif defined(_MSC_VER) && _MSC_VER == 1931 +#undef MSVCPP +#define MSVCPP "MSVC++ (17.1)" +#endif + +//! LANGUAGE STANDARD +#if __cplusplus == 199711L && !defined(_MSC_VER) +/* C++98: __cplusplus is 19971L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++98" +#undef CPP_VALUE +#define CPP_VALUE "19971L" +#elif __cplusplus == 201103L +/* C++11: __cplusplus is 201103L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++11" +#undef CPP_VALUE +#define CPP_VALUE "201103L" +#elif __cplusplus == 201402L +/* C++14: __cplusplus is 201402L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++14" +#undef CPP_VALUE +#define CPP_VALUE "201402L" +#elif __cplusplus == 201702L || __cplusplus == 201703 +/* C++17: __cplusplus is c++1z.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++17" +#undef CPP_VALUE +#define CPP_VALUE "201703" +#elif __cplusplus == 201707 || __cplusplus == 202002L || __cplusplus == 201709 +/* C++20: __cplusplus is c++2a.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++20" +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif __cplusplus == 20120 +/* C++23: __cplusplus is c++2b.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++23" +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif __embedded_cplusplus +#undef CPP_VERSION +#define CPP_VERSION "Embedded C++" +#undef CPP_VALUE +#define CPP_VALUE "19971L" +#elif defined(__clang__) +#undef CPP_VERSION +#define CPP_VERSION __cplusplus +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif defined(__GNUC__) +#undef CPP_VERSION +#define CPP_VERSION __cplusplus +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#else +#undef CPP_VERSION +#define CPP_VERSION 0 +#undef CPP_VALUE +#define CPP_VALUE "Unknown" +#endif + +//! EXPORTS & EXTRA +#if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ + defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ + defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ + defined(__WIN64__) +//! Microsoft Windows +#define PROJECT_EXPORT __declspec(dllexport) +#define PROJECT_IMPORT __declspec(dllimport) +#elif defined(__GNUC__) +//! Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... +#define PROJECT_EXPORT __attribute__((visibility("default"))) +#define PROJECT_IMPORT __attribute__((visibility("default"))) +#define PROJECT_HIDDEN __attribute__((visibility("hidden"))) +#else +// do nothing and hope for the best? +#define PROJECT_EXPORT +#define PROJECT_IMPORT +#pragma warning Unknown dynamic link import / export semantics. +#endif + +#define PROJECT_DATE __DATE__ +#define PROJECT_TIME __TIME__ +#define PROJECT_FUNCTION __FUNCTION__ +#define PROJECT_LINE __LINE__ +#define PROJECT_FILE __FILE__ +#define PROJECT_COUNTER __COUNTER__ + +/* NOTICE: __attribute__ is Linux syntax; __declspec is the Windows syntax.*/ +/*The __declspec(noinline) attribute suppresses the inlining of a function at +the call points of the function. + +__declspec(noinline) can also be applied to constant data, to prevent the +compiler from using the value for optimization purposes, without affecting its +placement in the object. This is a feature that can be used for patchable +constants, that is, data that is later patched to a different value. It is an +error to try to use such constants in a context where a constant value is +required. For example, an array dimension. +*/ + +#if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ + defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ + defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ + defined(__WIN64__) +#define PROJECT_NOINLINE __declspec(noinline) +#define PROJECT_INLINE inline +#else +/// Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... +#define PROJECT_NOINLINE __attribute__((noinline)) +#define PROJECT_INLINE inline +#endif + +//! ARCHITECTURE + +/* + * Classic Standard + * 32-bit and 64-Bit systems + * Developer: Intel & AMD Holdings + * Processors: Intel & AMD Machine + * (64-bit): EM64T, IA-32e, Intel64, x64, x86-64 + * (32-bit): IA-32, i386, x86, x86-32 + * Processors: Athlon, Atom, Core, Core 2, Core i3/i5/i7, Opteron, Pentium, + * Phenom, Sempron, Turion, etc. + */ + +#if (defined(i386) || defined(__i386) || defined(__i386__) || \ + defined(__IA32__) || defined(_M_IX86) || defined(_X86_)) && \ + !defined(__amd64) +//! x86 based systems (32-bit) +#undef X86_64BIT +#define X86_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE +#define ARCHITECTURE "x86 (32-Bit)" +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || \ + defined(_M_AMD64) || defined(_M_X64) && !defined(X86_32bit) +//! x64 based systems (64-bit) +#undef X64_64BIT +#define X64_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE +#define ARCHITECTURE "x86_64 (64-Bit)" +#endif + +/* + * x86 and x86-64 + * (64-bit): EM64T, IA-32e, Intel64, x64, x86-64 + * (32-bit): IA-32, i386, x86, x86-32 + * Developers: Intel only + * Processors: Athlon + * + */ + +#if defined(__i386__) && !defined(_M_AMD64) +/* x86 32-bit ----------------------------------------------- */ +#undef INTEL_32BIT +#define INTEL_32BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE_INTEL +#define ARCHITECTURE_INTEL "x86 (32-Bit)" +#elif defined(__x86_64__) && !defined(_M_AMD64) +/* x64 64-bit ----------------------------------------------- */ +#undef INTEL_64BIT +#define INTEL_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE_INTEL +#define ARCHITECTURE_INTEL "x86_64 (64-Bit)" +#endif + +/* + * x86 and x86-64 + * (32-bit): i386, x86, x86-32 + * (64-bit): AMD64, x64 + * Developers: AMD only + * Processors: Athlon + * + */ + +#if defined(__i386__) && !defined(__x86_64__) +/* x86 32-bit ----------------------------------------------- */ +#undef AMD_32BIT +#define AMD_32BIT +#undef PROCESSOR +#define PROCESSOR "AMD" +#undef AMD +#define AMD +#undef ARCHITECTURE +#undef ARCHITECTURE_AMD +#define ARCHITECTURE_AMD "x86 (32-Bit)" +#elif (defined(__amd64__) || defined(__amd64) || defined(_M_AMD64)) && \ + !defined(__x86_64__) +/* x64 64-bit ----------------------------------------------- */ +#undef AMD_64BIT +#define AMD_64BIT +#undef PROCESSOR +#define PROCESSOR "AMD" +#undef AMD +#define AMD +#undef ARCHITECTURE_AMD +#define ARCHITECTURE_AMD "x86_64 (64-Bit)" +#endif + +/* + * Alpha AXP + * (64-bit): x64 + * (32-bit): x86 + * Developers: Digital Equipment Corporation + * Processors: Alpha + * + */ + +#if defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) +/* Alpha ----------------------------------------------- */ +#undef ALPHA_32BIT +#define ALPHA_32BIT +#undef PROCESSOR +#define PROCESSOR "Alpha" +#undef ALPHA +#define ALPHA +#undef ARCHITECTURE +#define ARCHITECTURE "Alpha (32-Bit)" +#endif + +/* + * ARM + * 32-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +/* ARM-x86 -------------------------------------------------- */ +#undef ARM_32BIT +#define ARM_32BIT +#undef PROCESSOR +#define PROCESSOR "Arm" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "Arm (32-Bit)" +#endif + +/* + * ARM + * 64-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__aarch64__) +/* ARM-x64 -------------------------------------------------- */ +#undef ARM_64BIT +#define ARM_64BIT +#undef PROCESSOR +#define PROCESSOR "Arm64" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "ARM64/AArch64 (64-Bit)" +#endif + +/* + * PA-RISC + * 32-bit + * Developer: Convex Computer Corporation + * Processors: PA-RISC + */ + +#if defined(__convex__) +/* Blackfin -------------------------------------------------- */ +#undef PA_RISC_32BIT +#define PA_RISC_32BIT +#undef PROCESSOR +#define PROCESSOR "Convex PA-RISC" +#undef PA_RISC +#define PA_RISC +#undef ARCHITECTURE +#define ARCHITECTURE "RISC (32-Bit)" +#endif + +/* + * Epiphany + * 32-bit & 64-bit + * Developer: Adapteva + * Processors: Epiphany + */ + +#if defined(__epiphany__) +/* Convex -------------------------------------------------- */ +#undef EP_32BIT +#define EP_32BIT +#undef PROCESSOR +#define PROCESSOR "Adapteva Epiphany" +#undef EPIPHANY +#define EPIPHANY +#undef ARCHITECTURE +#define ARCHITECTURE "Epiphany (32-Bit)" +#endif + +/* + * Motorola 68000 + * 32-bit + * Developer: Motorola + * Processors: Motorola 68000 + */ + +#if defined(__m68k__) || defined(M68000) || defined(__MC68K__) +/* Convex -------------------------------------------------- */ +#undef MOTOROLA_32BIT +#define MOTOROLA_32BIT +#undef PROCESSOR +#define PROCESSOR "Motorola 68000" +#undef MOTOROLA +#define MOTOROLA +#undef ARCHITECTURE +#define ARCHITECTURE "Motorola (32-Bit)" +#endif +/* + * Notes: + * "IA64" is the old name for the processor ARCHITECTURE. Intel now prefers + * "Itanium". There is no single Itanium processor macro defined by all + * compilers on all OSes. An #if/#endif that checks multiple macros is required. + * Microsoft's support for Itanium ended after Visual Studio 2010 and Windows + * Server 2008. Clang/LLVM currently does not support Itanium processors. + */ + +/* + * POWER + * PowerPC + * Developer: IBM, Freescale + * Processors: PowerPC, POWER 1/2/3/4/5/6/7, G1, G2, G3, G4, G5, etc. + */ + +/// Indicates that the target architecture is PowerPC®. +#if defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || defined(__PPC) || defined(__PPC__) +/* POWER ---------------------------------------------------- */ +#undef POWER_PC_32BIT +#define POWER_PC_32BIT +#undef PROCESSOR +#define PROCESSOR "Power PC" +#undef ARCHITECTURE +#define ARCHITECTURE "PowerPC (32-Bit)" +#undef POWER_PC +#define POWER_PC +/// Indicates that the target architecture is PowerPC and that 64-bit +/// compilation mode is enabled. +#elif defined(__powerpc64__) +/* POWER 64-bit --------------------------------------------- */ +#undef POWER_PC_64bit__ +#define POWER_PC_64bit__ +#undef PROCESSOR +#define PROCESSOR "Power PC" +#undef POWER_PC +#define POWER_PC +#undef ARCHITECTURE +#define ARCHITECTURE "PowerPC (64-Bit)" +#endif + +/* + * Notes: + * There is no single POWER processor macro defined by all compilers on all + * OSes. An #if/#endif that checks multiple macros is required. GCC for AIX, + * NetBSD, and OpenBSD defines the same macros for 32-bit and 64-bit POWER + * processors. For AIX, __64BIT__ is defined for 64-bit POWER. For OpenBSD, + * _LP64 and __LP64__ are defined for 64-bit POWER. For NetBSD, GCC doesn't + * provide a macro to check for 64-bit use. Apple's OSX support for POWER + * processors ended after OSX 10.5 Leopard in 2007. The open source Darwin + * distribution, on which OSX is based, is still available for POWER processors. + */ + +/* + * SPARC + * Developer: Oracle, Fujitsu, Sun + * Processors: UltraSPARC I/II/III/IV/T1/T2, SPARC T3/T4, etc. + */ + +/* + * Notes: + * GCC defines processor name macros depending upon the value of the -march + * command-line option. These include__sparclite__, __sparclet__, __sparc_v8__, + * __sparc_v9__, __supersparc__, __hypersparc__, and so forth. However, other + * compilers don't provide this level of detail and writing code that depends + * upon these macros is probably a bad idea. + */ + +#if defined(sparc) || defined(__sparc) || defined(__sparc__) || \ + defined(__sparc64__) +/* x86 32-bit ----------------------------------------------- */ +#undef SPARC_32BIT +#define SPARC_32BIT +#undef PROCESSOR +#define PROCESSOR "Sparc" +#undef SPARC +#define SPARC +#undef ARCHITECTURE +#define ARCHITECTURE "Sparc (32-Bit)" +#elif defined(__sparc64__) +/* x64 64-bit ----------------------------------------------- */ +#undef SPARC_64bit__ +#define SPARC_64bit__ +#undef PROCESSOR +#define PROCESSOR "Sparc" +#undef SPARC +#define SPARC +#undef ARCHITECTURE +#define ARCHITECTURE "Sparc (64-Bit)" +#endif + +/* + * ARM + * 32-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +/* ARM-x86 -------------------------------------------------- */ +#undef ARM_32BIT +#define ARM_32BIT +#undef PROCESSOR +#define PROCESSOR "Arm" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "Arm (32-Bit)" +#endif + +// Embedded Architecture +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +#undef EMBEDDED +#define EMBEDDED +#undef PROCESSOR +#define PROCESSOR "Ebedded Unknown!" +#undef IS_EMBEDDED +#define IS_EMBEDDED 1 +#endif + +//! PLATFORM + +/* + Supported platforms: + * - Mac OSX, iPhone, Darwin + * - Orbis + * - OpenBSD + * - Generic BSD + * - Atari ST TOS + * - AmigaOS + * - Windows + * - Flashplayer (Crossbridge) + * - QNX + * - TI-Nspire + * - Emscripten + * - Linux + * - Solaris + * - Generic POSIX + * - Cygwin + * - Generic UNIX + * - Generic fallback + * - Playstation + * - Xbox + * Supported architectures: + * - x86 + * - x64 + * - ARM 32-bit + * - ARM 64-bit + * - MIPS 32-bit + * - MIPS 64-bit + * - PowerPC 32-bit + * - PowerPC 64-bit + * - SPARC 32-bit + * - SPARC 64-bit + * - SuperH + * - Motorola 68k + * - Emscripten + * - Generic + * + * Supported compilers: + * - Clang + * - GCC + * - MSVC + * - Emscripten + * - TinyC + * - VBCC + * - Bruce's C compiler + * - Generic + * + */ + +/* + * AIX + * Developer: IBM + * Distributions: AIX + * Processors: POWER + */ + +#if defined(X86_32bit) && defined(_AIX) || defined(__TOS_AIX__) || \ + defined(__xlC__) +/* IBM AIX. ------------------------------------------------- */ +#define PLATFORM_OS "AIX" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_AIX "AIX" +#define PLATFORM_TYPE "UNIX AIX" +#undef AIX +#define AIX +#elif defined(X64_64bit) && defined(_AIX) || defined(__TOS_AIX__) || \ + defined(__xlC__) +/* IBM AIX. ------------------------------------------------- */ +#define PLATFORM_OS "AIX" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_AIX "AIX" +#undef AIX +#define AIX +#define PLATFORM_TYPE "UNIX AIX" +#endif + +/* + * HP-UX + * Developer: Hewlett-Packard + * Distributions: HP-UX + * Processors: Itanium + */ + +#if defined(X86_32bit) && defined(hpux) || defined(__hpux) || \ + defined(__hpux) || defined(__hpux) +/* Hewlett-Packard HP-UX. ----------------------------------- */ +#define PLATFORM_OS "HP" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_HP "HP" +#define PLATFORM_TYPE "UNIX HP-UX" +#undef HPUX +#define HPUX +#elif defined(X64_64bit) && defined(X86_32bit) && defined(hpux) || \ + defined(__hpux) || defined(__hpux) || defined(__hpux) +/* Hewlett-Packard HP-UX. ----------------------------------- */ +#define PLATFORM_OS "HP" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_HP "HP" +#define PLATFORM_TYPE "UNIX HP-UX" +#undef HPUX +#define HPUX +#endif + +/* + * Linux + * Developer: Open source + * Distributions: Centos, Debian, Fedora, OpenSUSE, RedHat, Ubuntu + * Processors: x86, x86-64, arm64, POWER, etc. + */ + +#if defined(__linux__) && defined(linux) && !defined(ARM64_BIT) && !defined(X64_64bit) +/* Linux. --------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +#elif defined(X64_64bit) && defined(__linux) && defined(__linux__) && defined(linux) +/* Linux. --------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +/* Linux. --------------------------------------------------- */ +#elif defined(ARM64_BIT) && defined(__linux) && defined(__linux__) && !defined(ANDROID) +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "arm64 (aarch64)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +#endif + +/* + * OSX, iOS, and Darwin + * Developer: Apple and open source + * Distributions: OSX, iOS, Darwin + * Processors: x86, x86-64, ARM + */ + +#if defined(__APPLE__) && defined(__MACH__) +// Detect for x86 +/* Apple OSX and iOS (Darwin). ------------------------------ */ +#include +#if TARGET_OS_SIMULATOR == 1 +/* iOS in Xcode simulator */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS_SIMULATOR "iOS Simulator" +#define PLATFORM_TYPE "iOS-Emulator" +#undef PLATFORM_IS_IOS_EMULATOR +#define PLATFORM_IS_IOS_EMULATOR +#elif TARGET_OS_WATCH == 1 +/* iOS on iWatch. */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IWATCH "iOS (iWatch)" +#define PLATFORM_TYPE "iWatch" +#undef PLATFORM_IS_IWATCH +#define PLATFORM_IS_IWATCH +#elif TARGET_OS_TV == 1 +/* Apple TV. */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_APPLE_TV "Apple (TV)" +#define PLATFORM_TYPE "Apple TV" +#undef PLATFORM_IS_IOS_APPLE_TV +#define PLATFORM_IS_IOS_APPLE_TV +#elif TARGET_OS_IPHONE == 1 +/* iOS on iPhone, iPad, etc. */ +#if defined(__arm__) && !defined(__arm64__) +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "arm (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS "iOS" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_TYPE "iPhone, iPad" +#undef PLATFORM_IS_IOS +#define PLATFORM_IS_IOS +#elif !defined(__arm__) && defined(__arm64__) +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "arm64 (64-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS "iOS" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_TYPE "iPhone, iPad" +#undef PLATFORM_IS_IOS +#define PLATFORM_IS_IOS +#endif +#elif TARGET_OS_MAC == 1 +/* macOS */ +#define PLATFORM_OS "macOS" +#define PLATFORM_ARCH ARCHITECTURE +#define PLATFORM_DESKTOP +#define PLATFORM_MAC "Unix(Darwin)-macOS (X11)" +#define PLATFORM_DEVICE "Unix(Darwin)-macOS (X11)" +#define PLATFORM_TYPE "Macintosh" +#undef PLATFORM_IS_MAC +#define PLATFORM_IS_MAC +#endif +#endif +#if defined(_APPLE) && defined(_LINUX) || \ + defined(__APPLE__) && defined(__LINUX__) +#error Conflicting operating system option selected, choose one. +#endif + +/* + * Solaris + * Developer: Oracle and open source + * Distributions: Oracle Solaris, Open Indiana + * Processors: x86, x86-64, SPARC + */ + +#if defined(X86_32bit) && defined(__sun) && defined(__SVR4) +/* Solaris. ------------------------------------------------- */ +#define PLATFORM_OS "Solaris" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_SOLARIS "Solaris" +#define PLATFORM_TYPE "SUN (Solaris)" +#elif defined(X64_64bit) && defined(__sun) && defined(__SVR4) +/* Solaris. ------------------------------------------------- */ +#define PLATFORM_OS "Solaris" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_SOLARIS "Solaris" +#define PLATFORM_TYPE "SUN (Solaris)" +#endif + +/* + * Android + * Developer: Google + * Distributions: Android + * Processors: x86, x86-64, ARM + */ + +#if !defined(__aarch64__) && defined(__ANDROID__) && defined(__ARM_ARCH) || defined(__ARM_ARCH_7A__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "armv7a (32-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(__aarch64__) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "arm64-v8a (64-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(X86_64BIT) && !defined(__aarch64__) && !defined(__ARM_ARCH) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "x86 (32-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(X64_64BIT) && !defined(__aarch64__) && !defined(__ARM_ARCH) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "x86_64 (64-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#endif + +/* + * Windows with Cygwin (POSIX) + * Developer: Open source + * Distributions: Cygwin + * Processors: x86 + */ + +#if defined(X86_32bit) && defined(__CYGWIN__) && !defined(_WIN32) +/* Cygwin POSIX under Microsoft Windows. -------------------- */ +#define PLATFORM_OS "Microsoft Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_POSIX_WINDOWS "POSIX under Microsoft Windows" +#define PLATFORM_TYPE "POSIX under Microsoft Windows" +#elif defined(X64_64bit) && defined(__CYGWIN__) && !defined(_WIN32) +/* Cygwin POSIX under Microsoft Windows. -------------------- */ +#define PLATFORM_OS "Microsoft Windows" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_POSIX_WINDOWS "POSIX under Microsoft Windows" +#define PLATFORM_TYPE "POSIX under Microsoft Windows" +#undef PLATFORM_IS_WINDOWS +#define PLATFORM_IS_WINDOWS +#endif + +/* FreeBSD */ +#if defined(X86_32bit) && defined(__FreeBSD__) || defined(__FreeBSD) +#define CELL_P_FREEBSD +#define PLATFORM_OS "FreeBSD" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_FREEBSD "Linux (FreeBSD)" +#define PLATFORM_TYPE "FreeBSD" +#elif defined(X64_64bit) && defined(__FreeBSD__) || defined(__FreeBSD) +#define CELL_P_FREEBSD +#define PLATFORM_OS "FreeBSD" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_FREEBSD "Linux (FreeBSD)" +#undef PLATFORM_IS_FREEBSD +#define PLATFORM_IS_FREEBSD +#endif + +/* + * FreeBSD, ORBIS + * Developer: Sony + * Distributions: Orbis OS based on FreeBSD + * Processors: x86, x86-64 + */ + +/* Orbis (PS4) variant */ +#if defined(X86_32bit) && defined(CELL_P_FREEBSD) && defined(__ORBIS__) +#define PLATFORM_OS "Orbis" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ORBIS "Linux (Orbis)" +#define PLATFORM_PLAYSTATION "Playstation" +#define PLATFORM_TYPE "Playstation" +#elif defined(X64_64bit) && defined(CELL_P_FREEBSD) && defined(__ORBIS__) +#define PLATFORM_OS "Orbis" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ORBIS "Linux (Orbis)" +#define PLATFORM_TYPE "Playstation" +#undef PLATFORM_IS_PLAYSTATION +#define PLATFORM_IS_PLAYSTATION +#endif + +/* OpenBSD */ +#if defined(X86_32bit) && defined(__OpenBSD__) || defined(__OpenBSD) +#define PLATFORM_OS "Unix-like (BSD)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_OPENBSD "OpenBSD" +#define PLATFORM_TYPE "OpenBSD" +#elif defined(X64_64bit) && defined(__OpenBSD__) || defined(__OpenBSD) +#define PLATFORM_OS "Unix-like (BSD)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_OPENBSD "OpenBSD" +#define PLATFORM_TYPE "OpenBSD" +#undef PLATFORM_IS_OPENBSD +#define PLATFORM_IS_OPENBSD +#endif + +#if defined(_XBOX_ONE) && defined(_TITLE) +#define PLATFORM_OS "Windows 10.x" +#define PLATFORM_ARCH "AMD64 (x86-64)" +#define PLATFORM_XBOX "Windows 10 (Xbox)" +#define PLATFORM_TYPE "Xbox" +#undef PLATFORM_IS_XBOX +#define PLATFORM_IS_XBOX +#endif + +/* NetBSD */ +#if defined(X86_32bit) && defined(__NetBSD__) || defined(__NetBSD) +#define PLATFORM_OS "Unix (NetBSD)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_BLACKBERRY "NetBSD" +#define PLATFORM_TYPE "NetBSD" +#elif defined(X64_64bit) && defined(__NetBSD__) || defined(__NetBSD) +#define PLATFORM_OS "Unix (NetBSD)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_BLACKBERRY "NetBSD" +#define PLATFORM_TYPE "NetBSD" +#undef PLATFORM_IS_NETBSD +#define PLATFORM_IS_NETBSD +#endif + +/* QNX (Blackberry) variant */ +#if defined(X86_32bit) && defined(__QNXNTO__) || defined(__QNX__) +#define PLATFORM_OS "Unix (RTOS)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_BLACKBERRY "QNX" +#define PLATFORM_TYPE "Blackberry" +#elif defined(X64_64bit) && defined(__QNXNTO__) || defined(__QNX__) +#define PLATFORM_OS "Unix (RTOS)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_BLACKBERRY "QNX" +#define PLATFORM_TYPE "Blackberry" +#undef PLATFORM_IS_BLACKBERRY +#define PLATFORM_IS_BLACKBERRY +#endif + +/* VMS */ +#if defined(X86_32bit) && defined(VMS) || defined(__VMS) +#define PLATFORM_OS "OpenVMS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_VMS "DEC (OpenVMS)" +#define PLATFORM_TYPE "DEC" +#elif defined(X64_64bit) && defined(VMS) || defined(__VMS) +#define PLATFORM_OS "OpenVMS" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_VMS "DEC (OpenVMS)" +#define PLATFORM_TYPE "DEC" +#undef PLATFORM_IS_OPENVMS +#define PLATFORM_IS_OPENVMS +#endif + +/* VXWORKS variant */ +#if defined(X86_32bit) && defined(VXWORKS) +#define PLATFORM_OS "RTOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_VXWORKS "Monolithic" +#define PLATFORM_TYPE "VXWORKS" +#elif defined(X64_64bit) && defined(VXWORKS) +#define PLATFORM_OS "RTOS" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_VXWORKS "Monolithic" +#define PLATFORM_TYPE "VXWORKS" +#undef PLATFORM_IS_VXWORKS +#define PLATFORM_IS_VXWORKS +#endif + +/* Motorola 68K. Not defined by VBCC, so user must define one of these + * manually when using VBCC. + */ +#if defined(X86_32bit) && defined(__m68k__) || defined(M68000) || \ + defined(__MC68K__) +#define PLATFORM_OS "68K" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOTOROLA "Motorola (68K)" +#define PLATFORM_TYPE "Motorola 68K" +#elif defined(X64_64bit) && defined(__m68k__) || defined(M68000) || \ + defined(__MC68K__) +#define PLATFORM_OS "68K" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_MOTOROLA "Motorola (68K)" +#define PLATFORM_TYPE "Motorola 68K" +#endif + +/* Ultrix */ +#if defined(X86_32bit) && defined(ultrix) || defined(__ultrix) || \ + defined(__ultrix__) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X86_32bit) && defined(unix) && defined(vax) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X64_64bit) && defined(ultrix) || defined(__ultrix) || \ + defined(__ultrix__) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X64_64bit) && defined(unix) && defined(vax) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#undef PLATFORM_IS_ULTRIX +#define PLATFORM_IS_ULTRIX +#endif + +/* Embedded */ +#if defined(IS_EMBEDDED) +#define PLATFORM_EMBEDDED "Embedded" +#define PLATFORM_RPI "Embedded" +#endif + +/* Microsoft DOS */ +#if defined(MSDOS) || defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) +#define PLATFORM_OS "Dos" +#define PLATFORM_DOS "Microsoft-DOS" +#define PLATFORM_ARCH "16-Bit" +#define PLATFORM_TYPE "MS-Dos" +#undef PLATFORM_IS_MSDOS +#define PLATFORM_IS_MSDOS +#endif + +/* + * Windows, Cygwin (non-POSIX), and MinGW + * Developer: Microsoft + * Distributions: Windows XP, Vista, 7, 8 + * Processors: x86, x86-64 + */ + + +#if defined(_WIN32) && !defined(_WIN64) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (32-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_X86 "Microsoft Windows (32-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (32-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(_WIN64) && defined(_WIN32) && !defined(_M_ARM64) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_WINDOWS_X64 "Microsoft Windows (64-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (64-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(_M_ARM64) && defined(_WIN32) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "Arm64 (64-Bit)" +#define PLATFORM_WINDOWS_ARM64 "Microsoft Windows (64-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (64-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +/* Microsoft Phone ------------------------------ */ +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +/* Microsoft Windows Store or Universal Windows Platform - (32-bit). + * ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_X86 "Microsoft Windows (32-Bit)" +#define PLATFORM_WINDOWS_UWP "Microsoft Windows UWP (32-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) && \ + defined(_WIN64) && !defined(_WIN32) && !defined(_WIN32_WINNT) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows " +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_WINDOWS_X64 "Microsoft Windows x64" +#define PLATFORM_WINDOWS_UWP "Microsoft Windows UWP" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_WINDOWS "Microsoft Windows" +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +/* Microsoft Phone ------------------------------ */ +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +/* Microsoft Windows (Phone). ------------------------------ */ +#define PLATFORM_OS "WindowsRT" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_PHONE "Windows Phone" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_MOBILE +#define PLATFORM_TYPE "Mobile (Windows Phone)" +#elif defined(_WIN64) && defined(WINAPI_FAMILY_PHONE_APP) +/* Microsoft Windows (Phone). ------------------------------ */ +#define PLATFORM_OS "WindowsRT" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_WINDOWS_PHONE "Windows Phone" +#define PLATFORM_TYPE "Mobile (Windows Phone)" +#undef PLATFORM_IS_WINDOWS_PHONE +#define PLATFORM_IS_WINDOWS_PHPNE +#endif + +//! Language Standard Macro +#ifdef _MSC_VER + #if _MSC_VER < 1920 + #if __cplusplus == 199711L + #define CXX_STANDARD_98 199711L + #elif __cplusplus == 201103L || __cplusplus == 201100 + #define CXX_STANDARD_11 201100 + #elif __cplusplus == 201402L + #define CXX_STANDARD_14 + #elif __cplusplus == 201703L || __cplusplus == 201704L + #define CXX_STANDARD_17 201703L + #elif __cplusplus == 202002L + #define CXX_STANDARD_20 202002L + #endif + #else + #define CXX_STANDARD_20 202002L + #endif +#else + #if __cplusplus == 199711L + #define CXX_STANDARD_98 199711L + #elif __cplusplus == 201103L || __cplusplus == 201100 + #define CXX_STANDARD_11 201100 + #elif __cplusplus == 201402L + #define CXX_STANDARD_14 201402L + #elif __cplusplus == 201703L || __cplusplus == 201704L + #define CXX_STANDARD_17 201703L + #elif __cplusplus == 202002L + #define CXX_STANDARD_20 202002L + #endif +#endif diff --git a/utilities/preprocessor.hpp b/utilities/preprocessor.hpp new file mode 100644 index 0000000..82f89be --- /dev/null +++ b/utilities/preprocessor.hpp @@ -0,0 +1,1255 @@ +/*! + * + * Copyright (c) 2024 Kambiz Asadzadeh + * Copyright (c) 2024 Genyleap + */ + +//! COMPILERS +#if defined(__clang__) +/* Clang/LLVM. ---------------------------------------------- */ +#undef COMPILER +#define COMPILER "Clang/LLVM" +#undef COMPILER_CLANG_LLVM +#define COMPILER_CLANG_LLVM "Clang/LLVM" +#undef COMPILER_VER +#define COMPILER_VER __clang_version__ +#elif (defined(__clang__) && !defined(__llvm__)) && !defined(__GNUC__) +#elif defined(__ICC) || defined(__INTEL_COMPILER) +/* Intel ICC/ICPC. ------------------------------------------ */ +#undef COMPILER +#define COMPILER "Intel ICC/ICPC" +#undef COMPILER_INTEL +#define COMPILER_INTEL "Intel ICC/ICPC" +#define COMPILER_VER __INTEL_COMPILER_BUILD_DATE +#elif defined(__MINGW32__) && !defined(__amd64__) && !defined(__amd64) && \ + !defined(__ia64__) +/* __MINGW32__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w86 (x86) 32 Bit" +#undef COMPILER_MINGW +#define COMPILER_MINGW "MinGW-w86 (x86) 32 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION +#elif defined(__MINGW32__) +/* __MINGW64_32__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w64 (x86_64) 32-64 Bit" +#undef COMPILER_MINGW64_32 +#define COMPILER_MINGW64_32 "MinGW-w64 (x86_64) 32-64 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION +#elif defined(__MINGW64__) +/* __MINGW64__. ------------------------------------------------- */ +#undef COMPILER +#define COMPILER "MinGW-w64 (x64) 64 Bit" +#undef COMPILER_MINGW_64 +#define COMPILER_MINGW_64 "MinGW-w64 (x64) 64 Bit" +#undef COMPILER_VER +#define COMPILER_VER __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION +#elif defined(__GNUC__) || defined(__GNUG__) && !defined(__clang__) +#define GCC_VERSION __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ +/* GNU GCC/G++. --------------------------------------------- */ +#undef COMPILER +#define COMPILER "GNU GCC/G++" +#undef COMPILER_GNU +#define COMPILER_GNU "GNU GCC/G++" +#undef COMPILER_GCC +#define COMPILER_GCC "GNU GCC/G++" +#undef COMPILER_VER +#define COMPILER_VER GCC_VERSION +#elif defined(__HP_cc) || defined(__HP_aCC) +/* Hewlett-Packard C/aC++. ---------------------------------- */ +#undef COMPILER +#define COMPILER "Hewlett-Packard C/aC++" +#undef COMPILERHEWLETT +#define COMPILERHEWLETT "Hewlett-Packard C/aC++" +#define COMPILER_VER __HP_aCC +#elif defined(__IBMC__) || defined(__IBMCPP__) +/* IBM XL C/C++. -------------------------------------------- */ +#undef COMPILER +#define COMPILER "IBM XL C/C++" +#undef COMPILER_IBM +#define COMPILER_IBM "IBM XL C/C++" +#define COMPILER_VER __xlC_ver__ +#elif defined(_MSC_VER) +/* Microsoft Visual Studio. --------------------------------- */ +#undef COMPILER +#define COMPILER "MSVC++ " +#undef COMPILER_MSVC +#define COMPILER_MSVC "MSVC++ " +#undef COMPILER_VER +#define COMPILER_VER _MSC_VER +#elif defined(__PGI) +/* Portland Group PGCC/PGCPP. ------------------------------- */ +#undef COMPILER "PGCC/PGCPP" +#define COMPILER "PGCC/PGCPP" +#undef COMPILER_PGCC "PGCC/PGCPP" +#define COMPILER_PGCC "PGCC/PGCPP" +#define COMPILER_VER __VERSION__ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +/* Oracle Solaris Studio. ----------------------------------- */ +#undef COMPILER "Oracle Solaris" +#define COMPILER "Oracle Solaris" +#undef COMPILER_ORACLE "Oracle Solaris" +#define COMPILER_ORACLE "Oracle Solaris" +#define COMPILER_VER __SUNPRO_CC +#endif + +#if defined(_MSC_VER) && _MSC_VER == 1400 +#undef MSVCPP +#define MSVCPP "MSVC++ 8.0" +#elif defined(_MSC_VER) && _MSC_VER == 1500 +#undef MSVCPP +#define MSVCPP "MSVC++ 9.0" +#elif defined(_MSC_VER) && _MSC_VER == 1600 +#undef MSVCPP +#define MSVCPP "MSVC++ 10.0" +#elif defined(_MSC_VER) && _MSC_VER == 1700 +#undef MSVCPP +#define MSVCPP "MSVC++ 11.0" +#elif defined(_MSC_VER) && _MSC_VER == 1800 +#undef MSVCPP +#define MSVCPP "MSVC++ 12.0" +#elif defined(_MSC_VER) && _MSC_VER == 1900 +#undef MSVCPP +#define MSVCPP "MSVC++ 14.0" +#elif defined(_MSC_VER) && _MSC_VER == 1910 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.0" +#elif defined(_MSC_VER) && _MSC_VER == 1911 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.3" +#elif defined(_MSC_VER) && _MSC_VER == 1912 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.5" +#elif defined(_MSC_VER) && _MSC_VER == 1913 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.6" +#elif defined(_MSC_VER) && _MSC_VER == 1914 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.7" +#elif defined(_MSC_VER) && _MSC_VER == 1915 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.8" +#elif defined(_MSC_VER) && _MSC_VER == 1915 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.8" +#elif defined(_MSC_VER) && _MSC_VER == 1916 +#undef MSVCPP +#define MSVCPP "MSVC++ 15.9" +#elif defined(_MSC_VER) && _MSC_VER == 1920 +#undef MSVCPP +#define MSVCPP "MSVC++ RTW 16.0" +#elif defined(_MSC_VER) && _MSC_VER == 1921 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.1" +#elif defined(_MSC_VER) && _MSC_VER == 1922 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.2" +#elif defined(_MSC_VER) && _MSC_VER == 1923 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.3" +#elif defined(_MSC_VER) && _MSC_VER == 1924 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.4" +#elif defined(_MSC_VER) && _MSC_VER == 1925 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.5" +#elif defined(_MSC_VER) && _MSC_VER == 1926 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.6" +#elif defined(_MSC_VER) && _MSC_VER == 1927 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.7" +#elif defined(_MSC_VER) && _MSC_VER == 1928 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.8, 16.9" +#elif defined(_MSC_VER) && _MSC_VER == 1929 +#undef MSVCPP +#define MSVCPP "MSVC++ 16.10" +#elif defined(_MSC_VER) && _MSC_VER == 1930 +#undef MSVCPP +#elif defined(_MSC_VER) && _MSC_VER == 1931 +#undef MSVCPP +#define MSVCPP "MSVC++ (17.1)" +#endif + +//! LANGUAGE STANDARD +#if __cplusplus == 199711L && !defined(_MSC_VER) +/* C++98: __cplusplus is 19971L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++98" +#undef CPP_VALUE +#define CPP_VALUE "19971L" +#elif __cplusplus == 201103L +/* C++11: __cplusplus is 201103L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++11" +#undef CPP_VALUE +#define CPP_VALUE "201103L" +#elif __cplusplus == 201402L +/* C++14: __cplusplus is 201402L.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++14" +#undef CPP_VALUE +#define CPP_VALUE "201402L" +#elif __cplusplus == 201702L || __cplusplus == 201703 +/* C++17: __cplusplus is c++1z.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++17" +#undef CPP_VALUE +#define CPP_VALUE "201703" +#elif __cplusplus == 201707 || __cplusplus == 202002L || __cplusplus == 201709 +/* C++20: __cplusplus is c++2a.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++20" +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif __cplusplus == 20120 +/* C++23: __cplusplus is c++2b.*/ +#undef CPP_VERSION +#define CPP_VERSION "C++23" +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif __embedded_cplusplus +#undef CPP_VERSION +#define CPP_VERSION "Embedded C++" +#undef CPP_VALUE +#define CPP_VALUE "19971L" +#elif defined(__clang__) +#undef CPP_VERSION +#define CPP_VERSION __cplusplus +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#elif defined(__GNUC__) +#undef CPP_VERSION +#define CPP_VERSION __cplusplus +#undef CPP_VALUE +#define CPP_VALUE __cplusplus +#else +#undef CPP_VERSION +#define CPP_VERSION 0 +#undef CPP_VALUE +#define CPP_VALUE "Unknown" +#endif + +//! EXPORTS & EXTRA +#if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ + defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ + defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ + defined(__WIN64__) +//! Microsoft Windows +#define PROJECT_EXPORT __declspec(dllexport) +#define PROJECT_IMPORT __declspec(dllimport) +#elif defined(__GNUC__) +//! Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... +#define PROJECT_EXPORT __attribute__((visibility("default"))) +#define PROJECT_IMPORT __attribute__((visibility("default"))) +#define PROJECT_HIDDEN __attribute__((visibility("hidden"))) +#else +// do nothing and hope for the best? +#define PROJECT_EXPORT +#define PROJECT_IMPORT +#pragma warning Unknown dynamic link import / export semantics. +#endif + +#define PROJECT_DATE __DATE__ +#define PROJECT_TIME __TIME__ +#define PROJECT_FUNCTION __FUNCTION__ +#define PROJECT_LINE __LINE__ +#define PROJECT_FILE __FILE__ +#define PROJECT_COUNTER __COUNTER__ + +/* NOTICE: __attribute__ is Linux syntax; __declspec is the Windows syntax.*/ +/*The __declspec(noinline) attribute suppresses the inlining of a function at +the call points of the function. + +__declspec(noinline) can also be applied to constant data, to prevent the +compiler from using the value for optimization purposes, without affecting its +placement in the object. This is a feature that can be used for patchable +constants, that is, data that is later patched to a different value. It is an +error to try to use such constants in a context where a constant value is +required. For example, an array dimension. +*/ + +#if defined(__WINNT) || defined(__WINNT__) || defined(WIN32) || \ + defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || \ + defined(WIN64) || defined(_WIN64) || defined(__WIN64) || \ + defined(__WIN64__) +#define PROJECT_NOINLINE __declspec(noinline) +#define PROJECT_INLINE inline +#else +/// Define for Unix base OS such as: Linux, macOS, FreeBSD, etc... +#define PROJECT_NOINLINE __attribute__((noinline)) +#define PROJECT_INLINE inline +#endif + +//! ARCHITECTURE + +/* + * Classic Standard + * 32-bit and 64-Bit systems + * Developer: Intel & AMD Holdings + * Processors: Intel & AMD Machine + * (64-bit): EM64T, IA-32e, Intel64, x64, x86-64 + * (32-bit): IA-32, i386, x86, x86-32 + * Processors: Athlon, Atom, Core, Core 2, Core i3/i5/i7, Opteron, Pentium, + * Phenom, Sempron, Turion, etc. + */ + +#if (defined(i386) || defined(__i386) || defined(__i386__) || \ + defined(__IA32__) || defined(_M_IX86) || defined(_X86_)) && \ + !defined(__amd64) +//! x86 based systems (32-bit) +#undef X86_64BIT +#define X86_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE +#define ARCHITECTURE "x86 (32-Bit)" +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || \ + defined(_M_AMD64) || defined(_M_X64) && !defined(X86_32bit) +//! x64 based systems (64-bit) +#undef X64_64BIT +#define X64_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE +#define ARCHITECTURE "x86_64 (64-Bit)" +#endif + +/* + * x86 and x86-64 + * (64-bit): EM64T, IA-32e, Intel64, x64, x86-64 + * (32-bit): IA-32, i386, x86, x86-32 + * Developers: Intel only + * Processors: Athlon + * + */ + +#if defined(__i386__) && !defined(_M_AMD64) +/* x86 32-bit ----------------------------------------------- */ +#undef INTEL_32BIT +#define INTEL_32BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE_INTEL +#define ARCHITECTURE_INTEL "x86 (32-Bit)" +#elif defined(__x86_64__) && !defined(_M_AMD64) +/* x64 64-bit ----------------------------------------------- */ +#undef INTEL_64BIT +#define INTEL_64BIT +#undef PROCESSOR +#define PROCESSOR "Intel" +#undef INTEL +#define INTEL +#undef ARCHITECTURE_INTEL +#define ARCHITECTURE_INTEL "x86_64 (64-Bit)" +#endif + +/* + * x86 and x86-64 + * (32-bit): i386, x86, x86-32 + * (64-bit): AMD64, x64 + * Developers: AMD only + * Processors: Athlon + * + */ + +#if defined(__i386__) && !defined(__x86_64__) +/* x86 32-bit ----------------------------------------------- */ +#undef AMD_32BIT +#define AMD_32BIT +#undef PROCESSOR +#define PROCESSOR "AMD" +#undef AMD +#define AMD +#undef ARCHITECTURE +#undef ARCHITECTURE_AMD +#define ARCHITECTURE_AMD "x86 (32-Bit)" +#elif (defined(__amd64__) || defined(__amd64) || defined(_M_AMD64)) && \ + !defined(__x86_64__) +/* x64 64-bit ----------------------------------------------- */ +#undef AMD_64BIT +#define AMD_64BIT +#undef PROCESSOR +#define PROCESSOR "AMD" +#undef AMD +#define AMD +#undef ARCHITECTURE_AMD +#define ARCHITECTURE_AMD "x86_64 (64-Bit)" +#endif + +/* + * Alpha AXP + * (64-bit): x64 + * (32-bit): x86 + * Developers: Digital Equipment Corporation + * Processors: Alpha + * + */ + +#if defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) +/* Alpha ----------------------------------------------- */ +#undef ALPHA_32BIT +#define ALPHA_32BIT +#undef PROCESSOR +#define PROCESSOR "Alpha" +#undef ALPHA +#define ALPHA +#undef ARCHITECTURE +#define ARCHITECTURE "Alpha (32-Bit)" +#endif + +/* + * ARM + * 32-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +/* ARM-x86 -------------------------------------------------- */ +#undef ARM_32BIT +#define ARM_32BIT +#undef PROCESSOR +#define PROCESSOR "Arm" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "Arm (32-Bit)" +#endif + +/* + * ARM + * 64-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__aarch64__) +/* ARM-x64 -------------------------------------------------- */ +#undef ARM_64BIT +#define ARM_64BIT +#undef PROCESSOR +#define PROCESSOR "Arm64" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "ARM64/AArch64 (64-Bit)" +#endif + +/* + * PA-RISC + * 32-bit + * Developer: Convex Computer Corporation + * Processors: PA-RISC + */ + +#if defined(__convex__) +/* Blackfin -------------------------------------------------- */ +#undef PA_RISC_32BIT +#define PA_RISC_32BIT +#undef PROCESSOR +#define PROCESSOR "Convex PA-RISC" +#undef PA_RISC +#define PA_RISC +#undef ARCHITECTURE +#define ARCHITECTURE "RISC (32-Bit)" +#endif + +/* + * Epiphany + * 32-bit & 64-bit + * Developer: Adapteva + * Processors: Epiphany + */ + +#if defined(__epiphany__) +/* Convex -------------------------------------------------- */ +#undef EP_32BIT +#define EP_32BIT +#undef PROCESSOR +#define PROCESSOR "Adapteva Epiphany" +#undef EPIPHANY +#define EPIPHANY +#undef ARCHITECTURE +#define ARCHITECTURE "Epiphany (32-Bit)" +#endif + +/* + * Motorola 68000 + * 32-bit + * Developer: Motorola + * Processors: Motorola 68000 + */ + +#if defined(__m68k__) || defined(M68000) || defined(__MC68K__) +/* Convex -------------------------------------------------- */ +#undef MOTOROLA_32BIT +#define MOTOROLA_32BIT +#undef PROCESSOR +#define PROCESSOR "Motorola 68000" +#undef MOTOROLA +#define MOTOROLA +#undef ARCHITECTURE +#define ARCHITECTURE "Motorola (32-Bit)" +#endif +/* + * Notes: + * "IA64" is the old name for the processor ARCHITECTURE. Intel now prefers + * "Itanium". There is no single Itanium processor macro defined by all + * compilers on all OSes. An #if/#endif that checks multiple macros is required. + * Microsoft's support for Itanium ended after Visual Studio 2010 and Windows + * Server 2008. Clang/LLVM currently does not support Itanium processors. + */ + +/* + * POWER + * PowerPC + * Developer: IBM, Freescale + * Processors: PowerPC, POWER 1/2/3/4/5/6/7, G1, G2, G3, G4, G5, etc. + */ + +/// Indicates that the target architecture is PowerPC®. +#if defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || defined(__PPC) || defined(__PPC__) +/* POWER ---------------------------------------------------- */ +#undef POWER_PC_32BIT +#define POWER_PC_32BIT +#undef PROCESSOR +#define PROCESSOR "Power PC" +#undef ARCHITECTURE +#define ARCHITECTURE "PowerPC (32-Bit)" +#undef POWER_PC +#define POWER_PC +/// Indicates that the target architecture is PowerPC and that 64-bit +/// compilation mode is enabled. +#elif defined(__powerpc64__) +/* POWER 64-bit --------------------------------------------- */ +#undef POWER_PC_64bit__ +#define POWER_PC_64bit__ +#undef PROCESSOR +#define PROCESSOR "Power PC" +#undef POWER_PC +#define POWER_PC +#undef ARCHITECTURE +#define ARCHITECTURE "PowerPC (64-Bit)" +#endif + +/* + * Notes: + * There is no single POWER processor macro defined by all compilers on all + * OSes. An #if/#endif that checks multiple macros is required. GCC for AIX, + * NetBSD, and OpenBSD defines the same macros for 32-bit and 64-bit POWER + * processors. For AIX, __64BIT__ is defined for 64-bit POWER. For OpenBSD, + * _LP64 and __LP64__ are defined for 64-bit POWER. For NetBSD, GCC doesn't + * provide a macro to check for 64-bit use. Apple's OSX support for POWER + * processors ended after OSX 10.5 Leopard in 2007. The open source Darwin + * distribution, on which OSX is based, is still available for POWER processors. + */ + +/* + * SPARC + * Developer: Oracle, Fujitsu, Sun + * Processors: UltraSPARC I/II/III/IV/T1/T2, SPARC T3/T4, etc. + */ + +/* + * Notes: + * GCC defines processor name macros depending upon the value of the -march + * command-line option. These include__sparclite__, __sparclet__, __sparc_v8__, + * __sparc_v9__, __supersparc__, __hypersparc__, and so forth. However, other + * compilers don't provide this level of detail and writing code that depends + * upon these macros is probably a bad idea. + */ + +#if defined(sparc) || defined(__sparc) || defined(__sparc__) || \ + defined(__sparc64__) +/* x86 32-bit ----------------------------------------------- */ +#undef SPARC_32BIT +#define SPARC_32BIT +#undef PROCESSOR +#define PROCESSOR "Sparc" +#undef SPARC +#define SPARC +#undef ARCHITECTURE +#define ARCHITECTURE "Sparc (32-Bit)" +#elif defined(__sparc64__) +/* x64 64-bit ----------------------------------------------- */ +#undef SPARC_64bit__ +#define SPARC_64bit__ +#undef PROCESSOR +#define PROCESSOR "Sparc" +#undef SPARC +#define SPARC +#undef ARCHITECTURE +#define ARCHITECTURE "Sparc (64-Bit)" +#endif + +/* + * ARM + * 32-bit + * Developer: ARM Holdings + * Processors: Acorn RISC Machine + */ + +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +/* ARM-x86 -------------------------------------------------- */ +#undef ARM_32BIT +#define ARM_32BIT +#undef PROCESSOR +#define PROCESSOR "Arm" +#undef ARM +#define ARM +#undef ARCHITECTURE +#define ARCHITECTURE "Arm (32-Bit)" +#endif + +// Embedded Architecture +#if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || \ + defined(_M_ARMT) || defined(__arm) +#undef EMBEDDED +#define EMBEDDED +#undef PROCESSOR +#define PROCESSOR "Ebedded Unknown!" +#undef IS_EMBEDDED +#define IS_EMBEDDED 1 +#endif + +//! PLATFORM + +/* + Supported platforms: + * - Mac OSX, iPhone, Darwin + * - Orbis + * - OpenBSD + * - Generic BSD + * - Atari ST TOS + * - AmigaOS + * - Windows + * - Flashplayer (Crossbridge) + * - QNX + * - TI-Nspire + * - Emscripten + * - Linux + * - Solaris + * - Generic POSIX + * - Cygwin + * - Generic UNIX + * - Generic fallback + * - Playstation + * - Xbox + * Supported architectures: + * - x86 + * - x64 + * - ARM 32-bit + * - ARM 64-bit + * - MIPS 32-bit + * - MIPS 64-bit + * - PowerPC 32-bit + * - PowerPC 64-bit + * - SPARC 32-bit + * - SPARC 64-bit + * - SuperH + * - Motorola 68k + * - Emscripten + * - Generic + * + * Supported compilers: + * - Clang + * - GCC + * - MSVC + * - Emscripten + * - TinyC + * - VBCC + * - Bruce's C compiler + * - Generic + * + */ + +/* + * AIX + * Developer: IBM + * Distributions: AIX + * Processors: POWER + */ + +#if defined(X86_32bit) && defined(_AIX) || defined(__TOS_AIX__) || \ + defined(__xlC__) +/* IBM AIX. ------------------------------------------------- */ +#define PLATFORM_OS "AIX" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_AIX "AIX" +#define PLATFORM_TYPE "UNIX AIX" +#undef AIX +#define AIX +#elif defined(X64_64bit) && defined(_AIX) || defined(__TOS_AIX__) || \ + defined(__xlC__) +/* IBM AIX. ------------------------------------------------- */ +#define PLATFORM_OS "AIX" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_AIX "AIX" +#undef AIX +#define AIX +#define PLATFORM_TYPE "UNIX AIX" +#endif + +/* + * HP-UX + * Developer: Hewlett-Packard + * Distributions: HP-UX + * Processors: Itanium + */ + +#if defined(X86_32bit) && defined(hpux) || defined(__hpux) || \ + defined(__hpux) || defined(__hpux) +/* Hewlett-Packard HP-UX. ----------------------------------- */ +#define PLATFORM_OS "HP" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_HP "HP" +#define PLATFORM_TYPE "UNIX HP-UX" +#undef HPUX +#define HPUX +#elif defined(X64_64bit) && defined(X86_32bit) && defined(hpux) || \ + defined(__hpux) || defined(__hpux) || defined(__hpux) +/* Hewlett-Packard HP-UX. ----------------------------------- */ +#define PLATFORM_OS "HP" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_HP "HP" +#define PLATFORM_TYPE "UNIX HP-UX" +#undef HPUX +#define HPUX +#endif + +/* + * Linux + * Developer: Open source + * Distributions: Centos, Debian, Fedora, OpenSUSE, RedHat, Ubuntu + * Processors: x86, x86-64, arm64, POWER, etc. + */ + +#if defined(__linux__) && defined(linux) && !defined(ARM64_BIT) && !defined(X64_64bit) +/* Linux. --------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +#elif defined(X64_64bit) && defined(__linux) && defined(__linux__) && defined(linux) +/* Linux. --------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +/* Linux. --------------------------------------------------- */ +#elif defined(ARM64_BIT) && defined(__linux) && defined(__linux__) && !defined(ANDROID) +#define PLATFORM_OS "Linux" +#define PLATFORM_ARCH "arm64 (aarch64)" +#define PLATFORM_LINUX "Linux" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_TYPE "Unix (Linux)" +#undef PLATFORM_IS_LINUX +#define PLATFORM_IS_LINUX +#endif + +/* + * OSX, iOS, and Darwin + * Developer: Apple and open source + * Distributions: OSX, iOS, Darwin + * Processors: x86, x86-64, ARM + */ + +#if defined(__APPLE__) && defined(__MACH__) +// Detect for x86 +/* Apple OSX and iOS (Darwin). ------------------------------ */ +#include +#if TARGET_OS_SIMULATOR == 1 +/* iOS in Xcode simulator */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS_SIMULATOR "iOS Simulator" +#define PLATFORM_TYPE "iOS-Emulator" +#undef PLATFORM_IS_IOS_EMULATOR +#define PLATFORM_IS_IOS_EMULATOR +#elif TARGET_OS_WATCH == 1 +/* iOS on iWatch. */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IWATCH "iOS (iWatch)" +#define PLATFORM_TYPE "iWatch" +#undef PLATFORM_IS_IWATCH +#define PLATFORM_IS_IWATCH +#elif TARGET_OS_TV == 1 +/* Apple TV. */ +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_APPLE_TV "Apple (TV)" +#define PLATFORM_TYPE "Apple TV" +#undef PLATFORM_IS_IOS_APPLE_TV +#define PLATFORM_IS_IOS_APPLE_TV +#elif TARGET_OS_IPHONE == 1 +/* iOS on iPhone, iPad, etc. */ +#if defined(__arm__) && !defined(__arm64__) +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "arm (32-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS "iOS" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_TYPE "iPhone, iPad" +#undef PLATFORM_IS_IOS +#define PLATFORM_IS_IOS +#elif !defined(__arm__) && defined(__arm64__) +#define PLATFORM_OS "Apple iOS" +#define PLATFORM_ARCH "arm64 (64-Bit)" +#define PLATFORM_MOBILE +#define PLATFORM_IOS "iOS" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_TYPE "iPhone, iPad" +#undef PLATFORM_IS_IOS +#define PLATFORM_IS_IOS +#endif +#elif TARGET_OS_MAC == 1 +/* macOS */ +#define PLATFORM_OS "macOS" +#define PLATFORM_ARCH ARCHITECTURE +#define PLATFORM_DESKTOP +#define PLATFORM_MAC "Unix(Darwin)-macOS (X11)" +#define PLATFORM_DEVICE "Unix(Darwin)-macOS (X11)" +#define PLATFORM_TYPE "Macintosh" +#undef PLATFORM_IS_MAC +#define PLATFORM_IS_MAC +#endif +#endif +#if defined(_APPLE) && defined(_LINUX) || \ + defined(__APPLE__) && defined(__LINUX__) +#error Conflicting operating system option selected, choose one. +#endif + +/* + * Solaris + * Developer: Oracle and open source + * Distributions: Oracle Solaris, Open Indiana + * Processors: x86, x86-64, SPARC + */ + +#if defined(X86_32bit) && defined(__sun) && defined(__SVR4) +/* Solaris. ------------------------------------------------- */ +#define PLATFORM_OS "Solaris" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_SOLARIS "Solaris" +#define PLATFORM_TYPE "SUN (Solaris)" +#elif defined(X64_64bit) && defined(__sun) && defined(__SVR4) +/* Solaris. ------------------------------------------------- */ +#define PLATFORM_OS "Solaris" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_SOLARIS "Solaris" +#define PLATFORM_TYPE "SUN (Solaris)" +#endif + +/* + * Android + * Developer: Google + * Distributions: Android + * Processors: x86, x86-64, ARM + */ + +#if !defined(__aarch64__) && defined(__ANDROID__) && defined(__ARM_ARCH) || defined(__ARM_ARCH_7A__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "armv7a (32-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(__aarch64__) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "arm64-v8a (64-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(X86_64BIT) && !defined(__aarch64__) && !defined(__ARM_ARCH) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "x86 (32-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#elif defined(X64_64BIT) && !defined(__aarch64__) && !defined(__ARM_ARCH) && defined(__ANDROID__) +/* Android. ------------------------------------------------- */ +#define PLATFORM_OS "Linux" +#define PLATFORM_ANDROID "Linux (Android)" +#undef PLATFORM_DEVICE +#define PLATFORM_DEVICE "Mobile" +#undef PLATFORM_MOBILE +#define PLATFORM_MOBILE +#undef PLATFORM_ARCH +#define PLATFORM_ARCH "x86_64 (64-Bit)" +#undef PLATFORM_TYPE +#define PLATFORM_TYPE "Android" +#undef PLATFORM_IS_ANDROID +#define PLATFORM_IS_ANDROID +#endif + +/* + * Windows with Cygwin (POSIX) + * Developer: Open source + * Distributions: Cygwin + * Processors: x86 + */ + +#if defined(X86_32bit) && defined(__CYGWIN__) && !defined(_WIN32) +/* Cygwin POSIX under Microsoft Windows. -------------------- */ +#define PLATFORM_OS "Microsoft Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_POSIX_WINDOWS "POSIX under Microsoft Windows" +#define PLATFORM_TYPE "POSIX under Microsoft Windows" +#elif defined(X64_64bit) && defined(__CYGWIN__) && !defined(_WIN32) +/* Cygwin POSIX under Microsoft Windows. -------------------- */ +#define PLATFORM_OS "Microsoft Windows" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_POSIX_WINDOWS "POSIX under Microsoft Windows" +#define PLATFORM_TYPE "POSIX under Microsoft Windows" +#undef PLATFORM_IS_WINDOWS +#define PLATFORM_IS_WINDOWS +#endif + +/* FreeBSD */ +#if defined(X86_32bit) && defined(__FreeBSD__) || defined(__FreeBSD) +#define CELL_P_FREEBSD +#define PLATFORM_OS "FreeBSD" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_FREEBSD "Linux (FreeBSD)" +#define PLATFORM_TYPE "FreeBSD" +#elif defined(X64_64bit) && defined(__FreeBSD__) || defined(__FreeBSD) +#define CELL_P_FREEBSD +#define PLATFORM_OS "FreeBSD" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_FREEBSD "Linux (FreeBSD)" +#undef PLATFORM_IS_FREEBSD +#define PLATFORM_IS_FREEBSD +#endif + +/* + * FreeBSD, ORBIS + * Developer: Sony + * Distributions: Orbis OS based on FreeBSD + * Processors: x86, x86-64 + */ + +/* Orbis (PS4) variant */ +#if defined(X86_32bit) && defined(CELL_P_FREEBSD) && defined(__ORBIS__) +#define PLATFORM_OS "Orbis" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ORBIS "Linux (Orbis)" +#define PLATFORM_PLAYSTATION "Playstation" +#define PLATFORM_TYPE "Playstation" +#elif defined(X64_64bit) && defined(CELL_P_FREEBSD) && defined(__ORBIS__) +#define PLATFORM_OS "Orbis" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ORBIS "Linux (Orbis)" +#define PLATFORM_TYPE "Playstation" +#undef PLATFORM_IS_PLAYSTATION +#define PLATFORM_IS_PLAYSTATION +#endif + +/* OpenBSD */ +#if defined(X86_32bit) && defined(__OpenBSD__) || defined(__OpenBSD) +#define PLATFORM_OS "Unix-like (BSD)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_OPENBSD "OpenBSD" +#define PLATFORM_TYPE "OpenBSD" +#elif defined(X64_64bit) && defined(__OpenBSD__) || defined(__OpenBSD) +#define PLATFORM_OS "Unix-like (BSD)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_OPENBSD "OpenBSD" +#define PLATFORM_TYPE "OpenBSD" +#undef PLATFORM_IS_OPENBSD +#define PLATFORM_IS_OPENBSD +#endif + +#if defined(_XBOX_ONE) && defined(_TITLE) +#define PLATFORM_OS "Windows 10.x" +#define PLATFORM_ARCH "AMD64 (x86-64)" +#define PLATFORM_XBOX "Windows 10 (Xbox)" +#define PLATFORM_TYPE "Xbox" +#undef PLATFORM_IS_XBOX +#define PLATFORM_IS_XBOX +#endif + +/* NetBSD */ +#if defined(X86_32bit) && defined(__NetBSD__) || defined(__NetBSD) +#define PLATFORM_OS "Unix (NetBSD)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_BLACKBERRY "NetBSD" +#define PLATFORM_TYPE "NetBSD" +#elif defined(X64_64bit) && defined(__NetBSD__) || defined(__NetBSD) +#define PLATFORM_OS "Unix (NetBSD)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_BLACKBERRY "NetBSD" +#define PLATFORM_TYPE "NetBSD" +#undef PLATFORM_IS_NETBSD +#define PLATFORM_IS_NETBSD +#endif + +/* QNX (Blackberry) variant */ +#if defined(X86_32bit) && defined(__QNXNTO__) || defined(__QNX__) +#define PLATFORM_OS "Unix (RTOS)" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_BLACKBERRY "QNX" +#define PLATFORM_TYPE "Blackberry" +#elif defined(X64_64bit) && defined(__QNXNTO__) || defined(__QNX__) +#define PLATFORM_OS "Unix (RTOS)" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_BLACKBERRY "QNX" +#define PLATFORM_TYPE "Blackberry" +#undef PLATFORM_IS_BLACKBERRY +#define PLATFORM_IS_BLACKBERRY +#endif + +/* VMS */ +#if defined(X86_32bit) && defined(VMS) || defined(__VMS) +#define PLATFORM_OS "OpenVMS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_VMS "DEC (OpenVMS)" +#define PLATFORM_TYPE "DEC" +#elif defined(X64_64bit) && defined(VMS) || defined(__VMS) +#define PLATFORM_OS "OpenVMS" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_VMS "DEC (OpenVMS)" +#define PLATFORM_TYPE "DEC" +#undef PLATFORM_IS_OPENVMS +#define PLATFORM_IS_OPENVMS +#endif + +/* VXWORKS variant */ +#if defined(X86_32bit) && defined(VXWORKS) +#define PLATFORM_OS "RTOS" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_VXWORKS "Monolithic" +#define PLATFORM_TYPE "VXWORKS" +#elif defined(X64_64bit) && defined(VXWORKS) +#define PLATFORM_OS "RTOS" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_VXWORKS "Monolithic" +#define PLATFORM_TYPE "VXWORKS" +#undef PLATFORM_IS_VXWORKS +#define PLATFORM_IS_VXWORKS +#endif + +/* Motorola 68K. Not defined by VBCC, so user must define one of these + * manually when using VBCC. + */ +#if defined(X86_32bit) && defined(__m68k__) || defined(M68000) || \ + defined(__MC68K__) +#define PLATFORM_OS "68K" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_MOTOROLA "Motorola (68K)" +#define PLATFORM_TYPE "Motorola 68K" +#elif defined(X64_64bit) && defined(__m68k__) || defined(M68000) || \ + defined(__MC68K__) +#define PLATFORM_OS "68K" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_MOTOROLA "Motorola (68K)" +#define PLATFORM_TYPE "Motorola 68K" +#endif + +/* Ultrix */ +#if defined(X86_32bit) && defined(ultrix) || defined(__ultrix) || \ + defined(__ultrix__) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X86_32bit) && defined(unix) && defined(vax) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X64_64bit) && defined(ultrix) || defined(__ultrix) || \ + defined(__ultrix__) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#elif defined(X64_64bit) && defined(unix) && defined(vax) +#define PLATFORM_OS "Ultrix Os" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_ULTRIX "Ultrix" +#define PLATFORM_TYPE "Ultrix" +#undef PLATFORM_IS_ULTRIX +#define PLATFORM_IS_ULTRIX +#endif + +/* Embedded */ +#if defined(IS_EMBEDDED) +#define PLATFORM_EMBEDDED "Embedded" +#define PLATFORM_RPI "Embedded" +#endif + +/* Microsoft DOS */ +#if defined(MSDOS) || defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) +#define PLATFORM_OS "Dos" +#define PLATFORM_DOS "Microsoft-DOS" +#define PLATFORM_ARCH "16-Bit" +#define PLATFORM_TYPE "MS-Dos" +#undef PLATFORM_IS_MSDOS +#define PLATFORM_IS_MSDOS +#endif + +/* + * Windows, Cygwin (non-POSIX), and MinGW + * Developer: Microsoft + * Distributions: Windows XP, Vista, 7, 8 + * Processors: x86, x86-64 + */ + + +#if defined(_WIN32) && !defined(_WIN64) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (32-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_X86 "Microsoft Windows (32-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (32-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(_WIN64) && defined(_WIN32) && !defined(_M_ARM64) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_WINDOWS_X64 "Microsoft Windows (64-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (64-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(_M_ARM64) && defined(_WIN32) && !defined (WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "Arm64 (64-Bit)" +#define PLATFORM_WINDOWS_ARM64 "Microsoft Windows (64-Bit)" +#define PLATFORM_WINDOWS "Microsoft Windows (64-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +/* Microsoft Phone ------------------------------ */ +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +/* Microsoft Windows Store or Universal Windows Platform - (32-bit). + * ------------------------------ */ +#define PLATFORM_OS "Windows" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_X86 "Microsoft Windows (32-Bit)" +#define PLATFORM_WINDOWS_UWP "Microsoft Windows UWP (32-Bit)" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) && \ + defined(_WIN64) && !defined(_WIN32) && !defined(_WIN32_WINNT) +/* Microsoft Windows (64-bit). ------------------------------ */ +#define PLATFORM_OS "Windows " +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_WINDOWS_X64 "Microsoft Windows x64" +#define PLATFORM_WINDOWS_UWP "Microsoft Windows UWP" +#define PLATFORM_DEVICE "Desktop" +#define PLATFORM_DESKTOP +#define PLATFORM_WINDOWS "Microsoft Windows" +#define PLATFORM_TYPE "PC" +#undef PLATFORM_IS_PC +#define PLATFORM_IS_PC +/* Microsoft Phone ------------------------------ */ +#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +/* Microsoft Windows (Phone). ------------------------------ */ +#define PLATFORM_OS "WindowsRT" +#define PLATFORM_ARCH "x86 (32-Bit)" +#define PLATFORM_WINDOWS_PHONE "Windows Phone" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_MOBILE +#define PLATFORM_TYPE "Mobile (Windows Phone)" +#elif defined(_WIN64) && defined(WINAPI_FAMILY_PHONE_APP) +/* Microsoft Windows (Phone). ------------------------------ */ +#define PLATFORM_OS "WindowsRT" +#define PLATFORM_ARCH "x64 (64-Bit)" +#define PLATFORM_DEVICE "Mobile" +#define PLATFORM_WINDOWS_PHONE "Windows Phone" +#define PLATFORM_TYPE "Mobile (Windows Phone)" +#undef PLATFORM_IS_WINDOWS_PHONE +#define PLATFORM_IS_WINDOWS_PHPNE +#endif + +//! Language Standard Macro +#ifdef _MSC_VER + #if _MSC_VER < 1920 + #if __cplusplus == 199711L + #define CXX_STANDARD_98 199711L + #elif __cplusplus == 201103L || __cplusplus == 201100 + #define CXX_STANDARD_11 201100 + #elif __cplusplus == 201402L + #define CXX_STANDARD_14 + #elif __cplusplus == 201703L || __cplusplus == 201704L + #define CXX_STANDARD_17 201703L + #elif __cplusplus == 202002L + #define CXX_STANDARD_20 202002L + #endif + #else + #define CXX_STANDARD_20 202002L + #endif +#else + #if __cplusplus == 199711L + #define CXX_STANDARD_98 199711L + #elif __cplusplus == 201103L || __cplusplus == 201100 + #define CXX_STANDARD_11 201100 + #elif __cplusplus == 201402L + #define CXX_STANDARD_14 201402L + #elif __cplusplus == 201703L || __cplusplus == 201704L + #define CXX_STANDARD_17 201703L + #elif __cplusplus == 202002L + #define CXX_STANDARD_20 202002L + #endif +#endif diff --git a/utilities/types.hpp b/utilities/types.hpp new file mode 100644 index 0000000..b62e966 --- /dev/null +++ b/utilities/types.hpp @@ -0,0 +1,127 @@ +/*! + * + * Copyright (c) 2021 Kambiz Asadzadeh + * Copyright (c) 2023 Genyleap + */ + +#ifndef PROJECT_TYPES_HPP +#define PROJECT_TYPES_HPP + +#ifdef __has_include +# if __has_include() +# include +# endif +#else +# include +#endif + +namespace Types { + +using schar = signed char; +using uchar = unsigned char; +using ushort = unsigned short; +using uint = unsigned int; +using ulong = unsigned long; +using ullong = unsigned long long; +using llong = long long; + +//! Fixed width integer types (since C++11) +//! Signed integer type +using s8 = std::int8_t; +using s16 = std::int16_t; +using s32 = std::int32_t; +using s64 = std::int64_t; + +//! Fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively. +using fs8 = std::int_fast8_t; +using fs16 = std::int_fast16_t; +using fs32 = std::int_fast32_t; +using fs64 = std::int_fast64_t; + +//! Smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively. +using ss8 = std::int_least8_t; +using ss16 = std::int_least16_t; +using ss32 = std::int_least32_t; +using ss64 = std::int_least64_t; + +using smax = std::intmax_t; //! Maximum-width signed integer type. +using sptr = std::intptr_t; //! Signed integer type capable of holding a pointer to void. + +//! Unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively. +using u8 = std::uint8_t; +using u16 = std::uint16_t; +using u32 = std::uint32_t; +using u64 = std::uint64_t; + +//! Fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively. +using fu8 = std::uint_fast8_t; +using fu16 = std::uint_fast16_t; +using fu32 = std::uint_fast32_t; +using fu64 = std::uint_fast64_t; + +//! Smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively. +using su8 = std::uint_least8_t; +using su16 = std::uint_least16_t; +using su32 = std::uint_least32_t; +using su64 = std::uint_least64_t; + +using f32 = float; +using f64 = double; + +using b8 = bool; + +using umax = std::uintmax_t; //! Maximum-width unsigned integer type +using uptr = std::uintptr_t; //! Unsigned integer type capable of holding a pointer to void. + +using VariantTypes = std::map>; +using MapList = std::pair>; +using MapVector = std::pair>; +using IteratorConfig = std::map::iterator; +using LanguageType = std::map; +using MetaList = std::map; +using ResourceType = std::map; +using MapConfig = std::map; +using MapString = std::map; +using PairString = std::pair; +using SettingType = std::map; +using VectorString = std::vector; +using VectorSection = std::vector; +using OptionalString = std::optional; + +using OptionalNumeric = std::optional; +using OptionalBool = std::optional; + +#if defined(USE_JSON) && !defined(USE_BOOST) +namespace JSon = Json; +# elif defined(USE_BOOST) +namespace JSon = boost::json; +# elif !defined(USE_JSON) && !defined(USE_BOOST) +#if __cpp_lib_json +namespace JSon = std::json; +#endif +#endif + +using TableNames = std::vector; +using QueryType = std::vector; +using TranslateType = std::string; + +template using Map = std::map; +template using MultiMap = std::multimap; +template using Pair = std::pair; + +template using Vector = std::vector; +template using Optional = std::optional; +template using Variant = std::variant; + + +using Function = std::function; +using PackagedTask = std::packaged_task; +using MultiThreadVector = std::vector; +using StringStream = std::basic_stringstream; +using String = std::string; +using IfStreamer = std::ifstream; +using StringStream = std::stringstream; + +} + +#endif // PROJECT_TYPES_HPP