洛阳网站改版,wordpress登录界面,网站建设与管理考察报告,宁波企业网站设计文章目录 第0章 配置环境0.1 获取代码0.2 Docker镜像0.3 安装必要的软件0.3.1 获取CMake0.3.2 编译器0.3.3 自动化构建工具0.3.4 Python0.3.5 依赖软件0.3.5.1 BLAS和LAPACk0.3.5.2 消息传递接口(MPI)0.3.5.3 线性代数模板库0.3.5.4 Boost库0.3.5.5 交叉编译器0.3.5.6 ZeroMQ, … 文章目录 第0章 配置环境0.1 获取代码0.2 Docker镜像0.3 安装必要的软件0.3.1 获取CMake0.3.2 编译器0.3.3 自动化构建工具0.3.4 Python0.3.5 依赖软件0.3.5.1 BLAS和LAPACk0.3.5.2 消息传递接口(MPI)0.3.5.3 线性代数模板库0.3.5.4 Boost库0.3.5.5 交叉编译器0.3.5.6 ZeroMQ, pkg-config, UUID和Doxygen0.3.5.7 Conda的构建和部署 0.4 测试环境0.5 上报问题并提出改进建议 第0章 配置环境
主要内容 如何获取代码GNU/Linux、macOS和Windows 安装示例所需工具自动化测试如何工作报告问题提出改进建议
0.1 获取代码
git git clone https://github.com/...git获取特定版本 --single-branch -b v1.0 git clone --single-branch -b v1.0 https://github.com/...git 获取更新选择库的master分支
0.2 Docker镜像
Docker 环境搭建
$ docker run -it devcafe/cmake-cookbook_ubuntu-18.04
$ git clone https://github.com/dev-cafe/cmake-cookbook.git
$ cd cmake-cookbook
$ pipenv install --three
$ pipenv run python testing/collect_tests.py chapter-*/recipe-*0.3 安装必要的软件
主机操作系统安装依赖项安装组件 CMake 编译器 自动化构建工具 Python
0.3.1 获取CMake
GNU/Linux
$ cmake_version3.5.2
$ target_path$HOME/Deps/cmake/${cmake_version}
$ cmake_urlhttps://cmake.org/files/v${cmake_version%.*}/cmake-${cmake_version}-Linux-x86_64.tar.gz
$ mkdir -p ${target_path}
$ curl -Ls ${cmake_url} | tar -xz -C ${target_path} --strip-components1
$ export PATH$HOME/Deps/cmake/${cmake_version}/bin${PATH::$PATH}
$ cmake --versionWindows Visual Studio 2017 构建CMake项目下载MSYS2安装程序按说明更新包列表用pacman安装CMake
$ pacman -S mingw64/mingw-w64-x86_64-cmake0.3.2 编译器 C、C和Fortran 编译器 跨平台并尽可能独立于操作系统(开源编译器) GNU/Linux $ sudo apt-get install g gcc gfortranWindows $ pacman -S mingw64/mingw-w64-x86_64-toolchain0.3.3 自动化构建工具
自动化构建工具为项目提供构建和链接的基础设施最终安装和使用什么取决于操作系统 GNU/Linux上GNU MakemacOS上XCode将提供GNU MakeWindows上Visual Studio MSYS2 GNU Make作为mingw64/mingw-w64-x86_64工具链包的一部分 可移植性尽量使示例不受系统相关细节影响编译器固有特性配置、构建和链接自动化构建工具 Ninja 适用于GNU/Linux、macOS和Windows 注重速度贴别是增量重构Fortran安装Ninja
$ mkdir -p ninja
$ ninja_urlhttps://github.com/Kitware/ninja/releases/download/v1.8.2.g3bbbe.kitware.dyndep-1.jobserver-1/ninja-1.8.2.g3bbbe.kitware.dyndep-1.jobserver-1_x86_64-linux-gnu.tar.gz
$ curl -Ls ${ninja_url} | tar -xz -C ninja --strip-components1
$ export PATH$HOME/Deps/ninja${PATH::$PATH}windows MSYS2环境
$ pacman -S mingw64/mingw-w64-x86_64-ninja0.3.4 Python
Python安装 解释器、头文件和库Ubuntu 14.04 LTS
sudo apt-get install python3.5-devWindows MSYS2环境
$ pacman -S mingw64/mingw-w64-x86_64-python3
$ pacman -S mingw64/mingw-w64-x86_64-python3-pip
$ python3 -m pip install pipenv建议使用包管理器在隔离的环境中安装这些包 不影响系统环境下进行包的清理/安装没有管理员权限的情况下安装包降低软件版本和依赖项冲突的风险复现性可更好地控制包地依赖性 Pipfile 结合pipfile.lock 使用Pipenv创建独立环境安装所有包
$ pip install --user pip pipenv --upgrade
$ pipenv install --python python3.5执行pipenv shell进入一个命令行环境包含特定版本Python和可用的包执行exit退出当前环境使用pipenv run在隔离环境中直接执行命令将库中requirements.txt文件与Virtualenv和pip结合使用
$ virtualenv --pythonpython3.5 venv
$ source venv/bin/activate
$ pip install -r requirements.txtdeactivate命令退出虚拟环境Conda环境安装Miniconda
$ curl -Ls https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh miniconda.sh
$ bash miniconda.sh -b -p $HOME/Deps/conda /dev/null
$ touch $HOME/Deps/conda/conda-meta/pinned
$ export PATH$HOME/Deps/conda/bin${PATH::$PATH}
$ conda config --set show_channel_urls True
$ conda config --set changeps1 no
$ conda update --all
$ conda clean -tipyWindows 下载Miniconda(或使用PowerShell安装)
$basedir $pwd.Path \
$filepath $basedir Miniconda3-latest-Windows-x86_64.exe
$Anaconda_loc C:\Deps\conda
$args /InstallationTypeJustMe /AddToPath0 /RegisterPython0 /S /D$Anaconda_loc
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
$conda_path $Anaconda_loc \Scripts\conda.exe
$args config --set show_channel_urls True
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru
$args config --set changeps1 no
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru
$args update --all
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru
$args clean -tipy
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru安装Conda后安装Python模块
$ conda create -n cmake-cookbook python3.5
$ conda activate cmake-cookbook
$ conda install --file requirements.txt执行conda deactivate将退出conda的环境
0.3.5 依赖软件
0.3.5.1 BLAS和LAPACk
Linux Ubuntu 14.04 LTS 安装BLAS和LAPACk
$ sudo apt-get install libatlas-dev liblapack-dev liblapacke-devwindows MSYS2环境
$ pacman -S mingw64/mingw-w64-x86_64-openblas或者从GitHub下载 BLAS和LAPACk参考实现并从源代码编译库
0.3.5.2 消息传递接口(MPI)
Ubuntu 14.04 LTS 安装OpenMPI
$ sudo apt-get install openmpi-bin libopenmpi-dev可以从https://www.open-mpi.org/software/ 下载OpenMPI源码并编译
0.3.5.3 线性代数模板库
GNU/Linux和macOS上安装Eigen
$ eigen_version3.3.4
$ mkdir -p eigen
$ curl -Ls http://bitbucket.org/eigen/eigen/get/${eigen_version}.tar.gz | tar -xz -C eigen --strip-components1
$ cd eigen
$ cmake -H. -Bbuild_eigen -
DCMAKE_INSTALL_PREFIX$HOME/Deps/eigen /dev/null
$ cmake --build build_eigen -- install /dev/null0.3.5.4 Boost库
Ubuntu 14.04 LTS
$ sudo apt-get install libboost-filesystem-dev libboost-python-dev libboost-test-devWindows 二进制发行版 从Boost网站 http://www.boost.org 下载https://www.boost.org 下载源代码编译
0.3.5.5 交叉编译器
类Debian/Ubuntu系统安装交叉编译器
$ sudo apt-get install gcc-mingw-w64 g-mingw-w64 gfortran-mingw-w640.3.5.6 ZeroMQ, pkg-config, UUID和Doxygen
Ubuntu 14.04 LTS
$ sudo apt-get install pkg-config libzmq3-dev doxygen graphviz-dev uuid-devWindows MSYS2环境
$ pacman -S mingw64/mingw-w64-x86_64-zeromq
$ pacman -S mingw64/mingw-w64-x86_64-pkg-config
$ pacman -S mingw64/mingw-w64-x86_64-doxygen
$ pacman -S mingw64/mingw-w64-x86_64-graphviz0.3.5.7 Conda的构建和部署
GNU/Linux和macOS上安装Conda构建和部署工具
$ conda install --yes --quiet conda-build anaconda-client jinja2 setuptools
$ conda clean -tipsy
$ conda info -aWindows
$conda_path C:\Deps\conda\Scripts\conda.exe
$args install --yes --quiet conda-build anaconda-client jinja2 setuptools
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru
$args clean -tipsy
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru
$args info -a
Start-Process -FilePath $conda_path -ArgumentList $args -Wait -Passthru0.4 测试环境 示例持续集成测试 GNU/Linux和macOS Travis( https://travis-ci.org ) 配置文件 travis.yml 其他脚本 testing/dependenciesGNU/Linux CMake 3.5.2和CMake 3.12.1 macOS CMake 3.12.1 Windows Appveyor( https://www.appveyor.com ) .appveyor.yml 其他脚本 testing/dependenciesCMake 3.11.3 GNU/Linux测试和商业编译器 CircleCI ( https://circleci.com ) .circleci/config.ymlCMake 3.12.1 测试机制 python脚本 包含在testing文件夹中脚本collect_tests.py 运行测试并报告它们的状态示例可以单独测试也可以批量测试 collect_tests.py 接受正则表达式作为命令行输入
$ pipenv run python testing/collect_tests.py chapter-0[1,7]/recipe-0[1,2,5]更详细的输出可设置环境变量VERBOSE_OUTPUTON
$ env VERBOSE_OUTPUTON pipenv run python testing/collect_tests.py chapter-*/recipe-*0.5 上报问题并提出改进建议
问题反馈 https://github.com/dev-cafe/cmake-cookbook/issues 对源码进行贡献 Fork原始库 Pull Request提交更改原始库 https://github.com/dev-cafe/cmake-cookbook参考 https://help.github.com/articles/creating-a-pull-request-from-a-fork/ 非重要更改在Pull Request前创建问题描述并讨论要更改的问题 https://github.com/devcafe/cmake-cookbook/issues