Blame view

buildroot/buildroot-2016.08.1/package/openpowerlink/0003-Add-top-level-CMakeLists.txt.patch 7.6 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
  From 1b92df6f8283e15b6877f7cd70063648727fc88b Mon Sep 17 00:00:00 2001
  From: Romain Naour <romain.naour@gmail.com>
  Date: Wed, 25 May 2016 15:59:20 +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.
  
  Also replace OPLKLIB_DEBUG by OPLKLIB in OPLK_LINK_LIBRARIES macro
  if CMAKE_BUILD_TYPE is "Debug", otherwise TARGET_LINK_LIBRARIES can't
  find the openpowerlink library.
  This issue may be related to:
  https://github.com/OpenAutomationTechnologies/openPOWERLINK_V2/issues/109
  
  Fixes:
  http://autobuild.buildroot.net/results/da4/da445b65cb136d71577f04e3a17fdb2ef6302a9b
  
  This patch has not been accepted by upstream:
  https://github.com/openPOWERLINK/openPOWERLINK_V2/pull/57
  
  Add PCIe support (v2.3.2)
  
  Signed-off-by: Romain Naour <romain.naour@gmail.com>
  ---
   CMakeLists.txt                               | 42 +++++++++++++++++
   apps/common/cmake/findoplklib.cmake          | 68 +++++++++++++++-------------
   apps/common/cmake/linkoplklib.cmake          |  2 +-
   drivers/linux/drv_daemon_pcap/CMakeLists.txt | 12 +++--
   4 files changed, 89 insertions(+), 35 deletions(-)
   create mode 100644 CMakeLists.txt
  
  diff --git a/CMakeLists.txt b/CMakeLists.txt
  new file mode 100644
  index 0000000..28d4e7a
  --- /dev/null
  +++ b/CMakeLists.txt
  @@ -0,0 +1,42 @@
  +
  +CMAKE_MINIMUM_REQUIRED (VERSION 2.8.7)
  +
  +#### LIB ####
  +
  +IF (CFG_OPLK_LIB)
  +    ADD_SUBDIRECTORY("stack")
  +ENDIF (CFG_OPLK_LIB)
  +
  +#### Linux kernel Ethernet module  ####
  +
  +IF (CFG_KERNEL_DRIVERS)
  +    ADD_SUBDIRECTORY("drivers/linux/drv_kernelmod_edrv")
  +ENDIF (CFG_KERNEL_DRIVERS)
  +
  +#### Linux kernel PCIe module  ####
  +
  +IF (CFG_KERNEL_PCIE_DRIVERS)
  +    ADD_SUBDIRECTORY("drivers/linux/drv_kernelmod_pcie")
  +ENDIF (CFG_KERNEL_PCIE_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 aa427a6..e6a802e 100644
  --- a/apps/common/cmake/findoplklib.cmake
  +++ b/apps/common/cmake/findoplklib.cmake
  @@ -89,36 +89,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/apps/common/cmake/linkoplklib.cmake b/apps/common/cmake/linkoplklib.cmake
  index 49aab66..d9fd418 100644
  --- a/apps/common/cmake/linkoplklib.cmake
  +++ b/apps/common/cmake/linkoplklib.cmake
  @@ -33,7 +33,7 @@ MACRO(OPLK_LINK_LIBRARIES EXECUTABLE_NAME)
           TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB} debug ${OPLKLIB_DEBUG})
       ELSE()
           IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
  -            TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} debug ${OPLKLIB_DEBUG})
  +            TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} debug ${OPLKLIB})
           ELSE ()
               TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB})
           ENDIF()
  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.5.5