blob: 33a3f8ac65910dba889c450e8cf055053e9bc92e [file] [log] [blame]
Courtney Goeltzenleuchter3f2606d2014-10-13 17:51:58 -06001pkg_check_modules(XCB REQUIRED xcb)
2if (NOT XCB_FOUND)
3 message(FATAL_ERROR "xcb not found")
Chia-I Wuc19795a2014-09-13 11:12:55 +08004endif()
Courtney Goeltzenleuchter4825f6a2014-10-28 10:27:47 -06005if(NOT EXISTS /usr/include/glm/glm.hpp)
6 message(FATAL_ERROR "Necessary libglm-dev headers cannot be found: sudo apt-get install libglm-dev")
7endif()
Courtney Goeltzenleuchter17223602014-10-29 15:59:49 -06008if(NOT EXISTS /usr/include/png.h)
Mike Stroyana768fc12014-10-30 15:59:54 -06009 message(FATAL_ERROR "Necessary png12-dev headers cannot be found: sudo apt-get install libpng12-dev")
Courtney Goeltzenleuchter17223602014-10-29 15:59:49 -060010endif()
Courtney Goeltzenleuchter4825f6a2014-10-28 10:27:47 -060011
Courtney Goeltzenleuchterd72c6192014-10-29 16:25:34 -060012file(GLOB TEXTURES
13 "${PROJECT_SOURCE_DIR}/demos/*.png"
14 )
15file(COPY ${TEXTURES} DESTINATION ${CMAKE_BINARY_DIR}/demos)
Courtney Goeltzenleuchter3f2606d2014-10-13 17:51:58 -060016
Courtney Goeltzenleuchter7e334982014-10-30 15:14:16 -060017add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-vert.bil
18 COMMAND ${GLSLANG_PREFIX}/build/install/bin/glslangValidator -s -b ${PROJECT_SOURCE_DIR}/demos/cube.vert
19 COMMAND mv vert.bil ${CMAKE_BINARY_DIR}/demos/cube-vert.bil
20 DEPENDS cube.vert ${GLSLANG_PREFIX}/build/install/bin/glslangValidator
21 )
22
23add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-frag.bil
24 COMMAND ${GLSLANG_PREFIX}/build/install/bin/glslangValidator -s -b ${PROJECT_SOURCE_DIR}/demos/cube.frag
25 COMMAND mv frag.bil ${CMAKE_BINARY_DIR}/demos/cube-frag.bil
26 DEPENDS cube.frag ${GLSLANG_PREFIX}/build/install/bin/glslangValidator
27 )
28
Courtney Goeltzenleuchter3f2606d2014-10-13 17:51:58 -060029include_directories (
30 ${XCB_INCLUDE_DIRS}
31 "${PROJECT_SOURCE_DIR}/icd/common"
32 )
33
34link_directories(${XCB_LIBRARY_DIRS})
Courtney Goeltzenleuchter17223602014-10-29 15:59:49 -060035link_libraries(${XCB_LIBRARIES} XGL png m)
Courtney Goeltzenleuchter3f2606d2014-10-13 17:51:58 -060036
37add_executable(tri tri.c)
38target_link_libraries(tri)
Courtney Goeltzenleuchter4e8246e2014-10-23 13:16:59 -060039
Courtney Goeltzenleuchter7e334982014-10-30 15:14:16 -060040add_executable(cube cube.c ${CMAKE_BINARY_DIR}/demos/cube-vert.bil ${CMAKE_BINARY_DIR}/demos/cube-frag.bil)
Courtney Goeltzenleuchter4e8246e2014-10-23 13:16:59 -060041target_link_libraries(cube)