Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kconfig #71

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
404 changes: 404 additions & 0 deletions .config

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mainmenu "cONNXr configuration"

menu "Operators"
source "src/operators/Kconfig"
endmenu

menu "Build options"
source "build.Kconfig"
endmenu
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ LDFLAGS+=-g
LDLIBS+=-lcunit
LDLIBS+=-lm

INCDIR+=.
INCDIR+=include
INCDIR+=src
INCDIR+=src/pb
Expand All @@ -94,6 +95,13 @@ $(BINARY): $(OBJS)

DEFAULT=help

.phony: menuconfig
HELP_menuconfig=run menuconfig
TARGET+=menuconfig
menuconfig:
menuconfig
genconfig

# TODO: Define new objects that are compiled with -fic?
.phony: sharedlib
HELP_sharedlib=build sharedlib binary
Expand Down
134 changes: 134 additions & 0 deletions build.Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
choice BUILD_PRESET
prompt "build preset"
default BUILD_PRESET_RELEASE
config BUILD_PRESET_RELEASE
bool "Release"
help
Release build, turns on optimization and disabled trace generation.
config BUILD_PRESET_DEBUG
bool "Debug"
help
Debug build, turns off optimization and enabled trace generation.
endchoice

comment "use presets if unsure"

config BUILD_WERROR
bool "-Werror"
default y if BUILD_PRESET_RELEASE
default n if BUILD_PRESET_DEBUG
help
Make all warnings into errors.

config BUILD_WPEDANTIC
bool "-Wpedantic"
default y if BUILD_PRESET_DEBUG
default n if BUILD_PRESET_RELEASE
help
Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do
not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used.

Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few require -ansi or a -std option
specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are
supported as well. With this option, they are rejected.

-Wpedantic does not cause warning messages for use of the alternate keywords whose names begin and end with __. This alternate format can also
be used to disable warnings for non-ISO __intN types, i.e. __intN__. Pedantic warnings are also disabled in the expression that follows
"__extension__". However, only system header files should use these escape routes; application programs should avoid them.

Some users try to use -Wpedantic to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it
finds some non-ISO practices, but not all---only those for which ISO C requires a diagnostic, and some others for which diagnostics have been
added.

A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would
be quite different from -Wpedantic. We don't have plans to support such a feature in the near future.

Where the standard specified with -std represents a GNU extended dialect of C, such as gnu90 or gnu99, there is a corresponding base standard,
the version of ISO C on which the GNU extended dialect is based. Warnings from -Wpedantic are given where they are required by the base
standard. (It does not make sense for such warnings to be given only for features not in the specified GNU C dialect, since by definition the
GNU dialects of C include all features the compiler supports with the given option, and there would be nothing to warn about.)


config BUILD_WALL
bool "-Wall"
default y
help
This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the
warning), even in conjunction with macros. This also enables some language-specific warnings described in C++ Dialect Options and Objective-C
and Objective-C++ Dialect Options.

config BUILD_WEXTRA
bool "-Wextra"
default y if BUILD_PRESET_DEBUG
default n if BUILD_PRESET_RELEASE
help
This enables some extra warning flags that are not enabled by -Wall.

choice BUILD_OPTIMIZE
prompt "Optimize"
default BUILD_O2 if BUILD_PRESET_RELEASE
default BUILD_Og if BUILD_PRESET_DEBUG
config BUILD_O1
bool "-O1"
help
Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.
With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation
time.
config BUILD_O2
bool "-O2"
help
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this
option increases both compilation time and the performance of the generated code.
config BUILD_O3
bool "-O3"
help
Optimize yet more. -O3 turns on all optimizations specified by -O2 and more.
config BUILD_O0
bool "-O0"
help
Reduce compilation time and make debugging produce the expected results. This is the default.
config BUILD_Os
bool "-Os"
help
Optimize for size. -Os enables all -O2 optimizations except those that often increase code size,
It also enables -finline-functions, causes the compiler to tune for code size rather than execution speed, and performs further optimizations
designed to reduce code size.
config BUILD_Ofast
bool "-Ofast"
help
Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all
standard-compliant programs.
config BUILD_Og
bool "-Og"
help
Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable
level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than -O0 for producing
debuggable code because some compiler passes that collect debug information are disabled at -O0.
Like -O0, -Og completely disables a number of optimization passes so that individual options controlling them have no effect. Otherwise -Og
enables all -O1 optimization flags except for those that may interfere with debugging:
endchoice

config BUILD_STD
string "-std"
default "c99"
help
Determine the language standard.

menuconfig HAVE_TRACING
bool "Tracing"
default y if BUILD_PRESET_DEBUG
default n if BUILD_PRESET_RELEASE
help
Enable tracing macros.
if HAVE_TRACING
config TRACE_LEVEL
int "TRACE_LEVEL"
depends on HAVE_TRACING
default 0
help
Determines how many traces should be generated. Higher numbers include all lower ones.
0: None (except asserts)
1: execution flow related
2: data flow related
3 and more: internals
endif