summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ouroboros/CMakeLists.txt2
-rw-r--r--include/ouroboros/wrap/CMakeLists.txt42
-rw-r--r--include/ouroboros/wrap/ouroboros.i44
-rw-r--r--src/ipcpd/shim-udp/CMakeLists.txt45
4 files changed, 105 insertions, 28 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index eb5297d2..ae922b89 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -13,3 +13,5 @@ set(HEADER_FILES
qos.h)
install(FILES ${HEADER_FILES} DESTINATION usr/include/ouroboros)
+
+add_subdirectory(wrap)
diff --git a/include/ouroboros/wrap/CMakeLists.txt b/include/ouroboros/wrap/CMakeLists.txt
new file mode 100644
index 00000000..39737bbc
--- /dev/null
+++ b/include/ouroboros/wrap/CMakeLists.txt
@@ -0,0 +1,42 @@
+find_package(SWIG)
+
+if (NOT SWIG_FOUND)
+ message("-- SWIG not found: Bindings for other languages disabled.")
+else ()
+ include(${SWIG_USE_FILE})
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+ set(CMAKE_SWIG_FLAGS "")
+
+ find_package(PythonLibs)
+ if (NOT PYTHONLIBS_FOUND)
+ message("-- Python not found: Python bindings will not be built.")
+ else ()
+ include_directories(${PYTHON_INCLUDE_PATH})
+
+ swig_add_module(ouroboros python ouroboros.i)
+ swig_link_libraries(ouroboros ${PYTHON_LIBRARIES} ouroboros)
+
+ # Installation directives
+ if (CMAKE_INSTALL_PREFIX STREQUAL "")
+ execute_process(
+ COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"
+ OUTPUT_VARIABLE PYTHON_MODULE_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else ()
+ execute_process(
+ COMMAND python -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
+ OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ get_filename_component(_ABS_PYTHON_MODULE_PATH
+ ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
+ file(RELATIVE_PATH PYTHON_MODULE_PATH
+ ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
+ endif ()
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${SWIG_MODULE_ouroboros_REAL_NAME}.so
+ DESTINATION ${PYTHON_MODULE_PATH})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ouroboros.py
+ DESTINATION ${PYTHON_MODULE_PATH})
+ endif ()
+endif ()
diff --git a/include/ouroboros/wrap/ouroboros.i b/include/ouroboros/wrap/ouroboros.i
new file mode 100644
index 00000000..386c21cc
--- /dev/null
+++ b/include/ouroboros/wrap/ouroboros.i
@@ -0,0 +1,44 @@
+/*
+ * Ouroboros - Copyright (C) 2016
+ *
+ * SWIG wrapper file
+ *
+ * Sander Vrijders <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+%module ouroboros
+%{
+#include "ouroboros/cdap.h"
+#include "ouroboros/dev.h"
+#include "ouroboros/errno.h"
+#include "ouroboros/flow.h"
+#include "ouroboros/irm.h"
+#include "ouroboros/irm_config.h"
+#include "ouroboros/nsm.h"
+#include "ouroboros/qos.h"
+%}
+
+typedef int pid_t;
+
+%include "ouroboros/cdap.h"
+%include "ouroboros/dev.h"
+%include "ouroboros/errno.h"
+%include "ouroboros/flow.h"
+%include "ouroboros/irm.h"
+%include "ouroboros/irm_config.h"
+%include "ouroboros/nsm.h"
+%include "ouroboros/qos.h"
diff --git a/src/ipcpd/shim-udp/CMakeLists.txt b/src/ipcpd/shim-udp/CMakeLists.txt
index 71f9e1d1..c63bd29c 100644
--- a/src/ipcpd/shim-udp/CMakeLists.txt
+++ b/src/ipcpd/shim-udp/CMakeLists.txt
@@ -31,32 +31,6 @@ IF(NOT CMAKE_HAVE_GETHOSTBYNAME)
ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
-# Enable DNS by default
-if (NOT DISABLE_DNS MATCHES True)
- # Find the nsupdate executable
- find_program(NSUPDATE_EXECUTABLE
- NAMES nsupdate
- DOC "The nsupdate tool that enables DDNS")
-
- if (${NSUPDATE_EXECUTABLE} STREQUAL "NSUPDATE_EXECUTABLE-NOTFOUND")
- message(FATAL_ERROR "Could not find nsupdate, which is needed for DDNS")
- else()
- message("-- Found nsupdate: ${NSUPDATE_EXECUTABLE}")
- endif()
-
- # Find the nslookup executable
- find_program(NSLOOKUP_EXECUTABLE
- NAMES nslookup
- DOC "The nslookup tool that resolves DNS names")
-
- if (${NSLOOKUP_EXECUTABLE} STREQUAL "NSLOOKUP_EXECUTABLE-NOTFOUND")
- message(FATAL_ERROR
- "Could not find nslookup, which is needed for DNS resolution")
- else()
- message("-- Found nslookup: ${NSLOOKUP_EXECUTABLE}")
- endif()
-endif()
-
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/shim_udp_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/shim_udp_config.h")
@@ -72,8 +46,23 @@ add_executable (ipcpd-shim-udp ${SHIM_UDP_SOURCES} ${IPCP_SOURCES}
target_link_libraries (ipcpd-shim-udp LINK_PUBLIC ouroboros
${PROTOBUF_C_LIBRARY})
-# Enable DNS by default
-if (NOT DISABLE_DNS MATCHES True)
+# Find the nsupdate executable
+find_program(NSUPDATE_EXECUTABLE
+ NAMES nsupdate
+ DOC "The nsupdate tool that enables DDNS")
+
+# Find the nslookup executable
+find_program(NSLOOKUP_EXECUTABLE
+ NAMES nslookup
+ DOC "The nslookup tool that resolves DNS names")
+
+if (${NSUPDATE_EXECUTABLE} STREQUAL "NSUPDATE_EXECUTABLE-NOTFOUND")
+ message("-- Could not find nsupdate. Disabling DDNS functionality.")
+elseif (${NSLOOKUP_EXECUTABLE} STREQUAL "NSLOOKUP_EXECUTABLE-NOTFOUND")
+ message("-- Could not find nslookup. Disabling DNS lookups.")
+else ()
+ message("-- Found nsupdate: ${NSUPDATE_EXECUTABLE}")
+ message("-- Found nslookup: ${NSLOOKUP_EXECUTABLE}")
MACRO_ADD_COMPILE_FLAGS(ipcpd-shim-udp -DCONFIG_OUROBOROS_ENABLE_DNS)
endif()