Message ID | 20210203065128.1738003-3-hiroh@chromium.org |
---|---|
State | Changes Requested |
Headers | show |
Series |
|
Related | show |
Hi Hiro, I'm absolutely not the best person to review build system changes, but.. On Wed, Feb 03, 2021 at 06:51:28AM +0000, Hirokazu Honda wrote: > This adds download_subprojects option. It controls whether a > library in meson subprojects is downloaded as specified. The > motivation of the option is there is an environment where > the download is prohibited by "--wrap-mode nodownload". > The local library code (e.g. libyuv) is built with in such a > build environment if download_subprojects is set to false. > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org> > --- > meson_options.txt | 5 +++++ > src/android/meson.build | 32 ++++++++++++++++++-------------- > 2 files changed, 23 insertions(+), 14 deletions(-) > > diff --git a/meson_options.txt b/meson_options.txt > index 53f2675e..bd92475f 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -14,6 +14,11 @@ option('gstreamer', > value : 'auto', > description : 'Compile libcamera GStreamer plugin') > > +option('download_subprojects', > + type : 'boolean', > + value : 'true', > + description: 'Download subprojects in build') > + > option('pipelines', > type : 'array', > choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], > diff --git a/src/android/meson.build b/src/android/meson.build > index 7619517a..03d847ee 100644 > --- a/src/android/meson.build > +++ b/src/android/meson.build > @@ -15,20 +15,24 @@ foreach dep : android_deps > endforeach > > if android_enabled > - cmake = import('cmake') > - > - libyuv_vars = cmake.subproject_options() > - libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > - libyuv_vars.set_override_option('cpp_std', 'c++17') > - libyuv_vars.append_compile_args('cpp', > - '-Wno-sign-compare', > - '-Wno-unused-variable', > - '-Wno-unused-parameter') > - libyuv_vars.append_link_args('-ljpeg') > - libyuv = cmake.subproject('libyuv', options : libyuv_vars) > - libyuv_dep = libyuv.dependency('yuv') > - > - android_deps += [ libyuv_dep, ] > + if get_option('download_subprojects') > + cmake = import('cmake') > + > + libyuv_vars = cmake.subproject_options() > + libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > + libyuv_vars.set_override_option('cpp_std', 'c++17') > + libyuv_vars.append_compile_args('cpp', > + '-Wno-sign-compare', > + '-Wno-unused-variable', > + '-Wno-unused-parameter') > + libyuv_vars.append_link_args('-ljpeg') > + libyuv = cmake.subproject('libyuv', options : libyuv_vars) > + libyuv_dep = libyuv.dependency('yuv') > + > + android_deps += [ libyuv_dep, ] > + else > + android_deps += [ dependency('libyuv') ] I'm not sure I know the difference between the last two lines, but that's me. The rest looks ok to me Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > + endif > endif > > android_hal_sources = files([ > -- > 2.30.0.365.g02bc693789-goog > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Hiro, Thank you for the patch. On Wed, Feb 03, 2021 at 06:51:28AM +0000, Hirokazu Honda wrote: > This adds download_subprojects option. It controls whether a > library in meson subprojects is downloaded as specified. The > motivation of the option is there is an environment where > the download is prohibited by "--wrap-mode nodownload". > The local library code (e.g. libyuv) is built with in such a > build environment if download_subprojects is set to false. > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org> > --- > meson_options.txt | 5 +++++ > src/android/meson.build | 32 ++++++++++++++++++-------------- > 2 files changed, 23 insertions(+), 14 deletions(-) > > diff --git a/meson_options.txt b/meson_options.txt > index 53f2675e..bd92475f 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -14,6 +14,11 @@ option('gstreamer', > value : 'auto', > description : 'Compile libcamera GStreamer plugin') > > +option('download_subprojects', > + type : 'boolean', > + value : 'true', > + description: 'Download subprojects in build') > + > option('pipelines', > type : 'array', > choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], > diff --git a/src/android/meson.build b/src/android/meson.build > index 7619517a..03d847ee 100644 > --- a/src/android/meson.build > +++ b/src/android/meson.build > @@ -15,20 +15,24 @@ foreach dep : android_deps > endforeach > > if android_enabled > - cmake = import('cmake') > - > - libyuv_vars = cmake.subproject_options() > - libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > - libyuv_vars.set_override_option('cpp_std', 'c++17') > - libyuv_vars.append_compile_args('cpp', > - '-Wno-sign-compare', > - '-Wno-unused-variable', > - '-Wno-unused-parameter') > - libyuv_vars.append_link_args('-ljpeg') > - libyuv = cmake.subproject('libyuv', options : libyuv_vars) > - libyuv_dep = libyuv.dependency('yuv') > - > - android_deps += [ libyuv_dep, ] > + if get_option('download_subprojects') > + cmake = import('cmake') > + > + libyuv_vars = cmake.subproject_options() > + libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > + libyuv_vars.set_override_option('cpp_std', 'c++17') > + libyuv_vars.append_compile_args('cpp', > + '-Wno-sign-compare', > + '-Wno-unused-variable', > + '-Wno-unused-parameter') > + libyuv_vars.append_link_args('-ljpeg') > + libyuv = cmake.subproject('libyuv', options : libyuv_vars) > + libyuv_dep = libyuv.dependency('yuv') > + > + android_deps += [ libyuv_dep, ] > + else > + android_deps += [ dependency('libyuv') ] > + endif Could we automatate this without an option ? Something along the lines of libyuv_dep = dependency('libyuv', required : false) # Fallback to a subproject if libyuv isn't found, as it's typically not # provided by destributions. if not libyuv_dep.found() cmake = import('cmake') libyuv_vars = cmake.subproject_options() libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) libyuv_vars.set_override_option('cpp_std', 'c++17') libyuv_vars.append_compile_args('cpp', '-Wno-sign-compare', '-Wno-unused-variable', '-Wno-unused-parameter') libyuv_vars.append_link_args('-ljpeg') libyuv = cmake.subproject('libyuv', options : libyuv_vars) libyuv_dep = libyuv.dependency('yuv') endif android_deps += [ libyuv_dep, ] I've tested it on a native Linux system, it tries to find libyuv and falls back to the subproject. If '--wrap-mode nodownload' is set, meson complains after trying to find libyuv natively, so I believe it would work on Chrome OS. > endif > > android_hal_sources = files([
Hi Jacopo and Laurent, On Thu, Feb 4, 2021 at 7:44 AM Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > > Hi Hiro, > > Thank you for the patch. > > On Wed, Feb 03, 2021 at 06:51:28AM +0000, Hirokazu Honda wrote: > > This adds download_subprojects option. It controls whether a > > library in meson subprojects is downloaded as specified. The > > motivation of the option is there is an environment where > > the download is prohibited by "--wrap-mode nodownload". > > The local library code (e.g. libyuv) is built with in such a > > build environment if download_subprojects is set to false. > > > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org> > > --- > > meson_options.txt | 5 +++++ > > src/android/meson.build | 32 ++++++++++++++++++-------------- > > 2 files changed, 23 insertions(+), 14 deletions(-) > > > > diff --git a/meson_options.txt b/meson_options.txt > > index 53f2675e..bd92475f 100644 > > --- a/meson_options.txt > > +++ b/meson_options.txt > > @@ -14,6 +14,11 @@ option('gstreamer', > > value : 'auto', > > description : 'Compile libcamera GStreamer plugin') > > > > +option('download_subprojects', > > + type : 'boolean', > > + value : 'true', > > + description: 'Download subprojects in build') > > + > > option('pipelines', > > type : 'array', > > choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], > > diff --git a/src/android/meson.build b/src/android/meson.build > > index 7619517a..03d847ee 100644 > > --- a/src/android/meson.build > > +++ b/src/android/meson.build > > @@ -15,20 +15,24 @@ foreach dep : android_deps > > endforeach > > > > if android_enabled > > - cmake = import('cmake') > > - > > - libyuv_vars = cmake.subproject_options() > > - libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > > - libyuv_vars.set_override_option('cpp_std', 'c++17') > > - libyuv_vars.append_compile_args('cpp', > > - '-Wno-sign-compare', > > - '-Wno-unused-variable', > > - '-Wno-unused-parameter') > > - libyuv_vars.append_link_args('-ljpeg') > > - libyuv = cmake.subproject('libyuv', options : libyuv_vars) > > - libyuv_dep = libyuv.dependency('yuv') > > - > > - android_deps += [ libyuv_dep, ] > > + if get_option('download_subprojects') > > + cmake = import('cmake') > > + > > + libyuv_vars = cmake.subproject_options() > > + libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > > + libyuv_vars.set_override_option('cpp_std', 'c++17') > > + libyuv_vars.append_compile_args('cpp', > > + '-Wno-sign-compare', > > + '-Wno-unused-variable', > > + '-Wno-unused-parameter') > > + libyuv_vars.append_link_args('-ljpeg') > > + libyuv = cmake.subproject('libyuv', options : libyuv_vars) > > + libyuv_dep = libyuv.dependency('yuv') > > + > > + android_deps += [ libyuv_dep, ] > > + else > > + android_deps += [ dependency('libyuv') ] > > + endif > > Could we automatate this without an option ? Something along the lines > of > > libyuv_dep = dependency('libyuv', required : false) > > # Fallback to a subproject if libyuv isn't found, as it's typically not > # provided by destributions. > if not libyuv_dep.found() > cmake = import('cmake') > > libyuv_vars = cmake.subproject_options() > libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) > libyuv_vars.set_override_option('cpp_std', 'c++17') > libyuv_vars.append_compile_args('cpp', > '-Wno-sign-compare', > '-Wno-unused-variable', > '-Wno-unused-parameter') > libyuv_vars.append_link_args('-ljpeg') > libyuv = cmake.subproject('libyuv', options : libyuv_vars) > libyuv_dep = libyuv.dependency('yuv') > endif > > android_deps += [ libyuv_dep, ] > > I've tested it on a native Linux system, it tries to find libyuv and > falls back to the subproject. If '--wrap-mode nodownload' is set, meson > complains after trying to find libyuv natively, so I believe it would > work on Chrome OS. > Ah, nice suggestion! I didn't come up with the solution. I confirmed it worked in ChromiumOS built environment! Thanks. -Hiro > > endif > > > > android_hal_sources = files([ > > -- > Regards, > > Laurent Pinchart
diff --git a/meson_options.txt b/meson_options.txt index 53f2675e..bd92475f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,6 +14,11 @@ option('gstreamer', value : 'auto', description : 'Compile libcamera GStreamer plugin') +option('download_subprojects', + type : 'boolean', + value : 'true', + description: 'Download subprojects in build') + option('pipelines', type : 'array', choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], diff --git a/src/android/meson.build b/src/android/meson.build index 7619517a..03d847ee 100644 --- a/src/android/meson.build +++ b/src/android/meson.build @@ -15,20 +15,24 @@ foreach dep : android_deps endforeach if android_enabled - cmake = import('cmake') - - libyuv_vars = cmake.subproject_options() - libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) - libyuv_vars.set_override_option('cpp_std', 'c++17') - libyuv_vars.append_compile_args('cpp', - '-Wno-sign-compare', - '-Wno-unused-variable', - '-Wno-unused-parameter') - libyuv_vars.append_link_args('-ljpeg') - libyuv = cmake.subproject('libyuv', options : libyuv_vars) - libyuv_dep = libyuv.dependency('yuv') - - android_deps += [ libyuv_dep, ] + if get_option('download_subprojects') + cmake = import('cmake') + + libyuv_vars = cmake.subproject_options() + libyuv_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) + libyuv_vars.set_override_option('cpp_std', 'c++17') + libyuv_vars.append_compile_args('cpp', + '-Wno-sign-compare', + '-Wno-unused-variable', + '-Wno-unused-parameter') + libyuv_vars.append_link_args('-ljpeg') + libyuv = cmake.subproject('libyuv', options : libyuv_vars) + libyuv_dep = libyuv.dependency('yuv') + + android_deps += [ libyuv_dep, ] + else + android_deps += [ dependency('libyuv') ] + endif endif android_hal_sources = files([
This adds download_subprojects option. It controls whether a library in meson subprojects is downloaded as specified. The motivation of the option is there is an environment where the download is prohibited by "--wrap-mode nodownload". The local library code (e.g. libyuv) is built with in such a build environment if download_subprojects is set to false. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- meson_options.txt | 5 +++++ src/android/meson.build | 32 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 14 deletions(-) -- 2.30.0.365.g02bc693789-goog