Skip to content

Commit

Permalink
stat adding glfw
Browse files Browse the repository at this point in the history
  • Loading branch information
PaoloOranges committed Dec 6, 2016
1 parent 307519d commit 7aa79cc
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 34 deletions.
71 changes: 66 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,71 @@
cmake_minimum_required(VERSION 3.6)
project (OpenGLExamples)

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)

# Set Variables for include and linking depending on platform

IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X

# Support only desktop

SET(Processor "x64")
SET(OperatingSystem "Darwin")
SET(Compiler "GCC")

ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Linux

IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
# Raspberry Pi and i.MX6

IF(${SoC} MATCHES "iMX6")
# i.MX6

# Everything is in /usr/include

ELSE()
# Raspberry Pi
ENDIF()

ELSE()
# Support only desktop

SET(Processor "x64")
SET(OperatingSystem "Linux")
SET(Compiler "GCC")

ENDIF()

ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# Windows

SET(Processor "x86")
SET(OperatingSystem "Windows")
SET(Compiler "MSVC")
set(LIBRARIES_TO_LINK OpenGL32.lib glew32s.lib glfw3.lib)

ENDIF()

# set GLFW valiables
# set(BUILD_SHARED_LIBS "Build shared libraries" OFF)
set(GLFW_BUILD_EXAMPLES OFF)
set(GLFW_BUILD_TESTS OFF)
set(GLFW_BUILD_DOCS OFF)
set(GLFW_INSTALL OFF)

# set GLUS variables
set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})
set(EXTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/External/${ENV_DIR}/include)
set(EXTERNAL_LIB_DIR ${CMAKE_SOURCE_DIR}/External/${ENV_DIR}/lib)

include_directories(${EXTERNAL_INCLUDE_DIR})
link_directories(${EXTERNAL_LIB_DIR} ${LIBRARY_OUTPUT_PATH})

add_subdirectory(GLUS)
add_subdirectory(GLFW)


add_subdirectory(Example01)
2 changes: 1 addition & 1 deletion Example01/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ file(GLOB SOURCES "src/*.cpp" "src/*.c")

add_executable(Example01 ${SOURCES})

target_link_libraries (Example01 LINK_PUBLIC GLUS)
target_link_libraries(Example01 ${LIBRARIES_TO_LINK} GLUS)
33 changes: 5 additions & 28 deletions GLUS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X

# Support only desktop

SET(Processor "x64")
SET(OperatingSystem "Darwin")
SET(Compiler "GCC")

set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})

include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)

ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Linux
Expand All @@ -49,16 +41,7 @@ ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

ELSE()
# Support only desktop

SET(Processor "x64")
SET(OperatingSystem "Linux")
SET(Compiler "GCC")

set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})

# External directories
include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)


ENDIF()

ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
Expand Down Expand Up @@ -89,19 +72,13 @@ ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")

ELSE()
# Desktop

SET(Processor "x86")
SET(OperatingSystem "Windows")
SET(Compiler "MSVC")

set(ENV_DIR ${Processor}/${OperatingSystem}/${Compiler})

include_directories(${GLUS_SOURCE_DIR}/../External/${ENV_DIR}/include)


ENDIF()

ENDIF()


include_directories(${EXTERNAL_INCLUDE_DIR})

# Files only valid for desktop OpenGL
list(APPEND ONLY_GL_C_FILES ${GLUS_SOURCE_DIR}/src/glus_window_glfw.c
${GLUS_SOURCE_DIR}/src/glus_programpipeline.c
Expand Down

0 comments on commit 7aa79cc

Please sign in to comment.