Skip to content

Commit

Permalink
feat: Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
JJL772 committed Jul 5, 2022
0 parents commit aa01bc0
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterComma
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 4
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: true
DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PenaltyReturnTypeOnItsOwnLine: 1000000
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: c++20
TabWidth: 4
UseTab: Always
UseCRLF: false

15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
tab_width = 4
insert_final_newline = true

[*.{json,jsonc,json5}]
indent_style = spaces
indent_size = 2

35 changes: 35 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
* text=auto eol=lf
# Binaries
*.exe -text
*.dll -text
*.a -text
*.so* -text
*.pdb -text
# Images
*.vtf -text
*.jpg -text
*.tga -text
*.dds -text
*.png -text
*.jpeg -text
*.psd -text
*.bmp -text
# Models
*.vtx -text
*.mdl -text
*.phy -text
*.vvd -text
*.fbx -text
# Fonts
*.ttf -text
*.otf -text
# Sounds
*.wav -text
*.ogg -text
*.mp3 -text
*.flac -text
# Media
*.mp4 -text
*.webm -text
*.avi -text

23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
build
.vscode
.idea
.ccls-cache
*.kdev4
.kdev4/

# CMake with Visual Studio
.vs/
CMakeFiles/
[Dd]ebug*/
[Rr]elease*/
*.dir/
*_autogen/
*.vcxproj*
cmake_install.cmake
CMakeCache.txt
*.sln

# CMake with CLion
cmake-build-*/


3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/vtflib"]
path = external/vtflib
url = https://github.com/JJL772/VTFLib
40 changes: 40 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.15)

project(vtex2 CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Project settings

# Set to enable Qt for this project
set(USING_QT OFF)

# Global flags, mainly for UNIX. Use $ORIGIN rpath & -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)

# Sources
set(CLI_SRC
src/cli/main.cpp)

add_executable(vtex2 ${CLI_SRC})

# Qt support
if (USING_QT)
include(cmake_scripts/Qt.cmake)
find_package(Qt5 REQUIRED COMPONENTS Widgets Core Gui)
target_link_libraries(${PROJECTNAME} PRIVATE Qt5::Widgets Qt5::Core Qt5::Gui)
target_include_directories(${PROJECTNAME} PRIVATE ${QT_INCLUDE} ${QT_INCLUDE}/QtWidgets ${QT_INCLUDE}/QtGui ${QT_INCLUDE}/QtCore)
endif()


# Set up the debugger so it can run the program without copying a million dlls
if(WIN32)
set_target_properties(vtex2 PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${QT_BASEDIR}/bin;")
endif()

# Build vtflib as static lib
set(VTFLIB_STATIC ON)
add_subdirectory(external/vtflib)

target_link_libraries(vtex2 vtflib)
25 changes: 25 additions & 0 deletions cmake_scripts/Qt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Qt base script

if(UNIX)
set(QT_INCLUDE "/usr/include/x86_64-linux-gnu/qt5")
endif()

if(WIN32)
# On Windows, the install dir must be specified, as it's not standardized
if(DEFINED QT_BASEDIR)
# Add it to the prefix path so find_package can find it
list(APPEND CMAKE_PREFIX_PATH ${QT_BASEDIR})
set(QT_INCLUDE ${QT_BASEDIR}/include)
# CMake has an odd policy that links a special link lib for Qt on newer versions of CMake. Enable it so we don't get spammed, and I get to write less
cmake_policy(SET CMP0020 NEW)
else()
message(FATAL_ERROR "--!@ Please define your QT install dir with -DQT_BASEDIR=C:/your/qt5/here")
endif()
endif()

message("Using ${QT_INCLUDE} as our Qt include dir")

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

1 change: 1 addition & 0 deletions external/stb
Submodule stb added at af1a5b
1 change: 1 addition & 0 deletions external/vtflib
Submodule vtflib added at 634a0e
Binary file added res/chaos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions res/resource.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="resource">
<file>chaos.png</file>
</qresource>
</RCC>
4 changes: 4 additions & 0 deletions src/cli/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

int main(int argc, char** argv) {
return 0;
}

0 comments on commit aa01bc0

Please sign in to comment.