blob: befa8321aa21ef875b07c9f25ab024bb1f72133d [file] [log] [blame]
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
config("imgui_config") {
include_dirs = [
"repo",
"repo/backends",
]
defines = [ "CHIP_IMGUI_ENABLED=1" ]
# FUTURE: these should be parsed from `sdl2-config --cflags`
if (current_os == "mac") {
# Default path setup by `brew install sdl2`
include_dirs += [ "/usr/local/include/SDL2" ]
defines += [ "_THREAD_SAFE" ]
ldflags = [
"-framework",
"OpenGL",
]
} else {
# Linux defaults
include_dirs += [ "/usr/include/SDL2" ]
defines += [ "_REENTRANT" ]
}
}
source_set("imgui") {
sources = [
"repo/imconfig.h",
"repo/imgui.cpp",
"repo/imgui.h",
"repo/imgui_draw.cpp",
"repo/imgui_internal.h",
"repo/imgui_tables.cpp",
"repo/imgui_widgets.cpp",
"repo/imstb_rectpack.h",
"repo/imstb_textedit.h",
"repo/imstb_truetype.h",
]
# SDL2 + OPENGL3 backend enabled directly here since
# the includes are circular (backend includes imgui)
sources += [
"repo/backends/imgui_impl_opengl3.cpp",
"repo/backends/imgui_impl_opengl3.h",
"repo/backends/imgui_impl_sdl2.cpp",
"repo/backends/imgui_impl_sdl2.h",
]
# FUTURE: SDL2 libs should be from `sdl2-config --libs`
libs = [
"SDL2",
"dl",
]
if (current_os == "linux") {
libs += [ "GL" ]
}
public_configs = [ ":imgui_config" ]
}