Ios--compiling Poco C + + static libraries for Xcode
Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size: 16px;"><strong><span style="color: #0000ff;">Introduction of POCO C + + library</span></strong></span></p></p><p><p>POCO C + + library is a C + + written Cross-platform libraries, mainly for network connectivity, database management and server, for cross-platform, Embedded.</p></p><p><p><span style="font-size: 16px;"><strong><span style="color: #0000ff;">Ii. compiling poco C + + static libraries for Xcode</span></strong></span></p></p><p><p> <strong><span style="color: #0000ff;">1. Determine the version that needs to be compiled</span></strong></p></p><p><p>To make Poco C + + run on every platform on ios, we need to compile the different architectures for each platform, so we need to understand the architecture of each platform in ios, mainly the iphone simulator, iphone real mac, and the architecture running the Xcode computer itself.</p></p><p><p>(1) iphone Simulator</p></p><p><p>The current iphone simulator architecture is divided into two categories:</p></p><p><p>*iphone5 and the following version of the simulator architecture is i386;</p></p><p><p>*iphone5 above (not including iPhone5) version of the emulator architecture is x86_64;</p></p><p><p>(2) iphone Real Machine</p></p><p><p>iphone Real-computer architecture has armv7,armv7s and arm64;</p></p><p><p>(3) OSX</p></p><p><p>Osx's Architecture is x86_64;</p></p><p><p>From the above, we need to Armv7,armv7s,arm64,i386,iphone simulator x86_64 and computer x86_64 static library.</p></p><p><p> <strong><span style="color: #0000ff;">2. Compiler selection</span></strong></p></p><p><p>The compiler should be set to the compiler that comes with Xcode. To modify the compiler, Open the config file you want to modify with a text editor, such as poco/build/config/iphone, and modify the original CC and CXX to the path of the Xcode's compiler, for example:</p></p><p><p>CC =/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang</p></p><p><p>CXX =/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++</p></p><p><p>In the current xcode, the C language uses the clang compiler, the path in xcode:/applications/xcode.app/contents/developer/toolchains/ xcodedefault.xctoolchain/usr/bin/clang;</p></p><p><p>In the current xcode, the C + + language uses clang++, the path in xcode:/applications/xcode.app/contents/developer/toolchains/ xcodedefault.xctoolchain/usr/bin/clang++;</p></p><p><p>In general, we do not need to manually configure the compiler in a Poco configuration compilation script, and the script command will find the corresponding compiler itself.</p></p><p><p><strong><span style="color: #0000ff;">3. Compile the Static library</span></strong></p></p><p><p>(1) official website Download source Code: http://pocoproject.org/download/index.html</p></p><p><p>(2) extract the downloaded source code to the desktop;</p></p><p><p>(3) Open the terminal, enter the source code file, run the following command for different platform Architectures:</p></p><p><p>1) armv7:</p></p><p><p>./configure--config=iphone-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static--include-path =/usr/local/openssl/include--prefix=/users/"user name"/desktop/xcode-poco/armv7</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=armv7 Install</p></p><p><p>2) armv7s</p></p><p><p>./configure--config=iphone-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static--include-path =/usr/local/openssl/include--prefix=/users/"user name"/desktop/xcode-poco/armv7s</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=armv7s Install</p></p><p><p>3) arm64</p></p><p><p>./configure--config=iphone-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static--include-path =/usr/local/openssl/include--prefix=/users/"user name"/desktop/xcode-poco/arm64</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=armv64 Install</p></p><p><p>4) i386</p></p><p><p>./configure--config=iphonesimulator-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static-- Include-path=/usr/local/openssl/include--prefix=/users/"user name"/desktop/xcode-poco/i386</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=i386 Install</p></p><p><p>5) iphonesimulator-x86_64</p></p><p><p>./configure--config=iphonesimulator-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static-- Include-path=/usr/local/openssl/include--prefix=/users/"user name"/desktop/xcode-poco/iphonesimulator-x84_64</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=x86_64 Install</p></p><p><p>6) Darwin64</p></p><p><p></p></p><p><p>./configure--config=darwin64-clang-libc++--no-tests--no-samples--omit=data/mysql,data/odbc--static-- Include-path=/usr/local/openssl/include--prefix=/users/"user Name"/desktop/xcode-poco/darwin64</p></p><p><p>Make iphone_sdk_version_min=5.0 poco_target_osarch=x86_64 Install</p></p><p><p></p></p><p><p>Description</p></p><p><p>*--config Configuration compilation script, because Xcode C and C + + compiler is clang and clang++, so select Iphone-clang-libc++ script;</p></p><p><p>*--no-tests and--no-samples indicate that tests files and samples files are not compiled</p></p><p><p>*--omit Configure the library files that you don't need in this area</p></p><p><p>*--include-path is used to configure dependency information, where the path of OpenSSL needs to be configured because the crypto and NETSSL_OPENSSL modules depend on OpenSSL</p></p><p><p>*--static represents the creation of a static library file</p></p><p><p>*--prefix Configure where the compiled library files are stored</p></p><p><p>*iphone_sdk_version_min setting the minimum version of the SDK for supported iphones</p></p><p><p>*poco_target_osarch setting schema information for the platform</p></p><p><p><strong><span style="color: #0000ff;">4. Making Universal Library files</span></strong></p></p><p><p><strong><span style="color: #0000ff;">(1) Making a Universal library</span></strong></p></p><p><p>In this way we have multiple library files for each architecture, and for ease of use, we can make generic library files that can be crafted using Xcode's Lipo command, in the following format:</p></p><p><p>Lipo-create need to merge the Files-output the generated target file;</p></p><p><p>For example, you need to merge armv7/lib/libpocodata.a and arm64/lib/libpocodata.a into IOS/LIB/LIBPOCODATA.A using the following command:</p></p><p><p>Lipo-create armv7/lib/libpocodata.a arm64/lib/libpocodata.a-output IOS/LIB/LIBPOCODATA.A</p></p><p><p></p></p><p><p>Note: because the schema of the Darwin64 and the iphonesimulator-x86_64 are interlinked schemas, they cannot be merged together.</p></p><p><p><strong><span style="color: #0000ff;">(2) View library Information</span></strong></p></p><p><p>You can do this by:</p></p><p><p>Lipo-info the library file that needs to be viewed</p></p><p><p>To see the schemas supported by the library file, for example, to view the schemas supported by libpocodata.a, you can use the following command:</p></p><p><p>Lipo-info LIBPOCODATA.A</p></p><p><p> </p></p><p><p></p></p><p><p>Ios--compiling Poco C + + static libraries for Xcode</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service