1.首先编译框架 ./generate_ios_framework
2.把框架包含进project 在general-link Frameweork and Libraries 加入这个框架,注意一定也要加上Accelerate.framework,不然会有如下报错:
Undefined symbols for architecture x86_64:
"_daxpy_", referenced from:
_THDoubleBlas_axpy in Torch(THBlas.c.o)
"_dcopy_", referenced from:
_THDoubleBlas_copy in Torch(THBlas.c.o)
"_ddot_", referenced from:
_THDoubleBlas_dot in Torch(THBlas.c.o)
"_dgeev_", referenced from:
_THDoubleLapack_geev in Torch(THLapack.c.o)
"_dgels_", referenced from:
_THDoubleLapack_gels in Torch(THLapack.c.o)
"_dgemm_", referenced from:
_THDoubleBlas_gemm in Torch(THBlas.c.o)
"_dgemv_", referenced from:
_THDoubleBlas_gemv in Torch(THBlas.c.o)
"_dger_", referenced from:
_THDoubleBlas_ger in Torch(THBlas.c.o)
"_dgesv_", referenced from:
_THDoubleLapack_gesv in Torch(THLapack.c.o)
"_dgesvd_", referenced from:
_THDoubleLapack_gesvd in Torch(THLapack.c.o)
"_dgetrf_", referenced from:
_THDoubleLapack_getrf in Torch(THLapack.c.o)
"_dgetri_", referenced from:
_THDoubleLapack_getri in Torch(THLapack.c.o)
"_dscal_", referenced from:
_THDoubleBlas_scal in Torch(THBlas.c.o)
_THDoubleBlas_gemv in Torch(THBlas.c.o)
"_dswap_", referenced from:
_THDoubleBlas_swap in Torch(THBlas.c.o)
"_dsyev_", referenced from:
_THDoubleLapack_syev in Torch(THLapack.c.o)
"_saxpy_", referenced from:
_THFloatBlas_axpy in Torch(THBlas.c.o)
"_scopy_", referenced from:
_THFloatBlas_copy in Torch(THBlas.c.o)
"_sdot_", referenced from:
_THFloatBlas_dot in Torch(THBlas.c.o)
"_sgeev_", referenced from:
_THFloatLapack_geev in Torch(THLapack.c.o)
"_sgels_", referenced from:
_THFloatLapack_gels in Torch(THLapack.c.o)
"_sgemm_", referenced from:
_THFloatBlas_gemm in Torch(THBlas.c.o)
"_sgemv_", referenced from:
_THFloatBlas_gemv in Torch(THBlas.c.o)
"_sger_", referenced from:
_THFloatBlas_ger in Torch(THBlas.c.o)
"_sgesv_", referenced from:
_THFloatLapack_gesv in Torch(THLapack.c.o)
"_sgesvd_", referenced from:
_THFloatLapack_gesvd in Torch(THLapack.c.o)
"_sgetrf_", referenced from:
_THFloatLapack_getrf in Torch(THLapack.c.o)
"_sgetri_", referenced from:
_THFloatLapack_getri in Torch(THLapack.c.o)
"_sscal_", referenced from:
_THFloatBlas_scal in Torch(THBlas.c.o)
_THFloatBlas_gemv in Torch(THBlas.c.o)
"_sswap_", referenced from:
_THFloatBlas_swap in Torch(THBlas.c.o)
"_ssyev_", referenced from:
_THFloatLapack_syev in Torch(THLapack.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
3.把framework里面的torch.h和torch.m加进project,编译,大功告成。