initial commit for new repo
This commit is contained in:
58
dev/templateC/.clang-format
Normal file
58
dev/templateC/.clang-format
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'true'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AllowShortCaseLabelsOnASingleLine: 'true'
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'false'
|
||||
AlwaysBreakTemplateDeclarations: 'true'
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'true'
|
||||
BreakAfterJavaFieldAnnotations: 'true'
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeInheritanceComma: 'false'
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakStringLiterals: 'true'
|
||||
ColumnLimit: '80'
|
||||
CompactNamespaces: 'false'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
Cpp11BracedListStyle: 'true'
|
||||
FixNamespaceComments: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IndentCaseLabels: 'false'
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: 'true'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '1'
|
||||
NamespaceIndentation: Inner
|
||||
PointerAlignment: Right
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'true'
|
||||
SortUsingDeclarations: 'true'
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceAfterTemplateKeyword: 'false'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '2'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
Standard: Cpp11
|
||||
UseTab: ForIndentation
|
||||
|
||||
...
|
||||
4
dev/templateC/.gitignore
vendored
Normal file
4
dev/templateC/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
bin
|
||||
build
|
||||
debug
|
||||
!.gitignore
|
||||
74
dev/templateC/CMakeLists.txt
Normal file
74
dev/templateC/CMakeLists.txt
Normal file
@@ -0,0 +1,74 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project("PROJECTNAME"
|
||||
VERSION 0.1
|
||||
DESCRIPTION "Description of PROJECTNAME"
|
||||
HOMEPAGE_URL "https://labs.phundrak.fr/phundrak/PROJECTNAME"
|
||||
LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
file(GLOB SRC_FILES "src/*.c")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
include(functions)
|
||||
|
||||
enable_c_compiler_flag_if_supported("-Wall")
|
||||
enable_c_compiler_flag_if_supported("-pedantic")
|
||||
enable_c_compiler_flag_if_supported("-Wextra")
|
||||
enable_c_compiler_flag_if_supported("-Wfloat-equal")
|
||||
enable_c_compiler_flag_if_supported("-Wwrite-strings")
|
||||
enable_c_compiler_flag_if_supported("-Wpointer-arith")
|
||||
enable_c_compiler_flag_if_supported("-Wcast-qual")
|
||||
enable_c_compiler_flag_if_supported("-Wcast-align")
|
||||
enable_c_compiler_flag_if_supported("-Wconversion")
|
||||
enable_c_compiler_flag_if_supported("-Wshadow")
|
||||
enable_c_compiler_flag_if_supported("-Wreduntant-decls")
|
||||
enable_c_compiler_flag_if_supported("-Wdouble-promotion")
|
||||
enable_c_compiler_flag_if_supported("-Winit-self")
|
||||
enable_c_compiler_flag_if_supported("-Wswitch-default")
|
||||
enable_c_compiler_flag_if_supported("-Wswitch-enum")
|
||||
enable_c_compiler_flag_if_supported("-Wundef")
|
||||
enable_c_compiler_flag_if_supported("-Winline")
|
||||
enable_c_compiler_flag_if_supported("-Wpedantic")
|
||||
enable_c_compiler_flag_if_supported("-Wsign-conversion")
|
||||
enable_c_compiler_flag_if_supported("-Wnull-dereference")
|
||||
enable_c_compiler_flag_if_supported("-Wuseless-cast")
|
||||
enable_c_compiler_flag_if_supported("-Wformat=2")
|
||||
enable_c_compiler_flag_if_supported("-Wlifetime")
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
enable_c_compiler_flag_if_supported("-g")
|
||||
else()
|
||||
enable_c_compiler_flag_if_supported("-O3")
|
||||
enable_c_compiler_flag_if_supported("-flto")
|
||||
endif()
|
||||
|
||||
# include_directories(<PUBLIC HEADER DIRECTORIES>)
|
||||
|
||||
# Main software
|
||||
set(TGT PROJECTNAME)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/bin)
|
||||
add_executable(${TGT} ${SRC_FILES})
|
||||
target_compile_features(${TGT} PRIVATE c_std_11)
|
||||
target_include_directories(${TGT} PRIVATE include/PROJECTNAME)
|
||||
#target_link_libraries(${TGT})
|
||||
|
||||
# Tests, -DTESTS=True to activate
|
||||
if(TESTS)
|
||||
set(TESTTGT PROJECTNAME-tests)
|
||||
file(GLOB TEST_FILES "tests/tests.c")
|
||||
add_executable(${TESTTGT} ${TEST_FILES})
|
||||
set_property(TARGET ${TESTTGT} PROPERTY C_STANDARD 11)
|
||||
target_include_directories(${TESTTGT} PRIVATE include/PROJECTNAME)
|
||||
endif()
|
||||
|
||||
# OS specific instructions.
|
||||
if(APPLE)
|
||||
elseif(WIN32)
|
||||
# Windows developer environment specific instructions.
|
||||
if(MINGW)
|
||||
elseif(MSYS)
|
||||
elseif(CYGWIN)
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
else()
|
||||
endif()
|
||||
12
dev/templateC/Makefile
Normal file
12
dev/templateC/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
release:
|
||||
@mkdir -p build bin
|
||||
@cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make
|
||||
|
||||
debug:
|
||||
@mkdir -p build debug
|
||||
@cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make
|
||||
|
||||
clean:
|
||||
@rm -rf bin
|
||||
@rm -rf build
|
||||
@rm -rf debug
|
||||
14
dev/templateC/README.org
Normal file
14
dev/templateC/README.org
Normal file
@@ -0,0 +1,14 @@
|
||||
[[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]]
|
||||
|
||||
* PROJECTNAME
|
||||
|
||||
PROJECTNAME is a C11 project written for and built with CMake.
|
||||
|
||||
* How to build PROJECTNAME
|
||||
|
||||
You can directly run either ~make~ or ~make release~ to compile the release
|
||||
version of the binaries which will be generated in ~bin/~. If you wish to
|
||||
compile its debug version instead, run ~make debug~ to generate the binaries in
|
||||
the ~debug/~ directory. Once you have ran ~make~ at the root of the project, you
|
||||
can recompile the project from the ~build/~ directory if you wish to avoid to
|
||||
re-run CMake.
|
||||
12
dev/templateC/cmake/functions.cmake
Normal file
12
dev/templateC/cmake/functions.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
|
||||
function(enable_c_compiler_flag_if_supported flag)
|
||||
string(FIND "${CMAKE_C_FLAGS}" "${flag}" flag_already_set)
|
||||
if(flag_already_set EQUAL -1)
|
||||
check_c_compiler_flag("${flag}" flag_supported)
|
||||
if(flag_supported)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
unset(flag_supported CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
2440
dev/templateC/doc/Doxyfile
Normal file
2440
dev/templateC/doc/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
6
dev/templateC/src/main.c
Normal file
6
dev/templateC/src/main.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user