-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from sysprog21/integrate-kconfig
Make build system fully configurable
- Loading branch information
Showing
19 changed files
with
11,240 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Placeholder */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Twin - A Tiny Window System | ||
* Copyright (c) 2024 National Cheng Kung University, Taiwan | ||
* Copyright (c) 2004 Keith Packard <[email protected]> | ||
* All rights reserved. | ||
*/ | ||
|
@@ -33,6 +34,7 @@ | |
static twin_pixmap_t *load_background(twin_screen_t *screen, | ||
const char *filename) | ||
{ | ||
#if defined(CONFIG_LOADER_PNG) | ||
twin_pixmap_t *raw_background = twin_png_to_pixmap(filename, TWIN_ARGB32); | ||
if (!raw_background) /* Fallback to a default pattern */ | ||
return twin_make_pattern(); | ||
|
@@ -65,6 +67,9 @@ static twin_pixmap_t *load_background(twin_screen_t *screen, | |
twin_pixmap_destroy(raw_background); | ||
|
||
return scaled_background; | ||
#else | ||
return twin_make_pattern(); | ||
#endif | ||
} | ||
|
||
static twin_context_t *tx = NULL; | ||
|
@@ -99,12 +104,24 @@ int main(void) | |
twin_screen_set_background( | ||
tx->screen, load_background(tx->screen, ASSET_PATH "/tux.png")); | ||
|
||
#if defined(CONFIG_DEMO_MULTI) | ||
apps_demo_start(tx->screen, "Demo", 100, 100, 400, 400); | ||
#endif | ||
#if defined(CONFIG_DEMO_HELLO) | ||
apps_hello_start(tx->screen, "Hello, World", 0, 0, 200, 200); | ||
#endif | ||
#if defined(CONFIG_DEMO_CLOCK) | ||
apps_clock_start(tx->screen, "Clock", 10, 10, 200, 200); | ||
#endif | ||
#if defined(CONFIG_DEMO_CALCULATOR) | ||
apps_calc_start(tx->screen, "Calculator", 100, 100, 200, 200); | ||
#endif | ||
#if defined(CONFIG_DEMO_LINE) | ||
apps_line_start(tx->screen, "Line", 0, 0, 200, 200); | ||
#endif | ||
#if defined(CONFIG_DEMO_SPLINE) | ||
apps_spline_start(tx->screen, "Spline", 20, 20, 400, 400); | ||
#endif | ||
|
||
twin_dispatch(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
mainmenu "Mado System Configuration" | ||
|
||
config CONFIGURED | ||
bool | ||
default y | ||
|
||
choice | ||
prompt "Backend Selection" | ||
default BACKEND_SDL | ||
|
||
config BACKEND_FBDEV | ||
bool "Linux framebuffer support" | ||
|
||
config BACKEND_SDL | ||
bool "SDL video output support" | ||
|
||
endchoice | ||
|
||
menu "Image Loaders" | ||
|
||
config LOADER_PNG | ||
bool "Enable PNG loader" | ||
default y | ||
|
||
config LOADER_JPEG | ||
bool "Enable JPEG loader" | ||
default y | ||
|
||
endmenu | ||
|
||
menu "Demo Applications" | ||
|
||
config DEMO_APPLICATIONS | ||
bool "Build demo applications" | ||
default y | ||
|
||
config DEMO_MULTI | ||
bool "Build multi demo" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
config DEMO_HELLO | ||
bool "Build Hello world demo" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
config DEMO_CLOCK | ||
bool "Build clock demo" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
config DEMO_CALCULATOR | ||
bool "Build calculator demo" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
config DEMO_LINE | ||
bool "Build line demo" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
config DEMO_SPLINE | ||
bool "Build spline demp" | ||
default y | ||
depends on DEMO_APPLICATIONS | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CONFIG_CONFIGURED=y | ||
# CONFIG_BACKEND_FBDEV is not set | ||
CONFIG_BACKEND_SDL=y | ||
|
||
# | ||
# Image Loaders | ||
# | ||
CONFIG_LOADER_PNG=y | ||
CONFIG_LOADER_JPEG=y | ||
# end of Image Loaders | ||
|
||
# | ||
# Demo Applications | ||
# | ||
CONFIG_DEMO_APPLICATIONS=y | ||
CONFIG_DEMO_MULTI=y | ||
CONFIG_DEMO_HELLO=y | ||
CONFIG_DEMO_CLOCK=y | ||
CONFIG_DEMO_CALCULATOR=y | ||
CONFIG_DEMO_LINE=y | ||
CONFIG_DEMO_SPLINE=y | ||
# end of Demo Applications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.py[co] | ||
build/ | ||
*.egg-info/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2011-2019, Ulf Magnusson <[email protected]> | ||
|
||
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 ALL 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Kconfiglib | ||
|
||
A flexible Python 2/3 Kconfig implementation and library. | ||
|
||
Taken from https://github.com/ulfalizer/Kconfiglib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2019, Ulf Magnusson | ||
# SPDX-License-Identifier: ISC | ||
|
||
""" | ||
Reads a specified configuration file, then writes a new configuration file. | ||
This can be used to initialize the configuration from e.g. an arch-specific | ||
configuration file. This input configuration file would usually be a minimal | ||
configuration file, as generated by e.g. savedefconfig. | ||
The default output filename is '.config'. A different filename can be passed in | ||
the KCONFIG_CONFIG environment variable. | ||
""" | ||
import argparse | ||
|
||
import kconfiglib | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
formatter_class=argparse.RawDescriptionHelpFormatter, | ||
description=__doc__) | ||
|
||
parser.add_argument( | ||
"--kconfig", | ||
default="Kconfig", | ||
help="Top-level Kconfig file (default: Kconfig)") | ||
|
||
parser.add_argument( | ||
"config", | ||
metavar="CONFIGURATION", | ||
help="Input configuration file") | ||
|
||
args = parser.parse_args() | ||
|
||
kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True) | ||
print(kconf.load_config(args.config)) | ||
print(kconf.write_config()) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.