Easily cross compile your C/C++ projects or create your SDK
Project description
ebuild
Intro
Easily cross compile your C/C++ projects or create your SDK with simple Python scripts, let forget Makefile or CMake.
Features
- Easy to use, only a few fill-in-the-blanks based on simple template.
- Scalable and flexible, Use Python script, easy-to-use and powerfull, real program language, not string based language like CMake.
- Configurable, support menuconfig.
Install
Ensure you have Python installed first, then:
pip install ebuild
Execute ebuild -h to start.
First project
ebuild create hello_world
cd hello_world
ebuild # or ebuild build
ebuild run
ebuild clean
ebuild distclean
In hello_world directory have an ebuild_config.py file like:
from ebuild import find_src
class Project:
build_type = "binary" # binary, shared, static
id = "hello"
name = "Hello"
desc = "Simple hello program"
home = "https://github.com/neutree/ebuild"
license = "MIT"
version = "1.0.0"
def on_add_src(self, dl_dir):
srcs = find_src(".", [".c", ".cpp"], resursive = False)
return srcs
class Projectmeans this is a project.build_type = "binary"means we need to generate a executable binary file.idis the unique name of this project, the final binary file name will be this.nameis the name of this project.deschomelicenseare description, home url, open source license.versionis the version of project, format must be likemajor.minor.patchon_add_srcfunction need we return the souce files list, so we invokefind_srcto find allc/cppfile in current directory.
Cross compile
When execute ebuild, will automatically build for host(your PC) with default toolchain(e.g. gcc on Linux).
If you want to cross compile, you need to assign your platform info, by default ebuild ingrated some platforms like linux/windows/macos and some special embeded platforms, you can find them by ebuild platform list, every platform has some toolchains, use ebuild toolchain platform_name to show.
Then use ebuild config platform=linux toolchain=gcc, this config will save to this project's .config file, remove .config file will change back to default platform.
If you want to customize a new special platform or toolchain, edit or create .yaml file in ~/.ebuild/platforms, or commit code to ebuild.
Menuconfig
Execute ebuild menu, then you can select options in GUI mode.
Press Q or ESC to exit, the config items will be saved to build/config directory, and you can use config item in source like
#include "global_config.h"
#if CONFIG_LIBNAME_XXXX
#endif
Which LIBNAME is the uppercase of library name, XXXX is uppercase config item in the library.
Add requirements
If your project want to use some library, return your requires in on_requires function like:
class Project:
def on_requires(self):
'''
Returns:
requires I need, list type.
'''
requires = [
# "inifile2"
# "inifile2 >= 1.0.0"
# "inifile2 == 1.0.0"
# "inifile2 <= 1.0.0"
# "inifile2 > 1.0.0"
]
return requires
Where to find libraries:
- Official libraries repository: use int
add_requireswill automatically download. - Third party libraries contains
ebuild_config.py:- Download manually and put in
~/.ebuild/libraries. - Or just return github address like ["git+https://github.com/xxx/xxx.git"], ebuild will automatically download it, ensure you have
gitinstalled and good network can connecte togithub.com.
- Download manually and put in
Customize a library
Write a Lib class in ebuild_config.py file, implement callbacks
class Lib:
def on_add_include(self, dl_dir):
return ["inc"]
def on_add_src(self, dl_dir):
srcs = find_src("src", [".c", ".cpp"], resursive = False)
return srcs
Change data store path
All downloaded data will be downloaded to ~/.ebuild, you can customize this path by ebuild config data_path=/xxx/xxx/xxx
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ebuild-1.0.0.tar.gz.
File metadata
- Download URL: ebuild-1.0.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de1f6fc2dba2087b1169912672d67d57d1a3bbfd39263915820283775e71b4bb
|
|
| MD5 |
68e2a9bda0ea7301394952782fda217c
|
|
| BLAKE2b-256 |
503a4da330fdbcfd592b7c3c4cf6482ffd086df1402c351d77146798244e0957
|