cmake_minimum_required(VERSION 3.1) project(nnfw) enable_testing() macro(nnfw_include PREFIX) include("${CMAKE_SOURCE_DIR}/cmake/modules/${PREFIX}.cmake") endmacro(nnfw_include) # 'find_package()' wrapper to find in cmake/packages folder # # Example: # nnfw_find_package(Boost): Load settings from 'BoostConfig.cmake' file # - this may drop warnings like "-- Could NOT find Boost (missing: Boost_DIR) # nnfw_find_package(Boost QUIET): Load settings silently, without warnings # nnfw_find_package(Boost REQUIRED): Load settings but stop with error when failed macro(nnfw_find_package PREFIX) find_package(${PREFIX} CONFIG NO_DEFAULT_PATH PATHS ${CMAKE_SOURCE_DIR}/cmake/packages ${ARGN}) endmacro(nnfw_find_package) set(CMAKE_CXX_STANDARD 11) # This feature works with CMake 3.5.2 or later. However, using previous versions does not produce # an error. We are still officially using CMake 3.1.0, but put this code for the sake of semantic # support in various development tools. # Todo: Someday, CMake needs to be updated to 3.7.2 or later to take advantage of improvements # such as `cmake-server`. set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # identify platform: HOST_PLATFORM, TARGET_PLATFORM and related include("cmake/option/identify_platform.cmake") # platform specific options include("cmake/option/option_${TARGET_PLATFORM}.cmake") # apply compilation flags # note: this should be placed after cmake/option/option_xxx.cmake files include("cmake/ApplyCompileFlags.cmake") # Configuration flags include("cmake/CfgOptionFlags.cmake") # and besides CfgOptionFlags.cmake that can be given outside # OBS_BUILD: build boolean flag that tizen in OBS build # COVERAGE_BUILD: build boolean flag that enables converage test # ROOTFS_ARM: arm rootfs path for cross building # ROOTFS_ARM64: arm 64bit rootfs path for cross building, linux,tizen,android # TARGET_ARCH: target architecture string for cross building # TARGET_OS: target os string for cross building # Download configuration option(DOWNLOAD_TENSORFLOW "Download Tensorflow source" ON) option(DOWNLOAD_ABSL "Download Absl source" ON) option(DOWNLOAD_EIGEN "Download Eigen source" ON) option(DOWNLOAD_FARMHASH "Download farmhash source" ON) option(DOWNLOAD_GEMMLOWP "Download GEMM low precesion library source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" ON) option(DOWNLOAD_FLATBUFFERS "Download FlatBuffers source" ON) option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" ON) option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) CMAKE_DEPENDENT_OPTION(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" # Enable ARMCompute build if the target architecture is aarch ON "TARGET_IS_ARMARCH" # Disable ARMCompute build otherwise OFF) option(DOWNLOAD_NONIUS "Download nonius source" ON) option(DOWNLOAD_BOOST "Download boost source" OFF) option(BUILD_BOOST "Build boost source" OFF) # Project configuration option(BUILD_TOOLS "Bulid nnfw projects under tools/" ON) CMAKE_DEPENDENT_OPTION(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" # Enable android support for android build ON "${TARGET_OS} STREQUAL android" # Disable android support otherwise OFF) # GTest support option(BUILD_GTEST "Download and build Google Test" ON) nnfw_find_package(GTest QUIET) nnfw_include(ExtendCMakeFunction) add_library(nnapi-header INTERFACE) target_include_directories(nnapi-header INTERFACE include) # TODO Support android build via fine-control for each component # - Introduce BUILD_CONTRIB option # - Set "BUILD_TFLITE_BENCHMARK_MODEL" as OFF for android build # # The original android build script (for future reference) # # add_subdirectory(libs) # add_subdirectory(tests/tools/nnapi_test) # add_subdirectory(tests/tools/tflite_benchmark) # add_subdirectory(tests/nnapi) # # add_subdirectory(runtimes) add_subdirectory(contrib) add_subdirectory(libs) add_subdirectory(runtimes) add_subdirectory(tests) add_subdirectory(tools)