Skip to content

Commit cef691e

Browse files
committed
Handle local-conan-recipes as a remote
1 parent 91df124 commit cef691e

File tree

10 files changed

+55
-56
lines changed

10 files changed

+55
-56
lines changed

local-conan-recipes/imguifiledialog/conandata.yml renamed to local-conan-recipes/recipes/imguifiledialog/all/conandata.yml

File renamed without changes.

local-conan-recipes/imguifiledialog/conanfile.py renamed to local-conan-recipes/recipes/imguifiledialog/all/conanfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class ImguiFileDialogConan(ConanFile):
1717
settings = "os", "arch", "compiler", "build_type"
1818
homepage = "https://github.com/aiekick/ImGuiFileDialog"
1919
license = "MIT"
20-
version = "0.6.7"
2120
options = {
2221
"shared": [True, False],
2322
"fPIC": [True, False],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"0.6.7":
3+
folder: all
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sources:
2+
"12.8.93":
3+
Linux:
4+
x86_64:
5+
url: "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/linux-x86_64/cuda_nvrtc-linux-x86_64-12.8.93-archive.tar.xz"
6+
sha256: "992f5e4d95cb499f41e442245efa877dbd60c711451afe680a26700d61eb3843"
7+
Windows:
8+
x86_64:
9+
url: "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-linux-x86_64-12.8.93-archive.zip"
10+
sha256: "a63302a077f0248a743a1a7caa7dbd80d0fac56c6cfa9c41fa05fac9b7e5eda5"

local-conan-recipes/nvrtc/conanfile.py renamed to local-conan-recipes/recipes/nvrtc/binary/conanfile.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
class nvrtcRecipe(ConanFile):
1111
name = "nvrtc"
12-
version = "12.8.93"
1312
user = "luxcore"
1413
channel = "luxcore"
1514
package_type = "library"
@@ -28,19 +27,13 @@ def validate(self):
2827
raise ConanInvalidConfiguration("MacOS not supported")
2928

3029
def build(self):
31-
_os = str(self.settings.os)
32-
quirks = {
33-
"Linux": ("linux-x86_64", "tar.xz"),
34-
"Windows": ("windows-x86_64", "zip"),
35-
}
36-
37-
platform, extension = quirks[_os]
38-
39-
url = (
40-
"https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/"
41-
f"{platform}/cuda_nvrtc-{platform}-{self.version}-archive.{extension}"
30+
arch = "x86_64"
31+
get(
32+
self,
33+
**self.conan_data["sources"][self.version][str(self.settings.os)][arch],
34+
destination=self.build_folder,
35+
strip_root=True
4236
)
43-
get(self, url, destination=self.build_folder, strip_root=True)
4437

4538
def generate(self):
4639
tc = CMakeToolchain(self)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"12.8.93":
3+
folder: "binary"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"0.6.7":
3+
url: "https://github.com/aiekick/ImGuiFileDialog/archive/refs/tags/v0.6.7.zip"
4+
sha256: "939fa922162a490353f17b4bc15e59110fc9ea81c123acc29c6e5f3c8f1bbc7c"

local-conan-recipes/oidn/conanfile.py renamed to local-conan-recipes/recipes/oidn/all/conanfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
class OidnConan(ConanFile):
1717
name = "oidn"
18-
version = "2.3.3"
1918
user = "luxcore"
2019
channel = "luxcore"
2120
settings = "os", "arch", "compiler", "build_type"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"2.3.3":
3+
folder: "all"

run-conan.sh

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,10 @@ test -n "$RUNNER_ARCH" || die "RUNNER_ARCH not set"
1515

1616
CONAN_PROFILE=conan-profile-${RUNNER_OS}-${RUNNER_ARCH}
1717

18-
function conan_local_install() {
19-
name=$(echo "$1" | tr '[:upper:]' '[:lower:]') # Package name in lowercase
20-
21-
conan create \
22-
--profile:all=$CONAN_PROFILE \
23-
--build=missing \
24-
--remote=mycenter \
25-
-vnotice \
26-
$WORKSPACE/local-conan-recipes/$name
27-
conan install \
28-
--profile:all=$CONAN_PROFILE \
29-
--build=missing \
30-
--remote=mycenter \
31-
-vnotice \
32-
$WORKSPACE/local-conan-recipes/$name
33-
}
34-
3518

3619
# Script starts here
3720

21+
# 0. Initialize: set globals and install conan and ninja
3822
set -euxo pipefail
3923

4024
if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -48,17 +32,25 @@ pip install conan
4832
pip install ninja
4933
echo "::endgroup::"
5034

35+
# 1. Clone conancenter at a specific commit and add this cloned repo as a
36+
# remote ('mycenter')
37+
# This has 2 benefits:
38+
# - We can decide which packages will be built from sources (remote=mycenter)
39+
# and which ones will use precompiled binaries (remote=conancenter)
40+
# - We pin the index to a specific state (commit), which avoids spurious
41+
# updates
5142
# https://docs.conan.io/2/devops/devops_local_recipes_index.html
52-
# Add the mycenter remote pointing to the local folder
53-
# This allows to decide which packages are built from sources (remote=mycenter)
54-
# and which ones use precompiled binaries (remote=conancenter)
5543
echo "::group::CIBW_BEFORE_BUILD: local recipes index repository"
5644
git clone https://github.com/conan-io/conan-center-index
5745
cd conan-center-index
5846
git reset --hard 73bae27b468ae37f5bacd4991d1113aefcf23b2b
5947
git clean -df # cleans any untracked files/folders
6048
cd ..
6149
conan remote add mycenter ./conan-center-index
50+
51+
# 2. Add local recipe repository (as a remote)
52+
conan remote add mylocal ./local-conan-recipes
53+
conan list -r mylocal
6254
echo "::endgroup::"
6355

6456
if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -68,8 +60,8 @@ if [[ "$RUNNER_OS" == "Linux" ]]; then
6860
echo "::endgroup::"
6961
fi
7062

63+
# 3. Restore conan cache (add -vverbose to debug)
7164
echo "::group::CIBW_BEFORE_BUILD: restore conan cache"
72-
# Restore conan cache (add -vverbose to debug)
7365
cachefile=$cache_dir/conan-cache-save.tgz
7466
if [[ -e $cachefile ]]; then
7567
conan cache restore $cachefile
@@ -78,17 +70,18 @@ else
7870
fi
7971
echo "::endgroup::"
8072

81-
# Install profiles
73+
# 4. Install profiles
8274
echo "::group::CIBW_BEFORE_BUILD: Install profiles"
8375
conan create $WORKSPACE/conan-profiles \
8476
--profile:all=$WORKSPACE/conan-profiles/$CONAN_PROFILE \
8577
--version=$LUXDEPS_VERSION
8678
conan config install-pkg -vvv luxcoreconf/$LUXDEPS_VERSION@luxcore/luxcore
8779
echo "::endgroup::"
8880

89-
# Install build requirements (before local packages)
81+
# 5. Install build requirements
9082
echo "::group::CIBW_BEFORE_BUILD: Install tool requirements"
91-
# We allow to use precompiled binaries
83+
# We specify conancenter as a remote, thus allowing to use precompiled
84+
# binaries.
9285
# For pkgconf and meson, we have to manually target the right version
9386
build_deps=(b2/[*] cmake/[*] m4/[*] pkgconf/2.1.0 meson/1.2.2 yasm/[*])
9487
if [[ $RUNNER_OS == "Windows" ]]; then
@@ -104,48 +97,39 @@ for d in "${build_deps[@]}"; do
10497
done
10598
echo "::endgroup::"
10699

107-
# Install local packages
108-
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "Windows" ]]; then
109-
echo "::group::CIBW_BEFORE_BUILD: nvrtc"
110-
conan_local_install nvrtc
111-
echo "::endgroup::"
112-
fi
113-
114-
echo "::group::CIBW_BEFORE_BUILD: imguifiledialog"
115-
conan_local_install imguifiledialog
116-
echo "::endgroup::"
117-
118-
echo "::group::CIBW_BEFORE_BUILD: OIDN"
119-
conan_local_install oidn
120-
echo "::endgroup::"
121-
122100
if [[ $RUNNER_OS == "Windows" ]]; then
123101
DEPLOY_PATH=$(cygpath "C:\\Users\\runneradmin")
124102
else
125103
DEPLOY_PATH=$WORKSPACE
126104
fi
127105

106+
# 6. Show graph (for debug purpose)
128107
echo "::group::CIBW_BEFORE_BUILD: Explain graph"
129-
# For debugging purpose...
108+
# This is only for debugging purpose...
130109
cd $WORKSPACE
131110
conan graph info $WORKSPACE \
132111
--profile:all=$CONAN_PROFILE \
133112
--version=$LUXDEPS_VERSION \
134113
--remote=mycenter \
114+
--remote=mylocal \
135115
--build=missing \
136116
--format=dot
137117
echo "::endgroup::"
138118

119+
# 7. Create luxcoredeps package and all dependencies
120+
# (we do not specify conancenter as a remote, so it prevents conan from using
121+
# precompiled binaries and it forces compilation)
139122
echo "::group::CIBW_BEFORE_BUILD: Create LuxCore Deps"
140123
cd $WORKSPACE
141-
# Create package (without using conancenter precompiled binaries)
142124
conan create $WORKSPACE \
143125
--profile:all=$CONAN_PROFILE \
144126
--version=$LUXDEPS_VERSION \
145127
--remote=mycenter \
128+
--remote=mylocal \
146129
--build=missing
147130
echo "::endgroup::"
148131

132+
# 8. Save result
149133
echo "::group::Saving dependencies in ${cache_dir}"
150134
conan cache clean "*" # Clean non essential files
151135
conan remove -c -vverbose "*/*#!latest" # Keep only latest version of each package
@@ -155,6 +139,7 @@ conan graph info \
155139
--requires=luxcoreconf/$LUXDEPS_VERSION@luxcore/luxcore \
156140
--format=json \
157141
--remote=mycenter \
142+
--remote=mylocal \
158143
--profile:all=$CONAN_PROFILE \
159144
> graph.json
160145
conan list --graph=graph.json --format=json --graph-binaries=Cache > list.json

0 commit comments

Comments
 (0)