onekiloparsec / SwiftAA

The most comprehensive collection of accurate astronomical algorithms in (C++, Objective-C and) Swift.
http://www.onekiloparsec.dev/
MIT License
171 stars 31 forks source link

Make SwiftAA available through Swift Package Manager. #78

Closed onekiloparsec closed 4 years ago

onekiloparsec commented 6 years ago

Ongoing right now...

onekiloparsec commented 6 years ago

EPIC FAIL

error: target at '/Users/onekiloparsec/code/SwiftAA/Sources/SwiftAA' contains mixed language source files; feature not supported

onekiloparsec commented 6 years ago

Ah, ok now, but modules need to be separated. http://ankit.im/swift/2016/05/21/creating-objc-cpp-packages-with-swift-package-manager/

onekiloparsec commented 5 years ago

Will start over to work on this once I got through the WWDC2019 videos (especially about SwiftPackages)

onekiloparsec commented 4 years ago

Made some progresses today.

One must distinguish a pure C/C++/Objective-C target inside the Package definition, and then a pure Swift target declaring the previous one as dependency.

However, organising the code as the SPM expects and trying to build produces a lot of C/C++ errors that I don't know how to solve right now...

For the records:

'SwiftAA' /Users/onekiloparsec/code/SwiftAA: warning: Ignoring duplicate product 'SwiftAA' 
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.cpp:25:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:55:100: error: expected ';' at end of declaration list
  static double Calculate(double JD, const VSOP87Coefficient2* pTable, int nTableSize, bool bAngle) noexcept;
                                                                                                   ^
                                                                                                   ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:56:92: error: expected ';' at end of declaration list
  static double Calculate_Dash(double JD, const VSOP87Coefficient2* pTable, int nTableSize) noexcept;
                                                                                           ^
                                                                                           ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.cpp:26:
: expected ';' at end of declaration list
  static double A(double JD) noexcept;
                            ^

/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.h:42:29: error: expected ';' at end of declaration list
  static double L(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.h:43:29: error: expected ';' at end of declaration list
  static double K(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.h:44:29: error: expected ';' at end of declaration list
  static double H(double JD) noexcept;
                            ^
                            ;
29: error: expected ';' at end of declaration list
  static double Q(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.h:46:29: error: expected ';' at end of declaration list
  static double P(double JD) noexcept;
                            ^
                            ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.cpp:25:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:55:100: error: expected ';' at end of declaration list
  static double Calculate(double JD, const VSOP87Coefficient2* pTable, int nTableSize, bool bAngle) noexcept;
                                                                                                   ^
                                                                                                   ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:56:92: error: expected ';' at end of declaration list
  static double Calculate_Dash(double JD, const VSOP87Coefficient2* pTable, int nTableSize) noexcept;
                                                                                           ^
                                                                                           ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.cpp:26:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:41:29: error: expected ';' at end of declaration list
  static double A(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:42:29: error: expected ';' at end of declaration list

                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:43:29: error: expected ';' at end of declaration list
  static double K(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:44:29: error: expected ';' at end of declaration list
  static double H(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:45:29: error: expected ';' at end of declaration list
  static double Q(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_NEP.h:46:29: error: expected ';' at end of declaration list
  static double P(double JD) noexcept;
                            ^
                            ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.cpp:25:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:55:100: error: expected ';' at end of declaration list
  static double Calculate(double JD, const VSOP87Coefficient2* pTable, int nTableSize, bool bAngle) noexcept;
                                                                                                   ^
                                                                                                   ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:56:92: error: expected ';' at end of declaration list
  static double Calculate_Dash(double JD, const VSOP87Coefficient2* pTable, int nTableSize) noexcept;
                                                                                           ^
                                                                                           ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.cpp:26:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.h:41:29: error: expected ';' at end of declaration list
  static double A(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.h:42:29: error: expected ';' at end of declaration list
  static double L(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.h:43:29: error: expected ';' at end of declaration list
  static double K(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.h:44:29: error: expected ';' at end of declaration list
  static double H(double JD) noexcept;
                            ^
                            ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.cpp:25:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:55:100: error: expected ';' at end of declaration list
  static double Calculate(double JD, const VSOP87Coefficient2* pTable, int nTableSize, bool bAngle) noexcept;
                                                                                                   ^
                                                                                                   ;
error: expected ';' at end of declaration list
  static double Q(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_SAT.h:46:29: error: expected ';' at end of declaration list
  static double P(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87.h:56:92: error: expected ';' at end of declaration list
  static double Calculate_Dash(double JD, const VSOP87Coefficient2* pTable, int nTableSize) noexcept;
                                                                                           ^
                                                                                           ;
In file included from /Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.cpp:26:
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:41:29: error: expected ';' at end of declaration list
  static double A(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:42:29: error: expected ';' at end of declaration list
  static double L(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:43:29: error: expected ';' at end of declaration list
  static double K(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:44:29: error: expected ';' at end of declaration list
  static double H(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:45:29: error: expected ';' at end of declaration list
  static double Q(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_URA.h:46:29: error: expected ';' at end of declaration list
  static double P(double JD) noexcept;
                            ^
                            ;
/Users/onekiloparsec/code/SwiftAA/Sources/ObjCAA/aaplus-v2.08/AAVSOP87_VEN.cpp:3206:38: error: expected function body after function declarator
double CAAVSOP87_Venus::A(double JD) noexcept
                                     ^
9 errors generated.
[0/171] Compiling AAVSOP87_URA.cpp

Maybe @alex-vasenin you know something about it ?

alex-vasenin commented 4 years ago

I'm sorry, I haven't looked into SPM thing yet.

onekiloparsec commented 4 years ago

Ongoing... I successfully reorganised the whole project and made SPM work. Really neat.

onekiloparsec commented 4 years ago

Of course, the Pod is broken after that. CocoaPod creation is a true time consuming black hole.

onekiloparsec commented 4 years ago

Just under 2 years to complete... but it's done. v2.2.2 and ongoing. See README.