blob: 612528e805a1995c5a8ec82c7cf11d484e377555 (
plain)
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
|
find_program(PYTHON "python3")
include(TestBigEndian)
test_big_endian(BIGENDIAN)
if (BIGENDIAN)
add_definitions(-DBIG_ENDIAN_HOST)
else (BIGENDIAN)
add_definitions(-DLITTLE_ENDIAN_HOST)
endif (BIGENDIAN)
add_definitions("-D_GNU_SOURCE")
add_definitions("-D_BSD_SOURCE")
add_definitions("-D_DEFAULT_SOURCE")
add_definitions("-DRAZERCFG_BUILD")
add_definitions("-D_FORTIFY_SOURCE=2")
set(WARNING_COMPILE_FLAGS "-Wall -Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wsuggest-attribute=noreturn -Wundef -Wpointer-arith -Wcast-qual -Wlogical-op -Wshadow")
set(GENERIC_COMPILE_FLAGS "-O2 -std=c99 -fstack-protector -fstack-check ${WARNING_COMPILE_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=address")
find_path(LIBUSB_INCLUDE_PATH
NAMES libusb.h
PATHS "/usr/include/libusb" "/usr/include/libusb-1.0"
)
include_directories(AFTER ${LIBUSB_INCLUDE_PATH})
set(CMAKE_REQUIRED_INCLUDES "${LIBUSB_INCLUDE_PATH};${CMAKE_REQUIRED_INCLUDES}")
execute_process(COMMAND pkg-config --variable=systemdsystemunitdir systemd
OUTPUT_VARIABLE SYSTEMD_UNIT_DIR
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND pkg-config --variable=udevdir udev
OUTPUT_VARIABLE UDEV_DIR
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
macro(INSTALL_EXEC_CMD _COMMAND _FAILMSG)
install(CODE "
execute_process(COMMAND ${_COMMAND} RESULT_VARIABLE install_exec_res)
if (NOT \"\${install_exec_res}\" STREQUAL \"0\")
message(WARNING \"WARNING: ${_COMMAND} failed: \${install_exec_res}\n${_FAILMSG}\n\")
else (NOT \"\${install_exec_res}\" STREQUAL \"0\")
message(STATUS \"${_COMMAND}: \${install_exec_res}\")
endif (NOT \"\${install_exec_res}\" STREQUAL \"0\")
")
endmacro(INSTALL_EXEC_CMD)
|