From e87a839c128b30651a354693d7dd40ce9fa3921f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 7 Dec 2019 12:34:17 +0100 Subject: build: Remove support for SWIG This removes support for SWIG since it wasn't correctly generating all bindings. Since our API is lean, we will write the bindings for different languages from scratch. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/CMakeLists.txt | 2 - include/ouroboros/wrap/CMakeLists.txt | 76 ----------------------------------- include/ouroboros/wrap/ouroboros.i | 48 ---------------------- 3 files changed, 126 deletions(-) delete mode 100644 include/ouroboros/wrap/CMakeLists.txt delete mode 100644 include/ouroboros/wrap/ouroboros.i diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index fe0ccf5d..8f248710 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -22,5 +22,3 @@ set(HEADER_FILES ) install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ouroboros) - -add_subdirectory(wrap) diff --git a/include/ouroboros/wrap/CMakeLists.txt b/include/ouroboros/wrap/CMakeLists.txt deleted file mode 100644 index 4b4af98e..00000000 --- a/include/ouroboros/wrap/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}/include) - -find_package(SWIG QUIET) -if (NOT SWIG_FOUND) - message(STATUS "Install SWIG to enable bindings for other languages") -else () - set(DISABLE_SWIG TRUE CACHE BOOL "Disable SWIG support") - if (NOT DISABLE_SWIG) - message(STATUS "SWIG support enabled") - include(${SWIG_USE_FILE}) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - set(CMAKE_SWIG_FLAGS "") - - find_package(PythonInterp QUIET) - find_package(PythonLibs QUIET) - if (NOT PYTHONLIBS_FOUND OR NOT PYTHONINTERP_FOUND) - message(STATUS "Python not found: Python bindings will not be built") - else () - message(STATUS "Python found: Python bindings will be built") - include_directories(${PYTHON_INCLUDE_PATH}) - - # CMake > 3.8 deprecates swig_add_module - if (${CMAKE_VERSION} VERSION_LESS 3.8.0) - swig_add_module(ouroboros python ouroboros.i) - else () - swig_add_library(ouroboros - LANGUAGE python - SOURCES ouroboros.i - TYPE MODULE) - endif() - - # Python assumes C99 since Python 3.6 - # SWIG generates code for varargs with an unused parameter - # SWIG generates code with unsafe strncpy() - set_target_properties(ouroboros PROPERTIES - COMPILE_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wno-unused-parameter -Wno-stringop-truncation") - swig_link_libraries(ouroboros ${PYTHON_LIBRARIES} ouroboros-common - ouroboros-dev ouroboros-irm) - - # Installation directives - if (CMAKE_INSTALL_PREFIX STREQUAL "") - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c - "from distutils import sysconfig; print(sysconfig.get_python_lib())" - OUTPUT_VARIABLE PYTHON_MODULE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE) - else () - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -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 () - - if (${CMAKE_VERSION} VERSION_LESS "3.13") - install ( - ${CMAKE_CURRENT_BINARY_DIR}/${SWIG_MODULE_${ouroboros}_REAL_NAME}.so - DESTINATION ${PYTHON_MODULE_PATH}) - else () - install (TARGETS ouroboros - DESTINATION ${PYTHON_MODULE_PATH}) - endif () - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ouroboros.py - DESTINATION ${PYTHON_MODULE_PATH}) - endif () - else () - message(STATUS "SWIG support disabled") - endif () -endif () - -mark_as_advanced(SWIG_EXECUTABLE) diff --git a/include/ouroboros/wrap/ouroboros.i b/include/ouroboros/wrap/ouroboros.i deleted file mode 100644 index 1d93e42b..00000000 --- a/include/ouroboros/wrap/ouroboros.i +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2019 - * - * SWIG wrapper file - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., http://www.fsf.org/about/contact/. - */ - -%module ouroboros -%{ -#include "ouroboros/cdefs.h" -#include "ouroboros/cacep.h" -#include "ouroboros/dev.h" -#include "ouroboros/errno.h" -#include "ouroboros/fccntl.h" -#include "ouroboros/fqueue.h" -#include "ouroboros/irm.h" -#include "ouroboros/ipcp.h" -#include "ouroboros/qos.h" -#include "ouroboros/version.h" -%} - -typedef int pid_t; - -%include "ouroboros/cdefs.h" -%include "ouroboros/cacep.h" -%include "ouroboros/dev.h" -%include "ouroboros/errno.h" -%include "ouroboros/fccntl.h" -%include "ouroboros/fqueue.h" -%include "ouroboros/irm.h" -%include "ouroboros/ipcp.h" -%include "ouroboros/qos.h" -%include "ouroboros/version.h" -- cgit v1.2.3