Warn if new header files in include/library/private are not included in either include_files or exclude_files lists for bwc.h generation.
This commit is contained in:
parent
27cdf8d389
commit
f66091747a
2 changed files with 19 additions and 10 deletions
|
@ -91,13 +91,16 @@ destination = current_path.joinpath('include/library/public')
|
||||||
if os.path.isdir(destination) == False:
|
if os.path.isdir(destination) == False:
|
||||||
os.mkdir(destination)
|
os.mkdir(destination)
|
||||||
|
|
||||||
all_header_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))]
|
include_files = ['macros.h', 'constants.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
|
||||||
all_header_files.remove('prim_types_double.h')
|
|
||||||
all_header_files.remove('prim_types_single.h')
|
|
||||||
header_files = ['macros.h', 'constants.h', 'dwt.h', 'tagtree.h', 'mq_types.h', 'mq.h',
|
|
||||||
'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.h']
|
'bitstream.h', 'codestream.h', 'tier1.h', 'tier2.h', 'types.h', 'libbwc.h']
|
||||||
header_files += [element for element in all_header_files if element not in header_files]
|
exclude_files = ["prim_types_double.h", "prim_types_single.h"]
|
||||||
print(header_files)
|
all_files = [f for f in os.listdir(source) if os.path.isfile(os.path.join(source, f))]
|
||||||
|
missing_files = [f for f in all_files if f not in include_files and f not in exclude_files]
|
||||||
|
if missing_files:
|
||||||
|
raise Warning("Consider updating public_header.py. Missing header file(s)"
|
||||||
|
f"\n{missing_files}\n"
|
||||||
|
"should be added to include_files or exclude_files lists.")
|
||||||
|
print(include_files)
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Create the I/O stream and write the bwc file header. #
|
# Create the I/O stream and write the bwc file header. #
|
||||||
|
@ -216,7 +219,7 @@ printFlg = False
|
||||||
buff = ""
|
buff = ""
|
||||||
brktCnt = 0
|
brktCnt = 0
|
||||||
|
|
||||||
for file in header_files:
|
for file in include_files:
|
||||||
with open(source.joinpath(file)) as f:
|
with open(source.joinpath(file)) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if("BWC_" in line):
|
if("BWC_" in line):
|
||||||
|
@ -253,7 +256,7 @@ public_header.write(ubox + tab + sbox + lspaces * " " + "____ ____ _ _ ____ ___
|
||||||
delimFlg = False
|
delimFlg = False
|
||||||
buff = ""
|
buff = ""
|
||||||
|
|
||||||
for file in header_files:
|
for file in include_files:
|
||||||
with open(source.joinpath(file)) as f:
|
with open(source.joinpath(file)) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if("typedef enum" in line):
|
if("typedef enum" in line):
|
||||||
|
@ -291,7 +294,7 @@ preProcFlg = False
|
||||||
buff = ""
|
buff = ""
|
||||||
brktCnt = 0
|
brktCnt = 0
|
||||||
|
|
||||||
for file in header_files:
|
for file in include_files:
|
||||||
with open(source.joinpath(file)) as f:
|
with open(source.joinpath(file)) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if("typedef struct" in line or
|
if("typedef struct" in line or
|
||||||
|
|
|
@ -57,7 +57,13 @@ if("${PREC}" STREQUAL "Single")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND python3 public_header.py ${PYTHON_ARGUMENT}
|
execute_process(COMMAND python3 public_header.py ${PYTHON_ARGUMENT}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
ERROR_VARIABLE error_output)
|
||||||
|
|
||||||
|
if(result)
|
||||||
|
message(WARNING "Public header generation failed: ${error_output}")
|
||||||
|
endif()
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Set the linking type according to user choice and add #
|
# Set the linking type according to user choice and add #
|
||||||
|
|
Loading…
Reference in a new issue