Atlas - CMakeLists.txt

Home / ext / glfw Lines: 1 | Size: 5221 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1cmake_minimum_required(VERSION 3.16...3.28 FATAL_ERROR) 2 3project(GLFW VERSION 3.5.0 LANGUAGES C HOMEPAGE_URL "https://www.glfw.org/") 4 5set_property(GLOBAL PROPERTY USE_FOLDERS ON) 6 7string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE) 8 9option(BUILD_SHARED_LIBS "Build shared libraries" OFF) 10option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE}) 11option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE}) 12option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) 13option(GLFW_INSTALL "Generate installation target" ON) 14 15include(GNUInstallDirs) 16include(CMakeDependentOption) 17 18if (GLFW_USE_OSMESA) 19 message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint") 20endif() 21 22if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE) 23 message(FATAL_ERROR 24 "GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead") 25endif() 26 27cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF) 28cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF) 29cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF) 30cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF) 31 32cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF 33 "WIN32" OFF) 34cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON 35 "MSVC" OFF) 36 37set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING 38 "Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)") 39 40if (GLFW_LIBRARY_TYPE) 41 string(COMPARE EQUAL "${GLFW_LIBRARY_TYPE}" "SHARED" GLFW_BUILD_SHARED_LIBRARY) 42else() 43 set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) 44endif() 45 46list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules") 47 48find_package(Threads REQUIRED) 49 50#-------------------------------------------------------------------- 51# Report backend selection 52#-------------------------------------------------------------------- 53if (GLFW_BUILD_WIN32) 54 message(STATUS "Including Win32 support") 55endif() 56if (GLFW_BUILD_COCOA) 57 message(STATUS "Including Cocoa support") 58endif() 59if (GLFW_BUILD_WAYLAND) 60 message(STATUS "Including Wayland support") 61endif() 62if (GLFW_BUILD_X11) 63 message(STATUS "Including X11 support") 64endif() 65 66#-------------------------------------------------------------------- 67# Apply Microsoft C runtime library option 68# This is here because it also applies to tests and examples 69#-------------------------------------------------------------------- 70if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) 71 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") 72endif() 73 74#-------------------------------------------------------------------- 75# Create generated files 76#-------------------------------------------------------------------- 77include(CMakePackageConfigHelpers) 78 79set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3") 80 81configure_package_config_file(CMake/glfw3Config.cmake.in 82 src/glfw3Config.cmake 83 INSTALL_DESTINATION "${GLFW_CONFIG_PATH}" 84 NO_CHECK_REQUIRED_COMPONENTS_MACRO) 85 86write_basic_package_version_file(src/glfw3ConfigVersion.cmake 87 VERSION ${GLFW_VERSION} 88 COMPATIBILITY SameMajorVersion) 89 90#-------------------------------------------------------------------- 91# Add subdirectories 92#-------------------------------------------------------------------- 93add_subdirectory(src) 94 95if (GLFW_BUILD_EXAMPLES) 96 add_subdirectory(examples) 97endif() 98 99if (GLFW_BUILD_TESTS) 100 add_subdirectory(tests) 101endif() 102 103if (GLFW_BUILD_DOCS) 104 add_subdirectory(docs) 105endif() 106 107#-------------------------------------------------------------------- 108# Install files other than the library 109# The library is installed by src/CMakeLists.txt 110#-------------------------------------------------------------------- 111if (GLFW_INSTALL) 112 install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 113 FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) 114 115 install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" 116 "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" 117 DESTINATION "${GLFW_CONFIG_PATH}") 118 119 install(EXPORT glfwTargets FILE glfw3Targets.cmake 120 EXPORT_LINK_INTERFACE_LIBRARIES 121 DESTINATION "${GLFW_CONFIG_PATH}") 122 install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" 123 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") 124 125 # Only generate this target if no higher-level project already has 126 if (NOT TARGET uninstall) 127 configure_file(CMake/cmake_uninstall.cmake.in 128 cmake_uninstall.cmake IMMEDIATE @ONLY) 129 130 add_custom_target(uninstall 131 "${CMAKE_COMMAND}" -P 132 "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") 133 set_target_properties(uninstall PROPERTIES FOLDER "GLFW3") 134 endif() 135endif() 136 137
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.