Browse Source

Improved defines

Chlumsky 1 year ago
parent
commit
f62d2fa4be
2 changed files with 5 additions and 2 deletions
  1. 0 1
      .gitignore
  2. 5 1
      all-in-one/generate.py

+ 0 - 1
.gitignore

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

+ 5 - 1
all-in-one/generate.py

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