diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c1b0da08 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: c + +compiler: + - clang + - gcc + +addons: + apt: + packages: + - cmake + - swig + - libsqlite3-dev + - python-dev + +before_install: + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then + brew update; + brew install swig python sqlite; + fi + - mkdir -p build && cd build + +script: + - cmake .. -DBUILD_PYTHON_BINDINGS=ON + - make + - make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bcabf08..cff01918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 2.8) # automagically detect if we should cross-compile if(DEFINED ENV{TOOLCHAIN}) - set(CMAKE_C_COMPILER $ENV{TOOLCHAIN}gcc) - set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN}g++) - set(CMAKE_AR "$ENV{TOOLCHAIN}ar" CACHE FILEPATH "CW archiver" FORCE) + set(CMAKE_C_COMPILER $ENV{TOOLCHAIN}gcc) + set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN}g++) + set(CMAKE_AR "$ENV{TOOLCHAIN}ar" CACHE FILEPATH "CW archiver" FORCE) endif() project(libiec61850) @@ -32,20 +32,15 @@ option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF) option(CONFIG_MMS_SINGLE_THREADED "Compile for single threaded version" ON) option(CONFIG_MMS_THREADLESS_STACK "Optimize stack for threadless operation (warning: single- or multi-threaded server will not work!)" OFF) - -# choose the library features which shall be included +option(CONFIG_ACTIVATE_TCP_KEEPALIVE "Activate TCP keepalive" ON) option(CONFIG_INCLUDE_GOOSE_SUPPORT "Build with GOOSE support" ON) +# choose the library features which shall be included option(CONFIG_IEC61850_CONTROL_SERVICE "Build with support for IEC 61850 control features" ON) - option(CONFIG_IEC61850_REPORT_SERVICE "Build with support for IEC 61850 reporting services" ON) - option(CONFIG_IEC61850_LOG_SERVICE "Build with support for IEC 61850 logging services" ON) - option(CONFIG_IEC61850_SETTING_GROUPS "Build with support for IEC 61850 setting group services" ON) -option(CONFIG_ACTIVATE_TCP_KEEPALIVE "Activate TCP keepalive" ON) - set(CONFIG_REPORTING_DEFAULT_REPORT_BUFFER_SIZE "8000" CACHE STRING "Default buffer size for buffered reports in byte" ) # advanced options @@ -63,16 +58,16 @@ option(DEBUG_MMS_CLIENT "Enable MMS CLIENT printf debugging" OFF) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/config - ${CMAKE_CURRENT_LIST_DIR}/src/common/inc - ${CMAKE_CURRENT_LIST_DIR}/src/goose - ${CMAKE_CURRENT_LIST_DIR}/src/sampled_values - ${CMAKE_CURRENT_LIST_DIR}/src/hal/inc - ${CMAKE_CURRENT_LIST_DIR}/src/iec61850/inc - ${CMAKE_CURRENT_LIST_DIR}/src/iec61850/inc_private - ${CMAKE_CURRENT_LIST_DIR}/src/mms/inc - ${CMAKE_CURRENT_LIST_DIR}/src/mms/inc_private - ${CMAKE_CURRENT_LIST_DIR}/src/mms/iso_mms/asn1c - ${CMAKE_CURRENT_LIST_DIR}/src/logging + src/common/inc + src/goose + src/sampled_values + src/hal/inc + src/iec61850/inc + src/iec61850/inc_private + src/mms/inc + src/mms/inc_private + src/mms/iso_mms/asn1c + src/logging ) set(API_HEADERS @@ -114,42 +109,45 @@ set(API_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/config/stack_config.h ) -IF(MSVC) -include_directories( - src/vs -) -ENDIF(MSVC) +if(MSVC) + include_directories( + src/vs + ) +endif(MSVC) # write the detected stuff to this file -configure_file(${CMAKE_CURRENT_LIST_DIR}/config/stack_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config/stack_config.h) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/config/stack_config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config/stack_config.h +) if(BUILD_EXAMPLES) - add_subdirectory(examples) + add_subdirectory(examples) endif(BUILD_EXAMPLES) add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src) -INSTALL(FILES ${API_HEADERS} DESTINATION include/libiec61850 COMPONENT Development) - -IF(BUILD_PYTHON_BINDINGS) - add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/pyiec61850) -ENDIF(BUILD_PYTHON_BINDINGS) - -IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") -INCLUDE(InstallRequiredSystemLibraries) - -SET(CPACK_PACKAGE_DESCRIPTION "IEC 61850 MMS/GOOSE client and server library") -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IEC 61850 MMS/GOOSE client and server library") -SET(CPACK_PACKAGE_VENDOR "MZ Automation GmbH") -SET(CPACK_PACKAGE_CONTACT "info@libiec61850.com") -SET(CPACK_PACKAGE_VERSION_MAJOR "${LIB_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${LIB_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${LIB_VERSION_PATCH}") -SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CMAKE_SYSTEM_PROCESSOR}") -SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") - -SET(CPACK_COMPONENTS_ALL Libraries Development Applications) -#set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") -INCLUDE(CPack) - -ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") +install(FILES ${API_HEADERS} DESTINATION include/libiec61850 COMPONENT Development) + +if(BUILD_PYTHON_BINDINGS) + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/pyiec61850) +endif(BUILD_PYTHON_BINDINGS) + +if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + include(InstallRequiredSystemLibraries) + + set(CPACK_PACKAGE_DESCRIPTION "IEC 61850 MMS/GOOSE client and server library") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IEC 61850 MMS/GOOSE client and server library") + set(CPACK_PACKAGE_VENDOR "MZ Automation GmbH") + set(CPACK_PACKAGE_CONTACT "info@libiec61850.com") + set(CPACK_PACKAGE_VERSION_MAJOR "${LIB_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${LIB_VERSION_MINOR}") + set(CPACK_PACKAGE_VERSION_PATCH "${LIB_VERSION_PATCH}") + set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CMAKE_SYSTEM_PROCESSOR}") + set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + + set(CPACK_COMPONENTS_ALL Libraries Development Applications) + #set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") + + include(CPack) +endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 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/config/stack_config.h.cmake b/config/stack_config.h.cmake index c85e15d9..c36f782d 100644 --- a/config/stack_config.h.cmake +++ b/config/stack_config.h.cmake @@ -29,9 +29,9 @@ #cmakedefine01 DEBUG_MMS_SERVER #cmakedefine01 DEBUG_GOOSE_SUBSCRIBER #cmakedefine01 DEBUG_GOOSE_PUBLISHER -#cmakedefine01 DEBUG_SV_SUBSCRIBER 0 -#cmakedefine01 DEBUG_SV_PUBLISHER 0 -#cmakedefine01 DEBUG_HAL_ETHERNET 0 +#cmakedefine01 DEBUG_SV_SUBSCRIBER +#cmakedefine01 DEBUG_SV_PUBLISHER +#cmakedefine01 DEBUG_HAL_ETHERNET /* 1 ==> server runs in single threaded mode (one dedicated thread for the server) * 0 ==> server runs in multi threaded mode (one thread for each connection and diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index dba5285f..2502ff10 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -11,35 +11,34 @@ add_subdirectory(server_example_61400_25) add_subdirectory(server_example_setting_groups) add_subdirectory(server_example_logging) add_subdirectory(server_example_files) + add_subdirectory(iec61850_client_example1) add_subdirectory(iec61850_client_example2) add_subdirectory(iec61850_client_example3) add_subdirectory(iec61850_client_example4) add_subdirectory(iec61850_client_example5) -IF(WIN32) -else() -add_subdirectory(iec61850_client_example_files) -endif() add_subdirectory(iec61850_client_example_reporting) add_subdirectory(iec61850_client_example_log) -IF(WIN32) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/winpcap/Lib/wpcap.lib") -message("Found winpcap -> compile examples for GOOSE and SV") -add_subdirectory(server_example_goose) -add_subdirectory(goose_subscriber) -add_subdirectory(goose_publisher) -add_subdirectory(sv_subscriber) -add_subdirectory(iec61850_9_2_LE_example) -add_subdirectory(iec61850_sv_client_example) -add_subdirectory(sv_publisher) +if(NOT WIN32) + add_subdirectory(iec61850_client_example_files) endif() + +if(WIN32) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/winpcap/Lib/wpcap.lib") + set(BUILD_SV_GOOSE_EXAMPLES ON) + message("Found winpcap -> compile examples for GOOSE and SV") + endif() else() -add_subdirectory(server_example_goose) -add_subdirectory(goose_subscriber) -add_subdirectory(goose_publisher) -add_subdirectory(sv_subscriber) -add_subdirectory(iec61850_9_2_LE_example) -add_subdirectory(iec61850_sv_client_example) -add_subdirectory(sv_publisher) + set(BUILD_SV_GOOSE_EXAMPLES ON) +endif() + +if(${BUILD_SV_GOOSE_EXAMPLES}) + add_subdirectory(server_example_goose) + add_subdirectory(goose_subscriber) + add_subdirectory(goose_publisher) + add_subdirectory(sv_subscriber) + add_subdirectory(iec61850_9_2_LE_example) + add_subdirectory(iec61850_sv_client_example) + add_subdirectory(sv_publisher) endif() diff --git a/examples/iec61850_client_example_files/file-tool.c b/examples/iec61850_client_example_files/file-tool.c index 4610c7bd..53f23086 100644 --- a/examples/iec61850_client_example_files/file-tool.c +++ b/examples/iec61850_client_example_files/file-tool.c @@ -248,6 +248,8 @@ main(int argc, char** argv) case FileOperationType_Set: setFile(con); break; + case FileOperationType_None: + break; } diff --git a/pyiec61850/CMakeLists.txt b/pyiec61850/CMakeLists.txt index f5f0f922..156f90f2 100644 --- a/pyiec61850/CMakeLists.txt +++ b/pyiec61850/CMakeLists.txt @@ -1,23 +1,40 @@ -FIND_PACKAGE(SWIG REQUIRED) -INCLUDE(${SWIG_USE_FILE}) -FIND_PACKAGE(PythonLibs REQUIRED) -FIND_PACKAGE ( PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED ) -INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -SET(CMAKE_SWIG_FLAGS "") -SET_PROPERTY(SOURCE iec61850.i PROPERTY CPLUSPLUS ON) -SWIG_ADD_MODULE(iec61850 python iec61850.i) -IF(WIN32) - SWIG_LINK_LIBRARIES(iec61850 ${PYTHON_LIBRARIES} iec61850 ws2_32) -ELSE() - SWIG_LINK_LIBRARIES(iec61850 ${PYTHON_LIBRARIES} iec61850-shared) -ENDIF(WIN32) -EXECUTE_PROCESS ( #Finding python modules install path - COMMAND ${PYTHON_EXECUTABLE} -c - "import site, sys; sys.stdout.write(site.getsitepackages()[-1])" - OUTPUT_VARIABLE PYTHON_SITE_DIR - ) -INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/iec61850.py DESTINATION ${PYTHON_SITE_DIR}) -INSTALL ( TARGETS _iec61850 LIBRARY DESTINATION ${PYTHON_SITE_DIR}) +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(PythonLibs REQUIRED) +find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED) + +include_directories(${PYTHON_INCLUDE_PATH}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +set(CMAKE_SWIG_FLAGS "") +set_property(SOURCE iec61850.i PROPERTY CPLUSPLUS ON) + +if(WIN32) + set(LIBS iec61850 ws2_32) +else() + set(LIBS iec61850-shared) +endif() + +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}) + +# Finding python modules install path +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c + "import site, sys; sys.stdout.write(site.getsitepackages()[-1])" + OUTPUT_VARIABLE PYTHON_SITE_DIR +) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iec61850.py DESTINATION ${PYTHON_SITE_DIR}) +install(TARGETS _iec61850 LIBRARY DESTINATION ${PYTHON_SITE_DIR}) add_test(test_pyiec61850 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/test_pyiec61850.py)