-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
115 lines (95 loc) · 3.18 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# frabenu - Framebuffer menu
# Copyright (C) 2018 Frank Müller
#
# SPDX-License-Identifier: GPL-2.0-or-later
cmake_minimum_required(VERSION 3.0)
project (frabenu)
set(FRABENU_JOYMONITORMODE "NOTIFY" CACHE STRING "Monitor mode for joystick devices, POLL or NOTIFY")
set_property(CACHE FRABENU_JOYMONITORMODE PROPERTY STRINGS POLL NOTIFY)
add_definitions(-DFRABENU_JOYMONITORMODE_POLL=1 -DFRABENU_JOYMONITORMODE_NOTIFY=2 -DFRABENU_JOYMONITORMODE=FRABENU_JOYMONITORMODE_${FRABENU_JOYMONITORMODE})
add_compile_options("-Wall")
# for some FindXxx.cmake-files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# sources without main and lib dependend sources
set(FRABENU_BASE_SRC
debug.c
debug.h
input.c
input.h
input_kbd.c
input_kbd.h
input_joy.c
input_joy.h
menu.c
menu.h
timer.c
timer.h
fbida/fb-gui.c
fbida/fb-gui.h
fbida/fbi.c
fbida/fbi.h
fbida/fbtools.c
fbida/fbtools.h
fbida/gfx.h
fbida/kbd.c
fbida/kbd.h
fbida/list.h
fbida/misc.h
fbida/readers.c
fbida/readers.h
fbida/vt.c
fbida/vt.h
fbida/rd/read-bmp.c
fbida/rd/read-ppm.c
)
# Search and add realy needed libs
find_package(Pixman REQUIRED)
include_directories(${PIXMAN_INCLUDE_DIRS})
set(LIBS ${LIBS} ${PIXMAN_LIBRARIES})
# Search for extra libs and add them and extra sources
find_package(JPEG)
find_package(EXIF)
if (JPEG_FOUND AND EXIF_FOUND)
include_directories(${JPEG_INCLUDE_DIRS})
set(LIBS ${LIBS} ${JPEG_LIBRARIES})
execute_process(COMMAND "${CMAKE_SOURCE_DIR}/fbida/scripts/jpeg-version.sh"
OUTPUT_VARIABLE JPEG_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
include_directories(${CMAKE_SOURCE_DIR}/fbida/jpeg/${JPEG_VERSION})
include_directories(${EXIF_INCLUDE_DIRS})
set(LIBS ${LIBS} ${EXIF_LIBRARIES})
set(FRABENU_BASE_SRC ${FRABENU_BASE_SRC}
fbida/rd/read-jpeg.c
fbida/jpeg/${JPEG_VERSION}/jinclude.h
fbida/jpeg/${JPEG_VERSION}/jpegint.h
fbida/jpeg/${JPEG_VERSION}/jpeglib.h
fbida/jpeg/${JPEG_VERSION}/transupp.c
fbida/jpeg/${JPEG_VERSION}/transupp.h)
endif (JPEG_FOUND AND EXIF_FOUND)
find_package(PNG)
if (PNG_FOUND)
include_directories(${PNG_INCLUDE_DIRS})
set(LIBS ${LIBS} ${PNG_LIBRARIES})
set(FRABENU_BASE_SRC ${FRABENU_BASE_SRC} fbida/rd/read-png.c)
endif (PNG_FOUND)
find_package(GIF)
if (GIF_FOUND)
include_directories(${GIF_INCLUDE_DIRS})
set(LIBS ${LIBS} ${GIF_LIBRARIES})
set(FRABENU_BASE_SRC ${FRABENU_BASE_SRC} fbida/rd/read-gif.c)
endif (GIF_FOUND)
find_package(TIFF)
if (TIFF_FOUND)
include_directories(${TIFF_INCLUDE_DIRS})
set(LIBS ${LIBS} ${TIFF_LIBRARIES})
set(FRABENU_BASE_SRC ${FRABENU_BASE_SRC} fbida/rd/read-tiff.c)
endif (TIFF_FOUND)
# The main application
add_executable(frabenu "frabenu.c" ${FRABENU_BASE_SRC})
set_property(TARGET frabenu PROPERTY C_STANDARD 11)
target_link_libraries(frabenu ${LIBS})
# Some simple test code
enable_testing()
add_executable(frabenu_test "test/test.c" ${FRABENU_BASE_SRC})
target_link_libraries(frabenu_test ${LIBS})
add_test(NAME FrabenuTest COMMAND frabenu_test WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/example")