Skip to content

Commit

Permalink
refactor: move imgui-related sources into third_party/imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jun 26, 2024
1 parent a091139 commit f18bd67
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 3,867 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Stroustrup
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<[a-z_]+\.h>' # C system headers
- Regex: '^<[a-zA-Z0-9_]+\.h>' # C system headers
Priority: 1
SortPriority: 0
CaseSensitive: false
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ build/*
bedrock_server/*
wheelhouse/*
stubs/*
third_party/imgui/*
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ install(TARGETS endstone_python DESTINATION "endstone/_internal/" COMPONENT ends
# endstone::core
# ==============
file(GLOB_RECURSE ENDSTONE_CORE_SOURCE_FILES CONFIGURE_DEPENDS "src/endstone_core/*.cpp")
if (WIN32)
list(APPEND ENDSTONE_CORE_SOURCE_FILES "third_party/imgui/imgui_impl_glfw.cpp")
list(APPEND ENDSTONE_CORE_SOURCE_FILES "third_party/imgui/imgui_impl_opengl3.cpp")
endif ()
add_library(endstone_core ${ENDSTONE_CORE_SOURCE_FILES})
add_library(endstone::core ALIAS endstone_core)
target_link_libraries(endstone_core PUBLIC endstone::headers boost::boost concurrentqueue::concurrentqueue EnTT::EnTT
nonstd::expected-lite glm::glm magic_enum::magic_enum Microsoft.GSL::GSL spdlog::spdlog tomlplusplus::tomlplusplus)
if (WIN32)
target_link_libraries(endstone_core PUBLIC GLEW::GLEW glfw imgui::imgui)
target_include_directories(endstone_core PUBLIC third_party/imgui)
elseif (UNIX)
target_link_libraries(endstone_core PUBLIC ${CMAKE_DL_LIBS})
target_compile_definitions(endstone_core PUBLIC ENDSTONE_DISABLE_DEVTOOLS)
Expand Down
12 changes: 11 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os

from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import copy
from conan.tools.scm import Git
from conans.errors import ConanInvalidConfiguration
from conans.model.version import Version
Expand Down Expand Up @@ -143,6 +146,13 @@ def generate(self):
tc = CMakeToolchain(self)
tc.variables["ENDSTONE_VERSION"] = self.version
tc.generate()
if self.settings.os == "Windows":
copy(
self,
"*",
os.path.join(self.dependencies["imgui"].package_folder, "res", "bindings"),
os.path.join(self.source_folder, "third_party", "imgui"),
)

def build(self):
cmake = CMake(self)
Expand Down Expand Up @@ -171,7 +181,7 @@ def package_info(self):
"magic_enum::magic_enum",
"ms-gsl::ms-gsl",
"spdlog::spdlog",
"tomlplusplus::tomlplusplus"
"tomlplusplus::tomlplusplus",
]
if self.settings.os == "Windows":
self.cpp_info.components["core"].requires.extend(["glew::glew", "glfw::glfw", "imgui::imgui"])
Expand Down
68 changes: 0 additions & 68 deletions include/endstone/detail/gui/imgui_impl_glfw.h

This file was deleted.

70 changes: 0 additions & 70 deletions include/endstone/detail/gui/imgui_impl_opengl3.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/endstone_core/gui/dev_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "endstone/detail/gui/dev_tools.h"

#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <imgui_internal.h>

#include <cstdio>
Expand All @@ -25,8 +27,6 @@
#include <GL/glew.h>
#include <GLFW/glfw3.h>

#include "endstone/detail/gui/imgui_impl_glfw.h"
#include "endstone/detail/gui/imgui_impl_opengl3.h"
#include "endstone/detail/level/level.h"
#include "endstone/detail/logger_factory.h"
#include "endstone/detail/os.h"
Expand Down
Loading

0 comments on commit f18bd67

Please sign in to comment.