Updating autogen.py
This commit is contained in:
1 parent
a1e0a4edbb
commit
e1bb3542ee
2 files changed
+26
-7
No files matched your search
+1
-1
@@ -17,6 +17,6 @@ script:
|
|||||||
- export CC=gcc-9
|
- export CC=gcc-9
|
||||||
- gcc --version
|
- gcc --version
|
||||||
- python --version
|
- python --version
|
||||||
- python autogen.py -e -b -cv -r
|
- python autogen.py -e -b -cv -r -nf
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
+25
-6
@@ -43,6 +43,8 @@ SRC_DIR = f"{OUTPUT_DIR}/{DIR_MAP['SOURCE']}"
|
|||||||
OBJ_DIR = BUILD_DIR
|
OBJ_DIR = BUILD_DIR
|
||||||
# The name of the main test executable
|
# The name of the main test executable
|
||||||
TEST_EXE = f'{OUTPUT_DIR}/main.exe'
|
TEST_EXE = f'{OUTPUT_DIR}/main.exe'
|
||||||
|
# Where .gcov files should go
|
||||||
|
GCOV_DIR = f'{BUILD_DIR}/gcov'
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
|
|
||||||
@@ -50,8 +52,12 @@ TEST_EXE = f'{OUTPUT_DIR}/main.exe'
|
|||||||
CC = 'gcc'
|
CC = 'gcc'
|
||||||
# Compilation Flags
|
# Compilation Flags
|
||||||
CFLAGS = ['-Wall', '-Werror']
|
CFLAGS = ['-Wall', '-Werror']
|
||||||
|
# Link flags
|
||||||
|
LFLAGS = []
|
||||||
# Coverage Flags
|
# Coverage Flags
|
||||||
CVFLAGS = ['--coverage', '-O0']
|
CVFLAGS = ['--coverage', '-O0']
|
||||||
|
# gcov flags
|
||||||
|
GCOV_FLAGS = []
|
||||||
# Include to the main Library
|
# Include to the main Library
|
||||||
# const
|
# const
|
||||||
INCLUDE = ['-I', './src']
|
INCLUDE = ['-I', './src']
|
||||||
@@ -82,10 +88,13 @@ CONFIG = f'''Directory Settings
|
|||||||
INCLUDE_DIR = {INCLUDE_DIR}
|
INCLUDE_DIR = {INCLUDE_DIR}
|
||||||
SRC_DIR = {SRC_DIR}
|
SRC_DIR = {SRC_DIR}
|
||||||
OBJ_DIR = {OBJ_DIR}
|
OBJ_DIR = {OBJ_DIR}
|
||||||
|
GCOV_DIR = {GCOV_DIR}
|
||||||
Compiler Settings
|
Compiler Settings
|
||||||
CC = {CC}
|
CC = {CC}
|
||||||
CFLAGS = {CFLAGS}
|
CFLAGS = {CFLAGS}
|
||||||
|
LFLAGS = {LFLAGS}
|
||||||
CVFLAGS = {CVFLAGS}
|
CVFLAGS = {CVFLAGS}
|
||||||
|
GCOV_FLAGS = {GCOV_FLAGS}
|
||||||
INCLUDE = {INCLUDE}
|
INCLUDE = {INCLUDE}
|
||||||
TINCLUDE = {TINCLUDE}
|
TINCLUDE = {TINCLUDE}
|
||||||
Macro Expansion
|
Macro Expansion
|
||||||
@@ -165,6 +174,7 @@ def assert_structure():
|
|||||||
|
|
||||||
assert_dir(BUILD_DIR)
|
assert_dir(BUILD_DIR)
|
||||||
assert_dir(OBJ_DIR)
|
assert_dir(OBJ_DIR)
|
||||||
|
assert_dir(GCOV_DIR)
|
||||||
|
|
||||||
for lib in ALL_LIBS:
|
for lib in ALL_LIBS:
|
||||||
assert_dir(f'{OBJ_DIR}/{lib.lower()}')
|
assert_dir(f'{OBJ_DIR}/{lib.lower()}')
|
||||||
@@ -174,11 +184,13 @@ def clean_build(cleanfull: bool):
|
|||||||
'''
|
'''
|
||||||
Removes all files generated by compilation and code coverage along with folders.
|
Removes all files generated by compilation and code coverage along with folders.
|
||||||
'''
|
'''
|
||||||
execute_command(['rm', '-r', '*.gcov'])
|
execute_command(['rm', '-r', f'{GCOV_DIR}/*.gcov'])
|
||||||
execute_command(['rm', TEST_EXE])
|
execute_command(['rm', TEST_EXE])
|
||||||
|
execute_command(['rm', '-r', BUILD_DIR])
|
||||||
|
|
||||||
for directory in [BUILD_DIR, SRC_DIR, INCLUDE_DIR]:
|
if cleanfull:
|
||||||
execute_command(['rm', '-r', directory])
|
execute_command(['rm', '-r', SRC_DIR])
|
||||||
|
execute_command(['rm', '-r', INCLUDE_DIR])
|
||||||
|
|
||||||
|
|
||||||
def expand_code():
|
def expand_code():
|
||||||
@@ -268,6 +280,7 @@ def build_tests(with_coverage: bool):
|
|||||||
Build all object files and the main executable for tests
|
Build all object files and the main executable for tests
|
||||||
'''
|
'''
|
||||||
cflags = CFLAGS.copy()
|
cflags = CFLAGS.copy()
|
||||||
|
lflags = CFLAGS.copy()
|
||||||
|
|
||||||
if with_coverage:
|
if with_coverage:
|
||||||
cflags += CVFLAGS
|
cflags += CVFLAGS
|
||||||
@@ -295,6 +308,7 @@ def build_tests(with_coverage: bool):
|
|||||||
# Link everything producing OUTPUT_DIR/main.exe
|
# Link everything producing OUTPUT_DIR/main.exe
|
||||||
cmd = [CC]
|
cmd = [CC]
|
||||||
cmd += cflags
|
cmd += cflags
|
||||||
|
cmd += LFLAGS
|
||||||
cmd += ['-o', TEST_EXE]
|
cmd += ['-o', TEST_EXE]
|
||||||
cmd += [f'{OBJ_DIR}/main.o']
|
cmd += [f'{OBJ_DIR}/main.o']
|
||||||
cmd += [f'{OBJ_DIR}/{data["LIB"].lower()}/{data["SNAME"]}.o' for data in COLLECTIONS]
|
cmd += [f'{OBJ_DIR}/{data["LIB"].lower()}/{data["SNAME"]}.o' for data in COLLECTIONS]
|
||||||
@@ -308,9 +322,10 @@ def run_tests(coverage: bool):
|
|||||||
execute_command([full_path(TEST_EXE)])
|
execute_command([full_path(TEST_EXE)])
|
||||||
|
|
||||||
if coverage:
|
if coverage:
|
||||||
objects = [f'{OBJ_DIR}/main.o']
|
objects = [f'{OBJ_DIR}/main.gcda']
|
||||||
objects += [f'{OBJ_DIR}/{data["LIB"].lower()}/{data["SNAME"]}.o' for data in COLLECTIONS]
|
objects += [f'{OBJ_DIR}/{data["LIB"].lower()}/{data["SNAME"]}.gcda' for data in COLLECTIONS]
|
||||||
execute_command(['gcov'] + objects)
|
execute_command(['gcov'] + GCOV_FLAGS + objects)
|
||||||
|
execute_command(['mv', '*.gcov', GCOV_DIR])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@@ -395,6 +410,10 @@ if __name__ == '__main__':
|
|||||||
if not args.noformat:
|
if not args.noformat:
|
||||||
assert_executable('clang-format')
|
assert_executable('clang-format')
|
||||||
format_expand()
|
format_expand()
|
||||||
|
else:
|
||||||
|
# In case the next task is to build the code from source
|
||||||
|
# This warning is a very annoying one from gcc
|
||||||
|
CFLAGS += ['-Wno-misleading-indentation']
|
||||||
|
|
||||||
if args.fmt_source or args.fmt_tests:
|
if args.fmt_source or args.fmt_tests:
|
||||||
assert_executable('find')
|
assert_executable('find')
|
||||||
|
|||||||
Reference in new issue
Block a user