From dffe21930323f2b845bb7717cf7b1c28ca873101 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 10 Nov 2017 14:36:49 +0100 Subject: [PATCH] fix version incompatability in Swig --- .travis.yml | 2 +- build/pyiec61850/CTestTestfile.cmake | 7 + build/pyiec61850/Makefile | 266 +++++++++++++++++++++++++++ pyiec61850/CMakeLists.txt | 14 +- 4 files changed, 283 insertions(+), 6 deletions(-) create mode 100644 build/pyiec61850/CTestTestfile.cmake create mode 100644 build/pyiec61850/Makefile diff --git a/.travis.yml b/.travis.yml index 42856c26..13ffe2b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,9 @@ before_install: brew update; brew install swig python sqlite; fi + - mkdir -p build && cd build script: - - mkdir build && cd build - cmake .. -DBUILD_PYTHON_BINDINGS=ON - make - make test diff --git a/build/pyiec61850/CTestTestfile.cmake b/build/pyiec61850/CTestTestfile.cmake new file mode 100644 index 00000000..628a0177 --- /dev/null +++ b/build/pyiec61850/CTestTestfile.cmake @@ -0,0 +1,7 @@ +# CMake generated Testfile for +# Source directory: /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/pyiec61850 +# Build directory: /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build/pyiec61850 +# +# This file includes the relevant testing commands required for +# testing this directory and lists subdirectories to be tested as well. +add_test(test_pyiec61850 "/opt/local/bin/python3.6" "/Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/pyiec61850/test_pyiec61850.py") diff --git a/build/pyiec61850/Makefile b/build/pyiec61850/Makefile new file mode 100644 index 00000000..bd54c89f --- /dev/null +++ b/build/pyiec61850/Makefile @@ -0,0 +1,266 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.9 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /opt/local/bin/cmake + +# The command to remove a file. +RM = /opt/local/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /opt/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /opt/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /opt/local/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /opt/local/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Development\" \"Libraries\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components + +.PHONY : list_install_components/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /opt/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /opt/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target test +test: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..." + /opt/local/bin/ctest --force-new-ctest-process $(ARGS) +.PHONY : test + +# Special rule for the target test +test/fast: test + +.PHONY : test/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /opt/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /opt/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +.PHONY : rebuild_cache/fast + +# Special rule for the target package_source +package_source: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..." + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && /opt/local/bin/cpack --config ./CPackSourceConfig.cmake /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build/CPackSourceConfig.cmake +.PHONY : package_source + +# Special rule for the target package_source +package_source/fast: package_source + +.PHONY : package_source/fast + +# Special rule for the target package +package: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..." + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && /opt/local/bin/cpack --config ./CPackConfig.cmake +.PHONY : package + +# Special rule for the target package +package/fast: package + +.PHONY : package/fast + +# The main all target +all: cmake_check_build_system + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(CMAKE_COMMAND) -E cmake_progress_start /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build/CMakeFiles /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build/pyiec61850/CMakeFiles/progress.marks + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f CMakeFiles/Makefile2 pyiec61850/all + $(CMAKE_COMMAND) -E cmake_progress_start /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f CMakeFiles/Makefile2 pyiec61850/clean +.PHONY : clean + +# The main clean target +clean/fast: clean + +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f CMakeFiles/Makefile2 pyiec61850/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f CMakeFiles/Makefile2 pyiec61850/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +pyiec61850/CMakeFiles/_iec61850.dir/rule: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f CMakeFiles/Makefile2 pyiec61850/CMakeFiles/_iec61850.dir/rule +.PHONY : pyiec61850/CMakeFiles/_iec61850.dir/rule + +# Convenience name for target. +_iec61850: pyiec61850/CMakeFiles/_iec61850.dir/rule + +.PHONY : _iec61850 + +# fast build rule for target. +_iec61850/fast: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f pyiec61850/CMakeFiles/_iec61850.dir/build.make pyiec61850/CMakeFiles/_iec61850.dir/build +.PHONY : _iec61850/fast + +iec61850PYTHON_wrap.o: iec61850PYTHON_wrap.cxx.o + +.PHONY : iec61850PYTHON_wrap.o + +# target to build an object file +iec61850PYTHON_wrap.cxx.o: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f pyiec61850/CMakeFiles/_iec61850.dir/build.make pyiec61850/CMakeFiles/_iec61850.dir/iec61850PYTHON_wrap.cxx.o +.PHONY : iec61850PYTHON_wrap.cxx.o + +iec61850PYTHON_wrap.i: iec61850PYTHON_wrap.cxx.i + +.PHONY : iec61850PYTHON_wrap.i + +# target to preprocess a source file +iec61850PYTHON_wrap.cxx.i: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f pyiec61850/CMakeFiles/_iec61850.dir/build.make pyiec61850/CMakeFiles/_iec61850.dir/iec61850PYTHON_wrap.cxx.i +.PHONY : iec61850PYTHON_wrap.cxx.i + +iec61850PYTHON_wrap.s: iec61850PYTHON_wrap.cxx.s + +.PHONY : iec61850PYTHON_wrap.s + +# target to generate assembly for a file +iec61850PYTHON_wrap.cxx.s: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(MAKE) -f pyiec61850/CMakeFiles/_iec61850.dir/build.make pyiec61850/CMakeFiles/_iec61850.dir/iec61850PYTHON_wrap.cxx.s +.PHONY : iec61850PYTHON_wrap.cxx.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... install/strip" + @echo "... install" + @echo "... list_install_components" + @echo "... install/local" + @echo "... test" + @echo "... edit_cache" + @echo "... rebuild_cache" + @echo "... package_source" + @echo "... package" + @echo "... _iec61850" + @echo "... iec61850PYTHON_wrap.o" + @echo "... iec61850PYTHON_wrap.i" + @echo "... iec61850PYTHON_wrap.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /Users/stv0g/workspace/rwth/villas/node/thirdparty/libiec61850/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/pyiec61850/CMakeLists.txt b/pyiec61850/CMakeLists.txt index 235b832e..156f90f2 100644 --- a/pyiec61850/CMakeLists.txt +++ b/pyiec61850/CMakeLists.txt @@ -13,13 +13,17 @@ set_property(SOURCE iec61850.i PROPERTY CPLUSPLUS ON) if(WIN32) set(LIBS iec61850 ws2_32) else() - set(LIBS iec61850 iec61850-shared) + set(LIBS iec61850-shared) endif() -swig_add_library(iec61850 - LANGUAGE python - SOURCES iec61850.i -) +if(${SWIG_VERSION} VERSION_LESS 3.0) + swig_add_module(iec61850 python iec61850.i) +else() + swig_add_library(iec61850 + LANGUAGE python + SOURCES iec61850.i + ) +endif() swig_link_libraries(iec61850 ${PYTHON_LIBRARIES} ${LIBS})