aboutsummaryrefslogtreecommitdiff
path: root/package/openpowerlink/0001-fix-use-a-better-regex-for-cmake-system-processor.patch
blob: 6fd1990af2b1df22166bca8c4dcbeaf3395b689e (plain)
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
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