-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
92 lines (73 loc) · 3.44 KB
/
CMakeLists.txt
File metadata and controls
92 lines (73 loc) · 3.44 KB
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
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# sysd/CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
set (SYSD ops-sysd)
project (${SYSD})
set (SRC_DIR src)
set (INCL_DIR include)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Werror")
OPTION( PLATFORM_SIMULATION "Enable platform simulation" OFF )
set (SYSCONFDIR "/etc" CACHE STRING "Location of system configuration files")
set (HWDESC_FILE_LINK_PATH ${SYSCONFDIR}/openswitch)
set (HWDESC_FILE_LINK ${SYSCONFDIR}/openswitch/hwdesc)
set (HWDESC_FILES_PATH ${SYSCONFDIR}/openswitch/platform)
# Update the sysd.h with any compile time flags
configure_file (${PROJECT_SOURCE_DIR}/${INCL_DIR}/sysd.h.in
${PROJECT_BINARY_DIR}/${INCL_DIR}/sysd.h)
# Update the platform YAML config file location in sysd_cfg_yaml
configure_file (${PROJECT_SOURCE_DIR}/${INCL_DIR}/sysd_cfg_yaml.h.in
${PROJECT_BINARY_DIR}/${INCL_DIR}/sysd_cfg_yaml.h)
set (MANIFEST_FILE_PATH /etc/openswitch/image.manifest)
set (OS_RELEASE_FILE_PATH /etc/os-release)
set (VER_DETAIL_FILE_PATH /var/lib/version_detail.yaml)
# Update the image.manifest file location in sysd_util
configure_file (${PROJECT_SOURCE_DIR}/${INCL_DIR}/sysd_util.h.in
${PROJECT_BINARY_DIR}/${INCL_DIR}/sysd_util.h)
# Rules to locate needed libraries
include(FindPkgConfig)
pkg_check_modules(ZLIB REQUIRED zlib)
pkg_check_modules(CONFIG_YAML REQUIRED ops-config-yaml)
pkg_check_modules(OPSUTILS REQUIRED opsutils)
pkg_check_modules(OVSCOMMON REQUIRED libovscommon)
pkg_check_modules(OVSDB REQUIRED libovsdb)
include_directories (${PROJECT_BINARY_DIR}/${INCL_DIR}
${PROJECT_SOURCE_DIR}/${INCL_DIR}
${OVSCOMMON_INCLUDE_DIRS})
# Source files to build ops-sysd
set (SOURCES ${SRC_DIR}/sysd.c
${SRC_DIR}/sysd_cfg_yaml.c
${SRC_DIR}/sysd_fru.c
${SRC_DIR}/sysd_ovsdb_if.c
${SRC_DIR}/qos_init.c
${SRC_DIR}/sysd_util.c)
# Rules to build ops-sysd
add_executable (${SYSD} ${SOURCES})
target_link_libraries (${SYSD} ${OPSUTILS_LIBRARIES} ${CONFIG_YAML_LIBRARIES}
${OVSCOMMON_LIBRARIES} ${OVSDB_LIBRARIES} ${ZLIB_LIBRARIES}
-lpthread -lrt -lsupportability -lyaml)
# The default install prefix is /usr. We want to install manifest file at
# '/etc/openswitch'. So change the install prefix to '/', and use relative
# directories in the install command.
SET(CMAKE_INSTALL_PREFIX "/" CACHE STRING "Prefix prepended to install directories" FORCE)
# Rules to install ops-sysd binary in rootfs
install(TARGETS ${SYSD}
RUNTIME DESTINATION usr/bin)
# Build ops-sysd cli shared libraries.
add_subdirectory(src/cli)
# OPS_TODO: The image.manifest file should not be located in sysd.
# This is just temporary parking space until we find it better home.
install(FILES files/image.manifest
DESTINATION etc/openswitch)