aboutsummaryrefslogtreecommitdiffstats
path: root/raylib/cmake/GlfwImport.cmake
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-06-13 22:15:48 +0200
committersalaaad2 <arthurdurant263@gmail.com>2022-06-13 22:15:48 +0200
commit95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3 (patch)
tree352480349a46d19ab5b8078ac4ccb79d27166f04 /raylib/cmake/GlfwImport.cmake
parentmouse is captured again, pretty gud (diff)
downloadyabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.gz
yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.bz2
yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.xz
yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.zst
yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.zip
add raylib to the build chain with -O3 and -march=native
Diffstat (limited to 'raylib/cmake/GlfwImport.cmake')
-rw-r--r--raylib/cmake/GlfwImport.cmake34
1 files changed, 34 insertions, 0 deletions
diff --git a/raylib/cmake/GlfwImport.cmake b/raylib/cmake/GlfwImport.cmake
new file mode 100644
index 0000000..1b94cdf
--- /dev/null
+++ b/raylib/cmake/GlfwImport.cmake
@@ -0,0 +1,34 @@
+
+if(USE_EXTERNAL_GLFW STREQUAL "ON")
+ find_package(glfw3 3.3.3 REQUIRED)
+elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
+ find_package(glfw3 3.3.3 QUIET)
+endif()
+if (glfw3_FOUND)
+ set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
+endif()
+
+# Explicitly check against "ON", because USE_EXTERNAL_GLFW is a tristate option
+# Also adding only on desktop (web also uses glfw but it is more limited and is added using an emcc linker flag)
+if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
+ MESSAGE(STATUS "Using raylib's GLFW")
+ set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
+ set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
+ set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
+ set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
+ set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
+
+ set(WAS_SHARED ${BUILD_SHARED_LIBS})
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
+
+ add_subdirectory(external/glfw)
+
+ set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
+ unset(WAS_SHARED)
+
+ list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
+ include_directories(BEFORE SYSTEM external/glfw/include)
+else()
+ MESSAGE(STATUS "Using external GLFW")
+ set(GLFW_PKG_DEPS glfw3)
+endif()