Skip to content

Commit 67b908e

Browse files
authored
Merge pull request #133 from arrayfire/revert-132-cmake
Revert "Use glfw find_package"
2 parents 312945d + 930780c commit 67b908e

File tree

2 files changed

+69
-6
lines changed

2 files changed

+69
-6
lines changed

CMakeModules/FindGLFW.cmake

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Sourced from
2+
#https://code.google.com/p/assembly3d/
3+
4+
# Locate the glfw library
5+
# This module defines the following variables:
6+
# GLFW_LIBRARY, the name of the library;
7+
# GLFW_INCLUDE_DIR, where to find glfw include files.
8+
# GLFW_FOUND, true if both the GLFW_LIBRARY and GLFW_INCLUDE_DIR have been found.
9+
#
10+
# To help locate the library and include file, you could define an environment variable called
11+
# GLFW_ROOT which points to the root of the glfw library installation. This is pretty useful
12+
# on a Windows platform.
13+
#
14+
#
15+
# Usage example to compile an "executable" target to the glfw library:
16+
#
17+
# FIND_PACKAGE (glfw REQUIRED)
18+
# INCLUDE_DIRECTORIES (${GLFW_INCLUDE_DIR})
19+
# ADD_EXECUTABLE (executable ${EXECUTABLE_SRCS})
20+
# TARGET_LINK_LIBRARIES (executable ${GLFW_LIBRARY})
21+
#
22+
# TODO:
23+
# Allow the user to select to link to a shared library or to a static library.
24+
25+
#Search for the include file...
26+
FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h DOC "Path to GLFW include directory."
27+
HINTS
28+
$ENV{GLFW_ROOT}
29+
PATH_SUFFIX include #For finding the include file under the root of the glfw expanded archive, typically on Windows.
30+
PATHS
31+
/usr/include/
32+
/usr/local/include/
33+
# By default headers are under GLFW subfolder
34+
/usr/include/GLFW
35+
/usr/local/include/GLFW
36+
${GLFW_ROOT_DIR}/include/ # added by ptr
37+
)
38+
39+
FIND_LIBRARY(GLFW_LIBRARY DOC "Absolute path to GLFW library."
40+
NAMES glfw GLFW.lib glfw3
41+
HINTS
42+
$ENV{GLFW_ROOT}
43+
PATH_SUFFIXES lib/x64 release debug #For finding the library file under the root of the glfw expanded archive, typically on Windows.
44+
PATHS
45+
/usr/lib
46+
/usr/lib64
47+
/usr/lib/x86_64-linux-gnu
48+
/usr/lib/arm-linux-gnueabihf
49+
/usr/local/lib
50+
/usr/local/lib64
51+
/sw/lib
52+
/opt/local/lib
53+
${GLFW_ROOT_DIR}/lib-msvc100 # added by ptr
54+
${GLFW_ROOT_DIR}/lib-msvc110
55+
${GLFW_ROOT_DIR}/lib-msvc120
56+
${GLFW_ROOT_DIR}/lib
57+
)
58+
59+
SET(GLFW_FOUND 0)
60+
IF(GLFW_LIBRARY AND GLFW_INCLUDE_DIR)
61+
SET(GLFW_FOUND 1)
62+
message(STATUS "GLFW found!")
63+
ENDIF(GLFW_LIBRARY AND GLFW_INCLUDE_DIR)

src/backend/opengl/CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ IF(UNIX)
4040
ENDIF(UNIX)
4141

4242
IF(${USE_WINDOW_TOOLKIT} STREQUAL "glfw3")
43-
find_package(glfw3)
44-
IF(glfw3_FOUND)
45-
SET(WTK_INCLUDE_DIRS)
46-
SET(WTK_LIBRARIES glfw)
43+
FIND_PACKAGE(GLFW REQUIRED)
44+
IF(GLFW_FOUND)
45+
SET(WTK_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
46+
SET(WTK_LIBRARIES ${GLFW_LIBRARY})
4747
ADD_DEFINITIONS(-DUSE_GLFW)
48-
ELSE(glfw3_FOUND)
48+
ELSE(GLFW_FOUND)
4949
MESSAGE(FATAL_ERROR "GLFW not found")
50-
ENDIF(glfw3_FOUND)
50+
ENDIF(GLFW_FOUND)
5151
ENDIF()
5252

5353
IF(${USE_WINDOW_TOOLKIT} STREQUAL "sdl2")

0 commit comments

Comments
 (0)