uui/make.py

39 lines
1.4 KiB
Python

#! python3
from pathlib import Path
import shutil
from umake.umake import get_hash, make, Config
def main():
config = Config()
def pre_compile():
# Copying OpenGL shaders
src_opengl_shader_path = config.source_dir / 'uui' / 'opengl' / 'shaders'
for shader_path in (
list(src_opengl_shader_path.rglob('*.vert'))
+ list(src_opengl_shader_path.rglob('*.frag'))):
out_path = config.bin_dir / shader_path.relative_to(config.source_dir)
if out_path.exists() and get_hash(shader_path) == get_hash(out_path):
continue
if not out_path.parent.exists():
out_path.parent.mkdir(parents=True)
shutil.copy(shader_path, out_path)
config.apps = [str(p.relative_to(Path('src')))[:-4] for p in (config.source_dir / 'test').rglob('*.cpp')]
config.watch = True
config.common_flags = '-std=c++20 -fno-semantic-interposition'
config.common_debug_flags = '-g -Og -DDEBUG'
config.common_release_flags = '-O2 -flto=auto'
config.compile_flags = f'-Wall -Wextra -Wpedantic -Wconversion -I{config.include_dir} `pkg-config --cflags glfw3 gl x11 freetype2`'
config.link_flags = '-lpthread -ldl `pkg-config --libs glfw3 gl freetype2`'
config.pre_compile_function = pre_compile
make(config)
if __name__ == '__main__':
main()