2014-07-02 03:31:57 +08:00
#!/usr/bin/env python
"""
2015-12-16 22:28:03 +08:00
The script builds OpenCV . framework for OSX .
2014-07-02 03:31:57 +08:00
"""
2015-12-16 22:28:03 +08:00
from __future__ import print_function
2017-05-02 23:48:54 +08:00
import os , os . path , sys , argparse , traceback , multiprocessing
2014-07-02 03:31:57 +08:00
2015-12-16 22:28:03 +08:00
# import common code
sys . path . insert ( 0 , os . path . abspath ( os . path . abspath ( os . path . dirname ( __file__ ) ) + ' /../ios ' ) )
from build_framework import Builder
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
sys . path . insert ( 0 , os . path . abspath ( os . path . abspath ( os . path . dirname ( __file__ ) ) + ' /../apple ' ) )
2020-12-10 20:43:26 +08:00
from cv_build_utils import print_error , get_cmake_version
2014-07-02 03:31:57 +08:00
2019-08-23 23:22:29 +08:00
MACOSX_DEPLOYMENT_TARGET = ' 10.12 ' # default, can be changed via command line options or environment variable
2015-12-16 22:28:03 +08:00
class OSXBuilder ( Builder ) :
2014-07-02 03:31:57 +08:00
2020-12-10 20:43:26 +08:00
def checkCMakeVersion ( self ) :
assert get_cmake_version ( ) > = ( 3 , 17 ) , " CMake 3.17 or later is required. Current version is {} " . format ( get_cmake_version ( ) )
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
def getObjcTarget ( self , target ) :
2020-11-14 15:16:13 +08:00
# Obj-C generation target
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
if target == " Catalyst " :
return ' ios '
else :
return ' osx '
2020-11-14 15:16:13 +08:00
2015-12-16 22:28:03 +08:00
def getToolchain ( self , arch , target ) :
return None
2014-07-02 03:31:57 +08:00
2020-08-30 06:41:54 +08:00
def getBuildCommand ( self , arch , target ) :
2015-12-16 22:28:03 +08:00
buildcmd = [
" xcodebuild " ,
2019-08-23 23:22:29 +08:00
" MACOSX_DEPLOYMENT_TARGET= " + os . environ [ ' MACOSX_DEPLOYMENT_TARGET ' ] ,
2020-08-30 06:41:54 +08:00
" ARCHS= %s " % arch ,
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
" -sdk " , " macosx " if target == " Catalyst " else target . lower ( ) ,
2019-08-23 23:22:29 +08:00
" -configuration " , " Debug " if self . debug else " Release " ,
2015-12-16 22:28:03 +08:00
" -parallelizeTargets " ,
2017-05-02 23:59:37 +08:00
" -jobs " , str ( multiprocessing . cpu_count ( ) )
2015-12-16 22:28:03 +08:00
]
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
if target == " Catalyst " :
buildcmd . append ( " -destination ' platform=macOS,arch= %s ,variant=Mac Catalyst ' " % arch )
buildcmd . append ( " -UseModernBuildSystem=YES " )
buildcmd . append ( " SKIP_INSTALL=NO " )
buildcmd . append ( " BUILD_LIBRARY_FOR_DISTRIBUTION=YES " )
buildcmd . append ( " TARGETED_DEVICE_FAMILY= \" 1,2 \" " )
buildcmd . append ( " SDKROOT=iphoneos " )
buildcmd . append ( " SUPPORTS_MAC_CATALYST=YES " )
2015-12-16 22:28:03 +08:00
return buildcmd
2014-07-02 03:31:57 +08:00
2015-12-16 22:28:03 +08:00
def getInfoPlist ( self , builddirs ) :
return os . path . join ( builddirs [ 0 ] , " osx " , " Info.plist " )
2014-07-02 03:31:57 +08:00
if __name__ == " __main__ " :
2015-12-16 22:28:03 +08:00
folder = os . path . abspath ( os . path . join ( os . path . dirname ( sys . argv [ 0 ] ) , " ../.. " ) )
parser = argparse . ArgumentParser ( description = ' The script builds OpenCV.framework for OSX. ' )
2020-12-13 01:35:25 +08:00
# TODO: When we can make breaking changes, we should make the out argument explicit and required like in build_xcframework.py.
2015-12-16 22:28:03 +08:00
parser . add_argument ( ' out ' , metavar = ' OUTDIR ' , help = ' folder to put built framework ' )
parser . add_argument ( ' --opencv ' , metavar = ' DIR ' , default = folder , help = ' folder with opencv repository (default is " ../.. " relative to script location) ' )
parser . add_argument ( ' --contrib ' , metavar = ' DIR ' , default = None , help = ' folder with opencv_contrib repository (default is " None " - build only main framework) ' )
2020-12-13 01:35:25 +08:00
parser . add_argument ( ' --without ' , metavar = ' MODULE ' , default = [ ] , action = ' append ' , help = ' OpenCV modules to exclude from the framework. To exclude multiple, specify this flag again, e.g. " --without video --without objc " ' )
parser . add_argument ( ' --disable ' , metavar = ' FEATURE ' , default = [ ] , action = ' append ' , help = ' OpenCV features to disable (add WITH_*=OFF). To disable multiple, specify this flag again, e.g. " --disable tbb --disable openmp " ' )
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
parser . add_argument ( ' --dynamic ' , default = False , action = ' store_true ' , help = ' build dynamic framework (default is " False " - builds static framework) ' )
2018-12-12 22:32:19 +08:00
parser . add_argument ( ' --enable_nonfree ' , default = False , dest = ' enablenonfree ' , action = ' store_true ' , help = ' enable non-free modules (disabled by default) ' )
2019-08-23 23:22:29 +08:00
parser . add_argument ( ' --macosx_deployment_target ' , default = os . environ . get ( ' MACOSX_DEPLOYMENT_TARGET ' , MACOSX_DEPLOYMENT_TARGET ) , help = ' specify MACOSX_DEPLOYMENT_TARGET ' )
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
parser . add_argument ( ' --build_only_specified_archs ' , default = False , action = ' store_true ' , help = ' if enabled, only directly specified archs are built and defaults are ignored ' )
parser . add_argument ( ' --archs ' , default = None , help = ' (Deprecated! Prefer --macos_archs instead.) Select target ARCHS (set to " x86_64,arm64 " to build Universal Binary for Big Sur and later). Default is " x86_64 " . ' )
parser . add_argument ( ' --macos_archs ' , default = None , help = ' Select target ARCHS (set to " x86_64,arm64 " to build Universal Binary for Big Sur and later). Default is " x86_64 " ' )
parser . add_argument ( ' --catalyst_archs ' , default = None , help = ' Select target ARCHS (set to " x86_64,arm64 " to build Universal Binary for Big Sur and later). Default is None ' )
2019-08-23 23:22:29 +08:00
parser . add_argument ( ' --debug ' , action = ' store_true ' , help = ' Build " Debug " binaries (CMAKE_BUILD_TYPE=Debug) ' )
parser . add_argument ( ' --debug_info ' , action = ' store_true ' , help = ' Build with debug information (useful for Release mode: BUILD_WITH_DEBUG_INFO=ON) ' )
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
parser . add_argument ( ' --framework_name ' , default = ' opencv2 ' , dest = ' framework_name ' , help = ' Name of OpenCV framework (default: opencv2, will change to OpenCV in future version) ' )
2020-06-09 02:32:53 +08:00
parser . add_argument ( ' --legacy_build ' , default = False , dest = ' legacy_build ' , action = ' store_true ' , help = ' Build legacy framework (default: False, equivalent to " --framework_name=opencv2 --without=objc " ) ' )
2020-08-09 15:39:24 +08:00
parser . add_argument ( ' --run_tests ' , default = False , dest = ' run_tests ' , action = ' store_true ' , help = ' Run tests ' )
parser . add_argument ( ' --build_docs ' , default = False , dest = ' build_docs ' , action = ' store_true ' , help = ' Build docs ' )
2021-05-18 22:10:51 +08:00
parser . add_argument ( ' --disable-swift ' , default = False , dest = ' swiftdisabled ' , action = ' store_true ' , help = ' Disable building of Swift extensions ' )
2019-08-23 23:22:29 +08:00
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
args , unknown_args = parser . parse_known_args ( )
if unknown_args :
print ( " The following args are not recognized and will not be used: %s " % unknown_args )
2015-12-16 22:28:03 +08:00
2019-08-23 23:22:29 +08:00
os . environ [ ' MACOSX_DEPLOYMENT_TARGET ' ] = args . macosx_deployment_target
print ( ' Using MACOSX_DEPLOYMENT_TARGET= ' + os . environ [ ' MACOSX_DEPLOYMENT_TARGET ' ] )
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
macos_archs = None
if args . archs :
# The archs flag is replaced by macos_archs. If the user specifies archs,
# treat it as if the user specified the macos_archs flag instead.
args . macos_archs = args . archs
print ( " --archs is deprecated! Prefer --macos_archs instead. " )
if args . macos_archs :
macos_archs = args . macos_archs . split ( ' , ' )
elif not args . build_only_specified_archs :
# Supply defaults
macos_archs = [ " x86_64 " ]
print ( ' Using MacOS ARCHS= ' + str ( macos_archs ) )
catalyst_archs = None
if args . catalyst_archs :
catalyst_archs = args . catalyst_archs . split ( ' , ' )
# TODO: To avoid breaking existing CI, catalyst_archs has no defaults. When we can make a breaking change, this should specify a default arch.
print ( ' Using Catalyst ARCHS= ' + str ( catalyst_archs ) )
# Prevent the build from happening if the same architecture is specified for multiple platforms.
# When `lipo` is run to stitch the frameworks together into a fat framework, it'll fail, so it's
# better to stop here while we're ahead.
if macos_archs and catalyst_archs :
duplicate_archs = set ( macos_archs ) . intersection ( catalyst_archs )
if duplicate_archs :
print_error ( " Cannot have the same architecture for multiple platforms in a fat framework! Consider using build_xcframework.py in the apple platform folder instead. Duplicate archs are %s " % duplicate_archs )
exit ( 1 )
2020-08-30 06:41:54 +08:00
2020-06-09 02:32:53 +08:00
if args . legacy_build :
args . framework_name = " opencv2 "
if not " objc " in args . without :
args . without . append ( " objc " )
2019-08-23 23:22:29 +08:00
Merge pull request #18826 from Rightpoint:feature/colejd/build-catalyst-xcframework
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
2020-11-25 05:54:54 +08:00
targets = [ ]
if not macos_archs and not catalyst_archs :
print_error ( " --macos_archs and --catalyst_archs are undefined; nothing will be built. " )
sys . exit ( 1 )
if macos_archs :
targets . append ( ( macos_archs , " MacOSX " ) )
if catalyst_archs :
targets . append ( ( catalyst_archs , " Catalyst " ) ) ,
2021-05-18 22:10:51 +08:00
b = OSXBuilder ( args . opencv , args . contrib , args . dynamic , True , args . without , args . disable , args . enablenonfree , targets , args . debug , args . debug_info , args . framework_name , args . run_tests , args . build_docs , args . swiftdisabled )
2015-12-16 22:28:03 +08:00
b . build ( args . out )