-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
67 lines (50 loc) · 1.86 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
cmake_minimum_required(VERSION 2.8.7)
project(Amdgpu-Fan)
if (NOT CMAKE_BUILD_TYPE)
message("Setting build type to 'RelWithDebInfo'")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
OPTION(BUILD_DBUS_SUPPORT "Build DBUS listener." OFF)
OPTION(BUILD_CLIENT "Build CLI." OFF)
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX
"${CMAKE_CURRENT_SOURCE_DIR}/dist" CACHE PATH "Installation prefix, default 'dist'" FORCE
)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
unset(DBUS_AVAILABLE CACHE)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
#include_directories(.)
#include_directories(src)
add_executable(amdgpufand src/amdgpufand.c)
include(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(clock_nanosleep CLOCK_NANOSLEEP)
IF(NOT CLOCK_NANOSLEEP)
FIND_LIBRARY(RT_LIBRARIES rt)
target_link_libraries(amdgpufand ${RT_LIBRARIES})
ENDIF(NOT CLOCK_NANOSLEEP)
IF(BUILD_DBUS_SUPPORT)
message( FATAL_ERROR "DBUS is not implemented yet" )
find_package(DBus REQUIRED)
add_definitions(-DDBUS_FOUND)
include_directories(${DBUS_INCLUDE_DIRS})
add_library(libamdgpufan)
target_link_libraries(libamdgpufan ${DBUS_LIBRARIES})
target_link_libraries(amdgpufand ${DBUS_LIBRARIES})
IF(BUILD_CLIENT)
add_executable(amdgpufan src/amdgpufan.c)
target_link_libraries(amdgpufan libamdgpufan)
ENDIF(BUILD_CLIENT)
ELSE(BUILD_DBUS_SUPPORT)
IF(BUILD_CLIENT)
message( FATAL_ERROR "DBUS is required for client" )
ENDIF(BUILD_CLIENT)
ENDIF(BUILD_DBUS_SUPPORT)
IF(BUILD_DBUS_SUPPORT)
INSTALL(DIRECTORY src/ DESTINATION include/amdgpufan FILES_MATCHING PATTERN *.h)
ENDIF(BUILD_DBUS_SUPPORT)
#INSTALL(TARGETS Amdgpu-Fan amdgpufan
# RUNTIME DESTINATION bin
# ARCHIVE DESTINATION lib
# LIBRARY DESTINATION lib)
INSTALL(TARGETS amdgpufand
RUNTIME DESTINATION sbin)