|
| 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