summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
-rw-r--r--misc/pcilib.in9
-rw-r--r--misc/pcilib_api.service.in15
-rw-r--r--misc/pcilib_html.service.in14
-rw-r--r--pcilib/CMakeLists.txt6
-rw-r--r--pyserver/pcilib_api_server.py (renamed from pyserver/api_server.py)0
-rw-r--r--pyserver/pcilib_html_server.py (renamed from pyserver/html_server.py)2
7 files changed, 68 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3a8166..8b5e9ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ if(NOT DEFINED LOCALE_INSTALL_DIR)
set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/locale")
endif(NOT DEFINED LOCALE_INSTALL_DIR)
+
SET(ENV{PKG_CONFIG_PATH} "${LIB_INSTALL_DIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
find_package(PkgConfig REQUIRED)
@@ -103,6 +104,7 @@ set(PACKAGE_BUGREPORT "http://ufo.kit.edu/ufo/newticket")
set(PCILIB_PLUGIN_DIR "${LIB_INSTALL_DIR}/pcilib" CACHE PATH "Directory to install plugins")
set(PCILIB_DATA_DIR "${DATA_INSTALL_DIR}/pcilib" CACHE PATH "Directory to install data files")
+set(PCILIB_PY_SERVER_INSTALL_DIR "${PCILIB_DATA_DIR}/pyserver" CACHE PATH "Directory to install python server")
set(PCILIB_MODEL_DIR "${PCILIB_DATA_DIR}/models" CACHE PATH "Directory to install XML models")
set(PCILIB_DOC_DIR "${CMAKE_CURRENT_BINARY_DIR}/docs/" CACHE PATH "Directory to install documentation")
set(PCILIB_DEBUG_DIR "." CACHE PATH "Directory to write debug information")
@@ -128,6 +130,14 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/misc/pcitool.pc.in ${CMAKE_CURRENT_BI
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcilib/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/pcilib/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcilib/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/pcilib/version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile)
+if (HAVE_PYTHON)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/misc/pcilib_api.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/misc/pcilib_api.service)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/misc/pcilib_html.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/misc/pcilib_html.service)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/misc/pcilib.in
+ ${CMAKE_CURRENT_BINARY_DIR}/misc/pcilib)
+endif (HAVE_PYTHON)
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
file(COPY ${CMAKE_SOURCE_DIR}/xml DESTINATION ${CMAKE_BINARY_DIR})
@@ -147,4 +157,18 @@ install(FILES
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
)
+if (HAVE_PYTHON)
+ #install Python servers
+ file(GLOB DEPLOY_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/pyserver/*")
+ foreach(ITEM ${DEPLOY_FILES_AND_DIRS})
+ IF( IS_DIRECTORY "${ITEM}" )
+ LIST( APPEND DIRS_TO_DEPLOY "${ITEM}" )
+ ELSE()
+ LIST( APPEND FILES_TO_DEPLOY "${ITEM}" )
+ ENDIF()
+ endforeach()
+ INSTALL( FILES ${FILES_TO_DEPLOY} DESTINATION ${PCILIB_PY_SERVER_INSTALL_DIR} )
+ INSTALL( DIRECTORY ${DIRS_TO_DEPLOY} DESTINATION ${PCILIB_PY_SERVER_INSTALL_DIR} )
+endif (HAVE_PYTHON)
+
message("-- Configured pcitool ${PCILIB_VERSION_MAJOR}.${PCILIB_VERSION_MINOR}.${PCILIB_VERSION_MICRO} with public ABI ${PCILIB_ABI_VERSION}")
diff --git a/misc/pcilib.in b/misc/pcilib.in
new file mode 100644
index 0000000..9b7352c
--- /dev/null
+++ b/misc/pcilib.in
@@ -0,0 +1,9 @@
+# API server parameters
+API_SERVER_DEVICE="/dev/fpga0"
+API_SERVER_MODEL="test"
+
+# HTML server parameters
+HTML_SERVER_PORT=5000
+
+#Scripts directory
+PCILIB_SCRIPTS_DIR="${PCILIB_PY_SERVER_INSTALL_DIR}/scripts"
diff --git a/misc/pcilib_api.service.in b/misc/pcilib_api.service.in
new file mode 100644
index 0000000..291a3e0
--- /dev/null
+++ b/misc/pcilib_api.service.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=Pcilib Python api server
+Wants=network.target nss-lookup.target
+After=network.target nss-lookup.target
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/sysconfig/pcilib
+ExecStart=${PYTHON_EXECUTABLE} ${PCILIB_PY_SERVER_INSTALL_DIR}/pcilib_api_server.py -d $API_SERVER_DEVICE -m $API_SERVER_MODEL
+
+[Install]
+WantedBy=multi-user.target
+
+
+
diff --git a/misc/pcilib_html.service.in b/misc/pcilib_html.service.in
new file mode 100644
index 0000000..634d9c7
--- /dev/null
+++ b/misc/pcilib_html.service.in
@@ -0,0 +1,14 @@
+[Unit]
+Description=Pcilib Python html server
+Wants=network.target nss-lookup.target
+After=network.target nss-lookup.target
+Requires=pcilib_api.service
+After=pcilib_api.service
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/sysconfig/pcilib
+ExecStart=${PYTHON_EXECUTABLE} ${PCILIB_PY_SERVER_INSTALL_DIR}/pcilib_html_server.py -p $HTML_SERVER_PORT -e
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pcilib/CMakeLists.txt b/pcilib/CMakeLists.txt
index 27543e4..b24c7b3 100644
--- a/pcilib/CMakeLists.txt
+++ b/pcilib/CMakeLists.txt
@@ -21,6 +21,10 @@ install(FILES pcilib.h
DESTINATION include
)
-install(FILES bar.h kmem.h locking.h lock.h bank.h register.h xml.h dma.h event.h model.h error.h debug.h env.h tools.h timing.h cpu.h datacpy.h pagecpy.h memcpy.h export.h version.h view.h unit.h
+install(FILES bar.h kmem.h locking.h lock.h bank.h register.h xml.h dma.h event.h model.h error.h debug.h env.h tools.h timing.h cpu.h datacpy.h pagecpy.h memcpy.h export.h view.h unit.h
+ DESTINATION include/pcilib
+)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION include/pcilib
)
diff --git a/pyserver/api_server.py b/pyserver/pcilib_api_server.py
index 1d486d0..1d486d0 100644
--- a/pyserver/api_server.py
+++ b/pyserver/pcilib_api_server.py
diff --git a/pyserver/html_server.py b/pyserver/pcilib_html_server.py
index 571dc4e..893b9d8 100644
--- a/pyserver/html_server.py
+++ b/pyserver/pcilib_html_server.py
@@ -4,7 +4,7 @@ from optparse import OptionParser, OptionGroup
from multiprocessing import Process
import requests
-from api_server import ApiServer
+from pcilib_api_server import ApiServer
#import flask elements
from flask import render_template