Last active
June 25, 2018 01:02
-
-
Save puremourning/45467e81447eadcd9df7957f86c43599 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import os | |
platform_layer = [ | |
'handmade_platform.h', | |
'handmade_shared.h', | |
'SDL2/SDL.h', | |
'SDL2/SDL_opengl.h', | |
'stdio.h', | |
'unistd.h', | |
'fcntl.h', | |
'glob.h', | |
'dlfcn.h', | |
'sys/types.h', | |
'sys/stat.h', | |
'sys/mman.h', | |
'sys/wait.h', | |
'x86intrin.h', | |
'sdl_handmade.h', | |
'handmade_render.h', | |
'handmade_opengl.h' | |
] | |
dll_layer = [ | |
'handmade.h' | |
] | |
includes_per_file = { | |
'sdl_handmade.cpp': [], | |
'handmade_sort.cpp': platform_layer, | |
'handmade_opengl.cpp': platform_layer, | |
'handmade_render.cpp': platform_layer, | |
} | |
def FlagsForFile_old(file_name, **kwargs): | |
ftail = os.path.basename(file_name) | |
includes = (includes_per_file[ftail] | |
if ftail in includes_per_file else dll_layer) | |
incl_flags = list() | |
for i in includes: | |
incl_flags.extend(['-include', i]) | |
return { | |
'flags': [ | |
'-x', 'c++', | |
"-DDEBUG", | |
"-g", | |
"-Wall", | |
"-Wno-write-strings", | |
"-Wno-unused-variable", | |
"-Wno-unused-function", | |
"-Wno-sign-compare", | |
"-Wno-unused-result", | |
"-Wno-strict-aliasing", | |
"-Wno-switch", | |
"-Wno-missing-braces", | |
"-Wno-null-dereference", | |
"-std=c++11", | |
"-fno-rtti", | |
"-fno-exceptions", | |
"-DHANDMADE_INTERNAL=1", | |
"-DHANDMADE_SLOW=1", | |
"-DHANDMADE_SDL=1", | |
"-I" + os.path.join(os.path.dirname(__file__), | |
'cpp/code'), | |
] + subprocess.check_output(['sdl2-config', '--cflags']).split() + | |
incl_flags | |
} | |
def FlagsForFile(file_name, **kwargs): | |
sdl = os.path.join(os.path.dirname(__file__), 'code') | |
head = os.path.dirname(file_name) | |
if head == sdl: | |
tu = os.path.join(sdl, 'sdl_handmade.cpp') | |
else: | |
tu = os.path.join(os.path.dirname(__file__), | |
'cpp', | |
'code', | |
'handmade.cpp') | |
return { | |
# "unity" build | |
'override_filename': tu, | |
'flags': [ | |
'-x', 'c++', | |
"-DDEBUG", | |
"-g", | |
"-Wall", | |
"-Wno-write-strings", | |
"-Wno-unused-variable", | |
"-Wno-unused-function", | |
"-Wno-sign-compare", | |
"-Wno-unused-result", | |
"-Wno-strict-aliasing", | |
"-Wno-switch", | |
"-Wno-missing-braces", | |
"-Wno-null-dereference", | |
"-std=c++11", | |
"-fno-rtti", | |
"-fno-exceptions", | |
"-DHANDMADE_INTERNAL=1", | |
"-DHANDMADE_SLOW=1", | |
"-DHANDMADE_SDL=1", | |
"-I" + os.path.join(os.path.dirname(__file__), | |
'cpp/code'), | |
] + subprocess.check_output(['sdl2-config', '--cflags']).split() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
better (removing junk):