mirror of
https://github.com/thunderbrewhq/system.git
synced 2026-02-03 16:39:07 +00:00
chore: initial commit
This commit is contained in:
commit
d610030a1d
6 changed files with 272 additions and 0 deletions
54
.clang-format
Normal file
54
.clang-format
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
AccessModifierOffset: 0
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
ColumnLimit: 0
|
||||
CompactNamespaces: false
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
IncludeBlocks: Merge
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: "<[[:alnum:].]+>"
|
||||
Priority: 4
|
||||
- Regex: ".*"
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
IndentGotoLabels: false
|
||||
IndentWidth: 4
|
||||
MaxEmptyLinesToKeep: 1
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PointerAlignment: Left
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
Standard: c++11
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
15
.editorconfig
Normal file
15
.editorconfig
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[cmake/**/*]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
||||
[system/**/*]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.DS_Store
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
/build
|
||||
/dist
|
||||
87
cmake/system.cmake
Normal file
87
cmake/system.cmake
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# Arch defines
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
set(WHOA_ARCH_64 1)
|
||||
add_definitions(-DWHOA_ARCH_64=1)
|
||||
elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
|
||||
set(WHOA_ARCH_32 1)
|
||||
add_definitions(-DWHOA_ARCH_32=1)
|
||||
endif()
|
||||
|
||||
# System defines
|
||||
set(WHOA_WIN_UNK 9999)
|
||||
set(WHOA_WIN_XP 510)
|
||||
set(WHOA_WIN_VISTA 600)
|
||||
set(WHOA_WIN_7 610)
|
||||
set(WHOA_WIN_8 620)
|
||||
set(WHOA_WIN_8_1 630)
|
||||
set(WHOA_WIN_10 1000)
|
||||
set(WHOA_MAC_UNK 9999)
|
||||
set(WHOA_MAC_10_8 1008)
|
||||
set(WHOA_MAC_10_9 1009)
|
||||
set(WHOA_MAC_10_10 1010)
|
||||
set(WHOA_MAC_10_11 1011)
|
||||
set(WHOA_MAC_10_12 1012)
|
||||
set(WHOA_MAC_10_13 1013)
|
||||
set(WHOA_MAC_10_14 1014)
|
||||
set(WHOA_MAC_10_15 1015)
|
||||
set(WHOA_MAC_11_0 1100)
|
||||
set(WHOA_LINUX_UNK 9999)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(WHOA_SYSTEM_WIN 1)
|
||||
add_definitions(-DWHOA_SYSTEM_WIN=1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(WHOA_SYSTEM_MAC 1)
|
||||
add_definitions(-DWHOA_SYSTEM_MAC=1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(WHOA_SYSTEM_LINUX 1)
|
||||
add_definitions(-DWHOA_SYSTEM_LINUX=1)
|
||||
endif()
|
||||
|
||||
if(${WHOA_SYSTEM_WIN})
|
||||
if(${CMAKE_SYSTEM_VERSION} EQUAL "5.1")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_XP})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "6.0")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_VISTA})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "6.1")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_7})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "6.2")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_8})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "6.3")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_8_1})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.0")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_10})
|
||||
else()
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_WIN_UNK})
|
||||
endif()
|
||||
|
||||
add_definitions(-DWHOA_SYSTEM_VERSION=${WHOA_SYSTEM_VERSION})
|
||||
elseif(${WHOA_SYSTEM_MAC})
|
||||
if(${CMAKE_SYSTEM_VERSION} EQUAL "10.8")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_8})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.9")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_9})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.10")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_10})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.11")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_11})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.12")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_12})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.13")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_13})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.14")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_14})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "10.15")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_10_15})
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL "11.0")
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_11_0})
|
||||
else()
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_MAC_UNK})
|
||||
endif()
|
||||
|
||||
add_definitions(-DWHOA_SYSTEM_VERSION=${WHOA_SYSTEM_VERSION})
|
||||
elseif(${WHOA_SYSTEM_LINUX})
|
||||
set(WHOA_SYSTEM_VERSION ${WHOA_LINUX_UNK})
|
||||
|
||||
add_definitions(-DWHOA_SYSTEM_VERSION=${WHOA_SYSTEM_VERSION})
|
||||
endif()
|
||||
86
script/clang-format-all
Executable file
86
script/clang-format-all
Executable file
|
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# clang-format-all: a tool to run clang-format on an entire project
|
||||
# Copyright (C) 2016 Evan Klitzke <evan@eklitzke.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 DIR..."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Variable that will hold the name of the clang-format command
|
||||
FMT=""
|
||||
|
||||
# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent
|
||||
# that the version number be part of the command. We prefer clang-format if
|
||||
# that's present, otherwise we work backwards from highest version to lowest
|
||||
# version.
|
||||
for clangfmt in clang-format{,-{11,10,9,8,7,6,5,4,3}.{9,8,7,6,5,4,3,2,1,0}}; do
|
||||
if which "$clangfmt" &>/dev/null; then
|
||||
FMT="$clangfmt"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if we found a working clang-format
|
||||
if [ -z "$FMT" ]; then
|
||||
echo "failed to find clang-format"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check all of the arguments first to make sure they're all directories
|
||||
for dir in "$@"; do
|
||||
if [ ! -d "${dir}" ]; then
|
||||
echo "${dir} is not a directory"
|
||||
usage
|
||||
fi
|
||||
done
|
||||
|
||||
# Find a dominating file, starting from a given directory and going up.
|
||||
find-dominating-file() {
|
||||
if [ -r "$1"/"$2" ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ "$1" = "/" ]; then
|
||||
return 1
|
||||
fi
|
||||
find-dominating-file "$(realpath "$1"/..)" "$2"
|
||||
return $?
|
||||
}
|
||||
|
||||
# Run clang-format -i on all of the things
|
||||
for dir in "$@"; do
|
||||
pushd "${dir}" &>/dev/null
|
||||
if ! find-dominating-file . .clang-format; then
|
||||
echo "Failed to find dominating .clang-format starting at $PWD"
|
||||
continue
|
||||
fi
|
||||
find . \
|
||||
\( -name '*.c' \
|
||||
-o -name '*.cc' \
|
||||
-o -name '*.cpp' \
|
||||
-o -name '*.m' \
|
||||
-o -name '*.mm' \
|
||||
-o -name '*.h' \
|
||||
-o -name '*.hh' \
|
||||
-o -name '*.hpp' \) \
|
||||
-exec "${FMT}" -style=file -i '{}' \;
|
||||
popd &>/dev/null
|
||||
done
|
||||
24
system/System.hpp
Normal file
24
system/System.hpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef SYSTEM_SYSTEM_HPP
|
||||
#define SYSTEM_SYSTEM_HPP
|
||||
|
||||
// System versions
|
||||
#define WHOA_WIN_UNK 9999
|
||||
#define WHOA_WIN_XP 510
|
||||
#define WHOA_WIN_VISTA 600
|
||||
#define WHOA_WIN_7 610
|
||||
#define WHOA_WIN_8 620
|
||||
#define WHOA_WIN_8_1 630
|
||||
#define WHOA_WIN_10 1000
|
||||
#define WHOA_MAC_UNK 9999
|
||||
#define WHOA_MAC_10_8 1008
|
||||
#define WHOA_MAC_10_9 1009
|
||||
#define WHOA_MAC_10_10 1010
|
||||
#define WHOA_MAC_10_11 1011
|
||||
#define WHOA_MAC_10_12 1012
|
||||
#define WHOA_MAC_10_13 1013
|
||||
#define WHOA_MAC_10_14 1014
|
||||
#define WHOA_MAC_10_15 1015
|
||||
#define WHOA_MAC_11_0 1100
|
||||
#define WHOA_LINUX_UNK 9999
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue