Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexej Harm committed Oct 22, 2019
0 parents commit e1a4799
Show file tree
Hide file tree
Showing 20 changed files with 784 additions and 0 deletions.
132 changes: 132 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakStringLiterals: false
ColumnLimit: 120
CommentPragmas: '^ (NOTE|TODO):'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Preserve
IncludeIsMainRegex: '(_test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakAssignment: 2000
PenaltyBreakBeforeFirstCallParameter: 1000
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 100
PenaltyBreakString: 4000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 2
PenaltyReturnTypeOnItsOwnLine: 3000
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 8
UseTab: Never
---
Language: Cpp
Standard: Cpp11
Cpp11BracedListStyle: false
ForEachMacros:
- for co_await
- if constexpr
IncludeCategories:
- Regex: '^"'
Priority: 1
- Regex: '^<.*\.(hh|hpp|hxx)>'
Priority: 2
- Regex: '^<.*\/.*>'
Priority: 3
- Regex: '^<(ntifs|windows).h>'
Priority: 4
- Regex: '^<(ntddk|wdm.h>'
Priority: 5
- Regex: '^<(wdf|shellapi|winsock2|ws2tcpip|mswsock)\.h>'
Priority: 6
- Regex: '^<.*\.h>'
Priority: 7
- Regex: '^<c(assert|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stddef|stdint|stdio|stdlib|string|time|uchar|wchar|wctype)>'
Priority: 9
- Regex: '.*'
Priority: 8
MacroBlockBegin: '^(BEGIN_.*MSG_MAP.*|ALT_MSG_MAP)$'
MacroBlockEnd: '^(END_MSG_MAP)$'
SortIncludes: true
---
Language: ObjC
DisableFormat: true
---
Language: JavaScript
JavaScriptQuotes: Double
JavaScriptWrapImports: true
---
Language: Java
BreakAfterJavaFieldAnnotations: true
...
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
tab_width = 8

[*.{cmd,rc.in,rc}]
end_of_line = crlf

[makefile]
indent_style = tab
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=lf
*.cmd text eol=crlf
*.rc.in text eol=crlf
*.rc text eol=crlf
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
.*
*.aps
!/res/
!/src/
!/.clang-format
!/.editorconfig
!/.gitattributes
!/.gitignore
!/advisor.txt
!/CMakeLists.txt
!/CMakeSettings.json
!/license.txt
!/make.cmd
!/makefile
!/readme.md
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(advisor DESCRIPTION "Advisor" VERSION 1.0.0 LANGUAGES CXX)
file(COPY res/launch.vs.json DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.vs)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE STRING "")
set(CMAKE_CXX_EXTENSIONS OFF CACHE STRING "")

set(CMAKE_CXX_FLAGS "/arch:AVX2 /fp:fast /permissive- /EHsc /utf-8")
set(CMAKE_CXX_FLAGS_DEBUG "/nologo /Od /Oi- /Ob0 /Gy- /GS /ZI /await")
set(CMAKE_CXX_FLAGS_RELEASE "/nologo /Os /Oi /Oy /Ob2 /Gy /GS- /GF /GL /await /await:heapelide")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/nologo /debug:fastlink /incremental /editandcontinue")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/nologo /debug:none /opt:ref /opt:icf /LTCG:incremental")
set(CMAKE_RC_FLAGS "/nologo /c65001")

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:DebugDLL>" CACHE STRING "")

set(PROJECT_VENDOR "Alexej Harm")
configure_file(res/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/version.h LF)

file(GLOB_RECURSE headers CONFIGURE_DEPENDS src/*.hpp)
file(GLOB_RECURSE sources CONFIGURE_DEPENDS src/*.cpp src/*.manifest src/*.rc)

add_executable(${PROJECT_NAME} ${headers} ${sources})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
target_precompile_headers(${PROJECT_NAME} PRIVATE src/common.hpp)
target_link_libraries(${PROJECT_NAME} PRIVATE windowsapp)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION .)
22 changes: 22 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"configurations": [
{
"name": "Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"cmakeExecutable": "C:\\Program Files\\CMake\\bin\\cmake.exe",
"buildRoot": "${projectDir}\\build\\debug",
"installRoot": "${projectDir}"
},
{
"name": "Release",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64_x64" ],
"cmakeExecutable": "C:\\Program Files\\CMake\\bin\\cmake.exe",
"buildRoot": "${projectDir}\\build\\release",
"installRoot": "${projectDir}"
}
]
}
59 changes: 59 additions & 0 deletions advisor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
https://lotv.spawningtool.com/build/98237/
14 0:17 Supply Depot
15 0:41 Barracks
16 0:45 Refinery
19 1:28 Orbital Command
19 1:29 Reaper
20 1:41 2nd Command Center
20 1:51 Barracks
21 2:01 Barracks Reactor
21 2:05 Supply Depot
22 2:17 Barracks
24 2:38 2 Marines
24 2:41 Barracks Tech Lab
26 2:44 Engineering Bay
27 2:56 2 Marines, Orbital Command
29 3:05 Barracks Tech Lab
28 3:14 2 Marines
28 3:18 Stimpack
31 3:24 2 Marines
34 3:34 2 Marines
34 3:39 Terran Infantry Weapons 1
36 3:54 Supply Depot
40 3:56 Combat Shield
41 4:09 2 Refineries
48 4:18 Supply Depot
48 4:25 Supply Depot
52 4:34 Factory
56 4:45 2 Marauders
62 5:07 Marauder
62 5:16 Marauder
65 5:25 Missile Turret
56 5:47 3rd Command Center
56 5:53 Marauder
52 5:58 Refinery
50 6:06 Bunker
50 6:10 Concussive Shells
50 6:12 Starport
50 6:16 Factory Reactor
50 6:21 Marauder
57 6:35 Marauder
60 6:44 2 Barracks
65 7:02 Terran Infantry Armor 1
65 7:04 Armory
66 7:12 Orbital Command
66 7:15 2 Medivacs
66 7:17 2 Marauders
78 7:27 Missile Turret
78 7:32 Barracks Tech Lab
78 7:33 Barracks Reactor
79 7:38 Marauder
79 7:41 Orbital Command
84 7:47 2 Medivacs
93 8:04 Missile Turret
101 8:21 Factory Tech Lab
109 8:39 2 Liberators
109 8:46 2 Refineries
109 8:52 Fusion Core
109 8:53 Starport
124 9:39 Advanced Ballistics, Factory Reactor
15 changes: 15 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2019 Alexej Harm

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS AL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 changes: 51 additions & 0 deletions make.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@echo off
rem
rem Download make executable and add it to %Path%:
rem
rem http://www.equation.com/servlet/equation.cmd?fa=make
rem

set __VS_LOCATION=%ProgramFiles(x86)%\Microsoft Visual Studio\2019
set __VS_EDITIONS="Enterprise,Professional,Community"

set __SKIP_VCVARS=1
if "%1"=="" set __SKIP_VCVARS=0

for %%i in (%*) do (
(echo :format: :clean: | findstr /i ":%%i:" 1>nul 2>nul) || set __SKIP_VCVARS=0
)

if "%__SKIP_VCVARS%"=="1" (
goto :skip_vcvars
)

if not "%MAKE_WRAPPER_VCVARS_INITIALIZED%"=="1" (
for %%i in (%__VS_EDITIONS:"=%) do (
if exist "%__VS_LOCATION:"=%\%%i\VC\Auxiliary\Build\vcvarsall.bat" (
pushd "%__VS_LOCATION:"=%\%%i\VC\Auxiliary\Build"
goto :vcvarsall_found
)
)

echo error: missing script: "vcvarsall.bat" 1>&2
goto :cleanup

:vcvarsall_found
call vcvarsall.bat x64 && goto initialized
popd
echo error: could not initialize vcvars 1>&2
goto :cleanup

:initialized
popd
set MAKE_WRAPPER_VCVARS_INITIALIZED=1
)

:skip_vcvars

make.exe %*

:cleanup
set __SKIP_VCVARS=
set __VS_EDITIONS=
set __VS_LOCATION=
34 changes: 34 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# usage: make run|install|format|clean
#
# run - build and execute program
# install - build and install program
# format - use clang-format on all sources
# clean - remove curent build directory
#
MAKEFLAGS += --no-print-directory

TARGET := $(shell cmake -P res/scripts/target.cmake 2>&1)
SOURCE := $(shell cmake -P res/scripts/source.cmake 2>&1)

all: build/release/CMakeCache.txt
@cmake --build build/release --target $(TARGET)

run: build/release/CMakeCache.txt
@cmake --build build/release --target $(TARGET)
@build/release/$(TARGET)

install: build/release/CMakeCache.txt
@cmake --build build/release --target install

format:
@C:/LLVM/bin/clang-format.exe -i $(SOURCE)

clean:
@cmake -E remove_directory .vs build

build/release/CMakeCache.txt: CMakeLists.txt
@cmake -GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$(CURDIR)" \
-B build/release

.PHONY: all run install format clean
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Advisor
Narrator for build orders from sites like [Spawning Tool](https://lotv.spawningtool.com/).
Loading

0 comments on commit e1a4799

Please sign in to comment.