@@ -67,13 +67,23 @@ func makeFile() throws {
67
67
68
68
print ( " Found llvm-config at \( llvmConfig) ... " )
69
69
70
- let version = run ( llvmConfig, args: [ " --version " ] ) !
71
- . replacing ( charactersIn: . newlines, with: " " )
70
+ let versionStr = run ( llvmConfig, args: [ " --version " ] ) !
71
+ . replacing ( charactersIn: . newlines, with: " " )
72
+ let components = versionStr. components ( separatedBy: " . " )
73
+ . flatMap { Int ( $0) }
72
74
73
- guard version . hasPrefix ( " 3.9 " ) else {
74
- throw " LLVMSwift requires LLVM version >=3.9.0, but you have \( version ) "
75
+ guard components . count == 3 else {
76
+ throw " Invalid version number \( versionStr ) "
75
77
}
76
78
79
+ let version = ( components [ 0 ] , components [ 1 ] , components [ 2 ] )
80
+
81
+ guard version > ( 3 , 9 , 0 ) else {
82
+ throw " LLVMSwift requires LLVM version >=3.9.0, but you have \( versionStr) "
83
+ }
84
+
85
+ print ( " LLVM version is \( versionStr) " )
86
+
77
87
let ldFlags = run ( llvmConfig, args: [ " --ldflags " , " --libs " , " all " ,
78
88
" --system-libs " ] ) !
79
89
. replacing ( charactersIn: . newlines, with: " " )
@@ -95,7 +105,7 @@ func makeFile() throws {
95
105
let s = [
96
106
" Name: cllvm " ,
97
107
" Description: The llvm library " ,
98
- " Version: \( version ) " ,
108
+ " Version: \( versionStr ) " ,
99
109
" Libs: \( ldFlags) \( libCPP) " ,
100
110
" Requires.private: " ,
101
111
" Cflags: \( cFlags) " ,
0 commit comments