if ( ONDSELSOLVER_BUILD_SHARED )
    message( STATUS "[OndselSolver] Building shared library" )
    add_library(OndselSolver SHARED)
else()
    message( STATUS "[OndselSolver] Building static library" )
    add_library(OndselSolver STATIC)
endif()

set(ONDSELSOLVER_SRC
        Abs.cpp
        AbsConstraint.cpp
        AccICKineNewtonRaphson.cpp
        AccICNewtonRaphson.cpp
        AccKineNewtonRaphson.cpp
        AccNewtonRaphson.cpp
        AllowZRotation.cpp
        AllowZRotationConstraintIqctJqc.cpp
        AngleJoint.cpp
        AngleZConstraintIJ.cpp
        AngleZConstraintIqcJc.cpp
        AngleZConstraintIqcJqc.cpp
        AngleZIecJec.cpp
        AngleZIeqcJec.cpp
        AngleZIeqcJeqc.cpp
        AnyGeneralSpline.cpp
        AnyPosICNewtonRaphson.cpp
        ArcSine.cpp
        ArcTan.cpp
        ArcTan2.cpp
        Arguments.cpp
        Array.cpp
        ASMTAllowRotation.cpp
        ASMTAngleJoint.cpp
        ASMTAnimationParameters.cpp
        ASMTAssembly.cpp
        ASMTConeConeContact.cpp
        ASMTContact.cpp
        ASMTCylConeContact.cpp
        ASMTCylCylContact.cpp
        ASMTCompoundJoint.cpp
        ASMTConstantGravity.cpp
        ASMTConstantVelocityJoint.cpp
        ASMTConstraintSet.cpp
        ASMTCylindricalJoint.cpp
        ASMTCylSphJoint.cpp
        ASMTExtrusion.cpp
        ASMTFixedJoint.cpp
        ASMTForceTorque.cpp
        ASMTGearJoint.cpp
        ASMTGeneralMotion.cpp
        ASMTInPlaneJoint.cpp
        ASMTItem.cpp
        ASMTItemIJ.cpp
        ASMTJoint.cpp
        ASMTKinematicIJ.cpp
        ASMTLimit.cpp
        ASMTLineInPlaneJoint.cpp
        ASMTMarker.cpp
        ASMTMotion.cpp
        ASMTNoRotationJoint.cpp
        ASMTParallelAxesJoint.cpp
        ASMTPart.cpp
        ASMTPerpendicularJoint.cpp
        ASMTPlanarJoint.cpp
        ASMTPointInLineJoint.cpp
        ASMTPointInPlaneJoint.cpp
        ASMTPrincipalMassMarker.cpp
        ASMTRackPinionJoint.cpp
        ASMTRefCurve.cpp
        ASMTRefItem.cpp
        ASMTRefPoint.cpp
        ASMTRefSurface.cpp
        ASMTRevCylJoint.cpp
        ASMTRevoluteJoint.cpp
        ASMTRevRevJoint.cpp
        ASMTRotationalMotion.cpp
        ASMTRotationLimit.cpp
        ASMTScrewJoint.cpp
        ASMTSimulationParameters.cpp
        ASMTSpatialContainer.cpp
        ASMTSpatialItem.cpp
        ASMTSphericalJoint.cpp
        ASMTSphSphJoint.cpp
        ASMTTime.cpp
        ASMTTranslationalJoint.cpp
        ASMTTranslationalMotion.cpp
        ASMTTranslationLimit.cpp
        ASMTUniversalJoint.cpp
        AtPointConstraintIJ.cpp
        AtPointConstraintIqcJc.cpp
        AtPointConstraintIqcJqc.cpp
        AtPointConstraintIqctJqc.cpp
        AtPointJoint.cpp
        BasicIntegrator.cpp
        BasicQuasiIntegrator.cpp
        BasicUserFunction.cpp
        CADSystem.cpp
        CartesianFrame.cpp
        CompoundJoint.cpp
        Constant.cpp
        ConstantGravity.cpp
        ConstantVelocityJoint.cpp
        Constraint.cpp
        ConstraintIJ.cpp
        ConstraintSet.cpp
        ConstVelConstraintIJ.cpp
        ConstVelConstraintIqcJc.cpp
        ConstVelConstraintIqcJqc.cpp
        Cosine.cpp
        CREATE.cpp
        CylindricalJoint.cpp
        CylSphJoint.cpp
        DiagonalMatrix.cpp
        DifferenceOperator.cpp
        DifferentiatedGeneralSpline.cpp
        DirectionCosineConstraintIJ.cpp
        DirectionCosineConstraintIqcJc.cpp
        DirectionCosineConstraintIqcJqc.cpp
        DirectionCosineConstraintIqctJqc.cpp
        DirectionCosineIecJec.cpp
        DirectionCosineIeqcJec.cpp
        DirectionCosineIeqcJeqc.cpp
        DirectionCosineIeqctJeqc.cpp
        DiscontinuityError.cpp
        DispCompIecJecIe.cpp
        DispCompIecJecKec.cpp
        DispCompIecJecKeqc.cpp
        DispCompIecJecO.cpp
        DispCompIeqcJecIe.cpp
        DispCompIeqcJecKeqc.cpp
        DispCompIeqcJecO.cpp
        DispCompIeqcJeqcIe.cpp
        DispCompIeqcJeqcKeqc.cpp
        DispCompIeqcJeqcKeqct.cpp
        DispCompIeqcJeqcO.cpp
        DispCompIeqctJeqcIe.cpp
        DispCompIeqctJeqcKeqct.cpp
        DispCompIeqctJeqcO.cpp
        DistanceConstraintIJ.cpp
        DistanceConstraintIqcJc.cpp
        DistanceConstraintIqcJqc.cpp
        DistanceConstraintIqctJqc.cpp
        DistancexyConstraintIJ.cpp
        DistancexyConstraintIqcJc.cpp
        DistancexyConstraintIqcJqc.cpp
        DistIecJec.cpp
        DistIeqcJec.cpp
        DistIeqcJeqc.cpp
        DistIeqctJeqc.cpp
        DistxyIecJec.cpp
        DistxyIeqcJec.cpp
        DistxyIeqcJeqc.cpp
        DistxyIeqctJeqc.cpp
        EigenDecomposition.cpp
        EndFramec.cpp
        EndFrameqc.cpp
        EndFrameqct.cpp
        EndFrameqct2.cpp
        EulerAngles.cpp
        EulerAnglesDDot.cpp
        EulerAnglesDot.cpp
        EulerAngleszxz.cpp
        EulerAngleszxzDDot.cpp
        EulerAngleszxzDot.cpp
        EulerArray.cpp
        EulerConstraint.cpp
        EulerParameters.cpp
        EulerParametersDDot.cpp
        EulerParametersDot.cpp
        Exponential.cpp
        ExpressionX.cpp
        ExternalSystem.cpp
        FixedJoint.cpp
        ForceTorqueData.cpp
        ForceTorqueItem.cpp
        FullColumn.cpp
        FullMatrix.cpp
        FullMotion.cpp
        FullRow.cpp
        FullVector.cpp
        Function.cpp
        FunctionFromData.cpp
        FunctionWithManyArgs.cpp
        FunctionX.cpp
        FunctionXcParameter.cpp
        FunctionXY.cpp
        GearConstraintIJ.cpp
        GearConstraintIqcJc.cpp
        GearConstraintIqcJqc.cpp
        GearJoint.cpp
        GEFullMat.cpp
        GEFullMatFullPv.cpp
        GEFullMatParPv.cpp
        GeneralSpline.cpp
        GESpMat.cpp
        GESpMatFullPv.cpp
        GESpMatFullPvPosIC.cpp
        GESpMatParPv.cpp
        GESpMatParPvMarko.cpp
        GESpMatParPvMarkoFast.cpp
        GESpMatParPvPrecise.cpp
        ICKineIntegrator.cpp
        IndependentVariable.cpp
        InLineJoint.cpp
        InPlaneJoint.cpp
        Integral.cpp
        Integrator.cpp
        IntegratorInterface.cpp
        Item.cpp
        ItemIJ.cpp
        Joint.cpp
        KineIntegrator.cpp
        KinematicIeJe.cpp
        LDUFullMat.cpp
        LDUFullMatParPv.cpp
        LDUSpMat.cpp
        LDUSpMatParPv.cpp
        LDUSpMatParPvMarko.cpp
        LDUSpMatParPvPrecise.cpp
        LimitIJ.cpp
        LinearMultiStepMethod.cpp
        LineInPlaneJoint.cpp
        Ln.cpp
        Log10.cpp
        LogN.cpp
        MarkerFrame.cpp
        MatrixDecomposition.cpp
        MatrixGaussElimination.cpp
        MatrixLDU.cpp
        MatrixSolver.cpp
        MaximumIterationError.cpp
        MbDMath.cpp
        MomentOfInertiaSolver.cpp
        Negative.cpp
        NewtonRaphson.cpp
        NewtonRaphsonError.cpp
        NoRotationJoint.cpp
        NotKinematicError.cpp
        Numeric.cpp
        OrbitAngleZIecJec.cpp
        OrbitAngleZIeqcJec.cpp
        OrbitAngleZIeqcJeqc.cpp
        Orientation.cpp
        ParallelAxesJoint.cpp
        Part.cpp
        PartFrame.cpp
        PerpendicularJoint.cpp
        PiecewiseFunction.cpp
        PlanarJoint.cpp
        PointInLineJoint.cpp
        PointInPlaneJoint.cpp
        Polynomial.cpp
        PosICDragLimitNewtonRaphson.cpp
        PosICDragNewtonRaphson.cpp
        PosICKineNewtonRaphson.cpp
        PosICNewtonRaphson.cpp
        PosKineNewtonRaphson.cpp
        PosNewtonRaphson.cpp
        PosVelAccData.cpp
        Power.cpp
        PrescribedMotion.cpp
        Product.cpp
        QuasiIntegrator.cpp
        RackPinConstraintIJ.cpp
        RackPinConstraintIqcJc.cpp
        RackPinConstraintIqcJqc.cpp
        RackPinJoint.cpp
        RampStepFunction.cpp
        Reciprocal.cpp
        RedundantConstraint.cpp
        RevCylJoint.cpp
        RevoluteJoint.cpp
        RevRevJoint.cpp
        RotationLimitIJ.cpp
        RowTypeMatrix.cpp
        ScalarNewtonRaphson.cpp
        ScrewConstraintIJ.cpp
        ScrewConstraintIqcJc.cpp
        ScrewConstraintIqcJqc.cpp
        ScrewJoint.cpp
        SimulationStoppingError.cpp
        Sine.cpp
        SingularMatrixError.cpp
        Solver.cpp
        SparseColumn.cpp
        SparseMatrix.cpp
        SparseRow.cpp
        SparseVector.cpp
        SphericalJoint.cpp
        SphSphJoint.cpp
        StableBackwardDifference.cpp
        StateData.cpp
        Sum.cpp
        Symbolic.cpp
        SymbolicParser.cpp
        SyntaxError.cpp
        System.cpp
        SystemNewtonRaphson.cpp
        SystemSolver.cpp
        SymTime.cpp
        TooManyTriesError.cpp
        TooSmallStepSizeError.cpp
        Translation.cpp
        TranslationalJoint.cpp
        TranslationConstraintIJ.cpp
        TranslationConstraintIqcJc.cpp
        TranslationConstraintIqcJqc.cpp
        TranslationConstraintIqctJqc.cpp
        TranslationLimitIJ.cpp
        Units.cpp
        UniversalJoint.cpp
        UserFunction.cpp
        Variable.cpp
        VectorNewtonRaphson.cpp
        VelICKineSolver.cpp
        VelICSolver.cpp
        VelKineSolver.cpp
        VelSolver.cpp
        ZRotation.cpp
        ZTranslation.cpp
)

set(ONDSELSOLVER_HEADERS
        Abs.h
        AbsConstraint.h
        AccICKineNewtonRaphson.h
        AccICNewtonRaphson.h
        AccKineNewtonRaphson.h
        AccNewtonRaphson.h
        AllowZRotation.h
        AllowZRotationConstraintIqctJqc.h
        AngleJoint.h
        AngleZConstraintIJ.h
        AngleZConstraintIqcJc.h
        AngleZConstraintIqcJqc.h
        AngleZIecJec.h
        AngleZIeqcJec.h
        AngleZIeqcJeqc.h
        AnyGeneralSpline.h
        AnyPosICNewtonRaphson.h
        ArcSine.h
        ArcTan.h
        ArcTan2.h
        Arguments.h
        Array.h
        ASMTAllowRotation.h
        ASMTAngleJoint.h
        ASMTAnimationParameters.h
        ASMTAssembly.h
        ASMTAtPointJoint.h
        ASMTCompoundJoint.h
        ASMTConstantGravity.h
        ASMTConstantVelocityJoint.h
        ASMTConstraintSet.h
        ASMTCylindricalJoint.h
        ASMTCylSphJoint.h
        ASMTExtrusion.h
        ASMTFixedJoint.h
        ASMTForceTorque.h
        ASMTGearJoint.h
        ASMTGeneralMotion.h
        ASMTInLineJoint.h
        ASMTInPlaneJoint.h
        ASMTItem.h
        ASMTItemIJ.h
        ASMTJoint.h
        ASMTKinematicIJ.h
        ASMTLimit.h
        ASMTLineInPlaneJoint.h
        ASMTMarker.h
        ASMTMotion.h
        ASMTNoRotationJoint.h
        ASMTParallelAxesJoint.h
        ASMTPart.h
        ASMTPerpendicularJoint.h
        ASMTPlanarJoint.h
        ASMTPointInLineJoint.h
        ASMTPointInPlaneJoint.h
        ASMTPrincipalMassMarker.h
        ASMTRackPinionJoint.h
        ASMTRefCurve.h
        ASMTRefItem.h
        ASMTRefPoint.h
        ASMTRefSurface.h
        ASMTRevCylJoint.h
        ASMTRevoluteJoint.h
        ASMTRevRevJoint.h
        ASMTRotationalMotion.h
        ASMTRotationLimit.h
        ASMTScrewJoint.h
        ASMTSimulationParameters.h
        ASMTSpatialContainer.h
        ASMTSpatialItem.h
        ASMTSphericalJoint.h
        ASMTSphSphJoint.h
        ASMTTime.h
        ASMTTranslationalJoint.h
        ASMTTranslationalMotion.h
        ASMTTranslationLimit.h
        ASMTUniversalJoint.h
        AtPointConstraintIJ.h
        AtPointConstraintIqcJc.h
        AtPointConstraintIqcJqc.h
        AtPointConstraintIqctJqc.h
        AtPointJoint.h
        BasicIntegrator.h
        BasicQuasiIntegrator.h
        BasicUserFunction.h
        CADSystem.h
        CartesianFrame.h
        CompoundJoint.h
        ASMTConeConeContact.h
        ASMTContact.h
        ASMTCylConeContact.h
        ASMTCylCylContact.h
        Constant.h
        ConstantGravity.h
        ConstantVelocityJoint.h
        Constraint.h
        ConstraintIJ.h
        ConstraintSet.h
        ConstVelConstraintIJ.h
        ConstVelConstraintIqcJc.h
        ConstVelConstraintIqcJqc.h
        Cosine.h
        CREATE.h
        CylindricalJoint.h
        CylSphJoint.h
        DiagonalMatrix.h
        DifferenceOperator.h
        DifferentiatedGeneralSpline.h
        DirectionCosineConstraintIJ.h
        DirectionCosineConstraintIqcJc.h
        DirectionCosineConstraintIqcJqc.h
        DirectionCosineConstraintIqctJqc.h
        DirectionCosineIecJec.h
        DirectionCosineIeqcJec.h
        DirectionCosineIeqcJeqc.h
        DirectionCosineIeqctJeqc.h
        DiscontinuityError.h
        DispCompIecJecIe.h
        DispCompIecJecKec.h
        DispCompIecJecKeqc.h
        DispCompIecJecO.h
        DispCompIeqcJecIe.h
        DispCompIeqcJecKeqc.h
        DispCompIeqcJecO.h
        DispCompIeqcJeqcIe.h
        DispCompIeqcJeqcKeqc.h
        DispCompIeqcJeqcKeqct.h
        DispCompIeqcJeqcO.h
        DispCompIeqctJeqcIe.h
        DispCompIeqctJeqcKeqct.h
        DispCompIeqctJeqcO.h
        DistanceConstraintIJ.h
        DistanceConstraintIqcJc.h
        DistanceConstraintIqcJqc.h
        DistanceConstraintIqctJqc.h
        DistancexyConstraintIJ.h
        DistancexyConstraintIqcJc.h
        DistancexyConstraintIqcJqc.h
        DistIecJec.h
        DistIeqcJec.h
        DistIeqcJeqc.h
        DistIeqctJeqc.h
        DistxyIecJec.h
        DistxyIeqcJec.h
        DistxyIeqcJeqc.h
        DistxyIeqctJeqc.h
        EigenDecomposition.h
        EndFramec.h
        EndFrameqc.h
        EndFrameqct.h
        EndFrameqct2.h
        enum.h
        EulerAngles.h
        EulerAnglesDDot.h
        EulerAnglesDot.h
        EulerAngleszxz.h
        EulerAngleszxzDDot.h
        EulerAngleszxzDot.h
        EulerArray.h
        EulerConstraint.h
        EulerParameters.h
        EulerParametersDDot.h
        EulerParametersDot.h
        Exponential.h
        ExpressionX.h
        ExternalSystem.h
        FixedJoint.h
        ForceTorqueData.h
        ForceTorqueItem.h
        FullColumn.h
        FullMatrix.h
        FullMotion.h
        FullRow.h
        FullRow.h
        FullVector.h
        Function.h
        FunctionFromData.h
        FunctionWithManyArgs.h
        FunctionX.h
        FunctionXcParameter.h
        FunctionXY.h
        GearConstraintIJ.h
        GearConstraintIqcJc.h
        GearConstraintIqcJqc.h
        GearJoint.h
        GEFullMat.h
        GEFullMatFullPv.h
        GEFullMatParPv.h
        GeneralSpline.h
        GESpMat.h
        GESpMatFullPv.h
        GESpMatFullPvPosIC.h
        GESpMatParPv.h
        GESpMatParPvMarko.h
        GESpMatParPvMarkoFast.h
        GESpMatParPvPrecise.h
        ICKineIntegrator.h
        IndependentVariable.h
        InLineJoint.h
        InPlaneJoint.h
        Integrator.h
        IntegratorInterface.h
        Item.h
        ItemIJ.h
        Joint.h
        KineIntegrator.h
        KinematicIeJe.h
        LDUFullMat.h
        LDUFullMatParPv.h
        LDUSpMat.h
        LDUSpMatParPv.h
        LDUSpMatParPvMarko.h
        LDUSpMatParPvPrecise.h
        LimitIJ.h
        LinearMultiStepMethod.h
        LineInPlaneJoint.h
        Ln.h
        Log10.h
        LogN.h
        MarkerFrame.h
        MatrixDecomposition.h
        MatrixGaussElimination.h
        MatrixLDU.h
        MatrixSolver.h
        MaximumIterationError.h
        MbDMath.h
        MomentOfInertiaSolver.h
        Negative.h
        NewtonRaphson.h
        NewtonRaphsonError.h
        NoRotationJoint.h
        NotKinematicError.h
        Numeric.h
        OrbitAngleZIecJec.h
        OrbitAngleZIeqcJec.h
        OrbitAngleZIeqcJeqc.h
        Orientation.h
        ParallelAxesJoint.h
        Part.h
        PartFrame.h
        PerpendicularJoint.h
        PlanarJoint.h
        PointInLineJoint.h
        PointInPlaneJoint.h
        PosICDragLimitNewtonRaphson.h
        PosICDragNewtonRaphson.h
        PosICKineNewtonRaphson.h
        PosICNewtonRaphson.h
        PosKineNewtonRaphson.h
        PosNewtonRaphson.h
        PosVelAccData.h
        Power.h
        PrescribedMotion.h
        Product.h
        QuasiIntegrator.h
        RackPinConstraintIJ.h
        RackPinConstraintIqcJc.h
        RackPinConstraintIqcJqc.h
        RackPinJoint.h
        Reciprocal.h
        RedundantConstraint.h
        resource.h
        RevCylJoint.h
        RevoluteJoint.h
        RevRevJoint.h
        RotationLimitIJ.h
        RowTypeMatrix.h
        ScalarNewtonRaphson.h
        ScrewConstraintIJ.h
        ScrewConstraintIqcJc.h
        ScrewConstraintIqcJqc.h
        ScrewJoint.h
        SimulationStoppingError.h
        Sine.h
        SingularMatrixError.h
        Solver.h
        SparseColumn.h
        SparseMatrix.h
        SparseRow.h
        SparseVector.h
        SphericalJoint.h
        SphSphJoint.h
        StableBackwardDifference.h
        StateData.h
        Sum.h
        Symbolic.h
        SymbolicParser.h
        SyntaxError.h
        System.h
        SystemNewtonRaphson.h
        SystemSolver.h
        SymTime.h
        TooManyTriesError.h
        TooSmallStepSizeError.h
        Translation.h
        TranslationalJoint.h
        TranslationConstraintIJ.h
        TranslationConstraintIqcJc.h
        TranslationConstraintIqcJqc.h
        TranslationConstraintIqctJqc.h
        TranslationLimitIJ.h
        Units.h
        UniversalJoint.h
        UserFunction.h
        Variable.h
        VectorNewtonRaphson.h
        VelICKineSolver.h
        VelICSolver.h
        VelKineSolver.h
        VelSolver.h
        ZRotation.h
        ZTranslation.h
)

target_sources(OndselSolver PRIVATE
        "${ONDSELSOLVER_SRC}"
        "${ONDSELSOLVER_HEADERS}")

set_target_properties(OndselSolver
        PROPERTIES VERSION ${PROJECT_VERSION}
        SOVERSION 1
        PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}"
)

if(WIN32)
    target_compile_definitions(OndselSolver PRIVATE _USE_MATH_DEFINES)
endif(WIN32)

configure_file(../OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY)
install(TARGETS OndselSolver
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver)
install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
