Skip to content

Commit

Permalink
Merge pull request opencv#1234 from SpecLad:ios-plist
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Donchenko authored and OpenCV Buildbot committed Aug 23, 2013
2 parents cae4480 + 16814c7 commit 9bb1a7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ include(cmake/OpenCVGenAndroidMK.cmake)
# Generate OpenCVСonfig.cmake and OpenCVConfig-version.cmake for cmake projects
include(cmake/OpenCVGenConfig.cmake)

# Generate Info.plist for the IOS framework
include(cmake/OpenCVGenInfoPlist.cmake)

# ----------------------------------------------------------------------------
# Summary:
Expand Down
4 changes: 4 additions & 0 deletions cmake/OpenCVGenInfoPlist.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if(IOS)
configure_file("${OpenCV_SOURCE_DIR}/platforms/ios/Info.plist.in"
"${CMAKE_BINARY_DIR}/ios/Info.plist")
endif()
4 changes: 2 additions & 2 deletions platforms/ios/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<key>CFBundleIdentifier</key>
<string>org.opencv</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<string>${OPENCV_LIBVERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<string>${OPENCV_LIBVERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundlePackageType</key>
Expand Down
19 changes: 3 additions & 16 deletions platforms/ios/build_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,20 @@ def put_framework_together(srcroot, dstroot):
os.makedirs(framework_dir)
os.chdir(framework_dir)

# determine OpenCV version (without subminor part)
tdir0 = "../build/" + targetlist[0]
cfg = open(tdir0 + "/cvconfig.h", "rt")
for l in cfg.readlines():
if l.startswith("#define VERSION"):
opencv_version = l[l.find("\"")+1:l.rfind(".")]
break
cfg.close()

# form the directory tree
dstdir = "Versions/A"
os.makedirs(dstdir + "/Resources")

tdir0 = "../build/" + targetlist[0]
# copy headers
shutil.copytree(tdir0 + "/install/include/opencv2", dstdir + "/Headers")

# make universal static lib
wlist = " ".join(["../build/" + t + "/lib/Release/libopencv_world.a" for t in targetlist])
os.system("lipo -create " + wlist + " -o " + dstdir + "/opencv2")

# form Info.plist
srcfile = open(srcroot + "/platforms/ios/Info.plist.in", "rt")
dstfile = open(dstdir + "/Resources/Info.plist", "wt")
for l in srcfile.readlines():
dstfile.write(l.replace("${VERSION}", opencv_version))
srcfile.close()
dstfile.close()
# copy Info.plist
shutil.copyfile(tdir0 + "/ios/Info.plist", dstdir + "/Resources/Info.plist")

# make symbolic links
os.symlink("A", "Versions/Current")
Expand Down

0 comments on commit 9bb1a7d

Please sign in to comment.