Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper for cross-compiling Halide generators.
Created a new function, add_halide_generator, that helps users write correct cross-compiling builds by establishing the following convention for them: 1. Define Halide generators and libraries in the same project 2. Assume two builds: a host build and a cross build. 3. When creating a generator, check to see if we can load a pre-built version of the target. 4. If so, just use it, and add aliases to make sure all the names line up. 5. If not, make sure the full Halide package is loaded and create a target for the generator. a. If CMAKE_CROSSCOMPILING is set, then _warn_ the user (the variable is unreliable on macOS) that something seems fishy. b. Create export rules for the generator. It creates a package called PACKAGE_NAME and appends to its EXPORT_FILE. c. Create a custom target also named PACKAGE_NAME for building just the generators. d. Create an alias "${PACKAGE_NAMESPACE}${TARGET}". 6. Users are expected to use the alias in conjunction with add_halide_library. Users can test the existence of TARGET to determine whether a pre-built one was loaded (and set additional properties if not). 7. Setting ${PACKAGE_NAME}_ROOT is enough to load pre-built generators. PACKAGE_NAME is ${PROJECT_NAME}-generators by default. PACKAGE_NAMESPACE is "${PROJECT_NAME}::generators::" by default. EXPORT_FILE is "${PROJECT_BINARY_DIR}/cmake/${PACKAGE_NAME}-config.cmake" by default. Users are free to avoid the helper if it would not fit their workflow.
- Loading branch information