@@ -67,13 +67,23 @@ func makeFile() throws {
6767
6868 print ( " Found llvm-config at \( llvmConfig) ... " )
6969
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) }
7274
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 ) "
7577 }
7678
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+
7787 let ldFlags = run ( llvmConfig, args: [ " --ldflags " , " --libs " , " all " ,
7888 " --system-libs " ] ) !
7989 . replacing ( charactersIn: . newlines, with: " " )
@@ -95,7 +105,7 @@ func makeFile() throws {
95105 let s = [
96106 " Name: cllvm " ,
97107 " Description: The llvm library " ,
98- " Version: \( version ) " ,
108+ " Version: \( versionStr ) " ,
99109 " Libs: \( ldFlags) \( libCPP) " ,
100110 " Requires.private: " ,
101111 " Cflags: \( cFlags) " ,
0 commit comments