Skip to content

Commit 67b8e64

Browse files
xta0facebook-github-bot
authored andcommitted
[OSS] Add podspec for libtorch-lite (pytorch#59638)
Summary: Pull Request resolved: pytorch#59638 ghstack-source-id: 130847775 Test Plan: . Reviewed By: husthyc, cccclai Differential Revision: D28966693 fbshipit-source-id: 1b82623279709d0118c0967e2ba730d5dec040cc
1 parent 1bb1a9e commit 67b8e64

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

ios/LibTorch-Lite.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef LibTorch_Lite_h
2+
#define LibTorch_Lite_h
3+
4+
#include <torch/csrc/jit/mobile/import.h>
5+
#include <torch/csrc/jit/mobile/module.h>
6+
#include <torch/script.h>
7+
8+
#endif

ios/LibTorch-Lite.podspec

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'LibTorch-Lite'
3+
s.version = '1.9.0'
4+
s.authors = 'PyTorch Team'
5+
s.license = { :type => 'BSD' }
6+
s.homepage = 'https://github.com/pytorch/pytorch'
7+
s.source = { :http => "https://ossci-ios.s3.amazonaws.com/libtorch_lite_ios_#{s.version}.zip" }
8+
s.summary = 'The PyTorch C++ library for iOS'
9+
s.description = <<-DESC
10+
The PyTorch C++ library for iOS.
11+
DESC
12+
s.ios.deployment_target = '12.0'
13+
s.default_subspec = 'Core'
14+
s.subspec 'Core' do |ss|
15+
ss.dependency 'LibTorch-Lite/Torch'
16+
ss.source_files = 'src/*.{h,cpp,c,cc}'
17+
ss.public_header_files = ['src/LibTorch-Lite.h']
18+
end
19+
s.subspec 'Torch' do |ss|
20+
ss.header_mappings_dir = 'install/include/'
21+
ss.preserve_paths = 'install/include/**/*.{h,cpp,cc,c}'
22+
ss.vendored_libraries = 'install/lib/*.a'
23+
ss.libraries = ['c++', 'stdc++']
24+
end
25+
s.user_target_xcconfig = {
26+
'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch-Lite/install/include/"',
27+
'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/LibTorch-Lite/install/lib/libtorch.a" -force_load "$(PODS_ROOT)/LibTorch-Lite/install/lib/libtorch_cpu.a"',
28+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
29+
'CLANG_CXX_LIBRARY' => 'libc++'
30+
}
31+
s.pod_target_xcconfig = {
32+
'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch-Lite/install/include/"',
33+
'VALID_ARCHS' => 'x86_64 arm64'
34+
}
35+
s.library = ['c++', 'stdc++']
36+
end

0 commit comments

Comments
 (0)