Skip to content

Commit

Permalink
Restructure examples to use shared cubescape libraries per GL API
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibel committed Feb 26, 2024
1 parent 81b5b9a commit 3405ca0
Show file tree
Hide file tree
Showing 58 changed files with 571 additions and 3,043 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ auto shader = glCreateShader(GL_COMPUTE_SHADER);
// ...
```

*glbinding* is compatible with OpenGL-compatible windowing toolkits and we provide example integrations for the following ones within the examples:

* [GLFW](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-glfw)
* [GTK 3](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-gtk3)
* [GTK 4](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-gtk4)
* [Qt 5](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-qt)
* [SDL](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-sdl)

# Resources

* [Tools](https://github.com/cginternals/glbinding/wiki/tools)
Expand Down
18 changes: 16 additions & 2 deletions source/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@
# Examples
#

# General Features
add_subdirectory("callbacks")
add_subdirectory("comparison")
add_subdirectory("multi-context")
add_subdirectory("cubescape")

#
# Cubescape
#

# Shared Static Libraries
add_subdirectory("cubescape-shared-gl")
add_subdirectory("cubescape-shared-gles")

# OpenGL APIs
add_subdirectory("cubescape-gl")
add_subdirectory("cubescape-gles")
add_subdirectory("cubescape-log")

# Integrations
add_subdirectory("cubescape-glfw")
add_subdirectory("cubescape-wgl")
add_subdirectory("cubescape-qt")
add_subdirectory("cubescape-sdl")
add_subdirectory("cubescape-gtk3")
add_subdirectory("cubescape-gtk4")
add_subdirectory("cubescape-log")
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,28 @@
#

find_package(glfw3 QUIET)
find_package(cpplocate QUIET)


#
# Executable name and options
#

# Target name
set(target cubescape)
set(target cubescape-gl)

# Exit here if required dependencies are not met
if (NOT glfw3_FOUND)
message("Example ${target} skipped: glfw3 not found")
return()
endif()

if (NOT cpplocate_FOUND)
message(STATUS "Example ${target}: using static data path (cpplocate not found)")
else()
message(STATUS "Example ${target}")
endif()


#
# Sources
#

set(sources
main.cpp
CubeScape.cpp
CubeScape.h
glutils.cpp
glutils.h
RawFile.cpp
RawFile.h
)


Expand Down Expand Up @@ -90,7 +77,7 @@ target_link_libraries(${target}
glfw
${META_PROJECT_NAME}::glbinding
${META_PROJECT_NAME}::glbinding-aux
$<$<BOOL:${cpplocate_FOUND}>:cpplocate::cpplocate>
${META_PROJECT_NAME}::cubescape-shared-gl
)


Expand All @@ -102,7 +89,6 @@ target_compile_definitions(${target}
PRIVATE
${DEFAULT_COMPILE_DEFINITIONS}
GLFW_INCLUDE_NONE
$<$<BOOL:${cpplocate_FOUND}>:cpplocate_FOUND>
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <glbinding-aux/ValidVersions.h>
#include <glbinding-aux/debug.h>

#include "CubeScape.h"
#include <CubeScape.h>


using namespace gl;
Expand Down
16 changes: 1 addition & 15 deletions source/examples/cubescape-gles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#

find_package(glfw3 QUIET)
find_package(cpplocate QUIET)


#
Expand All @@ -20,25 +19,13 @@ if (NOT glfw3_FOUND)
return()
endif()

if (NOT cpplocate_FOUND)
message(STATUS "Example ${target}: using static data path (cpplocate not found)")
else()
message(STATUS "Example ${target}")
endif()


#
# Sources
#

set(sources
main.cpp
CubeScape.cpp
CubeScape.h
glutils.cpp
glutils.h
RawFile.cpp
RawFile.h
)


Expand Down Expand Up @@ -89,7 +76,7 @@ target_link_libraries(${target}
glfw
${META_PROJECT_NAME}::glbinding
${META_PROJECT_NAME}::glbinding-aux
$<$<BOOL:${cpplocate_FOUND}>:cpplocate::cpplocate>
${META_PROJECT_NAME}::cubescape-shared-gles
)


Expand All @@ -101,7 +88,6 @@ target_compile_definitions(${target}
PRIVATE
${DEFAULT_COMPILE_DEFINITIONS}
GLFW_INCLUDE_NONE
$<$<BOOL:${cpplocate_FOUND}>:cpplocate_FOUND>
)


Expand Down
2 changes: 1 addition & 1 deletion source/examples/cubescape-gles/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <glbinding-aux/types_to_string.h>
#include <glbinding-aux/ValidVersions.h>

#include "CubeScape.h"
#include <CubeScape.h>


using namespace gl;
Expand Down
135 changes: 135 additions & 0 deletions source/examples/cubescape-glfw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

#
# External dependencies
#

find_package(glfw3 QUIET)


#
# Executable name and options
#

# Target name
set(target cubescape-glfw)

# Exit here if required dependencies are not met
if (NOT glfw3_FOUND)
message("Example ${target} skipped: glfw3 not found")
return()
endif()


#
# Sources
#

set(sources
main.cpp
)


#
# Create executable
#

# Build executable
add_executable(${target}
MACOSX_BUNDLE
${sources}
)

# Create namespaced alias
add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target})


#
# Project options
#

set_target_properties(${target}
PROPERTIES
${DEFAULT_PROJECT_OPTIONS}
INSTALL_RPATH "${EXECUTABLE_INSTALL_RPATH}"
FOLDER "${IDE_FOLDER}"
)


#
# Include directories
#

target_include_directories(${target}
PRIVATE
${DEFAULT_INCLUDE_DIRECTORIES}
${PROJECT_BINARY_DIR}/source/include
SYSTEM
)


#
# Libraries
#

target_link_libraries(${target}
PRIVATE
${DEFAULT_LIBRARIES}
glfw
${META_PROJECT_NAME}::glbinding
${META_PROJECT_NAME}::glbinding-aux
${META_PROJECT_NAME}::cubescape-shared-gl
)


#
# Compile definitions
#

target_compile_definitions(${target}
PRIVATE
${DEFAULT_COMPILE_DEFINITIONS}
GLFW_INCLUDE_NONE
)


#
# Compile options
#

target_compile_options(${target}
PRIVATE
${DEFAULT_COMPILE_OPTIONS_PRIVATE}
PUBLIC
${DEFAULT_COMPILE_OPTIONS_PUBLIC}
)


#
# Linker options
#

target_link_libraries(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)


#
# Target Health
#

perform_health_checks(
${target}
${sources}
)


#
# Deployment
#

# Executable
install(TARGETS ${target}
RUNTIME DESTINATION ${INSTALL_EXAMPLES} COMPONENT examples_glfw
BUNDLE DESTINATION ${INSTALL_EXAMPLES} COMPONENT examples_glfw
)
Loading

0 comments on commit 3405ca0

Please sign in to comment.