Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-grechkin committed May 27, 2020
0 parents commit a9014b2
Show file tree
Hide file tree
Showing 40 changed files with 3,220 additions and 0 deletions.
135 changes: 135 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# vim: filetype=yaml
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: No
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
#BeforeLambdaBody: false
#BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: ['foreach', 'Q_FOREACH', 'BOOST_FOREACH']
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
#IndentExternBlock: Indent
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: true
JavaScriptQuotes: Single
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
StatementMacros: ['Q_UNUSED', 'QT_REQUIRE_VERSION']
TabWidth: 4
TypenameMacros: ['LIST']
UseCRLF: false
UseTab: ForContinuationAndIndentation
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.build-*
.tidyall.d
include/version.hpp
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "3rdparty/p7zip"]
path = 3rdparty/p7zip
url = https://github.com/btolab/p7zip.git
14 changes: 14 additions & 0 deletions .local.vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function! s:find_git_root()
return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
endfunction

if !exists("g:ale_configs_updated")
let g:ale_configs_updated = 1
let root = s:find_git_root()
"let g:ale_cpp_clang_options = g:ale_cpp_options." -std=c++20 -I /usr/include/fuse3 -I ".expand('%:p:h')."/include -I ".expand('%:p:h')."/src/include -I ".expand('%:p:h')."/3rdparty/p7zip -I ".expand('%:p:h')."/3rdparty/p7zip/CPP -I ".expand('%:p:h')."/3rdparty/p7zip/CPP/include_windows -I ".expand('%:p:h')."/src/7zip/include -D_FILE_OFFSET_BITS=64"
let g:ale_cpp_clang_options = g:ale_cpp_options." -std=c++20 -I /usr/include/fuse3 -I ".root."/include -I ".root."/src/include -I ".root."/3rdparty/p7zip -I ".root."/3rdparty/p7zip/CPP -I ".root."/3rdparty/p7zip/CPP/include_windows -I ".root."/src/7zip/include -D_FILE_OFFSET_BITS=64"
let g:ale_cpp_clangcheck_options = g:ale_cpp_clang_options
let g:ale_cpp_clangd_options = g:ale_cpp_clang_options
let g:ale_cpp_gcc_options = g:ale_cpp_clang_options
let g:ale_cpp_clangtidy_options = g:ale_cpp_clang_options
endif
13 changes: 13 additions & 0 deletions .tidyallrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; vim: filetype=dosini

[GenericValidator / ClangFromat]
cmd = clang-format
select = {include,src}/**/*.{c,cpp,h,hpp}
;ignore = {.build,3rdparty}/**/*
argv = --style=file

[GenericTransformer / ClangFromat]
cmd = clang-format
select = {include,src}/**/*.{c,cpp,h,hpp}
;ignore = {.build,3rdparty}/**/*
argv = --style=file
1 change: 1 addition & 0 deletions 3rdparty/p7zip
Submodule p7zip added at f30c85
87 changes: 87 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required (VERSION 3.12 FATAL_ERROR)

project (fuse3-p7zip
VERSION 0.9.0
LANGUAGES CXX
)

configure_file (
${CMAKE_CURRENT_LIST_DIR}/cmake/version.hpp.in
${CMAKE_CURRENT_LIST_DIR}/include/version.hpp
@ONLY
)

set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
set (CMAKE_INSTALL_PREFIX /usr)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

find_package (FUSE3 REQUIRED)
include_directories (${FUSE3_INCLUDE_DIR})
include_directories (${CMAKE_CURRENT_LIST_DIR}/3rdparty/p7zip)
include_directories (${CMAKE_CURRENT_LIST_DIR}/3rdparty/p7zip/CPP)
include_directories (${CMAKE_CURRENT_LIST_DIR}/3rdparty/p7zip/CPP/include_windows)
include_directories (${CMAKE_CURRENT_LIST_DIR}/3rdparty/p7zip/CPP/myWindows)

add_executable (${PROJECT_NAME}
src/main.cpp
src/library.cpp
src/string.cpp
src/fuse3.cpp
src/exception.cpp

src/7zip/Library.cpp
src/7zip/Format.cpp
src/7zip/Method.cpp
src/7zip/Archive.cpp
src/7zip/ReadStream.cpp
src/7zip/WriteStream.cpp
src/7zip/ArchiveExtractor.cpp
src/7zip/com.cpp

3rdparty/p7zip/CPP/Common/MyWindows.cpp
3rdparty/p7zip/CPP/Windows/PropVariant.cpp
)

# set_target_properties (${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)

target_compile_features (${PROJECT_NAME} PUBLIC
cxx_std_20
)
target_compile_definitions (${PROJECT_NAME} PUBLIC
_FILE_OFFSET_BITS=64
)
target_compile_options (${PROJECT_NAME} PUBLIC
-Wall
-fmax-errors=20
#--pedantic
#-Wextra
)

target_include_directories (${PROJECT_NAME} PRIVATE
src/include
)
target_include_directories (${PROJECT_NAME} PUBLIC
include
)
target_link_libraries (${PROJECT_NAME} PUBLIC
dl
${FUSE3_LIBRARIES}
)

# man: https://cmake.org/cmake/help/v3.12/command/install.html
install(TARGETS ${PROJECT_NAME}
CONFIGURATIONS Debug
ARCHIVE DESTINATION ~/.local/lib/static
LIBRARY DESTINATION ~/.local/lib
RUNTIME DESTINATION ~/.local/bin
)
install(TARGETS ${PROJECT_NAME}
CONFIGURATIONS Release
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/static
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
Loading

0 comments on commit a9014b2

Please sign in to comment.