-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
96 lines (73 loc) · 3.15 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
project(ubuntu-touch-sdl-template C CXX)
cmake_minimum_required(VERSION 2.8.9)
# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Automatically create moc files
set(CMAKE_AUTOMOC ON)
set(APP_NAME ubuntu-touch-sdl-template)
set(MAIN ${APP_NAME})
set(ICON "ubuntu-touch-sdl-template.png")
# Set install paths
set(CMAKE_INSTALL_PREFIX /)
set(DATA_DIR /)
set(DESKTOP_DIR ${DATA_DIR})
set(DESKTOP_FILE_NAME "ubuntu-touch-sdl-template.desktop")
set(EXEC "${APP_NAME}")
# This command figures out the target architecture for use in the manifest file
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${DESKTOP_FILE_NAME}
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${ICON} DESTINATION ${DATA_DIR})
install(FILES "ubuntu-touch-sdl-template.apparmor" DESTINATION ${DATA_DIR})
# Add source files from src/
set(
EXEC_SOURCES
src/main.c
)
# Add and install binary
add_executable(${EXEC} ${EXEC_SOURCES})
install_targets(${CMAKE_INSTALL_PREFIX} ${EXEC})
# Add the path to our local libraries
set(LIBRARY_SEARCH_PATHS "lib/arm-linux-gnueabihf/")
# Find libSDL2 (system-wide or local installation)
find_library(SDL2_LIB NAMES SDL2 PATHS ${LIBRARY_SEARCH_PATHS})
# Find libasound (system-wide or local installation)
# find_library(ASOUND_LIB NAMES asound PATHS ${LIBRARY_SEARCH_PATHS})
# Find pulseaudio libraries (system-wide or local installation)
# find_library(PULSE_LIB NAMES pulse PATHS ${LIBRARY_SEARCH_PATHS})
# find_library(PULSE_LIB_SIMPLE NAMES pulse-simple PATHS ${LIBRARY_SEARCH_PATHS})
# Find X11 libraries (system-wide or local installation)
# find_library(XCURSOR_LIB NAMES Xcursor PATHS ${LIBRARY_SEARCH_PATHS})
# find_library(XINERAMA_LIB NAMES Xinerama PATHS ${LIBRARY_SEARCH_PATHS})
# find_library(XKBCOMMON_LIB NAMES xkbcommon PATHS ${LIBRARY_SEARCH_PATHS})
# find_library(XI_LIB NAMES Xi PATHS ${LIBRARY_SEARCH_PATHS})
# find_library(XRANDR_LIB NAMES Xrandr PATHS ${LIBRARY_SEARCH_PATHS})
#find_library(XSS_LIB NAMES Xss PATHS ${LIBRARY_SEARCH_PATHS})
# List of libraries
set(
EXEC_LIBS
${XSS_LIB}
${SDL2_LIB}
)
# Link against libSDL2
target_link_libraries(${EXEC} ${EXEC_LIBS})
# Include headers
add_subdirectory(include)
# Include dynamic libraries
add_subdirectory(lib)
add_custom_target("check" ${EXEC}
DEPENDS ${EXEC}
WORKING_DIRECTORY .)
add_custom_target("run" ${EXEC}
DEPENDS ${EXEC}
WORKING_DIRECTORY .)
# No op custom target for all not compiled files, so they show up in the QtCreator project tree
add_custom_target("ubuntu-touch-sdl-template_ClickFiles" ALL SOURCES ${DESKTOP_FILE_NAME} "ubuntu-touch-sdl-template.apparmor" "manifest.json.in")