From 892b96b35050d1ffb083f05bc9e505820e7da8b6 Mon Sep 17 00:00:00 2001 From: Arnaud Loonstra Date: Wed, 10 Jul 2024 13:59:32 +0200 Subject: [PATCH 1/2] replace aux sources with glob to include headers --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc0f2e0..a505940 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,7 @@ if(WITH_DMX) endif(WITH_DMX) ### PROJECT SOURCES -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/actors ACTOR_SOURCES) +file (GLOB ACTOR_SOURCES CONFIGURE_DEPENDS actors/*.h actors/*.c actors/*.cpp actors/*.hpp) # get git version include(GitVersion) From c710a7e87f3e286d959bcee357be4f9cdd39b71c Mon Sep 17 00:00:00 2001 From: Arnaud Loonstra Date: Wed, 10 Jul 2024 14:16:53 +0200 Subject: [PATCH 2/2] minor changes to enable RPI build --- CMakeLists.txt | 21 +++------------------ main.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a505940..022dba1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ option (WITH_IMGUI_DEMO "Enable ImGUI demo console" ON) option (WITH_EMBED_PYTHON "Embed the python interpreter, otherwise use system installed" OFF) option (WITH_OPENVR "Enable OpenVR support" ON) option (WITH_DMX "Enable DMX support" ON) +option (RPI "Build for the Raspberry PI" OFF) ### END SET OPTIONS ### EXTERNAL LIBS @@ -82,17 +83,11 @@ add_subdirectory("ext/rtmidi" EXCLUDE_FROM_ALL) # include(CheckIncludeFile) # CHECK_INCLUDE_FILE(/opt/vc/include/bcm_host.h RPI) # doesn't work :S # Just check if the file is there -if (EXISTS "/opt/vc/include/bcm_host.h") +if (RPI) message(STATUS "Enabling building for the Raspberry Pi") - set(RPI "ON") add_definitions(-DIMGUI_IMPL_OPENGL_ES2) set(WITH_OPENVR "OFF") -endif(EXISTS "/opt/vc/include/bcm_host.h") -if (EXISTS "/usr/include/bcm_host.h") - message(STATUS "Enabling building for the Raspberry Pi on Raspberry Pi OS") - set(RPI4 "ON") - add_definitions(-DIMGUI_IMPL_OPENGL_ES2) -endif(EXISTS "/usr/include/bcm_host.h") +endif(RPI) # External system libraries through find_package find_package(libzmq REQUIRED) @@ -347,16 +342,6 @@ elseif (RPI) sphactor-static rtmidi ${Python3_LIBRARIES} - -lasound -ldl -L/opt/vc/lib -lbrcmGLESv2) - target_compile_options(gazebosc PUBLIC -D__LINUX_ALSA__ ) -elseif (RPI4) - list(APPEND DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ext/openvr/bin/linuxarm64") - target_link_libraries(gazebosc PUBLIC - SDL2-static - sphactor-static - rtmidi - ${OPENVR_LIBRARIES} - ${Python3_LIBRARIES} -lasound -ldl -lGLESv2) target_compile_options(gazebosc PUBLIC -D__LINUX_ALSA__ ) else() diff --git a/main.cpp b/main.cpp index c95a99d..4eabc35 100644 --- a/main.cpp +++ b/main.cpp @@ -564,7 +564,22 @@ ImGuiIO& ImGUIInit(SDL_Window* window, SDL_GLContext* gl_context, const char* gl //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphR> //IM_ASSERT(font != NULL); +#if defined(IMGUI_IMPL_OPENGL_ES2) // For the RPI + ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* { + GLuint tex; + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + return (void*)tex; + }; +#else // ImFileDialog requires you to set the CreateTexture and DeleteTexture ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* { GLuint tex; @@ -582,6 +597,7 @@ ImGuiIO& ImGUIInit(SDL_Window* window, SDL_GLContext* gl_context, const char* gl return (void*)tex; }; +#endif ifd::FileDialog::Instance().DeleteTexture = [](void* tex) { GLuint texID = (GLuint)((uintptr_t)tex); glDeleteTextures(1, &texID);