Skip to content

Commit

Permalink
All files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejas2805 committed Jul 12, 2020
0 parents commit b44da2f
Show file tree
Hide file tree
Showing 101 changed files with 25,857 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .cs211/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CS 211 project configuration

This directory contains files for configuring this CS 211 project:

cmake/ - build system setup

idea/ - CLion IDE configuration

README.md - this file

lib/ - included libraries

catch/ - testing framework
ge211/ - game engine library
You probably shouldn’t change anything in here.
50 changes: 50 additions & 0 deletions .cs211/cmake/211commands.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.3)

# Adds a program with the given name and source files, and sets the
# language to C++ 14
#
# Usage:
#
# add_program(NAME [OPTION...] SRCFILE...)
#
# where OPTIONs include:
#
# ASAN enable address sanitizer
# UBSAN enable undefined behavior sanitizer
# CXX17 enable C++ 2017
#
function (add_program name)
cmake_parse_arguments(pa "ASAN;UBSAN;CXX17;" "" "" ${ARGN})

add_executable(${name} ${pa_UNPARSED_ARGUMENTS})

if(pa_ASAN)
target_compile_options(${name} PRIVATE "-fsanitize=address")
target_link_options(${name} PRIVATE "-fsanitize=address")
endif(pa_ASAN)

if(pa_UBSAN)
target_compile_options(${name} PRIVATE "-fsanitize=undefined")
target_link_options(${name} PRIVATE "-fsanitize=undefined")
endif(pa_UBSAN)

if(pa_CXX17)
set_property(TARGET ${name} PROPERTY CXX_STANDARD 17)
else(pa_CXX17)
set_property(TARGET ${name} PROPERTY CXX_STANDARD 14)
endif(pa_CXX17)

set_property(TARGET ${name} PROPERTY CXX_STANDARD_REQUIRED On)
set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS Off)
endfunction(add_program)

# Adds a test program with the given name and source files
# Options are the same as `add_program`, but the listed
# source files should not define `main()`.
function(add_test_program name)
add_program(${name} ${ARGN})
target_link_libraries(${name} catch)
add_test(Test_${name} ${name})
endfunction(add_test_program)

# vim: ft=cmake
85 changes: 85 additions & 0 deletions .cs211/cmake/211helpers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Some helper functions.
cmake_minimum_required(VERSION 3.3)

# find_local_package(name dir)
#
# Look for an installed package ${name}, otherwise load the vendored
# version from ${dir}.
function(find_local_package name dir)
cmake_parse_arguments(pa
""
"VERSION"
""
${ARGN})
find_package(${name} ${pa_VERSION} CONFIG QUIET)
if(${name}_FOUND)
message(STATUS "Using system ${name} library (v${${name}_VERSION})")
else()
message(STATUS "Using vendored ${name} library (${dir})")
add_subdirectory(${dir} EXCLUDE_FROM_ALL)
endif()
endfunction(find_local_package)

macro(default_to var val)
if(NOT ${var})
set(${var} "${val}")
endif()
endmacro(default_to)

# glob_dirs(dest_list dir...)
#
# Sets dest_list to the names of all the files in all the given
# directories.
function(glob_dirs dest_list)
set(accum)

foreach(dir ${ARGN})
file(GLOB results "${dir}/*")
list(APPEND accum ${results})
endforeach(dir)

set(${dest_list} "${accum}" PARENT_SCOPE)
endfunction(glob_dirs)

# find_file_nc(dest_var filename dir...)
#
# Like find_file but doesn't cache the result and unsets
# ${dest_var} first.
function(find_file_nc dest_var filename)
unset(${dest_var} PARENT_SCOPE)
foreach(dir ${ARGN})
if(EXISTS "${dir}/${filename}")
set(${dest_var} "${dir}/${filename}" PARENT_SCOPE)
return()
endif()
endforeach()
endfunction(find_file_nc)

function(find_all dest_list)
cmake_parse_arguments(pa
"OPTIONAL;VERBOSE"
"AS;CALLED"
"FILES;IN"
${ARGN})
default_to(pa_AS "find_all")
default_to(pa_CALLED "File")
default_to(pa_IN "${GE211_RESOURCE_PATH}")

set(accum)

foreach(arg ${pa_UNPARSED_ARGUMENTS} ${pa_FILES})
find_file_nc(arg_file "${arg}" ${pa_IN})
if(arg_file)
list(APPEND accum "${arg_file}")
elseif(NOT pa_OPTIONAL)
string(JOIN "\n - " tried ${pa_IN})
message(SEND_ERROR "${pa_AS}:"
" ${pa_CALLED}${arg}’ not found. Searched in:"
"\n - ${tried}")
endif()
endforeach()

set(${dest_list} "${accum}" PARENT_SCOPE)
endfunction(find_all)

# vim: ft=cmake
27 changes: 27 additions & 0 deletions .cs211/cmake/211installer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.3)

function(add_installer name)
cmake_parse_arguments(pa "NO_RESOURCES" "TARGET" "RESOURCES" ${ARGN})
default_to(pa_TARGET "${name}")

set(search_path
"${CMAKE_CURRENT_SOURCE_DIR}/Resources"
${GE211_RESOURCE_PATH})

if(pa_NO_RESOURCES)
set(resource_files)
elseif(pa_RESOURCES)
find_all(resource_files VERBOSE
FILES ${pa_RESOURCES}
CALLED Resource
IN ${search_path}
AS add_installer)
else()
glob_dirs(resource_files ${search_path})
endif()

ge211_installer_name("${name}")
ge211_installer_add("${pa_TARGET}" ${resource_files})
endfunction(add_installer)

# vim: ft=cmake
14 changes: 14 additions & 0 deletions .cs211/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.3)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/.cs211/cmake")
include(211helpers)
include(211commands)

enable_testing()

find_local_package(Catch2 .cs211/lib/catch VERSION 2020.1)
find_local_package(Ge211 .cs211/lib/ge211 VERSION 2020.5)

include_directories(src)

# vim: ft=cmake
98 changes: 98 additions & 0 deletions .cs211/idea/codeStyles/Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<option name="RIGHT_MARGIN" value="80" />
<option name="SOFT_MARGINS" value="72,80" />
<CMakeCodeStyleSettings>
<option name="FORCE_COMMANDS_CASE" value="1" />
</CMakeCodeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
<option name="FUNCTION_BRACE_PLACEMENT" value="2" />
<option name="FUNCTION_PARAMETERS_WRAP" value="5" />
<option name="LAMBDA_CAPTURE_LIST_WRAP" value="1" />
<option name="LAMBDA_CAPTURE_LIST_ALIGN_MULTILINE" value="true" />
<option name="TEMPLATE_PARAMETERS_WRAP" value="5" />
<option name="TEMPLATE_PARAMETERS_ALIGN_MULTILINE" value="true" />
<option name="TEMPLATE_PARAMETERS_NEW_LINE_AFTER_LT" value="true" />
<option name="TEMPLATE_PARAMETERS_NEW_LINE_BEFORE_GT" value="true" />
<option name="TEMPLATE_PARAMETERS_ALIGN_MULTILINE_PARS" value="true" />
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="1" />
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="2" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_ALIGN_MULTILINE" value="false" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_COMMA_ON_NEXT_LINE" value="true" />
<option name="SPACE_WITHIN_TEMPLATE_DOUBLE_GT" value="false" />
<option name="SPACE_WITHIN_EMPTY_BRACES" value="true" />
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
<option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
<option name="ADD_GETTER_PREFIX" value="false" />
<option name="TYPE_QUALIFIERS_PLACEMENT" value="AFTER" />
</Objective-C>
<Objective-C-extensions>
<option name="TYPE_QUALIFIERS_PLACEMENT" value="AFTER" />
<extensions>
<pair source="cxx" header="hxx" fileNamingConvention="SNAKE_CASE" />
<pair source="c" header="h" fileNamingConvention="SNAKE_CASE" />
</extensions>
<rules>
<rule entity="NAMESPACE" visibility="ANY" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="MACRO" visibility="ANY" specifier="ANY" prefix="" style="SCREAMING_SNAKE_CASE" suffix="" />
<rule entity="CLASS" visibility="ANY" specifier="ANY" prefix="" style="LEADING_SNAKE_CASE" suffix="" />
<rule entity="ENUM" visibility="ANY" specifier="ANY" prefix="" style="LEADING_SNAKE_CASE" suffix="" />
<rule entity="ENUMERATOR" visibility="ANY" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="TYPEDEF" visibility="ANY" specifier="ANY" prefix="" style="NONE" suffix="_t" />
<rule entity="UNION" visibility="ANY" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="CLASS_MEMBER_FUNCTION,STRUCT_MEMBER_FUNCTION,CLASS_MEMBER_FIELD,STRUCT_MEMBER_FIELD" visibility="PROTECTED,PRIVATE" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="_" />
<rule entity="CLASS_MEMBER_FUNCTION,STRUCT_MEMBER_FUNCTION,CLASS_MEMBER_FIELD,STRUCT_MEMBER_FIELD" visibility="PUBLIC" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="GLOBAL_FUNCTION" visibility="ANY" specifier="ANY" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="GLOBAL_VARIABLE" visibility="ANY" specifier="ANY" prefix="" style="UPPER_SNAKE_CASE" suffix="" />
<rule entity="GLOBAL_VARIABLE" visibility="ANY" specifier="CONST" prefix="" style="SNAKE_CASE" suffix="" />
<rule entity="GLOBAL_VARIABLE" visibility="ANY" specifier="CONST" prefix="" style="SNAKE_CASE" suffix="_" />
<rule entity="PARAMETER,LOCAL_VARIABLE" visibility="ANY" specifier="ANY" prefix="" style="NONE" suffix="" />
</rules>
</Objective-C-extensions>
<RsCodeStyleSettings>
<option name="ALIGN_TYPE_PARAMS" value="true" />
<option name="INDENT_WHERE_CLAUSE" value="false" />
<option name="ALLOW_ONE_LINE_MATCH" value="true" />
</RsCodeStyleSettings>
<codeStyleSettings language="CMake">
<option name="SOFT_MARGINS" value="120" />
</codeStyleSettings>
<codeStyleSettings language="Markdown">
<option name="RIGHT_MARGIN" value="80" />
<option name="WRAP_ON_TYPING" value="0" />
<option name="SOFT_MARGINS" value="80" />
</codeStyleSettings>
<codeStyleSettings language="ObjectiveC">
<option name="RIGHT_MARGIN" value="80" />
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="5" />
<option name="ENUM_CONSTANTS_WRAP" value="2" />
<option name="WRAP_ON_TYPING" value="1" />
<option name="SOFT_MARGINS" value="72" />
<indentOptions>
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Rust">
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="SOFT_MARGINS" value="80" />
</codeStyleSettings>
</code_scheme>
</component>
5 changes: 5 additions & 0 deletions .cs211/idea/codeStyles/codeStyleConfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
31 changes: 31 additions & 0 deletions .cs211/idea/inspectionProfiles/CS_211.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="CS 211" />
<inspection_tool class="ClangTidy" enabled="false" level="WARNING" enabled_by_default="false">
<option name="clangTidyCheckOptions">
<list>
<ClangTidyCheckOption />
</list>
</option>
</inspection_tool>
<inspection_tool class="ClangTidyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EndlessLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InfiniteRecursion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LocalValueEscapesScope" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MissingReturn" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NotInitializedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NullDereferences" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
<option name="processCode" value="false" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="UnreachableCode" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedParameter" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedValue" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>
21 changes: 21 additions & 0 deletions .cs211/idea/inspectionProfiles/Project_Default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ClangTidy" enabled="false" level="WARNING" enabled_by_default="false">
<option name="clangTidyCheckOptions">
<list>
<ClangTidyCheckOption />
</list>
</option>
</inspection_tool>
<inspection_tool class="ClangTidyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="OCInconsistentNaming" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
<option name="processCode" value="false" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>
6 changes: 6 additions & 0 deletions .cs211/idea/inspectionProfiles/profiles_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="CS 211" />
<version value="1.0" />
</settings>
</component>
13 changes: 13 additions & 0 deletions .cs211/idea/misc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<sourceRoots>
<file path="$PROJECT_DIR$/src" />
<file path="$PROJECT_DIR$/test" />
</sourceRoots>
<libraryRoots>
<file path="$PROJECT_DIR$/.cs211" />
</libraryRoots>
</component>
</project>
2 changes: 2 additions & 0 deletions .cs211/lib/catch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
cmake-build-*/
Loading

0 comments on commit b44da2f

Please sign in to comment.