forked from tano-systems/psplash-tn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (76 loc) · 2.38 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
cmake_minimum_required(VERSION 2.8.10)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckFunctionExists)
OPTION(ENABLE_PNG "Enable support for PNG loading" ON)
OPTION(ENABLE_JPEG "Enable support for JPEG loading" OFF)
OPTION(ENABLE_ALIVE_GIF "Enable alive GIF animation support" OFF)
OPTION(ENABLE_SYSTEMD "Enable systemd init system support" OFF)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
PROJECT(psplash C)
ADD_DEFINITIONS(-Wall -Wextra)
ADD_DEFINITIONS(-D_GNU_SOURCE)
SET(PSPLASH_SOURCES
psplash.c
psplash-console.c
psplash-fb.c
psplash-uci.c
psplash-image.c
)
SET(PSPLASH_WRITE_SOURCES
psplash-write.c
)
IF(ENABLE_ALIVE_GIF)
SET(PSPLASH_SOURCES ${PSPLASH_SOURCES}
psplash-alive.c
3rdparty/gifdec/gifdec.c
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/gifdec)
ADD_DEFINITIONS(-DENABLE_ALIVE_GIF)
ENDIF()
IF(ENABLE_PNG)
FIND_LIBRARY(png NAMES png)
FIND_PATH(png_include_dir png.h)
INCLUDE_DIRECTORIES(${png_include_dir})
SET(LIBS ${LIBS} png)
ADD_DEFINITIONS(-DENABLE_PNG)
ENDIF()
IF(ENABLE_JPEG)
FIND_LIBRARY(jpeg NAMES jpeg)
FIND_PATH(jpeg_include_dir jpeglib.h)
INCLUDE_DIRECTORIES(${jpeg_include_dir})
SET(LIBS ${LIBS} jpeg)
ADD_DEFINITIONS(-DENABLE_JPEG)
ENDIF()
FIND_LIBRARY(uci NAMES uci)
FIND_PATH(uci_include_dir uci.h)
INCLUDE_DIRECTORIES(${uci_include_dir})
SET(LIBS ${LIBS} uci)
FIND_LIBRARY(ubox NAMES ubox)
FIND_PATH(ubox_include_dir libubox/ulog.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
SET(LIBS ${LIBS} ubox)
IF(ENABLE_SYSTEMD)
SET(LIBS ${LIBS} systemd)
ADD_DEFINITIONS(-DHAVE_SYSTEMD=1)
ADD_EXECUTABLE(psplash-systemd psplash-systemd.c)
SET_TARGET_PROPERTIES(psplash-systemd PROPERTIES OUTPUT_NAME psplash-systemd)
TARGET_LINK_LIBRARIES(psplash-systemd systemd)
# Install systemd service files
INSTALL(FILES systemd/psplash-systemd.service systemd/psplash-start.service
DESTINATION /usr/lib/systemd/system)
ENDIF()
ADD_EXECUTABLE(psplash ${PSPLASH_SOURCES})
SET_TARGET_PROPERTIES(psplash PROPERTIES OUTPUT_NAME psplash)
TARGET_LINK_LIBRARIES(psplash ${LIBS})
IF(ENABLE_SYSTEMD)
TARGET_LINK_LIBRARIES(psplash systemd)
ENDIF()
ADD_EXECUTABLE(psplash-write ${PSPLASH_WRITE_SOURCES})
SET_TARGET_PROPERTIES(psplash-write PROPERTIES OUTPUT_NAME psplash-write)
INSTALL(TARGETS psplash psplash-write
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# Install resources
INSTALL(DIRECTORY resources/ DESTINATION /usr/share/psplash)