ScrapExplorer - CMakeLists.txt

Home / ext / glfw Lines: 1 | Size: 5294 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 if (GLFW_LIBRARY_TYPE STREQUAL "SHARED") 42 set(GLFW_BUILD_SHARED_LIBRARY TRUE) 43 else() 44 set(GLFW_BUILD_SHARED_LIBRARY FALSE) 45 endif() 46else() 47 set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) 48endif() 49 50list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules") 51 52find_package(Threads REQUIRED) 53 54#-------------------------------------------------------------------- 55# Report backend selection 56#-------------------------------------------------------------------- 57if (GLFW_BUILD_WIN32) 58 message(STATUS "Including Win32 support") 59endif() 60if (GLFW_BUILD_COCOA) 61 message(STATUS "Including Cocoa support") 62endif() 63if (GLFW_BUILD_WAYLAND) 64 message(STATUS "Including Wayland support") 65endif() 66if (GLFW_BUILD_X11) 67 message(STATUS "Including X11 support") 68endif() 69 70#-------------------------------------------------------------------- 71# Apply Microsoft C runtime library option 72# This is here because it also applies to tests and examples 73#-------------------------------------------------------------------- 74if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) 75 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") 76endif() 77 78#-------------------------------------------------------------------- 79# Create generated files 80#-------------------------------------------------------------------- 81include(CMakePackageConfigHelpers) 82 83set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3") 84 85configure_package_config_file(CMake/glfw3Config.cmake.in 86 src/glfw3Config.cmake 87 INSTALL_DESTINATION "${GLFW_CONFIG_PATH}" 88 NO_CHECK_REQUIRED_COMPONENTS_MACRO) 89 90write_basic_package_version_file(src/glfw3ConfigVersion.cmake 91 VERSION ${GLFW_VERSION} 92 COMPATIBILITY SameMajorVersion) 93 94#-------------------------------------------------------------------- 95# Add subdirectories 96#-------------------------------------------------------------------- 97add_subdirectory(src) 98 99if (GLFW_BUILD_EXAMPLES) 100 add_subdirectory(examples) 101endif() 102 103if (GLFW_BUILD_TESTS) 104 add_subdirectory(tests) 105endif() 106 107if (GLFW_BUILD_DOCS) 108 add_subdirectory(docs) 109endif() 110 111#-------------------------------------------------------------------- 112# Install files other than the library 113# The library is installed by src/CMakeLists.txt 114#-------------------------------------------------------------------- 115if (GLFW_INSTALL) 116 install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 117 FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) 118 119 install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" 120 "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" 121 DESTINATION "${GLFW_CONFIG_PATH}") 122 123 install(EXPORT glfwTargets FILE glfw3Targets.cmake 124 EXPORT_LINK_INTERFACE_LIBRARIES 125 DESTINATION "${GLFW_CONFIG_PATH}") 126 install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" 127 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") 128 129 # Only generate this target if no higher-level project already has 130 if (NOT TARGET uninstall) 131 configure_file(CMake/cmake_uninstall.cmake.in 132 cmake_uninstall.cmake IMMEDIATE @ONLY) 133 134 add_custom_target(uninstall 135 "${CMAKE_COMMAND}" -P 136 "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") 137 set_target_properties(uninstall PROPERTIES FOLDER "GLFW3") 138 endif() 139endif() 140 141
[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.