Skip to content

Commit

Permalink
igl | Make sure we can completely eliminate OpenGL from our CMake builds
Browse files Browse the repository at this point in the history
Summary:
Make sure we can completely eliminate OpenGL from our CMake builds.

Clean Vulkan-only builds are now possible with IGLU/Shell/Tests enabled.

Reviewed By: EricGriffith

Differential Revision: D50154469

fbshipit-source-id: cfd42b2140a3246f88dc48d5058e4f559d644ebe
  • Loading branch information
corporateshark authored and facebook-github-bot committed Oct 13, 2023
1 parent 8a3058a commit 2ad8b26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ else()
endif()
endif()

if(IGL_WITH_IGLU AND (NOT IGL_WITH_OPENGL) AND (NOT IGL_WITH_OPENGLES))
message(FATAL_ERROR "IGL_WITH_IGLU requires enabling IGL_WITH_OPENGL OR IGL_WITH_OPENGLES.")
endif()

if(IGL_WITH_SHELL AND (NOT IGL_WITH_IGLU))
message(FATAL_ERROR "IGL_WITH_SHELL requires enabling IGL_WITH_IGLU.")
endif()
Expand Down
8 changes: 4 additions & 4 deletions IGLU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ set(PROJECT_NAME "IGLU")
macro(ADD_IGLU_MODULE module)
file(GLOB_RECURSE SRC_FILES LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${module}/*.cpp)
file(GLOB_RECURSE HEADER_FILES LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${module}/*.h)
if((NOT IGL_WITH_OPENGL) AND (NOT IGL_WITH_OPENGLES))
list(REMOVE_ITEM SRC_FILES ${module}/OpenGLTextureAccessor.cpp)
list(REMOVE_ITEM HEADER_FILES ${module}/OpenGLTextureAccessor.h)
endif()
add_library(IGLU${module} ${SRC_FILES} ${HEADER_FILES})
igl_set_cxxstd(IGLU${module} 17)
igl_set_folder(IGLU${module} "IGL/${PROJECT_NAME}")
Expand Down Expand Up @@ -49,7 +53,3 @@ target_sources(IGLUimgui PRIVATE "${IGL_ROOT_DIR}/third-party/deps/src/imgui/img
target_sources(IGLUimgui PRIVATE "${IGL_ROOT_DIR}/third-party/deps/src/imgui/imgui_widgets.cpp")
target_include_directories(IGLUimgui PUBLIC "${IGL_ROOT_DIR}/third-party/deps/src/imgui")
target_include_directories(IGLUtexture_accessor PUBLIC "${IGL_ROOT_DIR}/third-party/deps/src/glew/include")

if(WIN32)
target_include_directories(IGLUtexture_accessor PUBLIC "${IGL_ROOT_DIR}/third-party/deps/src/glew/include")
endif()
4 changes: 3 additions & 1 deletion IGLU/texture_accessor/TextureAccessorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ std::unique_ptr<ITextureAccessor> TextureAccessorFactory::createTextureAccessor(
const std::shared_ptr<igl::ITexture>& texture,
igl::IDevice& device) {
switch (backendType) {
#if IGL_BACKEND_OPENGL
case igl::BackendType::OpenGL:
return std::make_unique<OpenGLTextureAccessor>(texture, device);
#endif // IGL_BACKEND_OPENGL
#if IGL_PLATFORM_APPLE
case igl::BackendType::Metal:
return std::make_unique<MetalTextureAccessor>(texture, device);
#endif
#endif // IGL_PLATFORM_APPLE
default:
IGL_ASSERT_NOT_IMPLEMENTED();
return nullptr;
Expand Down

0 comments on commit 2ad8b26

Please sign in to comment.