Improved defines

This commit is contained in:
Chlumsky 2024-05-13 17:34:46 +02:00
parent dcc0cd3780
commit aec6abe4e5
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View File

@ -26,7 +26,6 @@ output.png
render.png
CMakeUserPresets.json
out/
/all-in-one/
/build_xcode/
/cmake-gen.bat
/line-ending-check.bat

View File

@ -80,6 +80,10 @@ header = """
"""
source = """
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "msdfgen.h"
#include <queue>
@ -136,7 +140,7 @@ license = '\n'.join([' * '+line for line in license.strip().split('\n')])
for filename in sourceList:
with open(os.path.join(rootDir, *filename.split('/')), 'r') as file:
src = file.read()
src = '\n'.join([line for line in src.split('\n') if not re.match(r'^\s*#(include\s.*|pragma\s+once)\s*$', line)])
src = '\n'.join([line for line in src.split('\n') if not re.match(r'^\s*#(include\s.*|pragma\s+once|define\s+(_CRT_SECURE_NO_WARNINGS|_USE_MATH_DEFINES))\s*$', line)])
if filename.startswith('ext/import-font.'):
src = '#ifdef MSDFGEN_USE_FREETYPE\n\n'+src+'\n\n#endif\n\n'
if filename.endswith('.h') or filename.endswith('.hpp'):