Implement PSU Power Sensor

Implement Power Supply Input Power Sensor.

Tested By:
With the related change in entity-manager, after run psusensor in
BMC console, xyz.openbmc_project.PSUSensor has been created and
PSU pin dbus interface has been created with correct Thresholds
and value. Ipmitool sensor list can show PSU pin sensor.

Change-Id: Ib057a9ecca7bf317eb8d98af1ddb8be39841a54f
Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index afb5caf..cfbe229 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@
 option (DISABLE_HWMON_TEMP "Disable installing hwmon temp sensor" OFF)
 option (DISABLE_INTRUSION "Disable installing intrusion sensor" OFF)
 option (DISABLE_IPMB "Disable installing IPMB sensor" OFF)
+option (DISABLE_PSU "Disable installing PSU sensor" OFF)
 
 include ("cmake/HunterGate.cmake")
 
@@ -44,6 +45,8 @@
 
 set (IPMB_SRC_FILES src/Utils.cpp src/Thresholds.cpp)
 
+set (PSU_SRC_FILES src/Utils.cpp src/PSUSensor.cpp src/Thresholds.cpp)
+
 set (EXTERNAL_PACKAGES Boost sdbusplus-project nlohmann-json)
 set (SENSOR_LINK_LIBS -lsystemd stdc++fs sdbusplus)
 
@@ -149,6 +152,10 @@
 add_dependencies (ipmbsensor sdbusplus)
 target_link_libraries (ipmbsensor ${SENSOR_LINK_LIBS})
 
+add_executable (psusensor src/PSUSensorMain.cpp ${PSU_SRC_FILES})
+add_dependencies (psusensor  sdbusplus-project)
+target_link_libraries (psusensor ${SENSOR_LINK_LIBS})
+
 if (NOT YOCTO)
     add_dependencies (adcsensor ${EXTERNAL_PACKAGES})
     add_dependencies (cpusensor ${EXTERNAL_PACKAGES})
@@ -215,3 +222,7 @@
                  ${SERVICE_FILE_SRC_DIR}/xyz.openbmc_project.ipmbsensor.service
                  DESTINATION ${SERVICE_FILE_INSTALL_DIR})
 endif ()
+
+if (NOT DISABLE_PSU)
+    install (TARGETS psusensor DESTINATION sbin)
+endif ()