Halide icon indicating copy to clipboard operation
Halide copied to clipboard

Some apps are missing CMake builds

Open alexreinking opened this issue 3 years ago • 9 comments

The following apps do not have CMake builds and so are not properly tested on CI

  • [ ] HelloAndroid (not built by Makefile either)
  • [ ] HelloAndroidCamera2 (not built by Makefile either)
  • [x] HelloAndroidGL (not built by Makefile either)
  • [x] HelloMatlab
  • [ ] HelloPyTorch (not built by Makefile either)
  • [ ] HelloiOS (not built by Makefile either)
  • [ ] HelloWasm (has CMake build, not built by Makefile)
  • [ ] auto_viz (not built by Makefile either)
  • [x] fft
  • [ ] hexagon_benchmarks (not built by Makefile either)
  • [ ] hexagon_dma (not built by Makefile either)
  • [ ] linear_blur (not built by Makefile either)
  • [ ] nn_ops (not built by Makefile either)
  • [ ] onnx
  • [ ] opengl_demo (not built by Makefile either)
  • [ ] openglcompute (not built by Makefile either)
  • [ ] resnet_50
  • [ ] simd_op_check (not built by Makefile either)

There might be good reasons for some of these, eg. I think linear_blur uses generator stubs, which aren't available from CMake (yet/ever). But even then, we should document that somewhere.

alexreinking avatar Oct 19 '20 17:10 alexreinking

Note that for HelloMatlab the makefile only exists as a stub to get the buildbots to call run_blur.sh. Matlab/octave itself takes over the build. A cmakelists with a single custom target that calls the script should suffice?

HelloiOS is intended as an example xcode project, but I'm not convinced it's doing things in a good way - it bakes in a shell script that builds the generator as a custom build step. I'm not sure if cmake can generate full ios applications natively. xcode keeps changing things like where the toolchain lives. HelloAndroid is somewhat similar - it's an attempt to use the android native build tools (at the time, gradle). I fear it has rotted.

simd_op_check appears to be a minimal stub to get an AOT version of test/correctness/simd_op_check.cpp to run on an android device using the object files output by that test.

I think those are the weird ones. Everything else should be more straightforward.

abadams avatar Oct 19 '20 18:10 abadams

I fear it has rotted.

I will bet you $1 that all the iOS and Android-specific builds are totally rotten. Is there a way to target these via CMake?

steven-johnson avatar Oct 19 '20 18:10 steven-johnson

I did recently use HelloiOS as a stub for an iOS app with success, and then spent several hours obsessively tweaking the reaction diffusion equation involved to do different pretty things. I think I may have had to adjust a path somewhere, but apart from that it was working. Getting it cmake'd instead of custom shell scripts would be great if it's possible and maintainable.

abadams avatar Oct 19 '20 18:10 abadams

(Note that we can't have cmake take over the whole project build though - the point of the app is how to incorporate Halide into an existing xcode project)

abadams avatar Oct 19 '20 18:10 abadams

Note that for HelloMatlab the makefile only exists as a stub to get the buildbots to call run_blur.sh. Matlab/octave itself takes over the build. A cmakelists with a single custom target that calls the script should suffice?

Yes, I think that should suffice. Will have to add an equivalent script for Windows, though.

HelloiOS is intended as an example xcode project, but I'm not convinced it's doing things in a good way - it bakes in a shell script that builds the generator as a custom build step. I'm not sure if cmake can generate full ios applications natively. xcode keeps changing things like where the toolchain lives. HelloAndroid is somewhat similar - it's an attempt to use the android native build tools (at the time, gradle). I fear it has rotted.

I know that CMake can generate Xcode projects and first-class support for iOS, watchOS, and tvOS. So that should be workable.

simd_op_check appears to be a minimal stub to get an AOT version of test/correctness/simd_op_check.cpp to run on an android device using the object files output by that test.

CMake also has first-class Android support.

alexreinking avatar Oct 19 '20 18:10 alexreinking

I will bet you $1 that all the iOS and Android-specific builds are totally rotten. Is there a way to target these via CMake?

Yes. CMake natively supports both iOS and Android.

(Note that we can't have cmake take over the whole project build though - the point of the app is how to incorporate Halide into an existing xcode project)

One could use CMake to generate an Xcode project and then include that one as a subproject? I admit I have no iOS development experience, so that might not be a great workflow.

alexreinking avatar Oct 19 '20 18:10 alexreinking

I'd be happy to try out that xcode configuration, but I'm also not an iOS development person. I do have an ipad though that I can try things on.

abadams avatar Oct 19 '20 18:10 abadams

Note that for HelloMatlab the makefile only exists as a stub to get the buildbots to call run_blur.sh. Matlab/octave itself takes over the build. A cmakelists with a single custom target that calls the script should suffice?

HelloiOS is intended as an example xcode project, but I'm not convinced it's doing things in a good way - it bakes in a shell script that builds the generator as a custom build step. I'm not sure if cmake can generate full ios applications natively. xcode keeps changing things like where the toolchain lives. HelloAndroid is somewhat similar - it's an attempt to use the android native build tools (at the time, gradle). I fear it has rotted.

simd_op_check appears to be a minimal stub to get an AOT version of test/correctness/simd_op_check.cpp to run on an android device using the object files output by that test.

I think those are the weird ones. Everything else should be more straightforward.

HelloiOS failed to compile in my case at: gpu_tile(clobber.x, clobber.y, 1, 1) with error: xxx/Halide/apps/HelloiOS/reaction_diffusion_2_generator.cpp:135:18: no matching member function for call to 'gpu_tile'

yangyanli avatar Feb 04 '21 09:02 yangyanli

Note that for HelloMatlab the makefile only exists as a stub to get the buildbots to call run_blur.sh. Matlab/octave itself takes over the build. A cmakelists with a single custom target that calls the script should suffice?

HelloiOS is intended as an example xcode project, but I'm not convinced it's doing things in a good way - it bakes in a shell script that builds the generator as a custom build step. I'm not sure if cmake can generate full ios applications natively. xcode keeps changing things like where the toolchain lives. HelloAndroid is somewhat similar - it's an attempt to use the android native build tools (at the time, gradle). I fear it has rotted.

simd_op_check appears to be a minimal stub to get an AOT version of test/correctness/simd_op_check.cpp to run on an android device using the object files output by that test.

I think those are the weird ones. Everything else should be more straightforward.

also, I have to add: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk \ to the Run Script for resolving an issue similar to this.

yangyanli avatar Feb 04 '21 09:02 yangyanli