-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
97 lines (90 loc) · 3.08 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required (VERSION 2.8)
project (glxosd)
include(GNUInstallDirs)
include(third-party/BuildLuaJIT.cmake)
include(third-party/BuildGLEW.cmake)
include(third-party/BuildFreetype.cmake)
##### Parameters #####
if (EXISTS "/etc/debian_version")
SET(INSTALLATION_SUFFIX_32 "/lib/i386-linux-gnu/" CACHE STRING "")
SET(INSTALLATION_SUFFIX_64 "/lib/x86_64-linux-gnu/" CACHE STRING "")
else()
SET(INSTALLATION_SUFFIX_32 "/lib/" CACHE STRING "")
SET(INSTALLATION_SUFFIX_64 "/lib64/" CACHE STRING "")
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/")
add_definitions(-DLUA_SOURCECODE_PATH="${CMAKE_INSTALL_FULL_DATAROOTDIR}/glxosd/")
##### Set version #####
set(GLXOSD_VERSION_MAJOR 3)
set(GLXOSD_VERSION_MINOR 2)
set(GLXOSD_VERSION_PATCH 2)
set(GLXOSD_VERSION_STRING ${GLXOSD_VERSION_MAJOR}.${GLXOSD_VERSION_MINOR}.${GLXOSD_VERSION_PATCH})
##### Compiler #####
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c11")
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
##### Find the libraries #####
#Find OpenGL
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
if(NOT OPENGL_FOUND)
message(ERROR " OPENGL not found!")
endif(NOT OPENGL_FOUND)
if(NOT OPENGL_GLU_FOUND)
message(ERROR " GLU not found!")
endif(NOT OPENGL_GLU_FOUND)
#Find Freetype
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
if(NOT FREETYPE_FOUND)
message(ERROR " Freetype not found!")
endif(NOT FREETYPE_FOUND)
#Find FontConfig
find_package(FontConfig REQUIRED)
include_directories(${FONTCONFIG_INCLUDE_DIRS})
if(NOT FONTCONFIG_FOUND)
message(ERROR " FontConfig not found!")
endif(NOT FONTCONFIG_FOUND)
#Find POSIX threads
find_package(Threads REQUIRED)
if(NOT Threads_FOUND)
message(ERROR " POSIX threads not found!")
endif(NOT Threads_FOUND)
#Find X11
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIRS})
if(NOT X11_FOUND)
message(ERROR " X11 not found!")
endif(NOT X11_FOUND)
##### Link to local libraries #####
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
##### Add subdirectories #####
add_subdirectory(src)
##### Install config #####
install(DIRECTORY src/glxosd/conf/
DESTINATION /etc/glxosd/)
##### Create launcher #####
configure_file(
${PROJECT_SOURCE_DIR}/launcher_template.sh.in
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/glxosd
@ONLY
)
file(
COPY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/glxosd
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
install(
FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/glxosd"
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)