###############################################################################
comment "Legacy options removed in 2016.02"
+config BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL
+ bool "openpowerlink debug option has been removed"
+ select BR2_LEGACY
+ help
+ This option depends on BR2_ENABLE_DEBUG which should not be used
+ by packages anymore.
+
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
+ bool "openpowerlink package has been updated"
+ select BR2_LEGACY
+ select BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
+ help
+ openpowerlink kernel modules are built if the
+ kernel stack library is selected.
+
+config BR2_PACKAGE_OPENPOWERLINK_LIBPCAP
+ bool "openpowerlink package has been updated"
+ select BR2_LEGACY
+ select BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB
+ help
+ The user space support has been split in two part:
+ - a monolitic user space library
+ - a user spae deamon driver
+
config BR2_LINUX_KERNEL_SAME_AS_HEADERS
bool "using the linux headers version for the kernel has been removed"
select BR2_LEGACY
+++ /dev/null
-From 9fd3aef2f9bb7a2b05b6823281bb5c988fa25149 Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@openwide.fr>
-Date: Mon, 17 Nov 2014 23:27:05 +0100
-Subject: [PATCH 1/2] [FIX] use a better regex for CMAKE_SYSTEM_PROCESSOR
-
-According to CMake doc, CMAKE_SYSTEM_PROCESSOR is set to the
-output of the command "uname -p" (in fact it is the output of "uname
--m"). This is only true for native compilation.
-
-In the case of cross-compilation, the CMake code does not set anything,
-it just expects the CMAKE_SYSTEM_* variables to be set in the
-toolchain file.
-
-Add a test matching the patern "^i.86$" and keep the old one "x86" for
-compatibility.
-By doing that, factorize this test using "^(i.86|x86(_64)?)$".
-
-Thanks to Samuel Martin [1]
-[1] http://lists.busybox.net/pipermail/buildroot/2014-November/112163.html
-
-Signed-off-by: Romain Naour <romain.naour@openwide.fr>
----
- Examples/X86/Linux/gnu/demo_kernel/CMakeLists.txt | 15 ++++-----------
- .../X86/Linux/gnu/powerlink_kernel_module/CMakeLists.txt | 15 ++++-----------
- 2 files changed, 8 insertions(+), 22 deletions(-)
-
-diff --git a/Examples/X86/Linux/gnu/demo_kernel/CMakeLists.txt b/Examples/X86/Linux/gnu/demo_kernel/CMakeLists.txt
-index 271ecdc..b49ef53 100644
---- a/Examples/X86/Linux/gnu/demo_kernel/CMakeLists.txt
-+++ b/Examples/X86/Linux/gnu/demo_kernel/CMakeLists.txt
-@@ -154,21 +154,14 @@ SET(MODULE_SOURCE_FILES
- ${POWERLINK_SOURCE_DIR}/ObjDicts/${OBJDICT}/Objdict.c
- )
-
--IF (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+IF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amix86.c)
--
--ELSEIF ( CMAKE_SYSTEM_PROCESSOR STREQUAL arm
-- OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
-+ELSEIF (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amiarm.c)
--
--ELSEIF ( CMAKE_SYSTEM_PROCESSOR STREQUAL i686
-- OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
-- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amix86.c)
--
--ELSE (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
- MESSAGE(FATAL_ERROR
- "ami: CMAKE_SYSTEM_PROCESSOR is set to ${CMAKE_SYSTEM_PROCESSOR}. Valid targets are (x86, x86_64, arm, armv7l, i686).")
--ENDIF (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
-
- SET(MODULE_FILE
- ${MODULE_NAME}.ko
-diff --git a/Examples/X86/Linux/gnu/powerlink_kernel_module/CMakeLists.txt b/Examples/X86/Linux/gnu/powerlink_kernel_module/CMakeLists.txt
-index 1b47c76..f534a4d 100644
---- a/Examples/X86/Linux/gnu/powerlink_kernel_module/CMakeLists.txt
-+++ b/Examples/X86/Linux/gnu/powerlink_kernel_module/CMakeLists.txt
-@@ -171,21 +171,14 @@ ELSE(CFG_POWERLINK_EDRV STREQUAL "I210")
- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/Target/X86/Linux/gnu/generic/TimerHighReskX86.c)
- ENDIF(CFG_POWERLINK_EDRV STREQUAL "I210")
-
--IF (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+IF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amix86.c)
--
--ELSEIF ( CMAKE_SYSTEM_PROCESSOR STREQUAL arm
-- OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
-+ELSEIF (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amiarm.c)
--
--ELSEIF ( CMAKE_SYSTEM_PROCESSOR STREQUAL i686
-- OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
-- SET(MODULE_SOURCE_FILES ${MODULE_SOURCE_FILES} ${POWERLINK_SOURCE_DIR}/EplStack/amix86.c)
--
--ELSE (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
- MESSAGE(FATAL_ERROR
- "ami: CMAKE_SYSTEM_PROCESSOR is set to ${CMAKE_SYSTEM_PROCESSOR}. Valid targets are (x86, x86_64, arm, armv7l, i686).")
--ENDIF (CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-+ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
-
- SET(MODULE_FILE
- ${MODULE_NAME}.ko
---
-1.9.3
-
--- /dev/null
+From ebc5aeff65aeda610d9e23ecf4b26b79f9305a0e Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Fri, 1 May 2015 12:19:34 +0200
+Subject: [PATCH] install the stack libraries to "lib" subdirectory
+
+Using '.' to install the stack libraries is not correct since
+it will install them to /usr/.
+
+ls /usr/liboplkmnapp-kernelintf.so
+
+Fix this by using 'lib' instead of '.'
+
+The problem with the openpowerlink build system is that it expect
+the stack directory to be a "local staging" directory which
+contains headers and libraries. So the libraries build by the
+stack project are installed in stack/lib by default.
+
+This is wrong to do that because it becomes difficult to package
+openpowerlink for normal Linux systems.
+
+Buildroot like others build system expect from a packaged software
+to install libraries and headers build/provided in a staging
+directory.
+
+It seems that CMAKE_INSTALL_PREFIX is misused by the default value
+"${CMAKE_CURRENT_SOURCE_DIR}/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR}"
+since it already contains the lib directory and therefore the
+entire build system is messed up.
+
+It seems that the openpowerlink's build system doesn't allow/support
+CMAKE_INSTALL_PREFIX to be set externally
+(which is the standard approach).
+
+The issue has been reported [1] upstream and a build system
+refactoring is needed to fix this properly.
+
+[1] http://sourceforge.net/p/openpowerlink/discussion/newbie/thread/3f13af65/#8f80/a50a/4649/f07c
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ stack/proj/linux/liboplkcn/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkcnapp-kernelintf/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkcnapp-userintf/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkcndrv-pcap/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkmn/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkmnapp-kernelintf/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkmnapp-userintf/CMakeLists.txt | 2 +-
+ stack/proj/linux/liboplkmndrv-pcap/CMakeLists.txt | 2 +-
+ 8 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/stack/proj/linux/liboplkcn/CMakeLists.txt b/stack/proj/linux/liboplkcn/CMakeLists.txt
+index b7c73e6..23e3112 100644
+--- a/stack/proj/linux/liboplkcn/CMakeLists.txt
++++ b/stack/proj/linux/liboplkcn/CMakeLists.txt
+@@ -88,4 +88,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkcnapp-kernelintf/CMakeLists.txt b/stack/proj/linux/liboplkcnapp-kernelintf/CMakeLists.txt
+index 6c3bec6..a6f9271 100644
+--- a/stack/proj/linux/liboplkcnapp-kernelintf/CMakeLists.txt
++++ b/stack/proj/linux/liboplkcnapp-kernelintf/CMakeLists.txt
+@@ -81,4 +81,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkcnapp-userintf/CMakeLists.txt b/stack/proj/linux/liboplkcnapp-userintf/CMakeLists.txt
+index fdf6fd4..6df8bb7 100644
+--- a/stack/proj/linux/liboplkcnapp-userintf/CMakeLists.txt
++++ b/stack/proj/linux/liboplkcnapp-userintf/CMakeLists.txt
+@@ -81,4 +81,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkcndrv-pcap/CMakeLists.txt b/stack/proj/linux/liboplkcndrv-pcap/CMakeLists.txt
+index 440f02c..6ffcbe9 100644
+--- a/stack/proj/linux/liboplkcndrv-pcap/CMakeLists.txt
++++ b/stack/proj/linux/liboplkcndrv-pcap/CMakeLists.txt
+@@ -77,4 +77,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkmn/CMakeLists.txt b/stack/proj/linux/liboplkmn/CMakeLists.txt
+index 8f97144..e29f795 100644
+--- a/stack/proj/linux/liboplkmn/CMakeLists.txt
++++ b/stack/proj/linux/liboplkmn/CMakeLists.txt
+@@ -92,4 +92,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkmnapp-kernelintf/CMakeLists.txt b/stack/proj/linux/liboplkmnapp-kernelintf/CMakeLists.txt
+index df74265..2ba1cd1 100644
+--- a/stack/proj/linux/liboplkmnapp-kernelintf/CMakeLists.txt
++++ b/stack/proj/linux/liboplkmnapp-kernelintf/CMakeLists.txt
+@@ -85,4 +85,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkmnapp-userintf/CMakeLists.txt b/stack/proj/linux/liboplkmnapp-userintf/CMakeLists.txt
+index 98835c7..12b3dc6 100644
+--- a/stack/proj/linux/liboplkmnapp-userintf/CMakeLists.txt
++++ b/stack/proj/linux/liboplkmnapp-userintf/CMakeLists.txt
+@@ -85,4 +85,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+diff --git a/stack/proj/linux/liboplkmndrv-pcap/CMakeLists.txt b/stack/proj/linux/liboplkmndrv-pcap/CMakeLists.txt
+index b4dd41b..cf875ca 100644
+--- a/stack/proj/linux/liboplkmndrv-pcap/CMakeLists.txt
++++ b/stack/proj/linux/liboplkmndrv-pcap/CMakeLists.txt
+@@ -80,4 +80,4 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${LIB_SOURCES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} ${ARCH_LIBRARIES})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
+ SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY DEBUG_POSTFIX "_d")
+-INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION . LIBRARY DESTINATION .)
++INSTALL(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
+--
+2.4.3
+
--- /dev/null
+From c904fb6ce3c29e77d51d8bcbbbdd48b8d22c754b Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Mon, 4 May 2015 11:47:05 +0200
+Subject: [PATCH] cmake: install oplk headers files
+
+In order to be able to link a third party application
+with openpowerlink libraries, we need to install the
+oplk headers files related to openpowerlink stack.
+
+Install all headers file from STACK_INCLUDE_DIR/oplk.
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ stack/CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/stack/CMakeLists.txt b/stack/CMakeLists.txt
+index 9ff13f4..f4614cd 100644
+--- a/stack/CMakeLists.txt
++++ b/stack/CMakeLists.txt
+@@ -103,3 +103,8 @@ ELSEIF((CMAKE_SYSTEM_NAME STREQUAL "Generic") AND (CMAKE_SYSTEM_PROCESSOR STREQU
+ ELSE()
+ MESSAGE(FATAL_ERROR "Unknown Platform and processor combination ${CMAKE_SYSTEM_NAME} and ${CMAKE_SYSTEM_PROCESSOR}!!")
+ ENDIF()
++
++################################################################################
++# Install oplk headers files
++################################################################################
++INSTALL(DIRECTORY ${STACK_INCLUDE_DIR}/oplk DESTINATION "include")
+--
+2.4.3
+
+++ /dev/null
-From 9c11eef037dc1137ab7a4656e45afde7d1a615c4 Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@openwide.fr>
-Date: Sat, 22 Nov 2014 16:38:01 +0100
-Subject: [PATCH 2/2] [FIX]: user space stack: enable dynamic build
-
-The build fail if BUILD_SHARED_LIBS is set to ON.
-
-Depending on BUILD_SHARED_LIBS, link with STATIC or SHARED.
-
-Signed-off-by: Romain Naour <romain.naour@openwide.fr>
----
- Examples/X86/Generic/powerlink_user_lib/CMakeLists.txt | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/Examples/X86/Generic/powerlink_user_lib/CMakeLists.txt b/Examples/X86/Generic/powerlink_user_lib/CMakeLists.txt
-index 40b7756..27360f2 100644
---- a/Examples/X86/Generic/powerlink_user_lib/CMakeLists.txt
-+++ b/Examples/X86/Generic/powerlink_user_lib/CMakeLists.txt
-@@ -93,7 +93,13 @@ ENDIF(CFG_STORE_RESTORE)
- #
- # Set type of library
- #
--IF (WIN32)
-+IF (UNIX)
-+ IF (BUILD_SHARED_LIBS)
-+ SET(LIB_TYPE "SHARED")
-+ ELSE (BUILD_SHARED_LIBS)
-+ SET(LIB_TYPE "STATIC")
-+ ENDIF(BUILD_SHARED_LIBS)
-+ELSEIF (WIN32)
- IF(CFG_X86_WINDOWS_DLL)
- SET(LIB_TYPE "SHARED")
- ELSE(CFG_X86_WINDOWS_DLL)
-@@ -313,7 +319,7 @@ ENDIF ()
- # Define library source code
- #
- IF (UNIX)
-- ADD_LIBRARY(powerlink ${LIB_SOURCES} ${LIB_SOURCES_KERNEL} ${LIB_SOURCES_USER} ${LIB_HEADERS} ${LIB_HEADERS_KERNEL} ${LIB_HEADERS_USER} ${LIB_OBJDICT})
-+ ADD_LIBRARY(powerlink ${LIB_TYPE} ${LIB_SOURCES} ${LIB_SOURCES_KERNEL} ${LIB_SOURCES_USER} ${LIB_HEADERS} ${LIB_HEADERS_KERNEL} ${LIB_HEADERS_USER} ${LIB_OBJDICT})
-
- SET_PROPERTY(TARGET powerlink
- PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEBUG_LVL=${CFG_DEBUG_LVL})
-@@ -330,7 +336,7 @@ ENDIF ()
- # Installation
- #
- IF (UNIX)
-- INSTALL(TARGETS powerlink ARCHIVE DESTINATION lib)
-+ INSTALL(TARGETS powerlink ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library)
- ELSEIF (WIN32)
- IF (CFG_X86_WINDOWS_DLL)
- INSTALL(TARGETS openPOWERLINK RUNTIME DESTINATION bin)
---
-1.9.3
-
--- /dev/null
+From c354e8d9599aa02566c8acc341f3a2c73281483b Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Wed, 17 Sep 2014 13:27:44 +0200
+Subject: [PATCH] cmake: use CMAKE_CURRENT_SOURCE_DIR instead of
+ CMAKE_SOURCE_DIR
+
+The aim of this patch is to be able to call each subproject's CMakeLists.txt
+from a top-level CMakeLists.txt.
+
+This will help to build automatically the epl libraries, epl driver, unittests
+and demos.
+
+This patch has been submitted upstream:
+https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ drivers/linux/drv_daemon_pcap/CMakeLists.txt | 6 +++---
+ drivers/linux/drv_kernelmod_edrv/CMakeLists.txt | 8 ++++----
+ hardware/CMakeLists.txt | 4 ++--
+ hardware/drivers/hostinterface/CMakeLists.txt | 2 +-
+ hardware/drivers/openmac/CMakeLists.txt | 4 ++--
+ unittests/CMakeLists.txt | 4 ++--
+ 6 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+index 4c3f933..9041e4d 100644
+--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt
++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+@@ -57,8 +57,8 @@ MESSAGE(STATUS "Configuring ${EXE_NAME}")
+ ###############################################################################
+ # Set global directories
+ ###############################################################################
+-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/../../..)
+-SET(DRV_SOURCE_DIR ${CMAKE_SOURCE_DIR})
++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
++SET(DRV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ SET(CONTRIB_SOURCE_DIR ${OPLK_BASE_DIR}/contrib)
+ SET(OPLK_INCLUDE_DIR ${OPLK_BASE_DIR}/stack/include)
+ SET(TOOLS_DIR ${OPLK_BASE_DIR}/tools)
+@@ -66,7 +66,7 @@ SET(TOOLS_DIR ${OPLK_BASE_DIR}/tools)
+ ###############################################################################
+ # Include CMake Modules
+ ###############################################################################
+-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../cmake ${CMAKE_MODULE_PATH})
++SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake ${CMAKE_MODULE_PATH})
+
+ # include standard cmake modules
+ INCLUDE(CMakeDependentOption)
+diff --git a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
+index 2ad1a0d..af85f86 100644
+--- a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
++++ b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
+@@ -75,7 +75,7 @@ SET_PROPERTY(CACHE CFG_POWERLINK_EDRV PROPERTY STRINGS 8139 82573 8255x i210 811
+ ################################################################################
+ # Set global directories
+ ################################################################################
+-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/../../..)
++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
+ SET(CONTRIB_SOURCE_DIR ${OPLK_BASE_DIR}/contrib)
+ SET(STACK_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src)
+ SET(COMMON_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src/common)
+@@ -152,10 +152,10 @@ IF(CFG_OPLK_MN)
+ ENDIF()
+ SET(MODULE_DEFS "${MODULE_DEFS} -DCONFIG_MN")
+ SET(MODULE_NAME "${MODULE_NAME}mn")
+- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/proj/mn)
++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/proj/mn)
+ ELSE()
+ SET(MODULE_NAME "${MODULE_NAME}cn")
+- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/proj/cn)
++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/proj/cn)
+ ENDIF()
+
+ ###############################################################################
+@@ -189,7 +189,7 @@ ENDFOREACH()
+ #
+ SET(MODULE_SOURCE_FILES
+ ${MODULE_SOURCE_FILES}
+- ${CMAKE_SOURCE_DIR}/main.c
++ ${CMAKE_CURRENT_SOURCE_DIR}/main.c
+ ${CONTRIB_SOURCE_DIR}/trace/trace-printk.c
+ ${EDRV_SOURCE_DIR}/edrvcyclic.c
+ ${KERNEL_SOURCE_DIR}/ctrl/ctrlk.c
+diff --git a/hardware/CMakeLists.txt b/hardware/CMakeLists.txt
+index 218c4eb..3ba85ca 100644
+--- a/hardware/CMakeLists.txt
++++ b/hardware/CMakeLists.txt
+@@ -40,7 +40,7 @@ INCLUDE(reduceboardname)
+
+ ################################################################################
+ # Set paths
+-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/..)
++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
+ SET(OMETHLIB_BASE_DIR ${PROJECT_SOURCE_DIR}/drivers/openmac)
+ SET(OMETHLIB_BUILD_DIR ${PROJECT_BINARY_DIR}/drivers/openmac)
+ SET(HOSTIF_BASE_DIR ${PROJECT_SOURCE_DIR}/drivers/hostinterface)
+@@ -56,7 +56,7 @@ STRING(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR_DIR)
+
+ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX
+- ${CMAKE_SOURCE_DIR}/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR} CACHE PATH "openPOWERLINK hardware install prefix" FORCE
++ ${CMAKE_CURRENT_SOURCE_DIR}/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR} CACHE PATH "openPOWERLINK hardware install prefix" FORCE
+ )
+ ENDIF()
+
+diff --git a/hardware/drivers/hostinterface/CMakeLists.txt b/hardware/drivers/hostinterface/CMakeLists.txt
+index 1a9d2aa..9c56c16 100644
+--- a/hardware/drivers/hostinterface/CMakeLists.txt
++++ b/hardware/drivers/hostinterface/CMakeLists.txt
+@@ -71,7 +71,7 @@ ELSE()
+ SET( HOSTIF_LIB_NAME "${HOSTIF_NAME}")
+ ENDIF()
+
+-SET(BOARDS_COMMON_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/common)
++SET(BOARDS_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/common)
+ SET(EXAMPLE_BINARY_DIR ${CMAKE_BINARY_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME})
+
+ ########################################################################
+diff --git a/hardware/drivers/openmac/CMakeLists.txt b/hardware/drivers/openmac/CMakeLists.txt
+index 560c0d9..d532996 100644
+--- a/hardware/drivers/openmac/CMakeLists.txt
++++ b/hardware/drivers/openmac/CMakeLists.txt
+@@ -55,8 +55,8 @@ ELSE()
+ SET(OMETH_LIB_NAME "${OMETH_NAME}")
+ ENDIF()
+
+-SET(BOARD_EXAMPLE_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME})
+-SET(BOARDS_COMMON_DIR ${CMAKE_SOURCE_DIR}/boards/${BOARD_NAME}/common)
++SET(BOARD_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME})
++SET(BOARDS_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_NAME}/common)
+ SET(EXAMPLE_BINARY_DIR ${CMAKE_BINARY_DIR}/boards/${BOARD_NAME}/${EXAMPLE_NAME})
+
+ ########################################################################
+diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
+index 533d4e7..4460c2e 100644
+--- a/unittests/CMakeLists.txt
++++ b/unittests/CMakeLists.txt
+@@ -55,10 +55,10 @@ ENDMACRO(ADD_UNIT_TEST)
+
+ ################################################################################
+ # Set general directories
+-SET(OPLK_BASE_DIR ${CMAKE_SOURCE_DIR}/..)
++SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
+ SET(OPLK_SOURCE_DIR ${OPLK_BASE_DIR}/stack/src)
+ SET(OPLK_INCLUDE_DIR ${OPLK_BASE_DIR}/stack/include)
+-SET(TEST_COMMON_SOURCE_DIR ${CMAKE_SOURCE_DIR}/common)
++SET(TEST_COMMON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
+
+ # We need a oplkcfg.h file for compiling the sources
+ # We are using the project for the complete MN library
+--
+2.4.3
+
--- /dev/null
+From 7aace6a9d28b02c4325610255dc8afe198f02c4d Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Wed, 12 Aug 2015 10:54:32 +0200
+Subject: [PATCH] Use PROJECT_NAME instead of CMAKE_PROJECT_NAME
+
+In order to support a top level CMakeLists.txt, use the current project
+name instead of the top level one.
+
+This patch has been submitted upstream:
+https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ apps/demo_cn_console/CMakeLists.txt | 2 +-
+ apps/demo_cn_console/linux.cmake | 2 +-
+ apps/demo_mn_console/CMakeLists.txt | 4 ++--
+ apps/demo_mn_console/linux.cmake | 2 +-
+ apps/demo_mn_qt/CMakeLists.txt | 4 ++--
+ apps/demo_mn_qt/linux.cmake | 2 +-
+ drivers/linux/drv_daemon_pcap/CMakeLists.txt | 2 +-
+ drivers/linux/drv_kernelmod_edrv/CMakeLists.txt | 10 +++++-----
+ 8 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/apps/demo_cn_console/CMakeLists.txt b/apps/demo_cn_console/CMakeLists.txt
+index cd3b418..c5a47a8 100644
+--- a/apps/demo_cn_console/CMakeLists.txt
++++ b/apps/demo_cn_console/CMakeLists.txt
+@@ -112,6 +112,6 @@ TARGET_LINK_LIBRARIES(demo_cn_console ${ARCH_LIBRARIES})
+ ################################################################################
+ # Installation rules
+
+-INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(TARGETS demo_cn_console RUNTIME DESTINATION ${PROJECT_NAME})
+
+
+diff --git a/apps/demo_cn_console/linux.cmake b/apps/demo_cn_console/linux.cmake
+index 409bf11..76e381d 100644
+--- a/apps/demo_cn_console/linux.cmake
++++ b/apps/demo_cn_console/linux.cmake
+@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
+ ################################################################################
+ # Set architecture specific installation files
+
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
+
+diff --git a/apps/demo_mn_console/CMakeLists.txt b/apps/demo_mn_console/CMakeLists.txt
+index 0c54a98..d8df68e 100644
+--- a/apps/demo_mn_console/CMakeLists.txt
++++ b/apps/demo_mn_console/CMakeLists.txt
+@@ -120,6 +120,6 @@ TARGET_LINK_LIBRARIES(demo_mn_console ${ARCH_LIBRARIES})
+ ################################################################################
+ # Installation rules
+
+-INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(TARGETS demo_mn_console RUNTIME DESTINATION ${PROJECT_NAME})
++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME})
+
+diff --git a/apps/demo_mn_console/linux.cmake b/apps/demo_mn_console/linux.cmake
+index a9e9072..a994928 100644
+--- a/apps/demo_mn_console/linux.cmake
++++ b/apps/demo_mn_console/linux.cmake
+@@ -53,5 +53,5 @@ SET (ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
+ ################################################################################
+ # Set architecture specific installation files
+
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
+
+diff --git a/apps/demo_mn_qt/CMakeLists.txt b/apps/demo_mn_qt/CMakeLists.txt
+index ff3a9aa..282a9d8 100644
+--- a/apps/demo_mn_qt/CMakeLists.txt
++++ b/apps/demo_mn_qt/CMakeLists.txt
+@@ -161,5 +161,5 @@ TARGET_LINK_LIBRARIES(demo_mn_qt ${ARCH_LIBRARIES} ${QT_LIBRARIES})
+ ################################################################################
+ # Installation rules
+
+-INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(TARGETS demo_mn_qt RUNTIME DESTINATION ${PROJECT_NAME})
++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mnobd.cdc DESTINATION ${PROJECT_NAME})
+diff --git a/apps/demo_mn_qt/linux.cmake b/apps/demo_mn_qt/linux.cmake
+index 6f19ff2..6ed75ee 100644
+--- a/apps/demo_mn_qt/linux.cmake
++++ b/apps/demo_mn_qt/linux.cmake
+@@ -45,5 +45,5 @@ SET(ARCH_LIBRARIES ${ARCH_LIBRARIES} pthread rt)
+ ################################################################################
+ # Set architecture specific installation files
+
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/set_prio DESTINATION ${PROJECT_NAME})
+
+diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+index 9041e4d..2702abd 100644
+--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt
++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+@@ -136,5 +136,5 @@ SET_PROPERTY(TARGET ${EXE_NAME} PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG;DEF_DEB
+ TARGET_LINK_LIBRARIES(${EXE_NAME} ${OPLKLIB} ${ARCH_LIBRARIES})
+
+ # add installation rules
+-INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${PROJECT_NAME})
+
+diff --git a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
+index af85f86..59400c0 100644
+--- a/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
++++ b/drivers/linux/drv_kernelmod_edrv/CMakeLists.txt
+@@ -301,8 +301,8 @@ ADD_CUSTOM_TARGET(
+ ################################################################################
+ # add installation rules
+
+-INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${CMAKE_PROJECT_NAME})
+-INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${CMAKE_PROJECT_NAME})
++INSTALL(FILES ${MODULE_OUTPUT_DIR}/${MODULE_NAME}.ko DESTINATION ${PROJECT_NAME})
++INSTALL(FILES ${TOOLS_DIR}/linux/50-openPOWERLINK.rules DESTINATION ${PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkload DESTINATION ${PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/plkunload DESTINATION ${PROJECT_NAME})
++INSTALL(PROGRAMS ${TOOLS_DIR}/linux/devices.txt DESTINATION ${PROJECT_NAME})
+--
+2.4.3
+
--- /dev/null
+From 5cf3f37e12d0bb4649e3cda29a43d748708aa554 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Wed, 12 Aug 2015 11:24:24 +0200
+Subject: [PATCH] Add top level CMakeLists.txt
+
+This CMakeLists.txt can be used to build openpowerlink
+using a automated build system.
+
+Don't use FIND_LIBRARY when the stack is built from a top
+level build (ie CFG_OPLK_LIB is ON).
+For a top level build, CMake will automatically add a build
+dependency on oplk libraries for building demos applications.
+
+This patch has been submitted upstream:
+https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ CMakeLists.txt | 36 +++++++++++++++
+ apps/common/cmake/findoplklib.cmake | 68 +++++++++++++++-------------
+ drivers/linux/drv_daemon_pcap/CMakeLists.txt | 12 +++--
+ 3 files changed, 82 insertions(+), 34 deletions(-)
+ create mode 100644 CMakeLists.txt
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 0000000..96e3d0f
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,36 @@
++
++CMAKE_MINIMUM_REQUIRED (VERSION 2.8.7)
++
++#### LIB ####
++
++IF (CFG_OPLK_LIB)
++ ADD_SUBDIRECTORY("stack")
++ENDIF (CFG_OPLK_LIB)
++
++#### Linux kernel module ####
++
++IF (CFG_KERNEL_DRIVERS)
++ ADD_SUBDIRECTORY("drivers/linux/drv_kernelmod_edrv")
++ENDIF (CFG_KERNEL_DRIVERS)
++
++#### Pcap userspace driver ####
++
++IF (CFG_PCAP_DAEMON)
++ ADD_SUBDIRECTORY("drivers/linux/drv_daemon_pcap")
++ENDIF (CFG_PCAP_DAEMON)
++
++#### OpenPowerLink Demos ####
++
++# Add subdirectory of CN console demo application
++IF (CFG_DEMO_CN_CONSOLE)
++ ADD_SUBDIRECTORY("apps/demo_cn_console")
++ENDIF (CFG_DEMO_CN_CONSOLE)
++
++# Add subdirectory of MN console demo application
++IF (CFG_DEMO_MN_CONSOLE)
++ ADD_SUBDIRECTORY("apps/demo_mn_console")
++ENDIF (CFG_DEMO_MN_CONSOLE)
++
++IF (CFG_DEMO_MN_QT)
++ ADD_SUBDIRECTORY("apps/demo_mn_qt")
++ENDIF (CFG_DEMO_MN_QT)
+diff --git a/apps/common/cmake/findoplklib.cmake b/apps/common/cmake/findoplklib.cmake
+index 1bf570e..79ea35b 100644
+--- a/apps/common/cmake/findoplklib.cmake
++++ b/apps/common/cmake/findoplklib.cmake
+@@ -81,36 +81,42 @@ MACRO(FIND_OPLK_LIBRARY OPLK_NODE_TYPE)
+ # Set oplk library directory
+ SET(OPLKLIB_DIR ${OPLK_BASE_DIR}/stack/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR})
+
+- IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
+- # Search for release library
+- UNSET(OPLKLIB CACHE)
+- MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_NAME} in ${OPLKLIB_DIR}")
+- FIND_LIBRARY(OPLKLIB NAME ${OPLKLIB_NAME}
+- HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
+-
+- IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-
+- UNSET(OPLKDLL CACHE)
+- FIND_PROGRAM(OPLKDLL NAME ${OPLKLIB_NAME}.dll
+- HINTS ${OPLKLIB_DIR})
+-
+- ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+- ENDIF()
+-
+- IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
+- # Search for debug library
+- UNSET(OPLKLIB_DEBUG CACHE)
+- MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_DEBUG_NAME} in ${OPLKLIB_DIR}")
+- FIND_LIBRARY(OPLKLIB_DEBUG NAME ${OPLKLIB_DEBUG_NAME}
+- HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
+-
+- IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-
+- UNSET(OPLKDLL_DEBUG CACHE)
+- FIND_PROGRAM(OPLKDLL_DEBUG NAME ${OPLKLIB_DEBUG_NAME}.dll
+- HINTS ${OPLKLIB_DIR})
+-
+- ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+- ENDIF()
++ # Don't look for oplk libraries for a top level build
++ IF(CFG_OPLK_LIB)
++ SET(OPLKLIB ${OPLKLIB_NAME})
++ SET(OPLKLIB_DEBUG ${OPLKLIB_DEBUG_NAME})
++ ELSE(CFG_OPLK_LIB)
++ IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
++ # Search for release library
++ UNSET(OPLKLIB CACHE)
++ MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_NAME} in ${OPLKLIB_DIR}")
++ FIND_LIBRARY(OPLKLIB NAME ${OPLKLIB_NAME}
++ HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
++
++ IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++
++ UNSET(OPLKDLL CACHE)
++ FIND_PROGRAM(OPLKDLL NAME ${OPLKLIB_NAME}.dll
++ HINTS ${OPLKLIB_DIR})
++
++ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++ ENDIF()
++
++ IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
++ # Search for debug library
++ UNSET(OPLKLIB_DEBUG CACHE)
++ MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_DEBUG_NAME} in ${OPLKLIB_DIR}")
++ FIND_LIBRARY(OPLKLIB_DEBUG NAME ${OPLKLIB_DEBUG_NAME}
++ HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
++
++ IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++
++ UNSET(OPLKDLL_DEBUG CACHE)
++ FIND_PROGRAM(OPLKDLL_DEBUG NAME ${OPLKLIB_DEBUG_NAME}.dll
++ HINTS ${OPLKLIB_DIR})
++
++ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++ ENDIF()
++ ENDIF(CFG_OPLK_LIB)
+
+ ENDMACRO(FIND_OPLK_LIBRARY)
+diff --git a/drivers/linux/drv_daemon_pcap/CMakeLists.txt b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+index 2702abd..81bb598 100644
+--- a/drivers/linux/drv_daemon_pcap/CMakeLists.txt
++++ b/drivers/linux/drv_daemon_pcap/CMakeLists.txt
+@@ -104,9 +104,15 @@ ENDIF()
+ SET(OPLKLIB_DIR ${OPLK_BASE_DIR}/stack/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR})
+ SET(OPLKLIB_INCDIR ${OPLK_BASE_DIR}/stack/proj/${SYSTEM_NAME_DIR}/lib${LIB_NAME})
+
+-UNSET(OPLKLIB CACHE)
+-FIND_LIBRARY(OPLKLIB NAME ${LIB_NAME}${BUILD_TYPE_EXT}
+- HINTS ${OPLKLIB_DIR})
++# Don't look for oplk libraries for a top level build
++IF(CFG_OPLK_LIB)
++ SET(OPLKLIB ${LIB_NAME}${BUILD_TYPE_EXT})
++ELSE(CFG_OPLK_LIB)
++ UNSET(OPLKLIB CACHE)
++ FIND_LIBRARY(OPLKLIB NAME ${LIB_NAME}${BUILD_TYPE_EXT}
++ HINTS ${OPLKLIB_DIR})
++ENDIF(CFG_OPLK_LIB)
++
+ INCLUDE_DIRECTORIES(${OPLKLIB_INCDIR})
+
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99 -pthread -fno-strict-aliasing")
+--
+2.4.3
+
comment "openpowerlink needs a toolchain w/ C++, threads"
- depends on BR2_USE_MMU
depends on BR2_i386 || BR2_x86_64
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_i386 || BR2_x86_64
- depends on BR2_USE_MMU # qt
help
- openPOWERLINK is an Open Source Industrial Ethernet
- stack implementing the POWERLINK protocol for Managing Node
- (MN, POWERLINK Master) and Controlled Node (CN, POWERLINK Slave).
+ openPOWERLINK is an Open Source Industrial Ethernet stack
+ implementing the POWERLINK protocol for Managing Node (MN,
+ POWERLINK Master) and Controlled Node (CN, POWERLINK Slave).
It is provided by
SYSTEC electronic (http://www.systec-electronic.com),
B&R (http://www.br-automation.com) and
Kalycito (http://www.kalycito.com).
- https://sourceforge.net/projects/openpowerlink/
+ http://openpowerlink.sourceforge.net/web/
if BR2_PACKAGE_OPENPOWERLINK
choice
- prompt "stack implementation"
+ prompt "MN/CN mode"
-config BR2_PACKAGE_OPENPOWERLINK_LIBPCAP
- bool "userspace stack"
+config BR2_PACKAGE_OPENPOWERLINK_MN
+ bool "Managing Node"
+ help
+ Enable Managing Node (master) mode
+
+config BR2_PACKAGE_OPENPOWERLINK_CN
+ bool "Controlled Node"
+ help
+ Enable Controlled Node (slave) mode
+
+endchoice
+
+choice
+ prompt "stack type"
+
+config BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB
+ bool "linked into application"
+ select BR2_PACKAGE_LIBPCAP
+ help
+ Compile a monolithic openPOWERLINK library. The library
+ contains an Ethernet driver which is using the PCAP library
+ for accessing the network. No kernel-side driver is needed.
+
+config BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB
+ bool "user-space pcap daemon"
select BR2_PACKAGE_LIBPCAP
+ select BR2_PACKAGE_OPENPOWERLINK_PCAP_DAEMON
help
- The Linux userspace implementation of the openPOWERLINK stack provides
- all functions for a software based POWERLINK solution running as Linux
- userspace application. The stack uses the libpcap library for accessing
- the network interface and is therefore totally independant of the used
- network card and driver.
-
-config BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
- bool "kernel stack"
+ Compile openPOWERLINK application library which contains the
+ interface to a Linux user space driver, and the Linux user
+ space driver. It is used for implementing a multi-process
+ solution where the openPOWERLINK layer is running as a
+ separate Linux user space daemon (i.e. a PCAP based user
+ space daemon). No kernel-side stack is needed.
+
+config BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
+ bool "kernel-space driver"
depends on BR2_LINUX_KERNEL
help
- The openPOWERLINK stack may be implemented as Linux kernel module.
- This solution provides the best performance, but is limited to the
- available openPOWERLINK network drivers.
- You may select BR2_PACKAGE_PCIUTILS for lscpi,
- and BR2_PACKAGE_PROCPS for ps command.
- These commands are used in EplLoad and EplUndload scripts.
+ Compile openPOWERLINK application library which contains the
+ interface to a Linux kernel space driver. This will also
+ build and install a Linux kernel module openPOWERLINK
+ driver.
+
+comment "openpowerlink kernel stack needs a Linux kernel to be built"
+ depends on !BR2_LINUX_KERNEL
endchoice
-if BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
+if BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
choice
prompt "select Ethernet Powerlink Driver"
-config BR2_PACKAGE_OPENPOWERLINK_82573
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_82573
bool "Intel 82573"
-config BR2_PACKAGE_OPENPOWERLINK_8255x
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_8255x
bool "Intel 8255x"
-config BR2_PACKAGE_OPENPOWERLINK_I210
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_I210
bool "Intel I210"
-config BR2_PACKAGE_OPENPOWERLINK_RTL8139
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_RTL8111
+ bool "Realtek RTL-8111/8168"
+
+config BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_RTL8139
bool "Realtek RTL-8139"
endchoice
-endif
-
-choice
- prompt "Select MN/CN mode"
-
- config BR2_PACKAGE_OPENPOWERLINK_MN
- bool "MN"
- help
- Enable Managing Node mode
-
- config BR2_PACKAGE_OPENPOWERLINK_CN
- bool "CN"
- help
- Enable Controlled Node mode
-
-endchoice
+endif # BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB
-menu "openpowerlink demos"
+menu "demos"
config BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_CONSOLE
bool "console MN demo"
depends on BR2_PACKAGE_OPENPOWERLINK_MN
-config BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_QT
- bool "qt MN demo"
- depends on BR2_PACKAGE_OPENPOWERLINK_MN
- depends on BR2_INSTALL_LIBSTDCPP
- select BR2_PACKAGE_QT
- select BR2_PACKAGE_QT_STL
-
config BR2_PACKAGE_OPENPOWERLINK_DEMO_CN_CONSOLE
bool "console CN demo"
- depends on !BR2_PACKAGE_OPENPOWERLINK_MN
-
-config BR2_PACKAGE_OPENPOWERLINK_DEMO_LINUX_KERNEL
- bool "kernel demo"
- depends on BR2_PACKAGE_OPENPOWERLINK_KERNEL_MODULE
- depends on BR2_PACKAGE_OPENPOWERLINK_MN
+ depends on BR2_PACKAGE_OPENPOWERLINK_CN
endmenu
-config BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL
- string "debug level for openpowerlink stack"
- default "0xEC000000L"
- help
- Debug level to be used for openPOWERLINK debugging functions.
-
-endif
+endif # BR2_PACKAGE_OPENPOWERLINK
--- /dev/null
+# From http://sourceforge.net/projects/openpowerlink/files/openPOWERLINK/V2.2.2/
+md5 d7f2b08d332b36fed5427ebc5ec118f2 openPOWERLINK_V2.2.2.tar.gz
+sha1 f565c6a8e10ba320325d120f6030158f4c4278f8 openPOWERLINK_V2.2.2.tar.gz
+# sha256 locally computed
+sha256 4de00eaf8af1ff3877bfa2e878a59989873406845fc8031bd6fc58cb1f7cf7e7 openPOWERLINK_V2.2.2.tar.gz
#
################################################################################
-OPENPOWERLINK_VERSION = V1.08.5
-OPENPOWERLINK_SITE = http://git.code.sf.net/p/openpowerlink/code
-OPENPOWERLINK_SITE_METHOD = git
+OPENPOWERLINK_VERSION = V2.2.2
+OPENPOWERLINK_SITE = http://downloads.sourceforge.net/project/openpowerlink/openPOWERLINK/$(OPENPOWERLINK_VERSION)
+OPENPOWERLINK_SOURCE = openPOWERLINK_$(OPENPOWERLINK_VERSION).tar.gz
OPENPOWERLINK_LICENSE = BSD-2c, GPLv2
-OPENPOWERLINK_LICENSE_FILES = license.txt
+OPENPOWERLINK_LICENSE_FILES = license.md
+
OPENPOWERLINK_INSTALL_STAGING = YES
-OPENPOWERLINK_CONF_OPTS = -DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL))
+# The archive has no leading component.
+OPENPOWERLINK_STRIP_COMPONENTS = 0
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_LIBPCAP),y)
-# use the user space stack (libpcap)
-OPENPOWERLINK_CONF_OPTS += -DCFG_KERNEL_STACK=OFF
-OPENPOWERLINK_DEPENDENCIES = libpcap
-else
-# use the kernel stack
+OPENPOWERLINK_MN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_MN),ON,OFF)
+OPENPOWERLINK_CN_ONOFF = $(if $(BR2_PACKAGE_OPENPOWERLINK_CN),ON,OFF)
+
+#### OPLK LIBRARY ####
+
+# Always build a oplk stack
+OPENPOWERLINK_CONF_OPTS += -DCFG_OPLK_LIB=ON
+
+# All option are ON by default
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_COMPILE_LIB_MN=$(OPENPOWERLINK_MN_ONOFF) \
+ -DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+ -DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+ -DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+ -DCFG_COMPILE_LIB_CN=$(OPENPOWERLINK_CN_ONOFF) \
+ -DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+ -DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+ -DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += libpcap
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_COMPILE_LIB_MN=OFF \
+ -DCFG_COMPILE_LIB_MNAPP_USERINTF=$(OPENPOWERLINK_MN_ONOFF) \
+ -DCFG_COMPILE_LIB_MNAPP_KERNELINTF=OFF \
+ -DCFG_COMPILE_LIB_MNDRV_PCAP=$(OPENPOWERLINK_MN_ONOFF) \
+ -DCFG_COMPILE_LIB_CN=OFF \
+ -DCFG_COMPILE_LIB_CNAPP_USERINTF=$(OPENPOWERLINK_CN_ONOFF) \
+ -DCFG_COMPILE_LIB_CNAPP_KERNELINTF=OFF \
+ -DCFG_COMPILE_LIB_CNDRV_PCAP=$(OPENPOWERLINK_CN_ONOFF)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
OPENPOWERLINK_CONF_OPTS += \
- -DCFG_KERNEL_STACK=ON \
- -DCFG_KERNEL_DIR=$(LINUX_DIR) \
- -DCMAKE_SYSTEM_VERSION=$(LINUX_VERSION)
-OPENPOWERLINK_DEPENDENCIES = linux
+ -DCFG_COMPILE_LIB_MN=OFF \
+ -DCFG_COMPILE_LIB_MNAPP_USERINTF=OFF \
+ -DCFG_COMPILE_LIB_MNAPP_KERNELINTF=$(OPENPOWERLINK_MN_ONOFF) \
+ -DCFG_COMPILE_LIB_MNDRV_PCAP=OFF \
+ -DCFG_COMPILE_LIB_CN=OFF \
+ -DCFG_COMPILE_LIB_CNAPP_USERINTF=OFF \
+ -DCFG_COMPILE_LIB_CNAPP_KERNELINTF=$(OPENPOWERLINK_CN_ONOFF) \
+ -DCFG_COMPILE_LIB_CNDRV_PCAP=OFF
endif
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_82573),y)
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_COMPILE_SHARED_LIBRARY=$(if $(BR2_STATIC_LIBS),OFF,ON)
+
+#### OPLK KERNEL DRIVERS ####
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_DEPENDENCIES += linux
+
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_KERNEL_DRIVERS=ON \
+ -DCFG_KERNEL_DIR="$(LINUX_DIR)" \
+ -DCMAKE_SYSTEM_VERSION="$(LINUX_VERSION)" \
+ -DCFG_OPLK_MN="$(OPENPOWERLINK_MN_ONOFF)" \
+ -DMAKE_KERNEL_ARCH="$(KERNEL_ARCH)" \
+ -DMAKE_KERNEL_CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)"
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_82573),y)
OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=82573
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_8255x),y)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_8255x),y)
OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8255x
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_I210),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=I210
-else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_RTL8139),y)
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_I210),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=i210
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_RTL8111),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8111
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_KERNEL_DRIVER_RTL8139),y)
OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_EDRV=8139
endif
-
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_MN),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_MN=ON
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_POWERLINK_MN=OFF
endif
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_CONSOLE),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_CONSOLE=ON
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_CONSOLE=OFF
+#### OPLK PCAP DAEMON ####
+
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_PCAP_DAEMON=ON \
+ -DCFG_OPLK_MN=$(OPENPOWERLINK_MN_ONOFF)
endif
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_QT),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_QT=ON
-OPENPOWERLINK_DEPENDENCIES += qt
-else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_MN_QT=OFF
+#### OPLK DEMO APPS ####
+
+# See apps/common/cmake/configure-linux.cmake for available options list.
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_MONOLITHIC_USER_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_BUILD_KERNEL_STACK="Link to Application"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_USERSPACE_DAEMON_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_BUILD_KERNEL_STACK="Linux Userspace Daemon"
+else ifeq ($(BR2_PACKAGE_OPENPOWERLINK_STACK_KERNEL_STACK_LIB),y)
+OPENPOWERLINK_CONF_OPTS += \
+ -DCFG_BUILD_KERNEL_STACK="Linux Kernel Module"
endif
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_CN_CONSOLE),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_CN_CONSOLE=ON
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_MN_CONSOLE),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_DEMO_MN_CONSOLE=ON \
+ -DCFG_DEMO_MN_CONSOLE_USE_SYNCTHREAD=ON
else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_CN_CONSOLE=OFF
+OPENPOWERLINK_CONF_OPTS += -DCFG_DEMO_MN_CONSOLE=OFF
endif
-ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_LINUX_KERNEL),y)
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_LINUX_KERNEL=ON
+ifeq ($(BR2_PACKAGE_OPENPOWERLINK_DEMO_CN_CONSOLE),y)
+OPENPOWERLINK_CONF_OPTS += -DCFG_DEMO_CN_CONSOLE=ON
else
-OPENPOWERLINK_CONF_OPTS += -DCFG_X86_DEMO_LINUX_KERNEL=OFF
+OPENPOWERLINK_CONF_OPTS += -DCFG_DEMO_CN_CONSOLE=OFF
endif
$(eval $(cmake-package))