CMake/FindGLM.cmake

Wed, 25 May 2022 20:36:34 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 May 2022 20:36:34 +0300
changeset 199
6988973515d2
parent 29
4cc6b582fde8
permissions
-rw-r--r--

Fix pick() picking from weird places on the screen with high DPI scaling

glReadPixels reads data from the frame buffer, which contains data after
high DPI scaling, so any reads to that need to take this scaling into account

29
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 # Find GLM
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 # Try to find GLM : OpenGL Mathematics.
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 # This module defines
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 # - GLM_INCLUDE_DIRS
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 # - GLM_FOUND
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 #
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 # The following variables can be set as arguments for the module.
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 # - GLM_ROOT_DIR : Root library directory of GLM
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 #
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 # References:
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 # - https://github.com/Groovounet/glm/blob/master/util/FindGLM.cmake
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 # - https://bitbucket.org/alfonse/gltut/src/28636298c1c0/glm-0.9.0.7/FindGLM.cmake
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 #
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 # Additional modules
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 include(FindPackageHandleStandardArgs)
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 if (WIN32)
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 # Find include files
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 find_path(
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 GLM_INCLUDE_DIR
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 NAMES glm/glm.hpp
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 PATHS
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 $ENV{PROGRAMFILES}/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 ${GLM_ROOT_DIR}/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 DOC "The directory where glm/glm.hpp resides")
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 else()
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 # Find include files
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 find_path(
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 GLM_INCLUDE_DIR
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 NAMES glm/glm.hpp
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 PATHS
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 /usr/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 /usr/local/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 /sw/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 /opt/local/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 ${GLM_ROOT_DIR}/include
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 DOC "The directory where glm/glm.hpp resides")
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 endif()
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 # Handle REQUIRD argument, define *_FOUND variable
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 # Define GLM_INCLUDE_DIRS
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 if (GLM_FOUND)
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 endif()
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
50
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
51 # Hide some variables
4cc6b582fde8 added FindGLM.cmake
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
52 mark_as_advanced(GLM_INCLUDE_DIR)

mercurial