Skip to content

Commit 3405ca0

Browse files
committed
Restructure examples to use shared cubescape libraries per GL API
1 parent 81b5b9a commit 3405ca0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+571
-3043
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ auto shader = glCreateShader(GL_COMPUTE_SHADER);
3434
// ...
3535
```
3636

37+
*glbinding* is compatible with OpenGL-compatible windowing toolkits and we provide example integrations for the following ones within the examples:
38+
39+
* [GLFW](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-glfw)
40+
* [GTK 3](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-gtk3)
41+
* [GTK 4](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-gtk4)
42+
* [Qt 5](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-qt)
43+
* [SDL](https://github.com/cginternals/glbinding/tree/master/source/examples/cubescape-sdl)
44+
3745
# Resources
3846

3947
* [Tools](https://github.com/cginternals/glbinding/wiki/tools)

source/examples/CMakeLists.txt

+16-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,28 @@
33
# Examples
44
#
55

6+
# General Features
67
add_subdirectory("callbacks")
78
add_subdirectory("comparison")
89
add_subdirectory("multi-context")
9-
add_subdirectory("cubescape")
10+
11+
#
12+
# Cubescape
13+
#
14+
15+
# Shared Static Libraries
16+
add_subdirectory("cubescape-shared-gl")
17+
add_subdirectory("cubescape-shared-gles")
18+
19+
# OpenGL APIs
20+
add_subdirectory("cubescape-gl")
1021
add_subdirectory("cubescape-gles")
11-
add_subdirectory("cubescape-log")
22+
23+
# Integrations
24+
add_subdirectory("cubescape-glfw")
1225
add_subdirectory("cubescape-wgl")
1326
add_subdirectory("cubescape-qt")
1427
add_subdirectory("cubescape-sdl")
1528
add_subdirectory("cubescape-gtk3")
1629
add_subdirectory("cubescape-gtk4")
30+
add_subdirectory("cubescape-log")

source/examples/cubescape/CMakeLists.txt source/examples/cubescape-gl/CMakeLists.txt

+2-16
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,28 @@
44
#
55

66
find_package(glfw3 QUIET)
7-
find_package(cpplocate QUIET)
87

98

109
#
1110
# Executable name and options
1211
#
1312

1413
# Target name
15-
set(target cubescape)
14+
set(target cubescape-gl)
1615

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

23-
if (NOT cpplocate_FOUND)
24-
message(STATUS "Example ${target}: using static data path (cpplocate not found)")
25-
else()
26-
message(STATUS "Example ${target}")
27-
endif()
28-
2922

3023
#
3124
# Sources
3225
#
3326

3427
set(sources
3528
main.cpp
36-
CubeScape.cpp
37-
CubeScape.h
38-
glutils.cpp
39-
glutils.h
40-
RawFile.cpp
41-
RawFile.h
4229
)
4330

4431

@@ -90,7 +77,7 @@ target_link_libraries(${target}
9077
glfw
9178
${META_PROJECT_NAME}::glbinding
9279
${META_PROJECT_NAME}::glbinding-aux
93-
$<$<BOOL:${cpplocate_FOUND}>:cpplocate::cpplocate>
80+
${META_PROJECT_NAME}::cubescape-shared-gl
9481
)
9582

9683

@@ -102,7 +89,6 @@ target_compile_definitions(${target}
10289
PRIVATE
10390
${DEFAULT_COMPILE_DEFINITIONS}
10491
GLFW_INCLUDE_NONE
105-
$<$<BOOL:${cpplocate_FOUND}>:cpplocate_FOUND>
10692
)
10793

10894

source/examples/cubescape/main.cpp source/examples/cubescape-gl/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <glbinding-aux/ValidVersions.h>
1818
#include <glbinding-aux/debug.h>
1919

20-
#include "CubeScape.h"
20+
#include <CubeScape.h>
2121

2222

2323
using namespace gl;

source/examples/cubescape-gles/CMakeLists.txt

+1-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55

66
find_package(glfw3 QUIET)
7-
find_package(cpplocate QUIET)
87

98

109
#
@@ -20,25 +19,13 @@ if (NOT glfw3_FOUND)
2019
return()
2120
endif()
2221

23-
if (NOT cpplocate_FOUND)
24-
message(STATUS "Example ${target}: using static data path (cpplocate not found)")
25-
else()
26-
message(STATUS "Example ${target}")
27-
endif()
28-
2922

3023
#
3124
# Sources
3225
#
3326

3427
set(sources
3528
main.cpp
36-
CubeScape.cpp
37-
CubeScape.h
38-
glutils.cpp
39-
glutils.h
40-
RawFile.cpp
41-
RawFile.h
4229
)
4330

4431

@@ -89,7 +76,7 @@ target_link_libraries(${target}
8976
glfw
9077
${META_PROJECT_NAME}::glbinding
9178
${META_PROJECT_NAME}::glbinding-aux
92-
$<$<BOOL:${cpplocate_FOUND}>:cpplocate::cpplocate>
79+
${META_PROJECT_NAME}::cubescape-shared-gles
9380
)
9481

9582

@@ -101,7 +88,6 @@ target_compile_definitions(${target}
10188
PRIVATE
10289
${DEFAULT_COMPILE_DEFINITIONS}
10390
GLFW_INCLUDE_NONE
104-
$<$<BOOL:${cpplocate_FOUND}>:cpplocate_FOUND>
10591
)
10692

10793

source/examples/cubescape-gles/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <glbinding-aux/types_to_string.h>
1616
#include <glbinding-aux/ValidVersions.h>
1717

18-
#include "CubeScape.h"
18+
#include <CubeScape.h>
1919

2020

2121
using namespace gl;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
2+
#
3+
# External dependencies
4+
#
5+
6+
find_package(glfw3 QUIET)
7+
8+
9+
#
10+
# Executable name and options
11+
#
12+
13+
# Target name
14+
set(target cubescape-glfw)
15+
16+
# Exit here if required dependencies are not met
17+
if (NOT glfw3_FOUND)
18+
message("Example ${target} skipped: glfw3 not found")
19+
return()
20+
endif()
21+
22+
23+
#
24+
# Sources
25+
#
26+
27+
set(sources
28+
main.cpp
29+
)
30+
31+
32+
#
33+
# Create executable
34+
#
35+
36+
# Build executable
37+
add_executable(${target}
38+
MACOSX_BUNDLE
39+
${sources}
40+
)
41+
42+
# Create namespaced alias
43+
add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target})
44+
45+
46+
#
47+
# Project options
48+
#
49+
50+
set_target_properties(${target}
51+
PROPERTIES
52+
${DEFAULT_PROJECT_OPTIONS}
53+
INSTALL_RPATH "${EXECUTABLE_INSTALL_RPATH}"
54+
FOLDER "${IDE_FOLDER}"
55+
)
56+
57+
58+
#
59+
# Include directories
60+
#
61+
62+
target_include_directories(${target}
63+
PRIVATE
64+
${DEFAULT_INCLUDE_DIRECTORIES}
65+
${PROJECT_BINARY_DIR}/source/include
66+
SYSTEM
67+
)
68+
69+
70+
#
71+
# Libraries
72+
#
73+
74+
target_link_libraries(${target}
75+
PRIVATE
76+
${DEFAULT_LIBRARIES}
77+
glfw
78+
${META_PROJECT_NAME}::glbinding
79+
${META_PROJECT_NAME}::glbinding-aux
80+
${META_PROJECT_NAME}::cubescape-shared-gl
81+
)
82+
83+
84+
#
85+
# Compile definitions
86+
#
87+
88+
target_compile_definitions(${target}
89+
PRIVATE
90+
${DEFAULT_COMPILE_DEFINITIONS}
91+
GLFW_INCLUDE_NONE
92+
)
93+
94+
95+
#
96+
# Compile options
97+
#
98+
99+
target_compile_options(${target}
100+
PRIVATE
101+
${DEFAULT_COMPILE_OPTIONS_PRIVATE}
102+
PUBLIC
103+
${DEFAULT_COMPILE_OPTIONS_PUBLIC}
104+
)
105+
106+
107+
#
108+
# Linker options
109+
#
110+
111+
target_link_libraries(${target}
112+
PRIVATE
113+
${DEFAULT_LINKER_OPTIONS}
114+
)
115+
116+
117+
#
118+
# Target Health
119+
#
120+
121+
perform_health_checks(
122+
${target}
123+
${sources}
124+
)
125+
126+
127+
#
128+
# Deployment
129+
#
130+
131+
# Executable
132+
install(TARGETS ${target}
133+
RUNTIME DESTINATION ${INSTALL_EXAMPLES} COMPONENT examples_glfw
134+
BUNDLE DESTINATION ${INSTALL_EXAMPLES} COMPONENT examples_glfw
135+
)

0 commit comments

Comments
 (0)