使用conda构建时使用正确的环境变量

2024-09-29 06:29:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我想将c++包(https://github.com/modsim/cadet)作为带有python包装器的anaconda包来提供。包装依赖于hdf5、LAPACK和日晷套装。所有这些都是作为水蟒包装,这使它非常方便。在

目前,我使用以下小脚本构建包(不使用conda):

#!bin/bash
export SUNDIALS_ROOT=~/anaconda3/include/sundials
cmake -DCMAKE_INSTALL_PREFIX="~/Dokumente/projects/pycadet/cadet" -DCMAKE_LIBRARY_PATH="~/anaconda3/lib" -DBLA_VENDOR=Intel10_64lp ../code/
make
make install

我被一些可能真的很简单的事情困住了,但是阅读所有的文档和在youtube上观看教程并没有帮助。如何使用conda构建使此代码通用?我想设置的路径日晷,mkl,hdf5等,它将在任何系统上工作。在

如果我理解正确,我会在我的系统上为linux64创建conda包。它涉及到给cmake打电话设置.sh脚本。但是系统如何知道所有库在不同计算机上的位置(例如,如果有人想使用conda install安装我的软件包)?例如:

export sundalials_ROOT=~/anaconda3/include/sundalials

这一行显然只适用于我的计算机或其他任何一个安装了anaconda的主目录并命名为anaconda3的计算机。在

如有任何提示,我们将不胜感激。我在conda构建配方示例中四处寻找,希望能找到一个合适的例子,但我无法想象我是唯一一个尝试为带有共享库的c++包提供python包装器的人。在

编辑

通过以下步骤,我更接近我想要实现的目标:

我补充道: conda config—添加通道conda forge

然后编辑梅塔亚姆公司名称:

包装: 姓名:pycadet 版本:3.1.2

^{pr2}$

所有的需求都会被自动下载,一切都会正常工作直到make崩溃。这个建筑.sh公司名称:

#!bin/bash
#
# The build receipy for conda 
#
#
#
#
# You can run build.sh with bash -x -e. The -x makes it echo each command that is run
# and the -e makes it exit whenever a command in the script returns nonzero exit status.
set -x -e

INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
CADET_PATH="${PREFIX}/cadet"

# get out of the work directory (contains downloaded cadet)
cd ..

# make the build directory (in source builds are prohibited)
mkdir build

# get into it
cd build

#export SUNDIALS_ROOT=${PREFIX}/include/sundials
cmake -DCMAKE_INSTALL_PREFIX="${CADET_PATH}" -DCMAKE_LIBRARY_PATH="${LIBRARY_PATH}"-DBLA_VENDOR=Intel10_64lp ${SRC_DIR} ../work/
make
make install

有什么提示吗?在


Tags: thepathbuildcmakebashprefixmakeinclude