diff --git a/README.md b/README.md index 1213e95..33eca16 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,52 @@ -## Pilot Light Build -### Background -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 +

+

A lightweight game engine with minimal dependencies.

-### Requirements -* 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. +

+ build + static-analysis + tests +

-### Benefits Over Raw Scripts -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. +

+ Information • + Developer Notes • + License • + Gallery • + Inspiration +

-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. +

+ Tooling Image +

-### Alternatives - -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 +## Information 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 + +

+ Sponza 0 +

+ +## 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 diff --git a/pl_build/core.py b/pl_build/core.py index 2b87615..f14fc4b 100644 --- a/pl_build/core.py +++ b/pl_build/core.py @@ -14,7 +14,7 @@ # [SECTION] version #----------------------------------------------------------------------------- -__version__ = "1.0.1" +__version__ = "1.0.2" #----------------------------------------------------------------------------- # [SECTION] imports @@ -152,10 +152,10 @@ class _CompilerProfile: def __init__(self): - self.compilers = None - self.platforms = None - self.configurations = None - self.targets = None + self.compiler_filter = None + self.platform_filter = None + self.configuration_filter = None + self.target_filter = None self.output_directory = None self.definitions = [] @@ -171,40 +171,40 @@ class _CompilerProfile: def is_active(self): - if self.targets is not None: + if self.target_filter is not None: found = False - for target in self.targets: + for target in self.target_filter: if target == _context._target_name: found = True break if not found: return False - if self.configurations is not None: + if self.configuration_filter is not None: found = False - for config_name in self.configurations: + for config_name in self.configuration_filter: if config_name == _context._config_name: found = True break if not found: return False - if self.platforms is not None: + if self.platform_filter is not None: found = False - for platform_name in self.platforms: + for platform_name in self.platform_filter: if platform_name == _context._platform_name: found = True break if not found: return False - if self.compilers is not None: + if self.compiler_filter is not None: found = False - for name in self.compilers: + for name in self.compiler_filter: if name == _context._working_settings.name: found = True break @@ -587,213 +587,27 @@ def set_pre_target_build_step(code: str): def set_post_target_build_step(code: str): _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() - - if "targets" in kwargs: - profile.targets = kwargs["targets"] + profile.compiler_filter = compiler_filter + profile.platform_filter = platform_filter + 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) def get_script_data() -> ScriptData: diff --git a/setup.py b/setup.py index 0194a39..ca2f3ee 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import setuptools from codecs import open import os -wip_version = "1.0.1" +wip_version = "1.0.2" def readme(): try: