-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
49 lines (42 loc) · 1.65 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
#
# This file is part of the STuffEmu (https://github.com/BigWhale/STuffEmu)
# Copyright (c) 2018 David Klasinc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.7)
project(stuffemu C)
set(CMAKE_C_STANDARD 99)
#
# This works on Raspbian
#
set (SYSTEMD_DIR "/lib/systemd/system/")
message(STATUS "Detecting CPU: ${CMAKE_SYSTEM_PROCESSOR}")
#
# If compiling on a PC assume it's just a test and disable RPi stuff
#
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(x86_64)|(X86_64)")
add_definitions(-DTESTENV)
endif ()
add_executable(stuffemu src/main.c src/main.h src/input.c src/helpers.c src/helpers.h src/hw_defs.h src/hw_defs.c src/input.h src/output.c src/output.h)
target_link_libraries(stuffemu pthread)
#
# TODO.md: Check if this works on RPi v1 and v3
#
if (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv6l")
target_link_libraries(stuffemu wiringPi)
endif ()
set(CMAKE_INSTALL_PREFIX "/opt/stuffemu/")
install(TARGETS stuffemu DESTINATION bin)
install(FILES systemd/stuffemu.path DESTINATION ${SYSTEMD_DIR})
install(FILES systemd/stuffemu.service DESTINATION ${SYSTEMD_DIR})