File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 1414
1515import (" //build_overrides/build.gni" )
1616import (" //build_overrides/chip.gni" )
17+ import (" ${ build_root } /config/linux/pkg_config.gni" )
18+
19+ pkg_config (" sdl2_pkgconfig" ) {
20+ packages = [ " sdl2" ]
21+ }
1722
1823config (" imgui_config" ) {
1924 include_dirs = [
@@ -22,18 +27,17 @@ config("imgui_config") {
2227 ]
2328 defines = [ " CHIP_IMGUI_ENABLED=1" ]
2429
25- # FUTURE: these should be parsed from `sdl2-config --cflags`
30+ # Use pkg-config for SDL2 on all platforms
31+ # FUTURE: SDL2 libs should be from `sdl2-config --libs`
32+ configs = [ " :sdl2_pkgconfig" ]
33+
2634 if (current_os == " mac" ) {
27- # Default path setup by `brew install sdl2`
28- include_dirs += [ " /usr/local/include/SDL2" ]
2935 defines += [ " _THREAD_SAFE" ]
3036 ldflags = [
3137 " -framework" ,
3238 " OpenGL" ,
3339 ]
3440 } else {
35- # Linux defaults
36- include_dirs += [ " /usr/include/SDL2" ]
3741 defines += [ " _REENTRANT" ]
3842 }
3943}
@@ -61,14 +65,12 @@ source_set("imgui") {
6165 " repo/backends/imgui_impl_sdl2.h" ,
6266 ]
6367
64- # FUTURE: SDL2 libs should be from `sdl2-config --libs`
65- libs = [
66- " SDL2" ,
67- " dl" ,
68- ]
69-
68+ # Additional libs needed on Linux beyond what pkg-config provides
7069 if (current_os == " linux" ) {
71- libs += [ " GL" ]
70+ libs = [
71+ " dl" ,
72+ " GL" ,
73+ ]
7274 }
7375
7476 public_configs = [ " :imgui_config" ]
You can’t perform that action at this time.
0 commit comments