Skip to content

Commit 7aa79cc

Browse files
committed
stat adding glfw
1 parent 307519d commit 7aa79cc

File tree

3 files changed

+72
-34
lines changed

3 files changed

+72
-34
lines changed

CMakeLists.txt

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,71 @@
11
cmake_minimum_required(VERSION 3.6)
22
project (OpenGLExamples)
33

4-
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
5-
6-
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
7-
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
8-
4+
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build)
5+
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
6+
7+
# Set Variables for include and linking depending on platform
8+
9+
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
10+
# Mac OS X
11+
12+
# Support only desktop
13+
14+
SET(Processor "x64")
15+
SET(OperatingSystem "Darwin")
16+
SET(Compiler "GCC")
17+
18+
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
19+
# Linux
20+
21+
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
22+
# Raspberry Pi and i.MX6
23+
24+
IF(${SoC} MATCHES "iMX6")
25+
# i.MX6
26+
27+
# Everything is in /usr/include
28+
29+
ELSE()
30+
# Raspberry Pi
31+
ENDIF()
32+
33+
ELSE()
34+
# Support only desktop
35+
36+
SET(Processor "x64")
37+
SET(OperatingSystem "Linux")
38+
SET(Compiler "GCC")
39+
40+
ENDIF()
41+
42+
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
43+
# Windows
44+
45+
SET(Processor "x86")
46+
SET(OperatingSystem "Windows")
47+
SET(Compiler "MSVC")
48+
set(LIBRARIES_TO_LINK OpenGL32.lib glew32s.lib glfw3.lib)
49+
50+
ENDIF()
51+
52+
# set GLFW valiables
53+
# set(BUILD_SHARED_LIBS "Build shared libraries" OFF)
54+
set(GLFW_BUILD_EXAMPLES OFF)
55+
set(GLFW_BUILD_TESTS OFF)
56+
set(GLFW_BUILD_DOCS OFF)
57+
set(GLFW_INSTALL OFF)
58+
59+
# set GLUS variables
60+
set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})
61+
set(EXTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/External/${ENV_DIR}/include)
62+
set(EXTERNAL_LIB_DIR ${CMAKE_SOURCE_DIR}/External/${ENV_DIR}/lib)
63+
64+
include_directories(${EXTERNAL_INCLUDE_DIR})
65+
link_directories(${EXTERNAL_LIB_DIR} ${LIBRARY_OUTPUT_PATH})
66+
967
add_subdirectory(GLUS)
68+
add_subdirectory(GLFW)
69+
70+
1071
add_subdirectory(Example01)

Example01/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ file(GLOB SOURCES "src/*.cpp" "src/*.c")
88

99
add_executable(Example01 ${SOURCES})
1010

11-
target_link_libraries (Example01 LINK_PUBLIC GLUS)
11+
target_link_libraries(Example01 ${LIBRARIES_TO_LINK} GLUS)

GLUS/CMakeLists.txt

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
1616
# Mac OS X
1717

1818
# Support only desktop
19-
20-
SET(Processor "x64")
21-
SET(OperatingSystem "Darwin")
22-
SET(Compiler "GCC")
23-
24-
set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})
25-
26-
include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)
2719

2820
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
2921
# Linux
@@ -49,16 +41,7 @@ ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
4941

5042
ELSE()
5143
# Support only desktop
52-
53-
SET(Processor "x64")
54-
SET(OperatingSystem "Linux")
55-
SET(Compiler "GCC")
56-
57-
set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})
58-
59-
# External directories
60-
include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)
61-
44+
6245
ENDIF()
6346

6447
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
@@ -89,19 +72,13 @@ ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
8972

9073
ELSE()
9174
# Desktop
92-
93-
SET(Processor "x86")
94-
SET(OperatingSystem "Windows")
95-
SET(Compiler "MSVC")
96-
97-
set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})
98-
99-
include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)
100-
75+
10176
ENDIF()
10277

10378
ENDIF()
104-
79+
80+
include_directories(${EXTERNAL_INCLUDE_DIR})
81+
10582
# Files only valid for desktop OpenGL
10683
list(APPEND ONLY_GL_C_FILES ${GLUS_SOURCE_DIR}/src/glus_window_glfw.c
10784
${GLUS_SOURCE_DIR}/src/glus_programpipeline.c

0 commit comments

Comments
 (0)