Skip to content

Commit

Permalink
Merge pull request #24 from robertmaynard/bug/teach_cmake_about_host_…
Browse files Browse the repository at this point in the history
…targets_dir

Ensure CMake finds CUDA libraries from host packages
  • Loading branch information
adibbley authored Jul 20, 2023
2 parents 7f506c3 + 9bfa9b9 commit a1a69ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions recipe/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ if [ "${CONDA_BUILD:-0}" = "1" ]; then
CUDA_LDFLAGS="${CUDA_LDFLAGS} -L${PREFIX}/${targetsDir}/lib/stubs"
CUDA_LDFLAGS="${CUDA_LDFLAGS} -L${BUILD_PREFIX}/${targetsDir}/lib"
CUDA_LDFLAGS="${CUDA_LDFLAGS} -L${BUILD_PREFIX}/${targetsDir}/lib/stubs"
# Needed to fix cross compilation
export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_FIND_ROOT_PATH=$PREFIX;$BUILD_PREFIX/$HOST/sysroot;$BUILD_PREFIX/${targetsDir}"
# Needed to fix cross compilation.
# $PREFIX and $PREFIX/${targetsDir} are needed to properly find all host components
# $BUILD_PREFIX/$HOST/sysroot is needed to find compiler bits and is placed before any `targetsDir` for priority.
# $BUILD_PREFIX/${targetsDir} is needed for projects that don't enable the CUDA language but use FindCUDAToolkit
export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_FIND_ROOT_PATH=$PREFIX;$BUILD_PREFIX/$HOST/sysroot;$PREFIX/${targetsDir};$BUILD_PREFIX/${targetsDir}"
else
CUDA_CFLAGS="${CUDA_CFLAGS} -I${CONDA_PREFIX}/${targetsDir}/include"
CUDA_LDFLAGS="${CUDA_LDFLAGS} -L${CONDA_PREFIX}/${targetsDir}/lib"
Expand Down
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source:
sha256: 5db25d4fd138013b563f9a3d1d87f7de7df1dac014fd4cccdfbb3435a5cff761

build:
number: 9
number: 10
skip: true # [osx or win]
skip: true # [target_platform != "linux-64" and target_platform != cross_target_platform]

Expand Down

0 comments on commit a1a69ae

Please sign in to comment.