From 18abeff68ec22ebcf923e8d4a96f26e14a8cfddd Mon Sep 17 00:00:00 2001 From: hendy643 Date: Sun, 30 Jun 2019 00:34:51 +0100 Subject: [PATCH] sync with upstream --- meson.build | 106 ++++++++++++++++++++++++++++++++++++++++++++++ meson_options.txt | 35 +++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 meson.build create mode 100644 meson_options.txt diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..7966dc5f7 --- /dev/null +++ b/meson.build @@ -0,0 +1,106 @@ +project('glfw', 'c', + version: '3.3.0', + license: 'zlib') + +cc = meson.get_compiler('c') +compiler_id = cc.get_id() + +math_dep = cc.find_library('m', required: false) +rt_dep = cc.find_library('rt', required: false) +threads_dep = dependency('threads') + + +#-------------------------------------------------------------------- +# Set compiler specific flags +#-------------------------------------------------------------------- + +if compiler_id == 'msvc' + if get_option('glfw_use_msvc_runtime_library_dll') + #foreach (flag CMAKE_C_FLAGS + # CMAKE_C_FLAGS_DEBUG + # CMAKE_C_FLAGS_RELEASE + # CMAKE_C_FLAGS_MINSIZEREL + # CMAKE_C_FLAGS_RELWITHDEBINFO) + # if (${flag} MATCHES "/MD") + # string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + # endif() + # if (${flag} MATCHES "/MDd") + # string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") + # endif() + #endforeach() + endif +endif + + +#-------------------------------------------------------------------- +# Detect and select backend APIs +#-------------------------------------------------------------------- + +host_system = host_machine.system() + +backend = get_option('glfw_backend') +if backend == 'auto' + if host_system == 'windows' or host_system == 'cygwin' + backend = 'win32' + elif host_system == 'darwin' + backend = 'cocoa' + elif host_system == 'linux' or host_system == 'bsd' + backend = 'x11' + else + error('Unable to determine the backend automatically.') + endif +endif + + +#-------------------------------------------------------------------- +# Add subdirectories +#-------------------------------------------------------------------- + +subdir('deps') +subdir('src') + +if get_option('glfw_build_tests') + subdir('tests') +endif + +if get_option('glfw_build_examples') + subdir('examples') +endif + +if get_option('glfw_build_docs') + subdir('docs') +endif + + +#-------------------------------------------------------------------- +# Install files other than the library +# The library is installed by src/CMakeLists.txt +#-------------------------------------------------------------------- + +#if (GLFW_INSTALL) +# install(DIRECTORY include/GLFW DESTINATION include +# FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) +# +# install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" +# "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" +# DESTINATION "${GLFW_CONFIG_PATH}") +# +# install(EXPORT glfwTargets FILE glfw3Targets.cmake +# EXPORT_LINK_INTERFACE_LIBRARIES +# DESTINATION "${GLFW_CONFIG_PATH}") +# install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" +# DESTINATION "lib${LIB_SUFFIX}/pkgconfig") +# +# # Only generate this target if no higher-level project already has +# if (NOT TARGET uninstall) +# configure_file(cmake_uninstall.cmake.in +# cmake_uninstall.cmake IMMEDIATE @ONLY) +# +# add_custom_target(uninstall +# "${CMAKE_COMMAND}" -P +# "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") +# endif() +#endif() + + +# vim: set softtabstop=4 shiftwidth=4: diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..f58a0976a --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,35 @@ +option('glfw_build_examples', + type: 'boolean', + description: 'Build the GLFW example programs', + value: false) + +option('glfw_build_tests', + type: 'boolean', + description: 'Build the GLFW test programs', + value: false) + +option('glfw_build_docs', + type: 'boolean', + description: 'Build the GLFW documentation', + value: false) + +option('glfw_vulkan_static', + type: 'boolean', + description: 'Use the Vulkan loader statically linked into application', + value: false) + +option('glfw_use_hybrid_hpg', + type: 'boolean', + description: 'Force use of high-performance GPU on hybrid systems', + value: false) + +option('glfw_use_msvc_runtime_library_dll', + type: 'boolean', + description: 'Use MSVC runtime library DLL', + value: true) + +option('glfw_backend', + type: 'combo', + description: 'Backend used for window creation', + value: 'auto', + choices: ['auto', 'wayland', 'mir', 'osmesa', 'win32', 'cocoa', 'x11'])