Add pre-compile function in configuration
This commit is contained in:
parent
2c9120752e
commit
1ed601c52c
2 changed files with 7 additions and 0 deletions
2
make.py
2
make.py
|
|
@ -23,6 +23,8 @@ class Config:
|
||||||
COMPILE_FLAGS = f'-Wall -I{INCLUDE_DIR}' # Flags added for compiling (recommandation : `pkg-config --cflags`)
|
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`)
|
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('.')]
|
CPP_SOURCES = [filepath for filepath in SOURCE_DIR.rglob('*.cpp') if not filepath.name.startswith('.')]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
5
umake.py
5
umake.py
|
|
@ -26,6 +26,8 @@ class Config:
|
||||||
COMPILE_FLAGS = f'-Wall -I{INCLUDE_DIR}' # Flags added for compiling (recommandation : `pkg-config --cflags`)
|
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`)
|
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')
|
CPP_SOURCES = SOURCE_DIR.rglob('*.cpp')
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -61,6 +63,9 @@ def make(config: Config):
|
||||||
shutil.rmtree(config.BIN_DIR, ignore_errors=True)
|
shutil.rmtree(config.BIN_DIR, ignore_errors=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if config.PRE_COMPILE_FUNCTION is not None:
|
||||||
|
config.PRE_COMPILE_FUNCTION()
|
||||||
|
|
||||||
# Update flags and directories for mode debug/release
|
# Update flags and directories for mode debug/release
|
||||||
if arguments.type == 'debug':
|
if arguments.type == 'debug':
|
||||||
config.COMMON_FLAGS += ' ' + config.COMMON_DEBUG_FLAGS
|
config.COMMON_FLAGS += ' ' + config.COMMON_DEBUG_FLAGS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue