Minor fixes * Sub-directory app
This commit is contained in:
parent
2888dc4e8e
commit
06981cd027
2 changed files with 7 additions and 4 deletions
1
make.py
1
make.py
|
|
@ -9,6 +9,7 @@ from umake import make
|
|||
class Config:
|
||||
CC = 'g++' # Compiler to call
|
||||
APPS = ['app_name'] # Output binaries (need to be found as .cpp directly in SOURCE_DIR)
|
||||
IGNORE_APPS = []
|
||||
JOB_COUNT = int(os.cpu_count() * 0.8) # Concurent jobs (multi-processing)
|
||||
|
||||
BIN_DIR = 'bin' # Output directory (binaries)
|
||||
|
|
|
|||
10
umake.py
10
umake.py
|
|
@ -4,6 +4,7 @@ from argparse import ArgumentParser
|
|||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import shutil
|
||||
import sys
|
||||
|
|
@ -132,19 +133,20 @@ def make(config: Config):
|
|||
for app_name in config.APPS:
|
||||
if 'IGNORE_APPS' in config.__dict__ and app_name in config.IGNORE_APPS:
|
||||
continue
|
||||
app_path = os.path.join(config.BIN_DIR, app_name)
|
||||
app_path = Path(config.BIN_DIR, app_name)
|
||||
if not app_path.parent.exists():
|
||||
app_path.parent.mkdir(parents=True)
|
||||
app_objects = [file_name + '.o' for file_name in config.APPS if file_name != app_name]
|
||||
object_files = [object_path for _, object_path in compile_list
|
||||
if os.path.basename(object_path) not in app_objects]
|
||||
cmd = ' '.join([config.CC, config.COMMON_FLAGS, *object_files, '-o', app_path, config.LINK_FLAGS])
|
||||
print(cmd)
|
||||
cmd = ' '.join([config.CC, config.COMMON_FLAGS, *object_files, '-o', str(app_path), config.LINK_FLAGS])
|
||||
complete = subprocess.run(cmd, check=False, shell=True)
|
||||
if complete.returncode != 0:
|
||||
error_path = app_name
|
||||
if error_path:
|
||||
with open(os.path.join(config.OBJECT_DIR, 'hash.json'), 'w') as hash_file:
|
||||
hash_file.write(json.dumps(hash_dict, indent=1))
|
||||
print('Error linking f{error_path}')
|
||||
print(f'Error linking {error_path}')
|
||||
sys.exit(1)
|
||||
|
||||
# Updating header hashes only if everything compiled and linked correctly
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue