11.4 以Conda包的形式发布一个简单的项目
准备工作
#include <iostream>
int main() {
std::cout << "hello from your conda package!" << std::endl;
return 0;
}具体实施
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-04 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON)add_executable(hello-conda "") target_sources(hello-conda PRIVATE example.cpp )nstall( TARGETS hello-conda DESTINATION bin ). ├── CMakeLists.txt ├── conda-recipe │ └── meta.yaml └── example.cpppackage: name: conda-example-simple version: "0.0.0" source: path: .. / # this can be changed to git-url build: number: 0 binary_relocation: true script: - cmake -H. -Bbuild_conda -G "${CMAKE_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${PREFIX} # [not win] - cmake -H. -Bbuild_conda -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" # [win] - cmake - -build build_conda - -target install requirements: build: - cmake >=3.5 - { { compiler('cxx') } } about: home: http://www.example.com license: MIT summary: "Summary in here ..."$ conda build conda-recipe$ conda install --use-local conda-example-simple$ hello-conda hello from your conda package!$ conda remove conda-example-simple
工作原理
更多信息
Last updated