| 1 |
find_package(OpenGL REQUIRED) |
| 2 |
find_package(GLEW REQUIRED) |
| 3 |
|
| 4 |
if(WIN32 AND NOT BUILD_SHARED_LIBS) |
| 5 |
add_definitions(-DGLEW_STATIC) |
| 6 |
endif() |
| 7 |
|
| 8 |
add_library(Rendering) |
| 9 |
|
| 10 |
avogadro_headers(Rendering |
| 11 |
arcsector.h |
| 12 |
arcstrip.h |
| 13 |
arrowgeometry.h |
| 14 |
avogadrogl.h |
| 15 |
avogadrorendering.h |
| 16 |
beziergeometry.h |
| 17 |
bsplinegeometry.h |
| 18 |
bufferobject.h |
| 19 |
camera.h |
| 20 |
cartoongeometry.h |
| 21 |
curvegeometry.h |
| 22 |
cylindergeometry.h |
| 23 |
dashedlinegeometry.h |
| 24 |
drawable.h |
| 25 |
geometrynode.h |
| 26 |
geometryvisitor.h |
| 27 |
groupnode.h |
| 28 |
glrenderer.h |
| 29 |
glrendervisitor.h |
| 30 |
linestripgeometry.h |
| 31 |
meshgeometry.h |
| 32 |
node.h |
| 33 |
plyvisitor.h |
| 34 |
povrayvisitor.h |
| 35 |
primitive.h |
| 36 |
quad.h |
| 37 |
quadoutline.h |
| 38 |
scene.h |
| 39 |
shader.h |
| 40 |
shaderprogram.h |
| 41 |
solidpipeline.h |
| 42 |
spheregeometry.h |
| 43 |
textlabel2d.h |
| 44 |
textlabel3d.h |
| 45 |
textlabelbase.h |
| 46 |
textproperties.h |
| 47 |
textrenderstrategy.h |
| 48 |
texture2d.h |
| 49 |
transformnode.h |
| 50 |
vertexarrayobject.h |
| 51 |
visitor.h |
| 52 |
volumegeometry.h |
| 53 |
widelinegeometry.h |
| 54 |
vrmlvisitor.h |
| 55 |
) |
| 56 |
|
| 57 |
target_sources(Rendering PRIVATE |
| 58 |
arcsector.cpp |
| 59 |
arcstrip.cpp |
| 60 |
arrowgeometry.cpp |
| 61 |
beziergeometry.cpp |
| 62 |
bufferobject.cpp |
| 63 |
bsplinegeometry.cpp |
| 64 |
cartoongeometry.cpp |
| 65 |
camera.cpp |
| 66 |
curvegeometry.cpp |
| 67 |
cylindergeometry.cpp |
| 68 |
dashedlinegeometry.cpp |
| 69 |
drawable.cpp |
| 70 |
geometrynode.cpp |
| 71 |
geometryvisitor.cpp |
| 72 |
groupnode.cpp |
| 73 |
glrenderer.cpp |
| 74 |
glrendervisitor.cpp |
| 75 |
linestripgeometry.cpp |
| 76 |
meshgeometry.cpp |
| 77 |
node.cpp |
| 78 |
plyvisitor.cpp |
| 79 |
povrayvisitor.cpp |
| 80 |
quad.cpp |
| 81 |
quadoutline.cpp |
| 82 |
scene.cpp |
| 83 |
shader.cpp |
| 84 |
shaderprogram.cpp |
| 85 |
solidpipeline.cpp |
| 86 |
spheregeometry.cpp |
| 87 |
textlabel2d.cpp |
| 88 |
textlabel3d.cpp |
| 89 |
textlabelbase.cpp |
| 90 |
textproperties.cpp |
| 91 |
textrenderstrategy.cpp |
| 92 |
texture2d.cpp |
| 93 |
transformnode.cpp |
| 94 |
vertexarrayobject.cpp |
| 95 |
visitor.cpp |
| 96 |
volumegeometry.cpp |
| 97 |
vrmlvisitor.cpp |
| 98 |
widelinegeometry.cpp |
| 99 |
ambientocclusionspheregeometry.cpp |
| 100 |
) |
| 101 |
|
| 102 |
set(shader_files |
| 103 |
"arrow_vs.glsl" |
| 104 |
"cylinders_fs.glsl" |
| 105 |
"cylinders_vs.glsl" |
| 106 |
"dashedline_fs.glsl" |
| 107 |
"dashedline_vs.glsl" |
| 108 |
"linestrip_fs.glsl" |
| 109 |
"linestrip_vs.glsl" |
| 110 |
"mesh_fs.glsl" |
| 111 |
"mesh_vs.glsl" |
| 112 |
"solid_vs.glsl" |
| 113 |
"solid_first_fs.glsl" |
| 114 |
"volume_box_fs.glsl" |
| 115 |
"volume_box_vs.glsl" |
| 116 |
"volume_fs.glsl" |
| 117 |
"volume_vs.glsl" |
| 118 |
"wideline_fs.glsl" |
| 119 |
"wideline_vs.glsl" |
| 120 |
"spheres_fs.glsl" |
| 121 |
"spheres_vs.glsl" |
| 122 |
"sphere_ao_depth_vs.glsl" |
| 123 |
"sphere_ao_depth_fs.glsl" |
| 124 |
"sphere_ao_bake_vs.glsl" |
| 125 |
"sphere_ao_bake_fs.glsl" |
| 126 |
"sphere_ao_render_vs.glsl" |
| 127 |
"sphere_ao_render_fs.glsl" |
| 128 |
"textlabelbase_fs.glsl" |
| 129 |
"textlabelbase_vs.glsl" |
| 130 |
) |
| 131 |
foreach(file ${shader_files}) |
| 132 |
get_filename_component(file_we ${file} NAME_WE) |
| 133 |
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file}) |
| 134 |
set(resh ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.h) |
| 135 |
list(APPEND shader_h_files ${resh}) |
| 136 |
add_custom_command( |
| 137 |
OUTPUT ${resh} |
| 138 |
DEPENDS ${src} encodefile |
| 139 |
COMMAND encodefile |
| 140 |
ARGS ${src} ${resh} ${file_we} |
| 141 |
COMMENT "Encoding ${src}" |
| 142 |
) |
| 143 |
endforeach() |
| 144 |
target_sources(Rendering PRIVATE |
| 145 |
FILE_SET shaders TYPE HEADERS |
| 146 |
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} |
| 147 |
FILES ${shader_h_files}) |
| 148 |
|
| 149 |
avogadro_add_library(Rendering) |
| 150 |
target_link_libraries(Rendering |
| 151 |
PUBLIC |
| 152 |
Avogadro::Headers |
| 153 |
PRIVATE |
| 154 |
Avogadro::Core # Needed for an emum in residue.h that we should move, maybe others. |
| 155 |
GLEW::GLEW |
| 156 |
OpenGL::GL) |
| 157 |
|
| 158 |
if(USE_3DCONNEXION AND (WIN32 OR APPLE)) |
| 159 |
target_compile_definitions(Rendering PUBLIC _3DCONNEXION) |
| 160 |
endif() |