refac: version 1.0.2
All checks were successful
Deploy Tools / build-package (push) Successful in 24s
All checks were successful
Deploy Tools / build-package (push) Successful in 24s
This commit is contained in:
parent
9d5da19a22
commit
53585cc906
71
README.md
71
README.md
@ -1,37 +1,52 @@
|
|||||||
## Pilot Light Build
|
|
||||||
|
|
||||||
### Background
|
<h1 align="center">
|
||||||
The **pl-build** project is a child of the larger [Pilot Light](https://github.com/PilotLightTech/pilotlight) project. In this larger project, we do not have a "build system" per se. Instead we prefer to write batch/bash scripts that directly call the compiler. If the project was an end user product, this would be the end of it. However, this is not the case. It is meant to be easily be extended through adding additional extensions and being used as a "pilot light" to start new projects. With this comes a couple issues. Extensions are meant to be cross platform so users need the ability to easily add new binaries for all target platforms with minimal duplication. Users shouldn't need to be bash or batch scripting experts to build new targets for all platforms and shouldn't need to test the build scripts continuously on each platform.
|
Pilot Light
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p align="center">A lightweight game engine with minimal dependencies.</p>
|
||||||
|
|
||||||
### Requirements
|
<h1></h1>
|
||||||
* minimize duplicated information
|
|
||||||
* fine-grained control over compilation settings
|
|
||||||
* support unity builds
|
|
||||||
* support hot reloading
|
|
||||||
* generate scripts that can be used separately
|
|
||||||
* easily extended
|
|
||||||
* easy to add new platforms and compilers
|
|
||||||
* extremely light weight
|
|
||||||
* easy to customize and extended
|
|
||||||
* no preference on editor/IDE
|
|
||||||
* doesn't pretend different platforms don't exist
|
|
||||||
* entire build system can be understood in an hour
|
|
||||||
|
|
||||||
Another way of putting it, is we want to focus on what matters to build binaries. Ultimately this is just compiler & linker settings. We don't want to think about the differences in bash/batch syntax.
|
<p align="center">
|
||||||
|
<a href="https://github.com/PilotLightTech/pilotlight/actions?workflow=Build"><img src="https://github.com/PilotLightTech/pilotlight/actions/workflows/build.yml/badge.svg?branch=master" alt="build"></a>
|
||||||
|
<a href="https://github.com/PilotLightTech/pilotlight/actions?workflow=Static%20Analysis"><img src="https://github.com/PilotLightTech/pilotlight/actions/workflows/static-analysis.yml/badge.svg?branch=master" alt="static-analysis"></a>
|
||||||
|
<a href="https://github.com/PilotLightTech/pilotlight/actions?workflow=Tests"><img src="https://github.com/PilotLightTech/pilotlight/actions/workflows/tests.yml/badge.svg?branch=master" alt="tests"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
### Benefits Over Raw Scripts
|
<p align="center">
|
||||||
Prior to this system, when we were writing scripts directly, we did what every developer does and began overengineering the build scripts to improve things like information duplication, configuration options, etc. However, this led to more compilicated scripts that were harder to debug and heavily deviated between platforms since batch/command are very different in features and syntax. It became hard for newcomers to work on and encouraged differences to creep in between the way individual build scripts worked.
|
<a href="#information">Information</a> •
|
||||||
|
<a href="#developer-notes">Developer Notes</a> •
|
||||||
|
<a href="#license">License</a> •
|
||||||
|
<a href="#gallery">Gallery</a> •
|
||||||
|
<a href="#inspiration">Inspiration</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
Using pl-build allows the clever/overengineered solutions to be accomplished at a higher level by the user in python. In the end, build scripts are output that are very straight forward and much easier to debug. It also makes it easier to implement new backends to target new compilers, platforms, scripting languages, etc.
|
<p align="center">
|
||||||
|
<a href="https://github.com/PilotLightTech/pilotlight-assets"><img src="https://github.com/PilotLightTech/pilotlight-assets/blob/master/images/tooling2.png" alt="Tooling Image"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
### Alternatives
|
## Information
|
||||||
|
|
||||||
Keep in mind, **we don't want a build system**. We don't want to hide away details or abstract away control. We ultimately just need a tool to assist in generating the scripts for each platform.
|
|
||||||
|
|
||||||
What about other CMake (and others)? They are bloated over complicated messes. They are also overkill for what we need (see Requirements section above).
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
Under construction.
|
Under construction.
|
||||||
|
|
||||||
|
## Developer Notes
|
||||||
|
Information for developers can be found in the [wiki](https://github.com/PilotLightTech/pilotlight/wiki). This includes:
|
||||||
|
* [building](https://github.com/PilotLightTech/pilotlight/wiki/Building)
|
||||||
|
* [contributing](https://github.com/PilotLightTech/pilotlight/wiki/Contributing)
|
||||||
|
* [style guide](https://github.com/PilotLightTech/pilotlight/wiki/Style-Guide)
|
||||||
|
|
||||||
|
## License
|
||||||
|
Pilot Light is licensed under the [MIT License](https://github.com/PilotLightTech/pilotlight/blob/master/LICENSE).
|
||||||
|
|
||||||
|
## Gallery
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/PilotLightTech/pilotlight"><img src="https://github.com/PilotLightTech/pilotlight-assets/blob/master/gifs/sponza0.gif" alt="Sponza 0" width="2553"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Inspiration
|
||||||
|
This project is inspired by:
|
||||||
|
* [Omar Cornut](http://www.miracleworld.net/) & [Dear ImGui](https://github.com/ocornut/imgui).
|
||||||
|
* Casey Muratori & [Handmade Hero](https://handmadehero.org/)
|
||||||
|
* Turánszki János & [Wicked Engine](https://wickedengine.net/)
|
||||||
|
* [Sean Barrett](https://nothings.org/) & his [stb](https://github.com/nothings/stb) libraries
|
||||||
|
* _The Machinery_ before they were abducted
|
||||||
|
248
pl_build/core.py
248
pl_build/core.py
@ -14,7 +14,7 @@
|
|||||||
# [SECTION] version
|
# [SECTION] version
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# [SECTION] imports
|
# [SECTION] imports
|
||||||
@ -152,10 +152,10 @@ class _CompilerProfile:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.compilers = None
|
self.compiler_filter = None
|
||||||
self.platforms = None
|
self.platform_filter = None
|
||||||
self.configurations = None
|
self.configuration_filter = None
|
||||||
self.targets = None
|
self.target_filter = None
|
||||||
|
|
||||||
self.output_directory = None
|
self.output_directory = None
|
||||||
self.definitions = []
|
self.definitions = []
|
||||||
@ -171,40 +171,40 @@ class _CompilerProfile:
|
|||||||
|
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
|
|
||||||
if self.targets is not None:
|
if self.target_filter is not None:
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for target in self.targets:
|
for target in self.target_filter:
|
||||||
if target == _context._target_name:
|
if target == _context._target_name:
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.configurations is not None:
|
if self.configuration_filter is not None:
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for config_name in self.configurations:
|
for config_name in self.configuration_filter:
|
||||||
if config_name == _context._config_name:
|
if config_name == _context._config_name:
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.platforms is not None:
|
if self.platform_filter is not None:
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for platform_name in self.platforms:
|
for platform_name in self.platform_filter:
|
||||||
if platform_name == _context._platform_name:
|
if platform_name == _context._platform_name:
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.compilers is not None:
|
if self.compiler_filter is not None:
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for name in self.compilers:
|
for name in self.compiler_filter:
|
||||||
if name == _context._working_settings.name:
|
if name == _context._working_settings.name:
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
@ -587,213 +587,27 @@ def set_pre_target_build_step(code: str):
|
|||||||
def set_post_target_build_step(code: str):
|
def set_post_target_build_step(code: str):
|
||||||
_context._working_settings.post_build_step = code
|
_context._working_settings.post_build_step = code
|
||||||
|
|
||||||
def add_compiler_flags_profile(*args, **kwargs):
|
def add_profile(*, compiler_filter=None, platform_filter=None, configuration_filter=None, target_filter=None, definitions=[], include_directories=[],
|
||||||
|
link_directories=[], static_link_libraries=[], dynamic_link_libraries=[], link_frameworks=[], source_files=[],
|
||||||
|
compiler_flags=[], linker_flags=[], output_directory: str = None, output_binary_extension: str = None):
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
profile = _CompilerProfile()
|
||||||
|
profile.compiler_filter = compiler_filter
|
||||||
if "targets" in kwargs:
|
profile.platform_filter = platform_filter
|
||||||
profile.targets = kwargs["targets"]
|
profile.configuration_filter = configuration_filter
|
||||||
|
profile.target_filter = target_filter
|
||||||
|
profile.definitions = definitions
|
||||||
|
profile.include_directories = include_directories
|
||||||
|
profile.output_directory = output_directory
|
||||||
|
profile.link_directories = link_directories
|
||||||
|
profile.static_link_libraries = static_link_libraries
|
||||||
|
profile.dynamic_link_libraries = dynamic_link_libraries
|
||||||
|
profile.link_frameworks = link_frameworks
|
||||||
|
profile.source_files = source_files
|
||||||
|
profile.compiler_flags = compiler_flags
|
||||||
|
profile.linker_flags = linker_flags
|
||||||
|
profile.output_binary_extension = output_binary_extension
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.compiler_flags = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_include_directories_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.include_directories = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_definitions_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.definitions = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_link_directories_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.link_directories = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_static_link_libraries_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.static_link_libraries = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_dynamic_link_libraries_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.dynamic_link_libraries = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_link_frameworks_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.link_frameworks = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_source_files_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.source_files = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def add_linker_flags_profile(*args, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.linker_flags = args
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def set_output_binary_extension_profile(extension: str, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.output_binary_extension = extension
|
|
||||||
_context._profiles.append(profile)
|
|
||||||
|
|
||||||
def set_output_directory_profile(directory: str, **kwargs):
|
|
||||||
|
|
||||||
profile = _CompilerProfile()
|
|
||||||
|
|
||||||
if "targets" in kwargs:
|
|
||||||
profile.targets = kwargs["targets"]
|
|
||||||
|
|
||||||
if "configurations" in kwargs:
|
|
||||||
profile.configurations = kwargs["configurations"]
|
|
||||||
|
|
||||||
if "compilers" in kwargs:
|
|
||||||
profile.compilers = kwargs["compilers"]
|
|
||||||
|
|
||||||
if "platforms" in kwargs:
|
|
||||||
profile.platforms = kwargs["platforms"]
|
|
||||||
|
|
||||||
profile.output_directory = directory
|
|
||||||
_context._profiles.append(profile)
|
_context._profiles.append(profile)
|
||||||
|
|
||||||
def get_script_data() -> ScriptData:
|
def get_script_data() -> ScriptData:
|
||||||
|
Loading…
Reference in New Issue
Block a user