提交 926b64ff 编写于 作者: V Vadim Pisarevsky

Merge pull request #3292 from mshabunin:fix-ios-warnings

......@@ -82,7 +82,7 @@ if(UNIX)
endif()
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations)
ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations)
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
OUTPUT_NAME ${ZLIB_LIBRARY}
......
......@@ -106,6 +106,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-march=i686)
endif()
if(APPLE)
add_extra_compiler_option(-Wno-semicolon-before-method-body)
endif()
# Other optimizations
if(ENABLE_OMIT_FRAME_POINTER)
add_extra_compiler_option(-fomit-frame-pointer)
......
......@@ -242,6 +242,24 @@ macro(ocv_warnings_disable)
endif(NOT ENABLE_NOISY_WARNINGS)
endmacro()
macro(add_apple_compiler_options the_module)
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
if(HAVE_OBJC_EXCEPTIONS)
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
if("${source}" MATCHES "\\.mm$")
get_source_file_property(flags "${source}" COMPILE_FLAGS)
if(flags)
set(flags "${_flags} -fobjc-exceptions")
else()
set(flags "-fobjc-exceptions")
endif()
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
endif()
endforeach()
endif()
endmacro()
# Provides an option that the user can optionally select.
# Can accept condition to control when option is available for user.
# Usage:
......
......@@ -177,7 +177,7 @@ namespace
static void block_function(void* context, size_t index)
{
ProxyLoopBody* ptr_body = static_cast<ProxyLoopBody*>(context);
(*ptr_body)(cv::Range(index, index + 1));
(*ptr_body)(cv::Range((int)index, (int)index + 1));
}
#elif defined HAVE_CONCURRENCY
class ProxyLoopBody : public ParallelLoopBodyWrapper
......
......@@ -1177,7 +1177,7 @@ force_int:
int val, is_hex = d == 'x';
c = ptr[3];
ptr[3] = '\0';
val = strtol( ptr + is_hex, &endptr, is_hex ? 8 : 16 );
val = (int)strtol( ptr + is_hex, &endptr, is_hex ? 8 : 16 );
ptr[3] = c;
if( endptr == ptr + is_hex )
buf[len++] = 'x';
......@@ -2787,7 +2787,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
// find the last occurence of </opencv_storage>
for(;;)
{
int line_offset = ftell( fs->file );
int line_offset = (int)ftell( fs->file );
char* ptr0 = icvGets( fs, xml_buf, xml_buf_size ), *ptr;
if( !ptr0 )
break;
......
......@@ -98,21 +98,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES})
macro(ocv_highgui_configure_target)
if(APPLE)
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
if(HAVE_OBJC_EXCEPTIONS)
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
if("${source}" MATCHES "\\.mm$")
get_source_file_property(flags "${source}" COMPILE_FLAGS)
if(flags)
set(flags "${_flags} -fobjc-exceptions")
else()
set(flags "-fobjc-exceptions")
endif()
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
endif()
endforeach()
endif()
add_apple_compiler_options(the_module)
endif()
if(BUILD_SHARED_LIBS)
......
......@@ -106,21 +106,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
macro(ocv_imgcodecs_configure_target)
if(APPLE)
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
if(HAVE_OBJC_EXCEPTIONS)
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
if("${source}" MATCHES "\\.mm$")
get_source_file_property(flags "${source}" COMPILE_FLAGS)
if(flags)
set(flags "${_flags} -fobjc-exceptions")
else()
set(flags "-fobjc-exceptions")
endif()
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
endif()
endforeach()
endif()
add_apple_compiler_options(the_module)
endif()
if(BUILD_SHARED_LIBS)
......
......@@ -52,10 +52,11 @@
namespace cv
{
static const char fmtSignTiffII[] = "II\x2a\x00";
static const char fmtSignTiffMM[] = "MM\x00\x2a";
#ifdef HAVE_TIFF
static const char fmtSignTiffMM[] = "MM\x00\x2a";
#include "tiff.h"
#include "tiffio.h"
......
......@@ -47,6 +47,9 @@
#include "opencv2/core.hpp"
#include "precomp.hpp"
UIImage* MatToUIImage(const cv::Mat& image);
void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
UIImage* MatToUIImage(const cv::Mat& image) {
NSData *data = [NSData dataWithBytes:image.data
......
......@@ -368,7 +368,8 @@ public:
uint16x8_t g0 = vaddq_u16(vshrq_n_u16(r0, 8), vshrq_n_u16(r2, 8));
uint16x8_t g1 = vandq_u16(r1, masklo);
g0 = vaddq_u16(g0, vaddq_u16(g1, vextq_u16(g1, g1, 1)));
g1 = vshlq_n_u16(vextq_u16(g1, g1, 1), 2);
uint16x8_t rot = vextq_u16(g1, g1, 1);
g1 = vshlq_n_u16(rot, 2);
// g0 = b0 b2 b4 ...
// g1 = b1 b3 b5 ...
......
......@@ -240,14 +240,18 @@ struct PyrDownVec_32s16u
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
int32x4_t shifted;
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, vshlq_n_s32(v_r10, 2)), v_delta), 8);
shifted = vshlq_n_s32(v_r10, 2);
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, shifted), v_delta), 8);
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, vshlq_n_s32(v_r11, 2)), v_delta), 8);
shifted = vshlq_n_s32(v_r11, 2);
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, shifted), v_delta), 8);
vst1q_u16(dst + x, vcombine_u16(vqmovun_s32(v_dst0), vqmovun_s32(v_dst1)));
}
......@@ -271,14 +275,17 @@ struct PyrDownVec_32s16s
int32x4_t v_r20 = vld1q_s32(row2 + x), v_r21 = vld1q_s32(row2 + x + 4);
int32x4_t v_r30 = vld1q_s32(row3 + x), v_r31 = vld1q_s32(row3 + x + 4);
int32x4_t v_r40 = vld1q_s32(row4 + x), v_r41 = vld1q_s32(row4 + x + 4);
int32x4_t shifted;
v_r00 = vaddq_s32(vqaddq_s32(v_r00, v_r40), vqaddq_s32(v_r20, v_r20));
v_r10 = vaddq_s32(vqaddq_s32(v_r10, v_r20), v_r30);
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, vshlq_n_s32(v_r10, 2)), v_delta), 8);
shifted = vshlq_n_s32(v_r10, 2);
int32x4_t v_dst0 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r00, shifted), v_delta), 8);
v_r01 = vaddq_s32(vqaddq_s32(v_r01, v_r41), vqaddq_s32(v_r21, v_r21));
v_r11 = vaddq_s32(vqaddq_s32(v_r11, v_r21), v_r31);
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, vshlq_n_s32(v_r11, 2)), v_delta), 8);
shifted = vshlq_n_s32(v_r11, 2);
int32x4_t v_dst1 = vshrq_n_s32(vaddq_s32(vqaddq_s32(v_r01, shifted), v_delta), 8);
vst1q_s16(dst + x, vcombine_s16(vqmovn_s32(v_dst0), vqmovn_s32(v_dst1)));
}
......
......@@ -1979,7 +1979,7 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
if( !f )
CV_Error( CV_StsError, "" );
fseek( f, 0, SEEK_END );
size = ftell( f );
size = (int)ftell( f );
fseek( f, 0, SEEK_SET );
size_t elements_read = fread( ptr, 1, size, f );
CV_Assert(elements_read == (size_t)(size));
......
......@@ -350,6 +350,11 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int
extractor_ = sextractor_;
}
#else
(void)hess_thresh;
(void)num_octaves;
(void)num_layers;
(void)num_octaves_descr;
(void)num_layers_descr;
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
#endif
}
......
......@@ -189,21 +189,7 @@ ocv_create_module(${VIDEOIO_LIBRARIES})
macro(ocv_videoio_configure_target)
if(APPLE)
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
if(HAVE_OBJC_EXCEPTIONS)
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
if("${source}" MATCHES "\\.mm$")
get_source_file_property(flags "${source}" COMPILE_FLAGS)
if(flags)
set(flags "${_flags} -fobjc-exceptions")
else()
set(flags "-fobjc-exceptions")
endif()
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
endif()
endforeach()
endif()
add_apple_compiler_options(the_module)
endif()
if(BUILD_SHARED_LIBS)
......
......@@ -181,7 +181,6 @@ class CvVideoWriter_AVFoundation : public CvVideoWriter{
AVAssetWriterInput* mMovieWriterInput;
AVAssetWriterInputPixelBufferAdaptor* mMovieWriterAdaptor;
unsigned char* imagedata;
NSString* path;
NSString* codec;
NSString* fileType;
......@@ -490,15 +489,15 @@ double CvCaptureCAM::getProperty(int property_id){
CMFormatDescriptionRef format = [[ports objectAtIndex:0] formatDescription];
CGSize s1 = CMVideoFormatDescriptionGetPresentationDimensions(format, YES, YES);
int width=(int)s1.width, height=(int)s1.height;
int w=(int)s1.width, h=(int)s1.height;
[localpool drain];
switch (property_id) {
case CV_CAP_PROP_FRAME_WIDTH:
return width;
return w;
case CV_CAP_PROP_FRAME_HEIGHT:
return height;
return h;
case CV_CAP_PROP_IOS_DEVICE_FOCUS:
return mCaptureDevice.focusMode;
......@@ -659,6 +658,8 @@ fromConnection:(AVCaptureConnection *)connection{
// Failed
// connection.videoOrientation = AVCaptureVideoOrientationPortrait;
(void)captureOutput;
(void)connection;
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
......@@ -710,26 +711,26 @@ fromConnection:(AVCaptureConnection *)connection{
memcpy(imagedata, baseaddress, currSize);
if (image == NULL) {
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
}
image->width =width;
image->height = height;
image->width = (int)width;
image->height = (int)height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = (int)rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
image->imageSize = (int)currSize;
if (bgr_image == NULL) {
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
}
bgr_image->width =width;
bgr_image->height = height;
bgr_image->width = (int)width;
bgr_image->height = (int)height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = (int)rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
bgr_image->imageSize = (int)currSize;
cvCvtColor(image, bgr_image, CV_BGRA2BGR);
......@@ -738,7 +739,7 @@ fromConnection:(AVCaptureConnection *)connection{
// iOS provides hardware accelerated rotation through AVCaptureConnection class
// I can't get it work.
if (bgr_image_r90 == NULL){
bgr_image_r90 = cvCreateImage(cvSize(height, width), IPL_DEPTH_8U, 3);
bgr_image_r90 = cvCreateImage(cvSize((int)height, (int)width), IPL_DEPTH_8U, 3);
}
cvTranspose(bgr_image, bgr_image_r90);
cvFlip(bgr_image_r90, NULL, 1);
......@@ -938,29 +939,29 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
memcpy(imagedata, baseaddress, currSize);
if (image == NULL) {
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
}
image->width =width;
image->height = height;
image->width = (int)width;
image->height = (int)height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = rowBytes;
image->widthStep = (int)rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
image->imageSize = (int)currSize;
if (bgr_image == NULL) {
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
}
bgr_image->width =width;
bgr_image->height = height;
bgr_image->width = (int)width;
bgr_image->height = (int)height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = rowBytes;
bgr_image->widthStep = (int)rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
bgr_image->imageSize = (int)currSize;
cvCvtColor(image, bgr_image,CV_BGRA2BGR);
......@@ -1009,7 +1010,7 @@ double CvCaptureFile::getFPS() {
return 30.0; //TODO: Debugging
}
double CvCaptureFile::getProperty(int property_id){
double CvCaptureFile::getProperty(int /*property_id*/){
/*
if (mCaptureSession == nil) return 0;
......@@ -1050,7 +1051,7 @@ double CvCaptureFile::getProperty(int property_id){
return 1.0; //Debugging
}
bool CvCaptureFile::setProperty(int property_id, double value) {
bool CvCaptureFile::setProperty(int /*property_id*/, double /*value*/) {
/*
if (mCaptureSession == nil) return false;
......@@ -1261,7 +1262,7 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
// writer status check
if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) {
NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ...");
NSLog(@"mMovieWriter.status: %d. Error: %@", mMovieWriter.status, [mMovieWriter.error localizedDescription]);
NSLog(@"mMovieWriter.status: %d. Error: %@", (int)mMovieWriter.status, [mMovieWriter.error localizedDescription]);
[localpool drain];
return false;
}
......
......@@ -150,6 +150,7 @@
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[super dealloc];
}
......@@ -226,6 +227,7 @@
- (void)deviceOrientationDidChange:(NSNotification*)notification
{
(void)notification;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
switch (orientation)
......@@ -242,7 +244,7 @@
default:
break;
}
NSLog(@"deviceOrientationDidChange: %d", orientation);
NSLog(@"deviceOrientationDidChange: %d", (int)orientation);
[self updateOrientation];
}
......@@ -308,7 +310,7 @@
if ([device position] == desiredPosition) {
[self.captureSession beginConfiguration];
NSError* error;
NSError* error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
NSLog(@"error creating input %@", [error localizedDescription]);
......@@ -316,7 +318,7 @@
// support for autofocus
if ([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
NSError *error = nil;
error = nil;
if ([device lockForConfiguration:&error]) {
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
[device unlockForConfiguration];
......
......@@ -101,7 +101,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
[super start];
if (self.recordVideo == YES) {
NSError* error;
NSError* error = nil;
if ([[NSFileManager defaultManager] fileExistsAtPath:[self videoFileString]]) {
[[NSFileManager defaultManager] removeItemAtPath:[self videoFileString] error:&error];
}
......@@ -424,6 +424,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{
(void)captureOutput;
(void)connection;
if (self.delegate) {
// convert from Core Media to Core Video
......@@ -462,9 +464,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
}
// delegate image processing to the delegate
cv::Mat image(height, width, format_opencv, bufferAddress, bytesPerRow);
cv::Mat image((int)height, (int)width, format_opencv, bufferAddress, bytesPerRow);
cv::Mat* result = NULL;
CGImage* dstImage;
if ([self.delegate respondsToSelector:@selector(processImage:)]) {
......@@ -473,7 +474,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
// check if matrix data pointer or dimensions were changed by the delegate
bool iOSimage = false;
if (height == image.rows && width == image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
if (height == (size_t)image.rows && width == (size_t)image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
iOSimage = true;
}
......@@ -591,7 +592,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
completionBlock:^(NSURL *assetURL, NSError *error){}];
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
}
}
......
......@@ -25,7 +25,18 @@ The script should handle minor OpenCV updates efficiently
However, opencv2.framework directory is erased and recreated on each run.
"""
import glob, re, os, os.path, shutil, string, sys
import glob, re, os, os.path, shutil, string, sys, exceptions, subprocess
def execute(cmd):
try:
print >>sys.stderr, "Executing:", cmd
retcode = subprocess.call(cmd, shell=True)
if retcode < 0:
raise Exception("Child was terminated by signal:", -retcode)
elif retcode > 0:
raise Exception("Child returned:", retcode)
except OSError as e:
raise Exception("Execution failed:", e)
def build_opencv(srcroot, buildroot, target, arch):
"builds OpenCV for device or simulator"
......@@ -48,17 +59,17 @@ def build_opencv(srcroot, buildroot, target, arch):
# if cmake cache exists, just rerun cmake to update OpenCV.xcodeproj if necessary
if os.path.isfile(os.path.join(builddir, "CMakeCache.txt")):
os.system("cmake %s ." % (cmakeargs,))
execute("cmake %s ." % (cmakeargs,))
else:
os.system("cmake %s %s" % (cmakeargs, srcroot))
execute("cmake %s %s" % (cmakeargs, srcroot))
for wlib in [builddir + "/modules/world/UninstalledProducts/libopencv_world.a",
builddir + "/lib/Release/libopencv_world.a"]:
if os.path.isfile(wlib):
os.remove(wlib)
os.system("xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 -parallelizeTargets ARCHS=%s -jobs 8 -sdk %s -configuration Release -target ALL_BUILD" % (arch, target.lower()))
os.system("xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 ARCHS=%s -sdk %s -configuration Release -target install install" % (arch, target.lower()))
execute("xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 -parallelizeTargets ARCHS=%s -jobs 8 -sdk %s -configuration Release -target ALL_BUILD" % (arch, target.lower()))
execute("xcodebuild IPHONEOS_DEPLOYMENT_TARGET=6.0 ARCHS=%s -sdk %s -configuration Release -target install install" % (arch, target.lower()))
os.chdir(currdir)
def put_framework_together(srcroot, dstroot):
......@@ -86,7 +97,7 @@ def put_framework_together(srcroot, dstroot):
# 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")
execute("lipo -create " + wlist + " -o " + dstdir + "/opencv2")
# copy Info.plist
shutil.copyfile(tdir0 + "/ios/Info.plist", dstdir + "/Resources/Info.plist")
......@@ -101,10 +112,13 @@ def put_framework_together(srcroot, dstroot):
def build_framework(srcroot, dstroot):
"main function to do all the work"
targets = ["iPhoneOS", "iPhoneOS", "iPhoneOS", "iPhoneSimulator", "iPhoneSimulator"]
archs = ["armv7", "armv7s", "arm64", "i386", "x86_64"]
for i in range(len(targets)):
build_opencv(srcroot, os.path.join(dstroot, "build"), targets[i], archs[i])
targets = [("armv7", "iPhoneOS"),
("armv7s", "iPhoneOS"),
("arm64", "iPhoneOS"),
("i386", "iPhoneSimulator"),
("x86_64", "iPhoneSimulator")]
for t in targets:
build_opencv(srcroot, os.path.join(dstroot, "build"), t[1], t[0])
put_framework_together(srcroot, dstroot)
......@@ -114,4 +128,8 @@ if __name__ == "__main__":
print "Usage:\n\t./build_framework.py <outputdir>\n\n"
sys.exit(0)
build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../..")), os.path.abspath(sys.argv[1]))
try:
build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../..")), os.path.abspath(sys.argv[1]))
except Exception as e:
print >>sys.stderr, e
sys.exit(1)
......@@ -39,8 +39,9 @@ set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSI
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# Hidden visibilty is required for cxx on iOS
set (CMAKE_C_FLAGS "")
set (CMAKE_CXX_FLAGS "-stdlib=libc++ -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden")
set (no_warn "-Wno-unused-function -Wno-overloaded-virtual")
set (CMAKE_C_FLAGS "${no_warn}")
set (CMAKE_CXX_FLAGS "-stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden ${no_warn}")
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册