@@ -15,26 +15,10 @@ test -n "$RUNNER_ARCH" || die "RUNNER_ARCH not set"
1515
1616CONAN_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
3822set -euxo pipefail
3923
4024if [[ " $RUNNER_OS " == " Linux" ]]; then
@@ -48,17 +32,25 @@ pip install conan
4832pip install ninja
4933echo " ::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)
5543echo " ::group::CIBW_BEFORE_BUILD: local recipes index repository"
5644git clone https://github.com/conan-io/conan-center-index
5745cd conan-center-index
5846git reset --hard 73bae27b468ae37f5bacd4991d1113aefcf23b2b
5947git clean -df # cleans any untracked files/folders
6048cd ..
6149conan 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
6254echo " ::endgroup::"
6355
6456if [[ " $RUNNER_OS " == " Linux" ]]; then
@@ -68,8 +60,8 @@ if [[ "$RUNNER_OS" == "Linux" ]]; then
6860 echo " ::endgroup::"
6961fi
7062
63+ # 3. Restore conan cache (add -vverbose to debug)
7164echo " ::group::CIBW_BEFORE_BUILD: restore conan cache"
72- # Restore conan cache (add -vverbose to debug)
7365cachefile=$cache_dir /conan-cache-save.tgz
7466if [[ -e $cachefile ]]; then
7567 conan cache restore $cachefile
7870fi
7971echo " ::endgroup::"
8072
81- # Install profiles
73+ # 4. Install profiles
8274echo " ::group::CIBW_BEFORE_BUILD: Install profiles"
8375conan create $WORKSPACE /conan-profiles \
8476 --profile:all=$WORKSPACE /conan-profiles/$CONAN_PROFILE \
8577 --version=$LUXDEPS_VERSION
8678conan config install-pkg -vvv luxcoreconf/$LUXDEPS_VERSION @luxcore/luxcore
8779echo " ::endgroup::"
8880
89- # Install build requirements (before local packages)
81+ # 5. Install build requirements
9082echo " ::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
9386build_deps=(b2/[* ] cmake/[* ] m4/[* ] pkgconf/2.1.0 meson/1.2.2 yasm/[* ])
9487if [[ $RUNNER_OS == " Windows" ]]; then
@@ -104,48 +97,39 @@ for d in "${build_deps[@]}"; do
10497done
10598echo " ::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-
122100if [[ $RUNNER_OS == " Windows" ]]; then
123101 DEPLOY_PATH=$( cygpath " C:\\ Users\\ runneradmin" )
124102else
125103 DEPLOY_PATH=$WORKSPACE
126104fi
127105
106+ # 6. Show graph (for debug purpose)
128107echo " ::group::CIBW_BEFORE_BUILD: Explain graph"
129- # For debugging purpose...
108+ # This is only for debugging purpose...
130109cd $WORKSPACE
131110conan graph info $WORKSPACE \
132111 --profile:all=$CONAN_PROFILE \
133112 --version=$LUXDEPS_VERSION \
134113 --remote=mycenter \
114+ --remote=mylocal \
135115 --build=missing \
136116 --format=dot
137117echo " ::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)
139122echo " ::group::CIBW_BEFORE_BUILD: Create LuxCore Deps"
140123cd $WORKSPACE
141- # Create package (without using conancenter precompiled binaries)
142124conan create $WORKSPACE \
143125 --profile:all=$CONAN_PROFILE \
144126 --version=$LUXDEPS_VERSION \
145127 --remote=mycenter \
128+ --remote=mylocal \
146129 --build=missing
147130echo " ::endgroup::"
148131
132+ # 8. Save result
149133echo " ::group::Saving dependencies in ${cache_dir} "
150134conan cache clean " *" # Clean non essential files
151135conan 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
160145conan list --graph=graph.json --format=json --graph-binaries=Cache > list.json
0 commit comments