From 1ed601c52c660fa0e497ac5ec8669504e8b37533 Mon Sep 17 00:00:00 2001 From: Corentin Date: Fri, 2 Jul 2021 01:03:55 +0900 Subject: [PATCH] Add pre-compile function in configuration --- make.py | 2 ++ umake.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/make.py b/make.py index 040e043..0de84ce 100644 --- a/make.py +++ b/make.py @@ -23,6 +23,8 @@ class Config: COMPILE_FLAGS = f'-Wall -I{INCLUDE_DIR}' # Flags added for compiling (recommandation : `pkg-config --cflags`) LINK_FLAGS = '' # Flags added for linking (recommandation : `pkg-config --libs`) + PRE_COMPILE_FUNCTION = None # Function to run before compile (not call in --clean situation) + CPP_SOURCES = [filepath for filepath in SOURCE_DIR.rglob('*.cpp') if not filepath.name.startswith('.')] diff --git a/umake.py b/umake.py index cce27ee..3403616 100755 --- a/umake.py +++ b/umake.py @@ -26,6 +26,8 @@ class Config: COMPILE_FLAGS = f'-Wall -I{INCLUDE_DIR}' # Flags added for compiling (recommandation : `pkg-config --cflags`) LINK_FLAGS = '' # Flags added for linking (recommandation : `pkg-config --libs`) + PRE_COMPILE_FUNCTION = None # Function to run before compile (not call in --clean situation) + CPP_SOURCES = SOURCE_DIR.rglob('*.cpp') @@ -61,6 +63,9 @@ def make(config: Config): shutil.rmtree(config.BIN_DIR, ignore_errors=True) return + if config.PRE_COMPILE_FUNCTION is not None: + config.PRE_COMPILE_FUNCTION() + # Update flags and directories for mode debug/release if arguments.type == 'debug': config.COMMON_FLAGS += ' ' + config.COMMON_DEBUG_FLAGS