-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
70 lines (54 loc) · 2.45 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
project(GL_EXAMPLES)
cmake_minimum_required(VERSION 2.8)
# ------------------------------------------------------------------------------
# Compiler Flags
# ------------------------------------------------------------------------------
set(C_FLAGS_COMMON "-Wall -DGL_GLEXT_PROTOTYPES -DGLX_GLXEXT_PROTOTYPES -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L")
set(CMAKE_C_FLAGS "--std=c99 ${C_FLAGS_COMMON}")
set(CMAKE_C_FLAGS_DEBUG "-g3 -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS ${C_FLAGS_COMMON})
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
# ------------------------------------------------------------------------------
# Output Directories
# ------------------------------------------------------------------------------
# Put libraries and binaries that get built into the directories at
# top of the build tree rather than in hard-to-find leaf
# directoreis. This simplifies manual testing.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# ------------------------------------------------------------------------------
# Find libraries
# ------------------------------------------------------------------------------
function(local_find_library VAR NAME)
find_library("${VAR}" "${NAME}")
if("${VAR}")
message(STATUS "Library found: ${NAME}")
else("${VAR}")
message(STATUS "Library not found: ${NAME}")
endif("${VAR}")
endfunction(local_find_library)
local_find_library(LOCAL_GL_LIB GL)
local_find_library(LOCAL_GLES2_LIB GLESv2)
local_find_library(LOCAL_EGL_LIB EGL)
local_find_library(LOCAL_X11_LIB X11)
local_find_library(LOCAL_X11_xcb_LIB X11-xcb)
local_find_library(LOCAL_xcb_LIB xcb)
if(UNIX AND APPLE)
find_package(OpenGL REQUIRED)
find_library(COCOA_FRAMEWORK Cocoa REQUIRED)
find_library(IOKIT_FRAMEWORK IOKit REQUIRED)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation REQUIRED)
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang")
endif(UNIX AND APPLE)
# ------------------------------------------------------------------------------
# Add subdirectores
# ------------------------------------------------------------------------------
function(local_notify_build NAME)
message(STATUS "Will build target: ${NAME}")
endfunction(local_notify_build)
add_subdirectory(src)
# vim: et sw=4 tw=80: