|
Halide
【1】Cmake编译1- cmake_minimum_required(VERSION 3.29)
- project(ContrastAdjust)
- #find_package(Halide REQUIRED)
- set(HELIDE_SUPPORT_PATH D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/Halide-17.0.1-x86-64-windows/)
- set(GENERATED_CONTRAST_ADJUST contrast_adjust)
- set(GENERATED_MINMAX min_max)
- set(CMAKE_BUILD_TYPE Release)
- add_compile_options(-std=c++17 -fno-rtti)
- #### Generator
- add_executable(contrastAdjustGenerator
- ContrastAdjustGenerator.cpp
- ${HELIDE_SUPPORT_PATH}/share/Halide/tools/GenGen.cpp
- )
- target_include_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/Halide-17.0.1-x86-64-windows/include/)
- target_link_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/Halide-17.0.1-x86-64-windows/lib/)
- target_link_libraries(contrastAdjustGenerator Halide)
- target_include_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/libjpeg-turbo64/include/)
- target_link_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/libjpeg-turbo64/lib/)
- target_link_libraries(contrastAdjustGenerator jpeg)
- target_link_libraries(contrastAdjustGenerator jpeg-static)
- target_link_libraries(contrastAdjustGenerator turbojpeg)
- target_link_libraries(contrastAdjustGenerator turbojpeg-static)
- target_include_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/libpng/include/)
- target_link_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/libpng/lib/)
- target_link_libraries(contrastAdjustGenerator libpng16)
- target_link_libraries(contrastAdjustGenerator libpng16_static)
- target_include_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/zlib/include/)
- target_link_directories(contrastAdjustGenerator PRIVATE D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/zlib/lib/)
- target_link_libraries(contrastAdjustGenerator zlib)
- target_link_libraries(contrastAdjustGenerator zlibstatic)
- #### Run generators with Adams2019 auto-scheduler
- add_custom_command(TARGET contrastAdjustGenerator POST_BUILD
- COMMAND ./contrastAdjustGenerator -g ${GENERATED_MINMAX} -e c_header,static_library,stmt_html,schedule
- BYPRODUCTS ${GENERATED_MINMAX}.h ${GENERATED_MINMAX}.a ${GENERATED_MINMAX}.stmt.html ${GENERATED_MINMAX}.schedule.h
- COMMENT "Generating min max library")
- add_custom_command(TARGET contrastAdjustGenerator POST_BUILD
- COMMAND ./contrastAdjustGenerator -g ${GENERATED_CONTRAST_ADJUST} -e c_header,static_library,stmt_html,schedule
- BYPRODUCTS ${GENERATED_CONTRAST_ADJUST}.h ${GENERATED_CONTRAST_ADJUST}.a ${GENERATED_CONTRAST_ADJUST}.stmt.html ${GENERATED_CONTRAST_ADJUST}.schedule.h
- COMMENT "Generating contrast adjust library")
- #### Test app
- add_executable(contrastAdjustTest
- ContrastAdjust.cpp
- )
- target_include_directories(contrastAdjustTest PRIVATE ${CMAKE_BINARY_DIR} D:/2-LearningCode/997_Witiai_Halide/WitiaicvHal/Halide-17.0.1-x86-64-windows/include/ ${HELIDE_SUPPORT_PATH}/share/Halide/tools)
- target_link_libraries(contrastAdjustTest ${CMAKE_BINARY_DIR}/${GENERATED_MINMAX}.a ${CMAKE_BINARY_DIR}/${GENERATED_CONTRAST_ADJUST}.a)
- add_dependencies(contrastAdjustTest contrastAdjustGenerator)
复制代码 视频:Step1_Cmake编译Halide_Generator文件 https://www.bilibili.com/video/BV1cT42117fu/
|
|