From c909c71e86b459d57c5e6da42831295aa393ed9f Mon Sep 17 00:00:00 2001 From: Glenn Waldron Date: Thu, 11 Jul 2024 13:45:35 -0400 Subject: [PATCH] Build fixes for GLEW on linux/mac --- .github/workflows/linux.yml | 1 + .github/workflows/macos.yml | 1 + CMakeLists.txt | 6 -- src/CMakeLists.txt | 26 ++++---- src/osgEarthImGui/CMakeLists.txt | 105 +++++++++++++++---------------- 5 files changed, 66 insertions(+), 73 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 15493c7dce..14f6f5dbba 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,6 +30,7 @@ jobs: sudo apt-get install -y libsqlite3-dev sudo apt-get install -y protobuf-compiler libprotobuf-dev sudo apt-get install -y libtinyxml-dev + sudo apt-get install -y libglew-dev - uses: actions/checkout@v2 with: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1231d6331f..367d163b4b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -28,6 +28,7 @@ jobs: brew install protobuf brew install poco brew install open-scene-graph + brew install glew sudo xcode-select -p - uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 78215803f4..306f2016dc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,12 +143,6 @@ if(OSGEARTH_ASSUME_SINGLE_THREADED_OSG) add_definitions(-DOSGEARTH_SINGLE_THREADED_OSG) endif() -# imgui? -if(OSGEARTH_BUILD_IMGUI_NODEKIT) - set(OSGEARTH_HAVE_IMGUI_NODEKIT ON) # for BuildConfig -endif() - - # Bring in our utility macros that sub-projects will use to configure themselves. include(cmake/osgearth-macros.cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29b4d2e8f0..dc8a4d72f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,8 @@ +if(OSGEARTH_BUILD_IMGUI_NODEKIT) + add_subdirectory(osgEarthImGui) +endif() -#optionals: if(OSGEARTH_BUILD_PROCEDURAL_NODEKIT) add_subdirectory(osgEarthProcedural) endif() @@ -17,26 +19,24 @@ if(OSGEARTH_BUILD_SILVERLINING_NODEKIT) add_subdirectory(osgEarthSilverLining) endif() -if(OSGEARTH_BUILD_TOOLS OR OSGEARTH_BUILD_EXAMPLES) - add_subdirectory( applications ) -endif() - -if(OSGEARTH_BUILD_TESTS AND NOT OSGEARTH_BUILD_PLATFORM_IPHONE) - add_subdirectory( tests ) -endif() - if(OSGEARTH_BUILD_LEGACY_SPLAT_NODEKIT) add_subdirectory(osgEarthSplat) endif() -if(OSGEARTH_BUILD_IMGUI_NODEKIT) - add_subdirectory(osgEarthImGui) -endif() - # plugins: add_subdirectory(osgEarthDrivers) + +if(OSGEARTH_BUILD_TOOLS OR OSGEARTH_BUILD_EXAMPLES) + add_subdirectory(applications) +endif() + +if(OSGEARTH_BUILD_TESTS AND NOT OSGEARTH_BUILD_PLATFORM_IPHONE) + add_subdirectory(tests) +endif() + # Do this LAST since we are generating the BuildConfig header # based on everything that's happened so far add_subdirectory(osgEarth) + set_property(TARGET osgEarth PROPERTY FOLDER "Core") diff --git a/src/osgEarthImGui/CMakeLists.txt b/src/osgEarthImGui/CMakeLists.txt index f10d43c251..ed6541a20c 100644 --- a/src/osgEarthImGui/CMakeLists.txt +++ b/src/osgEarthImGui/CMakeLists.txt @@ -3,62 +3,59 @@ # find_package(GLEW REQUIRED) -if(GLEW_FOUND) - set(OSGEARTH_HAVE_IMGUI_NODEKIT ON PARENT_SCOPE) # for BuildConfig +set(OSGEARTH_HAVE_IMGUI_NODEKIT ON PARENT_SCOPE) # for BuildConfig - set(LIB_NAME osgEarthImGui) - - # This forces the export of all ImGui symbols on Windows - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(LIB_NAME osgEarthImGui) + +# This forces the export of all ImGui symbols on Windows +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +# embedded ImGui source code: +set(IMGUI_HEADERS imgui.h imgui_internal.h imgui_impl_opengl3.h imconfig.h) +set(IMGUI_SOURCES imgui.cpp imgui_demo.cpp imgui_draw.cpp imgui_tables.cpp imgui_widgets.cpp imgui_impl_opengl3.cpp) - # embedded ImGui source code: - set(IMGUI_HEADERS imgui.h imgui_internal.h imgui_impl_opengl3.h imconfig.h) - set(IMGUI_SOURCES imgui.cpp imgui_demo.cpp imgui_draw.cpp imgui_tables.cpp imgui_widgets.cpp imgui_impl_opengl3.cpp) +set(STOCK_PANELS + AnnotationsGUI + CameraGUI + ContentBrowserGUI + #DateTimeGUI + EnvironmentGUI + LayersGUI + NetworkMonitorGUI + NotifyGUI + #PickerGUI + RenderingGUI + SceneGraphGUI + SearchGUI + ShaderGUI + SystemGUI + TerrainGUI + TextureInspectorGUI + ViewpointsGUI - set(STOCK_PANELS - AnnotationsGUI - CameraGUI - ContentBrowserGUI - #DateTimeGUI - EnvironmentGUI - LayersGUI - NetworkMonitorGUI - NotifyGUI - #PickerGUI - RenderingGUI - SceneGraphGUI - SearchGUI - ShaderGUI - SystemGUI - TerrainGUI - TextureInspectorGUI - ViewpointsGUI - - # osgEarthProcedural - LifeMapLayerGUI - TerrainEditGUI - TextureSplattingLayerGUI - VegetationLayerGUI - - # osgEarthCesium - CesiumIonGUI - ) + # osgEarthProcedural + LifeMapLayerGUI + TerrainEditGUI + TextureSplattingLayerGUI + VegetationLayerGUI + + # osgEarthCesium + CesiumIonGUI +) - # osgEarth source code: - set(LIB_HEADERS - Common - ImGuiEventHandler - ImGuiApp - ImGuiPanel ) - - set(LIB_SOURCES - ImGuiEventHandler.cpp ) +# osgEarth source code: +set(LIB_HEADERS + Common + ImGuiEventHandler + ImGuiApp + ImGuiPanel ) + +set(LIB_SOURCES + ImGuiEventHandler.cpp ) - add_osgearth_library( - TARGET ${LIB_NAME} - SOURCES ${LIB_SOURCES} ${IMGUI_SOURCES} - PUBLIC_HEADERS ${LIB_HEADERS} ${IMGUI_HEADERS} ${STOCK_PANELS} - LIBRARIES PRIVATE GLEW::GLEW OpenGL::GL - FOLDER "NodeKits") - -endif() \ No newline at end of file +add_osgearth_library( + TARGET ${LIB_NAME} + SOURCES ${LIB_SOURCES} ${IMGUI_SOURCES} + PUBLIC_HEADERS ${LIB_HEADERS} ${IMGUI_HEADERS} ${STOCK_PANELS} + LIBRARIES PRIVATE GLEW::GLEW OpenGL::GL + FOLDER "NodeKits")