摘要:操作系統(tǒng)我們假定是類操作系統(tǒng),采用非源碼文件夾編譯。創(chuàng)建工作目錄獲取源碼您可以直接指定的分支,比如分支。到目前為止發(fā)布了一個(gè)版本。
操作系統(tǒng)我們假定是類 unix 操作系統(tǒng),采用非源碼文件夾編譯。
創(chuàng)建工作目錄cd ~/ mkdir workspace cd workspace mkdir build-zendapi獲取源碼
您可以直接 clone 指定的分支,比如 master 分支。到目前為止 zendAPI 發(fā)布了一個(gè)版本 zapi-0.0.2-snapshot。
git clone https://github.com/qcoreteam/zendapi.git zendapidevel git checkout master默認(rèn)參數(shù)編譯
如果您的 PHP 安裝在標(biāo)準(zhǔn)路徑,可以用下面的命令進(jìn)行編譯
cd build-zendapi cmake ../zendapidevel
如果您想安裝到特定的路徑,可以使用下面的命名進(jìn)行編譯
cd build-zendapi cmake -DCMAKE_INSTALL_PREFIX=/usr/local/zapi ../zendapidevel
如果您的 PHP 沒有安裝在標(biāo)準(zhǔn)路徑,假定您安裝在 /usr/local/php-7.1.5 目錄下,那么您可以使用下面的命令進(jìn)行編譯
cd build-zendapi cmake -DZAPI_OPT_PHP_ROOT_PATH=/usr/local/php-7.1.5 ../zendapidevel
如果您想給編譯器指定額外的選項(xiàng)參數(shù),比如您想用 c++14 標(biāo)準(zhǔn)進(jìn)行編譯,您可以使用下面的命令進(jìn)行編譯
cd build-zendapi cmake -DCMAKE_CXX_FLAGS="-std=c++14" ../zendapidevel
如果您想使用特定版本的編譯器進(jìn)行編譯,比如我自己,我自己編譯了 clang 3.5, 按照路徑為 /usr/local/llvm-3.5/bin/clang++,這個(gè)路徑?jīng)]有在 PATH 環(huán)境變量里面,那么我們可以使用下面的命令進(jìn)行編譯
cd build-zendapi cmake -DCMAKE_C_COMPILER=/usr/local/llvm-3.5/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/llvm-3.5/bin/clang++ ../zendapidevel
現(xiàn)在我假定在我本機(jī)使用如下命令進(jìn)行編譯, PHP 安裝在 /usr/local/php7/, 操作系統(tǒng)為 MacOS
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc-6 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-6 -DCMAKE_BUILD_TYPE=Debug ../zendapidevel
如果一切正常的話,您將看到如下的結(jié)果
-- -------------------------------------------------------------------------------------- -- Thank for using zendAPI project, have a lot of fun! -- -------------------------------------------------------------------------------------- -- ZAPI_VERSION: 0.0.1-devel -- PHP_INCLUDE_PATH: /usr/local/php7/include -- PHP_LIB_PATH: /usr/local/php7/lib/libphp7.dylib -- PHP_EXECUTABLE: /usr/local/php7/bin/php -- PHP_CONFIG_EXECUABLE: /usr/local/php7/bin/php-config -- CMAKE_BUILD_TYPE: Debug -- CMAKE_BINARY_DIR: ~/workspace/build-zendapi -- CMAKE_CURRENT_BINARY_DIR: ~/workspace/build-zendapi -- CMAKE_SOURCE_DIR: ~/workspace/zendapidevel -- PROJECT_BINARY_DIR: ~/workspace/build-zendapi -- PROJECT_SOURCE_DIR: ~/workspace/zendapidevel -- CMAKE_MODULE_PATH: ~/workspace/zendapidevel/cmake/modules -- CMAKE_COMMAND: /usr/local/Cellar/cmake/3.7.2/bin/cmake -- CMAKE_INSTALL_PREFIX: /usr/local -- CMAKE_ROOT: /usr/local/Cellar/cmake/3.7.2/share/cmake -- CMAKE_SYSTEM: Darwin-16.7.0 -- CMAKE_SYSTEM_NAME: Darwin -- CMAKE_SYSTEM_VERSION: 16.7.0 -- CMAKE_SYSTEM_PROCESSOR: x86_64 -- CMAKE_SKIP_RPATH: NO -- CMAKE_VERBOSE_MAKEFILE: FALSE -- CMAKE_CXX_COMPILER: /usr/local/bin/g++-6 -- CMAKE_CXX_COMPILER_VERSION: 6.4.0 -- CMAKE_CXX_FLAGS: -Wa,-q -Wno-macro-redefined -Wno-deprecated-declarations -- CMAKE_AR: /usr/bin/ar -- CMAKE_RANLIB: /usr/bin/ranlib -- -------------------------------------------------------------------------------------- -- Configuring done -- Generating done -- Build files have been written to: ~/workspace/build-zendapi
如果有錯(cuò)誤,您可以根據(jù)具體的錯(cuò)誤信息進(jìn)行排查,如果不能解決,您可以到我們的 segmentfault 技術(shù)圈進(jìn)行交流討論
如果沒有錯(cuò)誤輸入一下命名進(jìn)行編譯, -j 指定編譯進(jìn)程數(shù),根據(jù) CPU 線程數(shù)定
make -j 8
如果整個(gè)編譯過程沒有錯(cuò)誤的話,您將看到如下的輸出,如果有錯(cuò)誤,麻煩您通知我們
[100%] Linking CXX shared library ../lib/libzapi.dylib [100%] Built target zapi
最后輸入以下命令進(jìn)行安裝
make install
安裝完成后您將看到如下輸出
Install the project... -- Install configuration: "Debug" -- Installing: /usr/local/lib/cmake/zendapi/ZendApiConfig.cmake -- Installing: /usr/local/lib/cmake/zendapi/ZendApiConfigVersion.cmake -- Installing: /usr/local/include/zapi -- Installing: /usr/local/include/zapi/CompilerDetection.h -- Installing: /usr/local/include/zapi/ds -- Installing: /usr/local/include/zapi/ds/ArrayItemProxy.h -- Installing: /usr/local/include/zapi/ds/ArrayVariant.h -- Installing: /usr/local/include/zapi/ds/BoolVariant.h -- Installing: /usr/local/include/zapi/ds/CallableVariant.h -- Installing: /usr/local/include/zapi/ds/DoubleVariant.h -- Installing: /usr/local/include/zapi/ds/internal -- Installing: /usr/local/include/zapi/ds/internal/ArrayItemProxyPrivate.h -- Installing: /usr/local/include/zapi/ds/internal/VariantPrivate.h -- Installing: /usr/local/include/zapi/ds/NumericVariant.h -- Installing: /usr/local/include/zapi/ds/ObjectVariant.h -- Installing: /usr/local/include/zapi/ds/StringVariant.h -- Installing: /usr/local/include/zapi/ds/Variant.h -- Installing: /usr/local/include/zapi/Global.h -- Installing: /usr/local/include/zapi/kernel -- Installing: /usr/local/include/zapi/kernel/Exception.h -- Installing: /usr/local/include/zapi/kernel/FatalError.h -- Installing: /usr/local/include/zapi/kernel/Meta.h -- Installing: /usr/local/include/zapi/kernel/NotImplemented.h -- Installing: /usr/local/include/zapi/kernel/OrigException.h -- Installing: /usr/local/include/zapi/kernel/StreamBuffer.h -- Installing: /usr/local/include/zapi/lang -- Installing: /usr/local/include/zapi/lang/Argument.h -- Installing: /usr/local/include/zapi/lang/Class.h -- Installing: /usr/local/include/zapi/lang/Constant.h -- Installing: /usr/local/include/zapi/lang/Extension.h -- Installing: /usr/local/include/zapi/lang/Function.h -- Installing: /usr/local/include/zapi/lang/Ini.h -- Installing: /usr/local/include/zapi/lang/Interface.h -- Installing: /usr/local/include/zapi/lang/internal -- Installing: /usr/local/include/zapi/lang/internal/ExtensionPrivate.h -- Installing: /usr/local/include/zapi/lang/internal/NamespacePrivate.h -- Installing: /usr/local/include/zapi/lang/internal/StdClassPrivate.h -- Installing: /usr/local/include/zapi/lang/Method.h -- Installing: /usr/local/include/zapi/lang/Namespace.h -- Installing: /usr/local/include/zapi/lang/Parameters.h -- Installing: /usr/local/include/zapi/lang/StdClass.h -- Installing: /usr/local/include/zapi/lang/Type.h -- Installing: /usr/local/include/zapi/PhpHeaders.h -- Installing: /usr/local/include/zapi/ProcessorDetection.h -- Installing: /usr/local/include/zapi/protocol -- Installing: /usr/local/include/zapi/protocol/AbstractIterator.h -- Installing: /usr/local/include/zapi/protocol/ArrayAccess.h -- Installing: /usr/local/include/zapi/protocol/Countable.h -- Installing: /usr/local/include/zapi/protocol/Interfaces.h -- Installing: /usr/local/include/zapi/protocol/Serializable.h -- Installing: /usr/local/include/zapi/protocol/Traversable.h -- Installing: /usr/local/include/zapi/stdext -- Installing: /usr/local/include/zapi/stdext/Functional.h -- Installing: /usr/local/include/zapi/stdext/internal -- Installing: /usr/local/include/zapi/stdext/internal/FunctionalPrivate.h -- Installing: /usr/local/include/zapi/stdext/internal/TuplePrivate.h -- Installing: /usr/local/include/zapi/stdext/Tuple.h -- Installing: /usr/local/include/zapi/stdext/TypeTraits.h -- Installing: /usr/local/include/zapi/SystemDetection.h -- Installing: /usr/local/include/zapi/Typedefs.h -- Installing: /usr/local/include/zapi/utils -- Installing: /usr/local/include/zapi/utils/CommonFuncs.h -- Installing: /usr/local/include/zapi/utils/PhpFuncs.h -- Installing: /usr/local/include/zapi/Version.h.in -- Installing: /usr/local/include/zapi/vm -- Installing: /usr/local/include/zapi/vm/AbstractClass.h -- Installing: /usr/local/include/zapi/vm/AbstractMember.h -- Installing: /usr/local/include/zapi/vm/BoolMember.h -- Installing: /usr/local/include/zapi/vm/Callable.h -- Installing: /usr/local/include/zapi/vm/Closure.h -- Installing: /usr/local/include/zapi/vm/Engine.h -- Installing: /usr/local/include/zapi/vm/ExecStateGuard.h -- Installing: /usr/local/include/zapi/vm/FloatMember.h -- Installing: /usr/local/include/zapi/vm/internal -- Installing: /usr/local/include/zapi/vm/internal/AbstractClassPrivate.h -- Installing: /usr/local/include/zapi/vm/internal/AbstractMemberPrivate.h -- Installing: /usr/local/include/zapi/vm/internal/CallablePrivate.h -- Installing: /usr/local/include/zapi/vm/InvokeBridge.h -- Installing: /usr/local/include/zapi/vm/IteratorBridge.h -- Installing: /usr/local/include/zapi/vm/NullMember.h -- Installing: /usr/local/include/zapi/vm/NumericMember.h -- Installing: /usr/local/include/zapi/vm/ObjectBinder.h -- Installing: /usr/local/include/zapi/vm/Property.h -- Installing: /usr/local/include/zapi/vm/StringMember.h -- Installing: /usr/local/include/zapi/vm/ZValMember.h -- Installing: /usr/local/include/zapi/ZendApi.h -- Installing: /usr/local/lib/libzapi.0.0.1.dylib -- Installing: /usr/local/lib/libzapi.0.dylib -- Installing: /usr/local/lib/libzapi.dylib -- Installing: /usr/local/lib/cmake/zendapi/ZendApiTargets.cmake -- Installing: /usr/local/lib/cmake/zendapi/ZendApiTargets-debug.cmake
到此我們整個(gè)安裝過程就結(jié)束了, Have a lot of fun。
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/25886.html
摘要:原文地址在新手學(xué)堂里面,我們將從零基于開發(fā)一個(gè)簡單的擴(kuò)展,這個(gè)擴(kuò)展的名字叫做現(xiàn)在我們著手準(zhǔn)備開發(fā)需要的環(huán)境吧。 原文地址: http://www.zendapi.org/manual... 在新手學(xué)堂里面,我們將從零基于 zendAPI 開發(fā)一個(gè)簡單的 PHP 擴(kuò)展,這個(gè)擴(kuò)展的名字叫做 hellozapi , 現(xiàn)在我們著手準(zhǔn)備開發(fā)需要的環(huán)境吧。 demo 的項(xiàng)目庫地址 https://...
摘要:項(xiàng)目編譯腳本整體代碼編譯腳本逐行解說我們推薦的版本是這里如果您的版本低于的話,會報(bào)錯(cuò)。這里我們定義我們的項(xiàng)目名稱為使用的編程語言為。這行代碼的意思就是指示編譯器使用的標(biāo)準(zhǔn)對代碼進(jìn)行編譯。在項(xiàng)目中我們主要有三個(gè)文件,在這里進(jìn)行添加。 原文鏈接:http://www.zendapi.org/manual... 因?yàn)?zendAPI 采用的是 CMake 進(jìn)行編譯,所以我們的 helloza...
摘要:類型字符串默認(rèn)值無描述這個(gè)變量的值將會傳遞給編譯器比如等等參數(shù)。類型字符串默認(rèn)值無描述參考當(dāng)可執(zhí)行文件在非主流的路徑下的時(shí)候可以指定這個(gè)變量,幫助編譯系統(tǒng)進(jìn)行探測。 zendAPI 是采用 CMake 進(jìn)行編譯的,我們在項(xiàng)目中定義了一些 CMake 的函數(shù),變量和選項(xiàng),下面我們在這篇文章中對這些進(jìn)行詳細(xì)的說明,有助于節(jié)省大家的時(shí)間。 CMake 內(nèi)置重要變量 CMAKE_INSTALL...
操作系統(tǒng) 部署操作系統(tǒng)只支持 Linux (只支持64位系統(tǒng))開發(fā)環(huán)境目前支持 MacOs 和 Linux (只支持64位系統(tǒng)) 目前在如下系統(tǒng)上 zendAPI 編譯通過:(X86_64) MacOS 10.12.6 (開發(fā)) openSUSE 42.2 (部署和開發(fā)) Ubuntu 16.04 (部署和開發(fā)) CentOS 7 (部署) 暫時(shí)沒來的及測試的有 (X86_64) Deepi...
摘要:操作系統(tǒng)對于開發(fā)友好的操作系統(tǒng),我們首先推薦操作系統(tǒng),首先是環(huán)境對開發(fā)者非常友好,另外是圖形界面非常穩(wěn)定。平臺編譯選項(xiàng)平臺編譯選項(xiàng) 操作系統(tǒng) 對于開發(fā)友好的操作系統(tǒng),我們首先推薦 MacOS 操作系統(tǒng),首先 MacOS 是 Unix 環(huán)境對開發(fā)者非常友好,另外是圖形界面非常穩(wěn)定。其次如果想用 GNU/Linux 操作系統(tǒng)作為開發(fā)環(huán)境,推薦使用最新版的 openSUSE/Ubuntu/d...
閱讀 3565·2021-09-24 09:48
閱讀 1087·2021-09-10 10:51
閱讀 3268·2019-08-30 13:03
閱讀 3315·2019-08-30 12:51
閱讀 1388·2019-08-30 11:22
閱讀 1052·2019-08-29 18:38
閱讀 2035·2019-08-29 16:41
閱讀 3183·2019-08-29 15:32