Add default compile database
This commit is contained in:
parent
7532011245
commit
2306dbfa94
5 changed files with 146 additions and 46 deletions
27
Makefile
27
Makefile
|
|
@ -15,8 +15,15 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
#
|
||||
# Platforms: Linux OpenIndiana
|
||||
# Works from command line (use gmake on OpenIndiana) and from NetBeans
|
||||
# Targets
|
||||
# debug
|
||||
# release
|
||||
# check1 --> uses cppcheck (ensure it is installed to use)
|
||||
# check2 --> uses clang-tidy (currently not available on OpenIndiana)
|
||||
|
||||
# Uses the variable NETBEANSBUILD which is added to _both_ the compile flags
|
||||
# and the link process. Without this option Netbeans will not recognise the
|
||||
# binary, so it is not possible to debug the binary in NetBeans.
|
||||
|
|
@ -57,6 +64,11 @@ endif
|
|||
#
|
||||
OS := $(shell uname -s)
|
||||
|
||||
#
|
||||
# Targets:
|
||||
# check1 uses cppcheck
|
||||
# check2 uses clang-tidy
|
||||
#
|
||||
ifeq ($(MAKECMDGOALS),check1)
|
||||
ifeq ($(OS),Linux)
|
||||
# installed by system and in PATH
|
||||
|
|
@ -76,6 +88,8 @@ endif
|
|||
ifeq ($(MAKECMDGOALS),check2)
|
||||
CPPCHECK := clang-tidy
|
||||
CHECKFLAGS := --checks=*
|
||||
#CHECKFLAGS := --checks=clang-analyzer-*
|
||||
#CHECKFLAGS := --checks=cppcoreguidelines-*, clang-analyzer-*
|
||||
endif
|
||||
|
||||
|
||||
|
|
@ -135,13 +149,14 @@ _CXXFLAGS=-Wall -Weffc++ -pedantic \
|
|||
-Werror=narrowing \
|
||||
-ftrapv -Wfloat-equal -Wpointer-arith \
|
||||
-D_FORTIFY_SOURCE=2 -O2
|
||||
APP_CXXFLAGS=
|
||||
|
||||
CXXFLAGS = $(NETBEANSBUILD) $(DBG_REL) -I./include/ $(_CXXFLAGS) $(APP_CXXFLAG)
|
||||
|
||||
APP_LIBS=
|
||||
LIBS = $(NETBEANSBUILD) $(APP_LIBS)
|
||||
# app specific includes
|
||||
_APP_CXXFLAGS =
|
||||
CXXFLAGS = -std=c++17 $(NETBEANSBUILD) $(DBG_REL) -I./include/ $(_CXXFLAGS) $(_APP_CXXFLAGS)
|
||||
|
||||
# app specific libs
|
||||
_APP_LIBS =
|
||||
LIBS = $(NETBEANSBUILD) $(_APP_LIBS)
|
||||
|
||||
|
||||
debug release: DIRS $(APP)
|
||||
|
|
|
|||
68
compile_commands.json
Normal file
68
compile_commands.json
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{
|
||||
"arguments": [
|
||||
"/usr/bin/g++",
|
||||
"-std=c++17",
|
||||
"-I./include/",
|
||||
"-Wall",
|
||||
"-Weffc++",
|
||||
"-pedantic",
|
||||
"-pedantic-errors",
|
||||
"-Waggregate-return",
|
||||
"-Wcast-align",
|
||||
"-Wcast-qual",
|
||||
"-Wchar-subscripts",
|
||||
"-Wcomment",
|
||||
"-Wdisabled-optimization",
|
||||
"-Wformat",
|
||||
"-Wformat=2",
|
||||
"-Wformat-nonliteral",
|
||||
"-Wformat-security",
|
||||
"-Wformat-y2k",
|
||||
"-Wimport",
|
||||
"-Winit-self",
|
||||
"-Winline",
|
||||
"-Winvalid-pch",
|
||||
"-Wlong-long",
|
||||
"-Wmissing-braces",
|
||||
"-Wmissing-format-attribute",
|
||||
"-Wmissing-include-dirs",
|
||||
"-Wmissing-noreturn",
|
||||
"-Wpacked",
|
||||
"-Wparentheses",
|
||||
"-Wpointer-arith",
|
||||
"-Wredundant-decls",
|
||||
"-Wreturn-type",
|
||||
"-Wsequence-point",
|
||||
"-Wshadow",
|
||||
"-Wsign-compare",
|
||||
"-fstack-protector-all",
|
||||
"-Wstack-protector",
|
||||
"-Wstrict-aliasing",
|
||||
"-Wstrict-aliasing=2",
|
||||
"-Wswitch",
|
||||
"-Wswitch-default",
|
||||
"-Wswitch-enum",
|
||||
"-Wtrigraphs",
|
||||
"-Wunknown-pragmas",
|
||||
"-Wunreachable-code",
|
||||
"-Wvariadic-macros",
|
||||
"-Wvolatile-register-var",
|
||||
"-Wwrite-strings",
|
||||
"-Werror=return-type",
|
||||
"-Werror=narrowing",
|
||||
"-ftrapv",
|
||||
"-Wfloat-equal",
|
||||
"-Wpointer-arith",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
"-O2",
|
||||
"-c",
|
||||
"-o",
|
||||
"obj/myapp.o",
|
||||
"src/myapp.cpp"
|
||||
],
|
||||
"directory": "/home/benn/devl/cpp/projects/NetBeans/nb_generic",
|
||||
"file": "/home/benn/devl/cpp/projects/NetBeans/nb_generic/src/nb_generic.cpp",
|
||||
"output": "/home/benn/devl/cpp/projects/NetBeans/nb_generic/obj/nb_generic.obj",
|
||||
}
|
||||
]
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/file.h to edit this template
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: add.h
|
||||
* Author: benn
|
||||
*
|
||||
* Created on February 24, 2023, 11:07 PM
|
||||
*/
|
||||
|
||||
#ifndef ADD_H
|
||||
#define ADD_H
|
||||
|
||||
int add(int x, int y);
|
||||
|
||||
|
||||
#endif /* ADD_H */
|
||||
|
||||
|
|
@ -3,9 +3,7 @@
|
|||
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
|
||||
<df root="." name="0">
|
||||
<df name="src">
|
||||
<in>add.cpp</in>
|
||||
<in>myapp.cpp</in>
|
||||
<in>testptr.cpp</in>
|
||||
</df>
|
||||
</df>
|
||||
<logicalFolder name="ExternalFiles"
|
||||
|
|
@ -29,8 +27,7 @@
|
|||
<rebuildPropChanged>false</rebuildPropChanged>
|
||||
</toolsSet>
|
||||
<flagsDictionary>
|
||||
<element flagsID="0" commonFlags="-march=x86-64 -fstack-protector-all -O2"/>
|
||||
<element flagsID="1"
|
||||
<element flagsID="0"
|
||||
commonFlags="-pedantic -pedantic-errors -fstack-protector-all -O2"/>
|
||||
</flagsDictionary>
|
||||
<codeAssistance>
|
||||
|
|
@ -53,16 +50,9 @@
|
|||
</preBuild>
|
||||
</makefileType>
|
||||
<item path="src/myapp.cpp" ex="false" tool="1" flavor2="0">
|
||||
<ccTool flags="1">
|
||||
<incDir>
|
||||
<pElem>include</pElem>
|
||||
<pElem>.</pElem>
|
||||
</incDir>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="src/testptr.cpp" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="0">
|
||||
<incDir>
|
||||
<pElem>include</pElem>
|
||||
<pElem>.</pElem>
|
||||
</incDir>
|
||||
</ccTool>
|
||||
|
|
@ -74,9 +64,6 @@
|
|||
<dependencyChecking>false</dependencyChecking>
|
||||
<rebuildPropChanged>false</rebuildPropChanged>
|
||||
</toolsSet>
|
||||
<flagsDictionary>
|
||||
<element flagsID="0" commonFlags="-march=x86-64 -fstack-protector-all -O2"/>
|
||||
</flagsDictionary>
|
||||
<codeAssistance>
|
||||
</codeAssistance>
|
||||
<makefileType>
|
||||
|
|
@ -99,9 +86,51 @@
|
|||
<preBuildCommand></preBuildCommand>
|
||||
</preBuild>
|
||||
</makefileType>
|
||||
<item path="src/testptr.cpp" ex="false" tool="1" flavor2="0">
|
||||
<ccTool flags="0">
|
||||
</ccTool>
|
||||
</conf>
|
||||
<conf name="check1" type="0">
|
||||
<toolsSet>
|
||||
<compilerSet>default</compilerSet>
|
||||
<dependencyChecking>false</dependencyChecking>
|
||||
<rebuildPropChanged>false</rebuildPropChanged>
|
||||
</toolsSet>
|
||||
<codeAssistance>
|
||||
</codeAssistance>
|
||||
<makefileType>
|
||||
<makeTool>
|
||||
<buildCommandWorkingDir>.</buildCommandWorkingDir>
|
||||
<buildCommand>${MAKE} check1</buildCommand>
|
||||
<cleanCommand>${MAKE} clean</cleanCommand>
|
||||
<executablePath></executablePath>
|
||||
</makeTool>
|
||||
<preBuild>
|
||||
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
|
||||
<preBuildCommand></preBuildCommand>
|
||||
</preBuild>
|
||||
</makefileType>
|
||||
<item path="src/myapp.cpp" ex="false" tool="1" flavor2="0">
|
||||
</item>
|
||||
</conf>
|
||||
<conf name="check2" type="0">
|
||||
<toolsSet>
|
||||
<compilerSet>default</compilerSet>
|
||||
<dependencyChecking>false</dependencyChecking>
|
||||
<rebuildPropChanged>false</rebuildPropChanged>
|
||||
</toolsSet>
|
||||
<codeAssistance>
|
||||
</codeAssistance>
|
||||
<makefileType>
|
||||
<makeTool>
|
||||
<buildCommandWorkingDir>.</buildCommandWorkingDir>
|
||||
<buildCommand>${MAKE} check2</buildCommand>
|
||||
<cleanCommand>${MAKE} clean</cleanCommand>
|
||||
<executablePath></executablePath>
|
||||
</makeTool>
|
||||
<preBuild>
|
||||
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
|
||||
<preBuildCommand></preBuildCommand>
|
||||
</preBuild>
|
||||
</makefileType>
|
||||
<item path="src/myapp.cpp" ex="false" tool="1" flavor2="0">
|
||||
</item>
|
||||
</conf>
|
||||
</confs>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
<type>org.netbeans.modules.cnd.makeproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/make-project/1">
|
||||
<name>3_multi_files</name>
|
||||
<name>nb_generic</name>
|
||||
<c-extensions/>
|
||||
<cpp-extensions>cpp</cpp-extensions>
|
||||
<header-extensions>h</header-extensions>
|
||||
<header-extensions/>
|
||||
<sourceEncoding>UTF-8</sourceEncoding>
|
||||
<make-dep-projects/>
|
||||
<sourceRootList>
|
||||
|
|
@ -21,6 +21,14 @@
|
|||
<name>Default</name>
|
||||
<type>0</type>
|
||||
</confElem>
|
||||
<confElem>
|
||||
<name>check1</name>
|
||||
<type>0</type>
|
||||
</confElem>
|
||||
<confElem>
|
||||
<name>check2</name>
|
||||
<type>0</type>
|
||||
</confElem>
|
||||
</confList>
|
||||
<formatting>
|
||||
<project-formatting-style>false</project-formatting-style>
|
||||
|
|
|
|||
Loading…
Reference in a new issue