diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-07-30 11:32:26 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-07-30 11:32:26 +0900 |
commit | 05e0ec30a632339a8533082476f27bda31ccde16 (patch) | |
tree | 5f220ac83084fe133ffb08a6a17e99f9bb36ec1c /infra/cmake | |
parent | e2ef8438a24f7c56a0744eb579a6e293ee2fbf8e (diff) | |
download | nnfw-05e0ec30a632339a8533082476f27bda31ccde16.tar.gz nnfw-05e0ec30a632339a8533082476f27bda31ccde16.tar.bz2 nnfw-05e0ec30a632339a8533082476f27bda31ccde16.zip |
Imported Upstream version 1.7.0upstream/1.7.0
Diffstat (limited to 'infra/cmake')
54 files changed, 561 insertions, 855 deletions
diff --git a/infra/cmake/modules/ExternalSourceTools.cmake b/infra/cmake/modules/ExternalSourceTools.cmake index 96210eb63..87cb15270 100644 --- a/infra/cmake/modules/ExternalSourceTools.cmake +++ b/infra/cmake/modules/ExternalSourceTools.cmake @@ -107,33 +107,3 @@ function(ExternalSource_Download PREFIX) set(${PREFIX}_SOURCE_DIR "${OUT_DIR}" PARENT_SCOPE) endfunction(ExternalSource_Download) - -function(ExternalSource_Get PREFIX DOWNLOAD_FLAG URL) - nnas_include(StampTools) - - set(CACHE_DIR "${NNAS_EXTERNALS_DIR}") - set(OUT_DIR "${CACHE_DIR}/${PREFIX}") - set(STAMP_PATH "${CACHE_DIR}/${PREFIX}.stamp") - - if(NOT EXISTS "${CACHE_DIR}") - file(MAKE_DIRECTORY "${CACHE_DIR}") - endif(NOT EXISTS "${CACHE_DIR}") - - # Compare URL in STAMP file and the given URL - Stamp_Check(URL_CHECK "${STAMP_PATH}" "${URL}") - - # TODO Check MD5 for correctness - - set(SOURCE_GET TRUE) - - if(NOT EXISTS "${OUT_DIR}" OR NOT URL_CHECK) - if(NOT DOWNLOAD_FLAG) - set(SOURCE_GET FALSE) - else(NOT DOWNLOAD_FLAG) - ExternalSource_Download(${PREFIX} ${URL} ${ARGN}) - endif(NOT DOWNLOAD_FLAG) - endif() - - set(${PREFIX}_SOURCE_GET ${SOURCE_GET} PARENT_SCOPE) - set(${PREFIX}_SOURCE_DIR "${OUT_DIR}" PARENT_SCOPE) -endfunction(ExternalSource_Get) diff --git a/infra/cmake/packages/ARMCompute/SConstruct b/infra/cmake/packages/ARMCompute/SConstruct deleted file mode 100644 index 9c0e4a84e..000000000 --- a/infra/cmake/packages/ARMCompute/SConstruct +++ /dev/null @@ -1,309 +0,0 @@ -# Copyright (c) 2016, 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import SCons -import os -import subprocess - -def version_at_least(version, required): - end = min(len(version), len(required)) - - for i in range(0, end, 2): - if int(version[i]) < int(required[i]): - return False - elif int(version[i]) > int(required[i]): - return True - - return True - -vars = Variables("scons") -vars.AddVariables( - BoolVariable("debug", "Debug", False), - BoolVariable("asserts", "Enable asserts (this flag is forced to 1 for debug=1)", False), - BoolVariable("logging", "Logging (this flag is forced to 1 for debug=1)", False), - EnumVariable("arch", "Target Architecture", "armv7a", allowed_values=("armv7a", "arm64-v8a", "arm64-v8.2-a", "arm64-v8.2-a-sve", "x86_32", "x86_64")), - EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "tizen", "bare_metal")), - EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile", "embed_only")), - BoolVariable("examples", "Build example programs", True), - BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True), - BoolVariable("standalone", "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute", False), - BoolVariable("opencl", "Enable OpenCL support", True), - BoolVariable("neon", "Enable Neon support", False), - BoolVariable("gles_compute", "Enable OpenGL ES Compute Shader support", False), - BoolVariable("embed_kernels", "Embed OpenCL kernels and OpenGL ES compute shaders in library binary", True), - BoolVariable("set_soname", "Set the library's soname and shlibversion (requires SCons 2.4 or above)", False), - BoolVariable("openmp", "Enable OpenMP backend", False), - BoolVariable("cppthreads", "Enable C++11 threads backend", True), - PathVariable("build_dir", "Specify sub-folder for the build", ".", PathVariable.PathAccept), - PathVariable("install_dir", "Specify sub-folder for the install", "", PathVariable.PathAccept), - ("extra_cxx_flags", "Extra CXX flags to be appended to the build command", ""), - ("extra_link_flags", "Extra LD flags to be appended to the build command", ""), - ("compiler_cache", "Command to prefix to the C and C++ compiler (e.g ccache)", "") -) - -env = Environment(platform="posix", variables=vars, ENV = os.environ) -build_path = env['build_dir'] -# If build_dir is a relative path then add a #build/ prefix: -if not env['build_dir'].startswith('/'): - SConsignFile('build/%s/.scons' % build_path) - build_path = "#build/%s" % build_path -else: - SConsignFile('%s/.scons' % build_path) - -install_path = env['install_dir'] -#If the install_dir is a relative path then assume it's from inside build_dir -if not env['install_dir'].startswith('/') and install_path != "": - install_path = "%s/%s" % (build_path, install_path) - -env.Append(LIBPATH = [build_path]) -Export('env') -Export('vars') - -def install_lib( lib ): - # If there is no install folder, then there is nothing to do: - if install_path == "": - return lib - return env.Install( "%s/lib/" % install_path, lib) -def install_bin( bin ): - # If there is no install folder, then there is nothing to do: - if install_path == "": - return bin - return env.Install( "%s/bin/" % install_path, bin) -def install_include( inc ): - if install_path == "": - return inc - return env.Install( "%s/include/" % install_path, inc) - -Export('install_lib') -Export('install_bin') - -Help(vars.GenerateHelpText(env)) - -if env['build'] == "embed_only": - SConscript('./SConscript', variant_dir=build_path, duplicate=0) - Return() - -if env['neon'] and 'x86' in env['arch']: - print("Cannot compile NEON for x86") - Exit(1) - -if env['set_soname'] and not version_at_least(SCons.__version__, "2.4"): - print("Setting the library's SONAME / SHLIBVERSION requires SCons 2.4 or above") - print("Update your version of SCons or use set_soname=0") - Exit(1) - -if env['os'] == 'bare_metal': - if env['cppthreads'] or env['openmp']: - print("ERROR: OpenMP and C++11 threads not supported in bare_metal. Use cppthreads=0 openmp=0") - Exit(1) - -env.Append(CXXFLAGS = ['-Wno-deprecated-declarations','-Wall','-DARCH_ARM', - '-Wextra','-Wno-unused-parameter','-pedantic','-Wdisabled-optimization','-Wformat=2', - '-Winit-self','-Wstrict-overflow=2','-Wswitch-default', - '-fpermissive','-std=gnu++11','-Wno-vla','-Woverloaded-virtual', - '-Wctor-dtor-privacy','-Wsign-promo','-Weffc++','-Wno-format-nonliteral','-Wno-overlength-strings','-Wno-strict-overflow']) - -env.Append(CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP']) - -default_cpp_compiler = 'g++' if env['os'] != 'android' else 'clang++' -default_c_compiler = 'gcc' if env['os'] != 'android' else 'clang' -cpp_compiler = os.environ.get('CXX', default_cpp_compiler) -c_compiler = os.environ.get('CC', default_c_compiler) - -if env['os'] == 'android' and ( 'clang++' not in cpp_compiler or 'clang' not in c_compiler ): - print( "WARNING: Only clang is officially supported to build the Compute Library for Android") - -if 'clang++' in cpp_compiler: - env.Append(CXXFLAGS = ['-Wno-format-nonliteral','-Wno-deprecated-increment-bool','-Wno-vla-extension','-Wno-mismatched-tags']) -else: - env.Append(CXXFLAGS = ['-Wlogical-op','-Wnoexcept','-Wstrict-null-sentinel','-Wno-implicit-fallthrough']) - -if env['cppthreads']: - env.Append(CPPDEFINES = [('ARM_COMPUTE_CPP_SCHEDULER', 1)]) - -if env['openmp']: - if 'clang++' in cpp_compiler: - print( "Clang does not support OpenMP. Use scheduler=cpp.") - Exit(1) - - env.Append(CPPDEFINES = [('ARM_COMPUTE_OPENMP_SCHEDULER', 1)]) - env.Append(CXXFLAGS = ['-fopenmp']) - env.Append(LINKFLAGS = ['-fopenmp']) - -prefix = "" -if env['arch'] == 'armv7a': - env.Append(CXXFLAGS = ['-march=armv7-a', '-mthumb', '-mfpu=neon']) - - if env['os'] == 'linux': - prefix = "arm-linux-gnueabihf-" - env.Append(CXXFLAGS = ['-mfloat-abi=hard']) - elif env['os'] == 'bare_metal': - prefix = "arm-eabi-" - env.Append(CXXFLAGS = ['-mfloat-abi=hard']) - elif env['os'] == 'android': - prefix = "arm-linux-androideabi-" - env.Append(CXXFLAGS = ['-mfloat-abi=softfp']) - elif env['os'] == 'tizen': - prefix = "arm-linux-gnueabi-" - env.Append(CXXFLAGS = ['-mfloat-abi=softfp']) -elif env['arch'] == 'arm64-v8a': - env.Append(CXXFLAGS = ['-march=armv8-a']) - env.Append(CPPDEFINES = ['ARM_COMPUTE_AARCH64_V8A','NO_DOT_IN_TOOLCHAIN']) - if env['os'] == 'linux': - prefix = "aarch64-linux-gnu-" - elif env['os'] == 'bare_metal': - prefix = "aarch64-elf-" - elif env['os'] == 'android': - prefix = "aarch64-linux-android-" - elif env['os'] == 'tizen': - prefix = "aarch64-linux-gnu-" - if 'clang++' in cpp_compiler: - env.Append(CXXFLAGS = ['-no-integrated-as']) -elif 'arm64-v8.2-a' in env['arch']: - if env['arch'] == 'arm64-v8.2-a-sve': - if env['os'] != 'bare_metal': - print("Only bare metal SVE is supported at the moment") - Exit(1) - env.Append(CXXFLAGS = ['-march=armv8.2-a+sve+fp16+dotprod']) - else: - env.Append(CXXFLAGS = ['-march=armv8.2-a+fp16']) # explicitly enable fp16 extension otherwise __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is undefined - if env['os'] == 'linux': - prefix = "aarch64-linux-gnu-" - elif env['os'] == 'bare_metal': - prefix = "aarch64-elf-" - elif env['os'] == 'android': - prefix = "aarch64-linux-android-" - elif env['os'] == 'tizen': - prefix = "aarch64-linux-gnu-" - env.Append(CPPDEFINES = ['ARM_COMPUTE_AARCH64_V8_2','NO_DOT_IN_TOOLCHAIN']) - if 'clang++' in cpp_compiler: - env.Append(CXXFLAGS = ['-no-integrated-as']) -elif env['arch'] == 'x86_32': - env.Append(CCFLAGS = ['-m32']) - env.Append(LINKFLAGS = ['-m32']) -elif env['arch'] == 'x86_64': - env.Append(CCFLAGS = ['-m64']) - env.Append(LINKFLAGS = ['-m64']) - -if env['build'] == 'native': - prefix = "" - -env['CC'] = env['compiler_cache']+" "+prefix + c_compiler -env['CXX'] = env['compiler_cache']+" "+prefix + cpp_compiler -env['LD'] = prefix + "ld" -env['AS'] = prefix + "as" -env['AR'] = prefix + "ar" -env['RANLIB'] = prefix + "ranlib" - -if not GetOption("help"): - try: - compiler_ver = subprocess.check_output(env['CXX'].split() + ["-dumpversion"]).strip() - except OSError: - print("ERROR: Compiler '%s' not found" % env['CXX']) - Exit(1) - - if 'clang++' not in cpp_compiler: - if env['arch'] == 'arm64-v8.2-a' and not version_at_least(compiler_ver, '6.2.1'): - print("GCC 6.2.1 or newer is required to compile armv8.2-a code") - Exit(1) - elif env['arch'] == 'arm64-v8a' and not version_at_least(compiler_ver, '4.9'): - print("GCC 4.9 or newer is required to compile NEON code for AArch64") - Exit(1) - - if version_at_least(compiler_ver, '6.1'): - env.Append(CXXFLAGS = ['-Wno-ignored-attributes']) - - if compiler_ver == '4.8.3': - env.Append(CXXFLAGS = ['-Wno-array-bounds']) - -if env['standalone']: - env.Append(CXXFLAGS = ['-fPIC']) - env.Append(LINKFLAGS = ['-static-libgcc','-static-libstdc++']) - -if env['Werror']: - env.Append(CXXFLAGS = ['-Werror']) - -if env['os'] == 'android': - env.Append(CPPDEFINES = ['ANDROID']) - env.Append(LINKFLAGS = ['-pie', '-static-libstdc++']) -elif env['os'] == 'bare_metal': - env.Append(LINKFLAGS = ['-static']) - env.Append(LINKFLAGS = ['-specs=rdimon.specs']) - env.Append(CXXFLAGS = ['-fPIC']) - env.Append(CPPDEFINES = ['NO_MULTI_THREADING']) - env.Append(CPPDEFINES = ['BARE_METAL']) - -if env['opencl']: - if env['os'] in ['bare_metal'] or env['standalone']: - print("Cannot link OpenCL statically, which is required for bare metal / standalone builds") - Exit(1) - -if env['gles_compute']: - if env['os'] in ['bare_metal'] or env['standalone']: - print("Cannot link OpenGLES statically, which is required for bare metal / standalone builds") - Exit(1) - -if env["os"] not in ["android", "bare_metal"] and (env['opencl'] or env['cppthreads']): - env.Append(LIBS = ['pthread']) - -if env['opencl'] or env['gles_compute']: - if env['embed_kernels']: - env.Append(CPPDEFINES = ['EMBEDDED_KERNELS']) - -if env['debug']: - env['asserts'] = True - env['logging'] = True - env.Append(CXXFLAGS = ['-O0','-g','-gdwarf-2']) - env.Append(CPPDEFINES = ['ARM_COMPUTE_DEBUG_ENABLED']) -else: - env.Append(CXXFLAGS = ['-O3','-ftree-vectorize']) - -if env['asserts']: - env.Append(CPPDEFINES = ['ARM_COMPUTE_ASSERTS_ENABLED']) - env.Append(CXXFLAGS = ['-fstack-protector-strong']) - -if env['logging']: - env.Append(CPPDEFINES = ['ARM_COMPUTE_LOGGING_ENABLED']) - -env.Append(CPPPATH = ['#/include', "#"]) -env.Append(CXXFLAGS = env['extra_cxx_flags']) -env.Append(LINKFLAGS = env['extra_link_flags']) - -Default( install_include("arm_compute")) -Default( install_include("support")) - -Export('version_at_least') - -if env['opencl']: - SConscript("./opencl-1.2-stubs/SConscript", variant_dir="%s/opencl-1.2-stubs" % build_path, duplicate=0) - -if env['gles_compute'] and env['os'] != 'android': - env.Append(CPPPATH = ['#/include/linux']) - SConscript("./opengles-3.1-stubs/SConscript", variant_dir="%s/opengles-3.1-stubs" % build_path, duplicate=0) - -SConscript('./SConscript', variant_dir=build_path, duplicate=0) - -if env['examples'] and env['os'] != 'bare_metal': - SConscript('./examples/SConscript', variant_dir='%s/examples' % build_path, duplicate=0) - -if env['os'] != 'bare_metal': - SConscript('./tests/SConscript', variant_dir='%s/tests' % build_path, duplicate=0) diff --git a/infra/cmake/packages/ARMComputeConfig.cmake b/infra/cmake/packages/ARMComputeConfig.cmake deleted file mode 100644 index 83c8d20f6..000000000 --- a/infra/cmake/packages/ARMComputeConfig.cmake +++ /dev/null @@ -1,192 +0,0 @@ -function(_ARMCompute_Import) - include(FindPackageHandleStandardArgs) - - list(APPEND ARMCompute_LIB_SEARCH_PATHS ${ARMCompute_PREFIX}) - - find_path(INCLUDE_DIR NAMES arm_compute/core/ITensor.h PATHS ${ARMCompute_INCLUDE_SEARCH_PATHS}) - - find_library(CORE_LIBRARY NAMES arm_compute_core PATHS ${ARMCompute_LIB_SEARCH_PATHS} CMAKE_FIND_ROOT_PATH_BOTH) - find_library(RUNTIME_LIBRARY NAMES arm_compute PATHS ${ARMCompute_LIB_SEARCH_PATHS} CMAKE_FIND_ROOT_PATH_BOTH) - find_library(GRAPH_LIBRARY NAMES arm_compute_graph PATHS ${ARMCompute_LIB_SEARCH_PATHS} CMAKE_FIND_ROOT_PATH_BOTH) - - message(STATUS "Search acl in ${ARMCompute_LIB_SEARCH_PATHS}") - - if(NOT INCLUDE_DIR) - nnas_find_package(ARMComputeSource QUIET) - if (NOT ARMComputeSource_FOUND) - set(ARMCompute_FOUND FALSE PARENT_SCOPE) - return() - endif() - set(INCLUDE_DIR ${ARMComputeSource_DIR} ${ARMComputeSource_DIR}/include) - endif(NOT INCLUDE_DIR) - - if(NOT CORE_LIBRARY) - set(ARMCompute_FOUND FALSE PARENT_SCOPE) - message(STATUS "Cannot find libarm_compute_core.so") - return() - endif() - - if(NOT RUNTIME_LIBRARY) - message(STATUS "Cannot find libarm_compute.so") - set(ARMCompute_FOUND FALSE PARENT_SCOPE) - return() - endif() - - if(NOT GRAPH_LIBRARY) - message(STATUS "Cannot find libarm_compute_graph.so") - set(ARMCompute_FOUND FALSE PARENT_SCOPE) - return() - endif() - - if(NOT TARGET arm_compute_core) - add_library(arm_compute_core INTERFACE) - target_include_directories(arm_compute_core SYSTEM INTERFACE ${INCLUDE_DIR}) - target_link_libraries(arm_compute_core INTERFACE dl ${LIB_PTHREAD}) - target_link_libraries(arm_compute_core INTERFACE ${CORE_LIBRARY}) - endif(NOT TARGET arm_compute_core) - - if(NOT TARGET arm_compute) - add_library(arm_compute INTERFACE) - target_include_directories(arm_compute SYSTEM INTERFACE ${INCLUDE_DIR}) - target_link_libraries(arm_compute INTERFACE ${RUNTIME_LIBRARY}) - target_link_libraries(arm_compute INTERFACE arm_compute_core) - endif(NOT TARGET arm_compute) - - if(NOT TARGET arm_compute_graph) - add_library(arm_compute_graph INTERFACE) - target_include_directories(arm_compute_graph SYSTEM INTERFACE ${INCLUDE_DIR}) - target_link_libraries(arm_compute_graph INTERFACE ${GRAPH_LIBRARY}) - target_link_libraries(arm_compute_graph INTERFACE arm_compute) - endif(NOT TARGET arm_compute_graph) - - set(ARMCompute_FOUND TRUE PARENT_SCOPE) -endfunction(_ARMCompute_Import) - -### Check whether library exists -function(_ARMCompute_Check VAR LIBDIR) - set(FOUND TRUE) - - if(NOT EXISTS "${LIBDIR}/libarm_compute_core.so") - set(FOUND FALSE) - endif() - - if(NOT EXISTS "${LIBDIR}/libarm_compute.so") - set(FOUND FALSE) - endif() - - if(NOT EXISTS "${LIBDIR}/libarm_compute_graph.so") - set(FOUND FALSE) - endif() - - set(${VAR} ${FOUND} PARENT_SCOPE) -endfunction(_ARMCompute_Check) - -# Let's build and install ARMCompute libraries -# NOTE This function silently returns on error -function(_ARMCompute_Build ARMCompute_INSTALL_PREFIX) - ### Check whether library exists - _ARMCompute_Check(ARMCompute_FOUND ${ARMCompute_INSTALL_PREFIX}) - - if(ARMCompute_FOUND) - return() - endif(ARMCompute_FOUND) - - ### Let's build with SCONS - nnas_find_package(ARMComputeSource QUIET) - - if(NOT ARMComputeSource_FOUND) - return() - endif(NOT ARMComputeSource_FOUND) - - find_program(SCONS_PATH scons) - - if(NOT SCONS_PATH) - message(WARNING "SCONS NOT FOUND. Please install SCONS to build ARMCompute.") - return() - endif(NOT SCONS_PATH) - - if(CMAKE_BUILD_TYPE) - string(TOLOWER "${CMAKE_BUILD_TYPE}" SCON_BUILD_TYPE) - else(CMAKE_BUILD_TYPE) - set(SCON_BUILD_TYPE "release") - endif(CMAKE_BUILD_TYPE) - - #### Architecture-specific configurations - if(TARGET_ARCH STREQUAL "armv7l") - set(BUILD_ARCH "armv7a") - set(BUILD_DIR "${BUILD_ARCH}-${TARGET_OS}.${SCON_BUILD_TYPE}") - endif() - - if(TARGET_ARCH STREQUAL "aarch64") - set(BUILD_ARCH "arm64-v8a") - set(BUILD_DIR "${BUILD_ARCH}-${TARGET_OS}.${SCON_BUILD_TYPE}") - endif() - - #### Platform-specific configurations - #### TODO Support android - - #### Mode-specific configurations - if(SCON_BUILD_TYPE STREQUAL "debug") - list(APPEND SCONS_OPTIONS "debug=1") - endif() - - #### Generic configurations - list(APPEND SCONS_OPTIONS "neon=1") - list(APPEND SCONS_OPTIONS "opencl=1") - list(APPEND SCONS_OPTIONS "examples=0") - list(APPEND SCONS_OPTIONS "Werror=0") - list(APPEND SCONS_OPTIONS "os=${TARGET_OS}") - include(ProcessorCount) - ProcessorCount(N) - if((NOT N EQUAL 0) AND BUILD_EXT_MULTITHREAD) - list(APPEND SCONS_OPTIONS -j${N}) - endif() - if(DEFINED BUILD_ARCH) - list(APPEND SCONS_OPTIONS "arch=${BUILD_ARCH}") - endif(DEFINED BUILD_ARCH) - - if(DEFINED BUILD_DIR) - list(APPEND SCONS_OPTIONS "build_dir=${BUILD_DIR}") - endif(DEFINED BUILD_DIR) - - message(STATUS "Build ARMCompute with ${SCONS_PATH} ('${SCONS_OPTIONS}'") - - # Copy externals/SConstruct to externals/acl/ for Tizen build support. - # TODO The change of externals/SConstruct should be upstreamed to ARM Compute Library community layer. - # execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/ARMCompute/SConstruct" "${ARMComputeSource_DIR}") - - # Build ARMCompute libraries with SCONS - # NOTE ARMCompute SConstruct unconditioanlly appends "arm-linux-gnueabihf-" prefix for linux - execute_process(COMMAND /usr/bin/env CC=gcc CXX=g++ "${SCONS_PATH}" ${SCONS_OPTIONS} - WORKING_DIRECTORY ${ARMComputeSource_DIR} - RESULT_VARIABLE ARMCompute_BUILD) - - # Install ARMCompute libraries - # Ps. CI server will copy below installed libraries to target device to test. - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${ARMCompute_INSTALL_PREFIX}" - WORKING_DIRECTORY ${ARMComputeSource_DIR} - RESULT_VARIABLE ARMCompute_BUILD) - execute_process(COMMAND ${CMAKE_COMMAND} -E copy "build/${BUILD_DIR}/libarm_compute_core.so" "${ARMCompute_INSTALL_PREFIX}" - COMMAND ${CMAKE_COMMAND} -E copy "build/${BUILD_DIR}/libarm_compute.so" "${ARMCompute_INSTALL_PREFIX}" - COMMAND ${CMAKE_COMMAND} -E copy "build/${BUILD_DIR}/libarm_compute_graph.so" "${ARMCompute_INSTALL_PREFIX}" - WORKING_DIRECTORY ${ARMComputeSource_DIR} - RESULT_VARIABLE ARMCompute_BUILD) -endfunction(_ARMCompute_Build) - - -set(ARMCompute_PREFIX ${EXT_OVERLAY_DIR}/lib) - -# This is a workaround for CI issues -# Ps. CI server will copy below installed libraries to target device to test. -# TODO Remove this workaround -if(DEFINED ARMCompute_EXTDIR) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${ARMCompute_PREFIX}") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${ARMCompute_EXTDIR}/libarm_compute_core.so" "${ARMCompute_PREFIX}" - COMMAND ${CMAKE_COMMAND} -E copy "${ARMCompute_EXTDIR}/libarm_compute.so" "${ARMCompute_PREFIX}" - COMMAND ${CMAKE_COMMAND} -E copy "${ARMCompute_EXTDIR}/libarm_compute_graph.so" "${ARMCompute_PREFIX}") -endif(DEFINED ARMCompute_EXTDIR) - -if(BUILD_ARMCOMPUTE) - _ARMCompute_Build("${ARMCompute_PREFIX}") -endif(BUILD_ARMCOMPUTE) -_ARMCompute_Import() diff --git a/infra/cmake/packages/ARMComputeSourceConfig.cmake b/infra/cmake/packages/ARMComputeSourceConfig.cmake index 45d8727d4..51a235a35 100644 --- a/infra/cmake/packages/ARMComputeSourceConfig.cmake +++ b/infra/cmake/packages/ARMComputeSourceConfig.cmake @@ -1,10 +1,15 @@ function(_ARMComputeSource_import) + if(NOT ${DOWNLOAD_ARMCOMPUTE}) + set(ARMComputeSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT ${DOWNLOAD_ARMCOMPUTE}) + nnas_include(ExternalSourceTools) nnas_include(OptionTools) envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") set(ARMCOMPUTE_URL ${EXTERNAL_DOWNLOAD_SERVER}/ARM-software/ComputeLibrary/archive/v19.11.1.tar.gz) - ExternalSource_Get(ARMCOMPUTE ${DOWNLOAD_ARMCOMPUTE} ${ARMCOMPUTE_URL}) + ExternalSource_Download(ARMCOMPUTE ${ARMCOMPUTE_URL}) set(ARMComputeSource_DIR ${ARMCOMPUTE_SOURCE_DIR} PARENT_SCOPE) set(ARMComputeSource_FOUND ${ARMCOMPUTE_SOURCE_GET} PARENT_SCOPE) diff --git a/infra/cmake/packages/AbseilConfig.cmake b/infra/cmake/packages/AbseilConfig.cmake index 06d36b9ea..e16dd94d7 100644 --- a/infra/cmake/packages/AbseilConfig.cmake +++ b/infra/cmake/packages/AbseilConfig.cmake @@ -17,13 +17,15 @@ function(_Abseil_import) add_library(abseil INTERFACE) target_link_libraries(abseil INTERFACE # From "Available Abseil CMake Public Targets" in CMake/README.md - absl::base absl::algorithm - absl::container + absl::base absl::debugging + absl::flat_hash_map + absl::flags absl::memory absl::meta absl::numeric + absl::random_random absl::strings absl::synchronization absl::time diff --git a/infra/cmake/packages/AbseilSourceConfig.cmake b/infra/cmake/packages/AbseilSourceConfig.cmake index 7c5d4bdeb..8be732660 100644 --- a/infra/cmake/packages/AbseilSourceConfig.cmake +++ b/infra/cmake/packages/AbseilSourceConfig.cmake @@ -12,10 +12,14 @@ function(_AbseilSource_import) # # The last change of "48cd2c3f351" was commited on 2018.09.27 # - # Let's use the latest released version (2018-12 release) - envoption(ABSEIL_URL https://github.com/abseil/abseil-cpp/archive/20181200.tar.gz) + # Let's use the latest released version (2020-02 release patch 2) + envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") + envoption(ABSEIL_URL ${EXTERNAL_DOWNLOAD_SERVER}/abseil/abseil-cpp/archive/20200225.2.tar.gz) - ExternalSource_Download(ABSEIL ${ABSEIL_URL}) + ExternalSource_Download(ABSEIL + DIRNAME ABSEIL + URL ${ABSEIL_URL} + CHECKSUM MD5=73f2b6e72f1599a9139170c29482ddc4) set(AbseilSource_DIR ${ABSEIL_SOURCE_DIR} PARENT_SCOPE) set(AbseilSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/BoostSourceConfig.cmake b/infra/cmake/packages/BoostSourceConfig.cmake index 07d1800df..ea2a6ca4b 100644 --- a/infra/cmake/packages/BoostSourceConfig.cmake +++ b/infra/cmake/packages/BoostSourceConfig.cmake @@ -1,11 +1,16 @@ function(_BoostSource_import) + if(NOT ${DOWNLOAD_BOOST}) + set(BoostSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT ${DOWNLOAD_BOOST}) + nnas_include(ExternalSourceTools) nnas_include(OptionTools) # EXTERNAL_DOWNLOAD_SERVER will be overwritten by CI server to use mirror server. envoption(EXTERNAL_DOWNLOAD_SERVER "http://sourceforge.net") set(BOOST_URL ${EXTERNAL_DOWNLOAD_SERVER}/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz) - ExternalSource_Get(BOOST ${DOWNLOAD_BOOST} ${BOOST_URL}) + ExternalSource_Download(BOOST ${BOOST_URL}) set(BoostSource_DIR ${BOOST_SOURCE_DIR} PARENT_SCOPE) set(BoostSource_FOUND ${BOOST_SOURCE_GET} PARENT_SCOPE) diff --git a/infra/cmake/packages/CaffeConfig.cmake b/infra/cmake/packages/CaffeConfig.cmake index 0d27ef4fe..3ae5440e6 100644 --- a/infra/cmake/packages/CaffeConfig.cmake +++ b/infra/cmake/packages/CaffeConfig.cmake @@ -20,7 +20,7 @@ function(_Caffe_import) return() endif() - find_package(HDF5 COMPONENTS HL QUIET) + nnas_find_package(HDF5 QUIET) if(NOT HDF5_FOUND) set(Caffe_FOUND FALSE PARENT_SCOPE) diff --git a/infra/cmake/packages/CpuinfoSourceConfig.cmake b/infra/cmake/packages/CpuinfoSourceConfig.cmake deleted file mode 100644 index 1f3b4773e..000000000 --- a/infra/cmake/packages/CpuinfoSourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_cpuinfoSource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(CPUINFO_URL ${EXTERNAL_DOWNLOAD_SERVER}/pytorch/cpuinfo/archive/d5e37adf1406cf899d7d9ec1d317c47506ccb970.tar.gz) - - ExternalSource_Get("CPUINFO" ${DOWNLOAD_NNPACK} ${CPUINFO_URL}) - - set(CPUINFO_SOURCE_DIR ${CPUINFO_SOURCE_DIR} PARENT_SCOPE) - set(CPUINFO_SOURCE_FOUND ${CPUINFO_SOURCE_GET} PARENT_SCOPE) -endfunction(_cpuinfoSource_import) - -_cpuinfoSource_import() diff --git a/infra/cmake/packages/Eigen-fd6845384b86Config.cmake b/infra/cmake/packages/Eigen-fd6845384b86Config.cmake new file mode 100644 index 000000000..e98856af5 --- /dev/null +++ b/infra/cmake/packages/Eigen-fd6845384b86Config.cmake @@ -0,0 +1,25 @@ +# NOTE TensorFlow 1.12 uses eigen commit ID fd6845384b86 + +# find_package rejects version with commit number. Commit ID is appended to the package name +# as a workaround. +# +# TODO Find a better way +function(_Eigen_import) + nnas_find_package(EigenSource-fd6845384b86 QUIET) + + if(NOT EigenSource-fd6845384b86_FOUND) + set(Eigen-fd6845384b86_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT EigenSource-fd6845384b86_FOUND) + + if(NOT TARGET eigen-fd6845384b86) + add_library(eigen-fd6845384b86 INTERFACE) + target_include_directories(eigen-fd6845384b86 INTERFACE "${EigenSource_DIR}") + # Add EIGEN_MPL2_ONLY to remove license issue posibility + target_compile_definitions(eigen-fd6845384b86 INTERFACE EIGEN_MPL2_ONLY) + endif(NOT TARGET eigen-fd6845384b86) + + set(Eigen-fd6845384b86_FOUND TRUE PARENT_SCOPE) +endfunction(_Eigen_import) + +_Eigen_import() diff --git a/infra/cmake/packages/EigenSource-fd6845384b86Config.cmake b/infra/cmake/packages/EigenSource-fd6845384b86Config.cmake index dc322cfc8..4a854e77b 100644 --- a/infra/cmake/packages/EigenSource-fd6845384b86Config.cmake +++ b/infra/cmake/packages/EigenSource-fd6845384b86Config.cmake @@ -11,6 +11,7 @@ function(_import) nnas_include(ExternalSourceTools) nnas_include(ThirdPartyTools) + # NOTE TensorFlow 1.12 downloads eigen from the following URL ThirdParty_URL(EIGEN_URL PACKAGE Eigen VERSION fd6845384b86) ExternalSource_Download(EIGEN diff --git a/infra/cmake/packages/EigenSourceConfig.cmake b/infra/cmake/packages/EigenSourceConfig.cmake index 14ed5e7e7..a0cbf82a9 100644 --- a/infra/cmake/packages/EigenSourceConfig.cmake +++ b/infra/cmake/packages/EigenSourceConfig.cmake @@ -7,10 +7,15 @@ function(_EigenSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - # NOTE The following URL comes from TensorFlow 1.7 - envoption(EIGEN_URL https://bitbucket.org/eigen/eigen/get/2355b229ea4c.tar.gz) + # NOTE TensorFlow 1.13.1 uses https://bitbucket.org/eigen/eigen/get/9f48e814419e.tar.gz + # but it has a issue https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1643 + # The following URL resolves above issue + envoption(EXTERNAL_DOWNLOAD_SERVER "https://bitbucket.org") + envoption(EIGEN_1_13_1_URL ${EXTERNAL_DOWNLOAD_SERVER}/eigen/eigen/get/88fc23324517.tar.gz) - ExternalSource_Download(EIGEN ${EIGEN_URL}) + ExternalSource_Download(EIGEN + DIRNAME EIGEN + URL ${EIGEN_1_13_1_URL}) set(EigenSource_DIR ${EIGEN_SOURCE_DIR} PARENT_SCOPE) set(EigenSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/Enum34SourceConfig.cmake b/infra/cmake/packages/Enum34SourceConfig.cmake deleted file mode 100644 index 04d22eb97..000000000 --- a/infra/cmake/packages/Enum34SourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_enum34Source_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://bitbucket.org") - set(ENUM34_URL ${EXTERNAL_DOWNLOAD_SERVER}/stoneleaf/enum34/get/1.1.6.tar.gz) - - ExternalSource_Get("PYTHON_ENUM" ${DOWNLOAD_NNPACK} ${ENUM34_URL}) - - set(PYTHON_ENUM_SOURCE_DIR ${PYTHON_ENUM_SOURCE_DIR} PARENT_SCOPE) - set(PYTHON_ENUM_SOURCE_FOUND ${PYTHON_ENUM_SOURCE_GET} PARENT_SCOPE) -endfunction(_enum34Source_import) - -_enum34Source_import() diff --git a/infra/cmake/packages/FP16SourceConfig.cmake b/infra/cmake/packages/FP16SourceConfig.cmake deleted file mode 100644 index c7e9db578..000000000 --- a/infra/cmake/packages/FP16SourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_FP16Source_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(FP16_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/FP16/archive/febbb1c163726b5db24bed55cc9dc42529068997.tar.gz) - - ExternalSource_Get("FP16" ${DOWNLOAD_NNPACK} ${FP16_URL}) - - set(FP16_SOURCE_DIR ${FP16_SOURCE_DIR} PARENT_SCOPE) - set(FP16_SOURCE_FOUND ${FP16_SOURCE_GET} PARENT_SCOPE) -endfunction(_FP16Source_import) - -_FP16Source_import() diff --git a/infra/cmake/packages/FXdivSourceConfig.cmake b/infra/cmake/packages/FXdivSourceConfig.cmake deleted file mode 100644 index fa41adbc6..000000000 --- a/infra/cmake/packages/FXdivSourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_FXdivSource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(FXDIV_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/FXdiv/archive/f8c5354679ec2597792bc70a9e06eff50c508b9a.tar.gz) - - ExternalSource_Get("FXDIV" ${DOWNLOAD_NNPACK} ${FXDIV_URL}) - - set(FXDIV_SOURCE_DIR ${FXDIV_SOURCE_DIR} PARENT_SCOPE) - set(FXDIV_SOURCE_FOUND ${FXDIV_SOURCE_GET} PARENT_SCOPE) -endfunction(_FXdivSource_import) - -_FXdivSource_import() diff --git a/infra/cmake/packages/FarmhashSourceConfig.cmake b/infra/cmake/packages/FarmhashSourceConfig.cmake index 66cadab87..8a9a384df 100644 --- a/infra/cmake/packages/FarmhashSourceConfig.cmake +++ b/infra/cmake/packages/FarmhashSourceConfig.cmake @@ -7,10 +7,12 @@ function(_FarmhashSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - # NOTE TensorFlow 1.7 downloads farmhash from the following URL - envoption(FARMHASH_URL https://github.com/google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz) + # NOTE TensorFlow 1.12 downloads farmhash from the following URL + # TensorFlow 1.13.1 downloads farmhash from the following URL + # TensorFlow 2.3-rc0 downloads farmhash from the following URL + envoption(FARMHASH_1_12_URL https://github.com/google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz) - ExternalSource_Download(FARMHASH ${FARMHASH_URL}) + ExternalSource_Download(FARMHASH ${FARMHASH_1_12_URL}) set(FarmhashSource_DIR ${FARMHASH_SOURCE_DIR} PARENT_SCOPE) set(FarmhashSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/FlatBuffersSource-1.10/FlatBuffersSourceConfig.cmake b/infra/cmake/packages/FlatBuffersSource-1.10/FlatBuffersSourceConfig.cmake index 5a7aa3aea..09a922b67 100644 --- a/infra/cmake/packages/FlatBuffersSource-1.10/FlatBuffersSourceConfig.cmake +++ b/infra/cmake/packages/FlatBuffersSource-1.10/FlatBuffersSourceConfig.cmake @@ -8,8 +8,11 @@ function(_FlatBuffersSource_import) nnas_include(OptionTools) envoption(FLATBUFFERS_1_10_URL https://github.com/google/flatbuffers/archive/v1.10.0.tar.gz) - - ExternalSource_Download(FLATBUFFERS DIRNAME FLATBUFFERS-1.10 ${FLATBUFFERS_1_10_URL}) + ExternalSource_Download(FLATBUFFERS + DIRNAME FLATBUFFERS-1.10 + CHECKSUM MD5=f7d19a3f021d93422b0bc287d7148cd2 + URL ${FLATBUFFERS_1_10_URL} + ) set(FlatBuffersSource_DIR ${FLATBUFFERS_SOURCE_DIR} PARENT_SCOPE) set(FlatBuffersSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/FlatBuffersSource-1.8/FlatBuffersSourceConfig.cmake b/infra/cmake/packages/FlatBuffersSource-1.11/FlatBuffersSourceConfig.cmake index a44f3254f..92efbf97e 100644 --- a/infra/cmake/packages/FlatBuffersSource-1.8/FlatBuffersSourceConfig.cmake +++ b/infra/cmake/packages/FlatBuffersSource-1.11/FlatBuffersSourceConfig.cmake @@ -7,9 +7,12 @@ function(_FlatBuffersSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - envoption(FLATBUFFERS_1_8_URL https://github.com/google/flatbuffers/archive/v1.8.0.tar.gz) - - ExternalSource_Download(FLATBUFFERS DIRNAME FLATBUFFERS-1.8 ${FLATBUFFERS_1_8_URL}) + envoption(FLATBUFFERS_1_11_URL https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz) + ExternalSource_Download(FLATBUFFERS + DIRNAME FLATBUFFERS-1.11 + CHECKSUM MD5=02c64880acb89dbd57eebacfd67200d8 + URL ${FLATBUFFERS_1_11_URL} + ) set(FlatBuffersSource_DIR ${FLATBUFFERS_SOURCE_DIR} PARENT_SCOPE) set(FlatBuffersSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/FlatBuffersSource-1.8/FlatBuffersSourceConfigVersion.cmake b/infra/cmake/packages/FlatBuffersSource-1.11/FlatBuffersSourceConfigVersion.cmake index ac5e9b2b9..f008e0528 100644 --- a/infra/cmake/packages/FlatBuffersSource-1.8/FlatBuffersSourceConfigVersion.cmake +++ b/infra/cmake/packages/FlatBuffersSource-1.11/FlatBuffersSourceConfigVersion.cmake @@ -1,4 +1,4 @@ -set(PACKAGE_VERSION "1.8") +set(PACKAGE_VERSION "1.11") set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/infra/cmake/packages/FlatBuffersSourceConfig.cmake b/infra/cmake/packages/FlatBuffersSourceConfig.cmake index a35bc3727..52bce6de0 100644 --- a/infra/cmake/packages/FlatBuffersSourceConfig.cmake +++ b/infra/cmake/packages/FlatBuffersSourceConfig.cmake @@ -15,8 +15,11 @@ function(_FlatBuffersSource_import) # # TODO Manage multiple versions envoption(FLATBUFFERS_URL https://github.com/google/flatbuffers/archive/v1.10.0.tar.gz) - - ExternalSource_Download(FLATBUFFERS ${FLATBUFFERS_URL}) + ExternalSource_Download(FLATBUFFERS + DIRNAME FLATBUFFERS + CHECKSUM MD5=f7d19a3f021d93422b0bc287d7148cd2 + URL ${FLATBUFFERS_URL} + ) set(FlatBuffersSource_DIR ${FLATBUFFERS_SOURCE_DIR} PARENT_SCOPE) set(FlatBuffersSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/GEMMLowpSourceConfig.cmake b/infra/cmake/packages/GEMMLowpSourceConfig.cmake index f5fe9d771..6e1cfa9c9 100644 --- a/infra/cmake/packages/GEMMLowpSourceConfig.cmake +++ b/infra/cmake/packages/GEMMLowpSourceConfig.cmake @@ -7,8 +7,9 @@ function(_GEMMLowpSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - # NOTE TensorFlow 1.7 uses the following URL - envoption(GEMMLOWP_URL https://github.com/google/gemmlowp/archive/7c7c744640ddc3d0af18fb245b4d23228813a71b.zip) + # NOTE TensorFlow 1.12 uses the following URL + # TensorFlow 1.13.1 uses the following URL + envoption(GEMMLOWP_URL https://github.com/google/gemmlowp/archive/38ebac7b059e84692f53e5938f97a9943c120d98.tar.gz) ExternalSource_Download(GEMMLOWP ${GEMMLOWP_URL}) diff --git a/infra/cmake/packages/HDF5Config.cmake b/infra/cmake/packages/HDF5Config.cmake new file mode 100644 index 000000000..e282e0bc9 --- /dev/null +++ b/infra/cmake/packages/HDF5Config.cmake @@ -0,0 +1,70 @@ +function(_HDF5_build) + if(NOT BUILD_HDF5) + return() + endif(NOT BUILD_HDF5) + + nnas_find_package(HDF5Source QUIET) + + if(NOT HDF5Source_FOUND) + return() + endif(NOT HDF5Source_FOUND) + + nnas_include(ExternalBuildTools) + ExternalBuild_CMake(CMAKE_DIR ${HDF5Source_DIR} + BUILD_DIR ${CMAKE_BINARY_DIR}/externals/HDF5/build + INSTALL_DIR ${EXT_OVERLAY_DIR} + IDENTIFIER "1.8.16" + PKG_NAME "HDF5" + EXTRA_OPTS "-DBUILD_SHARED_LIBS:BOOL=ON" + "-DHDF5_BUILD_TOOLS:BOOL=ON" + "-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF" + "-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") + +endfunction(_HDF5_build) + +_HDF5_build() + +find_path(HDF5_CONFIG_DIR "hdf5-config.cmake" + PATHS ${EXT_OVERLAY_DIR} + PATH_SUFFIXES + share/cmake + share/cmake/hdf5 + cmake/hdf5 + lib/cmake/hdf5) + +include(${HDF5_CONFIG_DIR}/hdf5-config.cmake) + +unset(HDF5_INCLUDE_DIRS) +unset(HDF5_C_INCLUDE_DIRS) +unset(HDF5_CXX_INCLUDE_DIRS) +unset(HDF5_HL_INCLUDE_DIRS) + +unset(HDF5_LIBRARIES) +unset(HDF5_HL_LIBRARIES) +unset(HDF5_C_LIBRARIES) +unset(HDF5_CXX_LIBRARIES) +unset(HDF5_C_HL_LIBRARIES) +unset(HDF5_CXX_HL_LIBRARIES) + +# If user doesn't specify static or shared, set it to shared by default +list(FIND HDF5_FIND_COMPONENTS "STATIC" _index) +if(${_index} GREATER -1) + # static + set(_SUFFIX "-static") +else() + # shared + set(_SUFFIX "-shared") +endif() + +list(REMOVE_ITEM HDF5_FIND_COMPONENTS "static;shared") +set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) +foreach(COMP HDF5_FIND_COMPONENTS) + set(HDF5_${COMP}_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) +endforeach() + +set(HDF5_LIBRARIES "hdf5${_SUFFIX}") +set(HDF5_C_LIBRARIES "hdf5${_SUFFIX}") +set(HDF5_CXX_LIBRARIES "hdf5_cpp${_SUFFIX}") +set(HDF5_HL_LIBRARIES "hdf5_hl${_SUFFIX}") +set(HDF5_C_HL_LIBRARIES "hdf5_hl${_SUFFIX}") +set(HDF5_CXX_HL_LIBRARIES "hdf5_hl_cpp${_SUFFIX}") diff --git a/infra/cmake/packages/HDF5SourceConfig.cmake b/infra/cmake/packages/HDF5SourceConfig.cmake new file mode 100644 index 000000000..134efa6f4 --- /dev/null +++ b/infra/cmake/packages/HDF5SourceConfig.cmake @@ -0,0 +1,18 @@ +function(_HDF5Source_import) + if(NOT DOWNLOAD_HDF5) + set(HDF5Source_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT DOWNLOAD_HDF5) + + nnas_include(ExternalSourceTools) + nnas_include(OptionTools) + + envoption(HDF5_URL https://github.com/HDFGroup/hdf5/archive/hdf5-1_8_16.tar.gz) + + ExternalSource_Download(HDF5 ${HDF5_URL}) + + set(HDF5Source_DIR ${HDF5_SOURCE_DIR} PARENT_SCOPE) + set(HDF5Source_FOUND TRUE PARENT_SCOPE) +endfunction(_HDF5Source_import) + +_HDF5Source_import() diff --git a/infra/cmake/packages/NEON2SSESourceConfig.cmake b/infra/cmake/packages/NEON2SSESourceConfig.cmake index c6585c0ca..5970ec73e 100644 --- a/infra/cmake/packages/NEON2SSESourceConfig.cmake +++ b/infra/cmake/packages/NEON2SSESourceConfig.cmake @@ -7,10 +7,12 @@ function(_NEON2SSESource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - # NOTE TensorFlow 1.7 downloads NEON2SSE from the following URL - envoption(NEON2SSE_URL https://github.com/intel/ARM_NEON_2_x86_SSE/archive/0f77d9d182265259b135dad949230ecbf1a2633d.tar.gz) + # NOTE TensorFlow 1.12 downloads NEON2SSE from the following URL + # NOTE TensorFlow 1.13.1 downloads NEON2SSE from the following URL + # NOTE TensorFlow 2.2 downloads NEON2SSE from the following URL + envoption(NEON2SSE_1_12_URL https://github.com/intel/ARM_NEON_2_x86_SSE/archive/1200fe90bb174a6224a525ee60148671a786a71f.tar.gz) - ExternalSource_Download(NEON2SSE ${NEON2SSE_URL}) + ExternalSource_Download(NEON2SSE ${NEON2SSE_1_12_URL}) set(NEON2SSESource_DIR ${NEON2SSE_SOURCE_DIR} PARENT_SCOPE) set(NEON2SSESource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/NNPACKConfig.cmake b/infra/cmake/packages/NNPACKConfig.cmake deleted file mode 100644 index 31a02a6b4..000000000 --- a/infra/cmake/packages/NNPACKConfig.cmake +++ /dev/null @@ -1,51 +0,0 @@ -function(_NNPACK_Import) - nnas_find_package(NNPACKSource QUIET) - - if(NOT NNPACK_SOURCE_FOUND) - set(NNPACK_FOUND FALSE PARENT_SCOPE) - message(STATUS "NNPACK not found") - return() - endif(NOT NNPACK_SOURCE_FOUND) - - nnas_find_package(CpuinfoSource REQUIRED) - nnas_find_package(FP16Source REQUIRED) - nnas_find_package(FXdivSource REQUIRED) - nnas_find_package(PSIMDSource REQUIRED) - nnas_find_package(PthreadpoolSource REQUIRED) - nnas_find_package(SixSource REQUIRED) - nnas_find_package(Enum34Source REQUIRED) - nnas_find_package(OpcodesSource REQUIRED) - nnas_find_package(PeachpySource QUIET) - - if(NOT PYTHON_PEACHPY_SOURCE_FOUND) - set(NNPACK_FOUND FALSE PARENT_SCOPE) - return() - endif(NOT PYTHON_PEACHPY_SOURCE_FOUND) - - # workaround for CI - set(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by CMakeLists.txt." FORCE) - if(NOT TARGET nnpack) - # Allows us to build nnpack at build time - set(NNPACK_BUILD_TESTS OFF CACHE BOOL "") - set(NNPACK_BUILD_BENCHMARKS OFF CACHE BOOL "") - set(NNPACK_LIBRARY_TYPE "static" CACHE STRING "") - set(PTHREADPOOL_LIBRARY_TYPE "static" CACHE STRING "") - set(CPUINFO_LIBRARY_TYPE "static" CACHE STRING "") - nnas_include(ExternalProjectTools) - add_extdirectory("${NNPACK_SOURCE_DIR}" nnpack EXCLUDE_FROM_ALL) - # We build static versions of nnpack and pthreadpool but link - # them into a shared library (high-perf-backend), so they need PIC. - set_property(TARGET nnpack PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET pthreadpool PROPERTY POSITION_INDEPENDENT_CODE ON) - set_property(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON) - endif() - - set(NNPACK_FOUND TRUE PARENT_SCOPE) - set(NNPACK_INCLUDE_DIRS - $<TARGET_PROPERTY:nnpack,INCLUDE_DIRECTORIES> - $<TARGET_PROPERTY:pthreadpool,INCLUDE_DIRECTORIES> PARENT_SCOPE) - set(NNPACK_LIBRARIES $<TARGET_FILE:nnpack> $<TARGET_FILE:cpuinfo> PARENT_SCOPE) - -endfunction(_NNPACK_Import) - -_NNPACK_Import() diff --git a/infra/cmake/packages/NNPACKSourceConfig.cmake b/infra/cmake/packages/NNPACKSourceConfig.cmake deleted file mode 100644 index 10a08ea7c..000000000 --- a/infra/cmake/packages/NNPACKSourceConfig.cmake +++ /dev/null @@ -1,20 +0,0 @@ -function(_NNPACKSource_import) - if(NOT DOWNLOAD_NNPACK) - set(NNPACKSource_FOUND FALSE PARENT_SCOPE) - message(WARNING "NNPACK not downloaded") - return() - endif(NOT DOWNLOAD_NNPACK) - - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(NNPACK_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/NNPACK/archive/c039579abe21f5756e0f0e45e8e767adccc11852.tar.gz) - ExternalSource_Get("NNPACK" ${DOWNLOAD_NNPACK} ${NNPACK_URL}) - - set(NNPACK_SOURCE_DIR ${NNPACK_SOURCE_DIR} PARENT_SCOPE) - set(NNPACK_INCLUDE_DIR ${NNPACK_SOURCE_DIR}/include PARENT_SCOPE) - set(NNPACK_SOURCE_FOUND ${NNPACK_SOURCE_GET} PARENT_SCOPE) -endfunction(_NNPACKSource_import) - -_NNPACKSource_import() diff --git a/infra/cmake/packages/NoniusConfig.cmake b/infra/cmake/packages/NoniusConfig.cmake deleted file mode 100644 index fa18ebbdf..000000000 --- a/infra/cmake/packages/NoniusConfig.cmake +++ /dev/null @@ -1,26 +0,0 @@ -function(_Nonius_import) - nnas_find_package(NoniusSource QUIET) - - if(NOT NoniusSource_FOUND) - set(Nonius_FOUND FALSE PARENT_SCOPE) - return() - endif(NOT NoniusSource_FOUND) - - if(NOT TARGET nonius) - message(STATUS "Found nonius: TRUE") - add_library(nonius INTERFACE) - target_include_directories(nonius INTERFACE "${NoniusSource_DIR}/include") - endif(NOT TARGET nonius) - - if(BUILD_KBENCHMARK) - # Copy html_report_template.g.h++ file to externals/nonius. - # This header file is modified to show the html summary view according to the layer in kbenchmark. - execute_process(COMMAND ${CMAKE_COMMAND} -E copy - "${CMAKE_CURRENT_LIST_DIR}/Nonius/html_report_template.g.h++" - "${NoniusSource_DIR}/include/nonius/detail") - endif(BUILD_KBENCHMARK) - - set(Nonius_FOUND TRUE PARENT_SCOPE) -endfunction(_Nonius_import) - -_Nonius_import() diff --git a/infra/cmake/packages/NoniusSourceConfig.cmake b/infra/cmake/packages/NoniusSourceConfig.cmake index 16de63918..0af23ef0e 100644 --- a/infra/cmake/packages/NoniusSourceConfig.cmake +++ b/infra/cmake/packages/NoniusSourceConfig.cmake @@ -1,10 +1,23 @@ function(_NoniusSource_import) + if(NOT ${DOWNLOAD_NONIUS}) + set(NoniusSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT ${DOWNLOAD_NONIUS}) + nnas_include(ExternalSourceTools) nnas_include(OptionTools) envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") set(NONIUS_URL ${EXTERNAL_DOWNLOAD_SERVER}/libnonius/nonius/archive/v1.2.0-beta.1.tar.gz) - ExternalSource_Get("NONIUS" ${DOWNLOAD_NONIUS} ${NONIUS_URL}) + ExternalSource_Download("NONIUS" ${NONIUS_URL}) + + if(BUILD_KBENCHMARK) + # Copy html_report_template.g.h++ file to externals/nonius. + # This header file is modified to show the html summary view according to the layer in kbenchmark. + execute_process(COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_CURRENT_LIST_DIR}/Nonius/html_report_template.g.h++" + "${NoniusSource_DIR}/include/nonius/detail") + endif(BUILD_KBENCHMARK) set(NoniusSource_DIR ${NONIUS_SOURCE_DIR} PARENT_SCOPE) set(NoniusSource_FOUND ${NONIUS_SOURCE_GET} PARENT_SCOPE) diff --git a/infra/cmake/packages/OpcodesSourceConfig.cmake b/infra/cmake/packages/OpcodesSourceConfig.cmake deleted file mode 100644 index 8b324ea57..000000000 --- a/infra/cmake/packages/OpcodesSourceConfig.cmake +++ /dev/null @@ -1,13 +0,0 @@ -function(_PeachpySource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(PEACHPY_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/Opcodes/archive/6e2b0cd9f1403ecaf164dea7019dd54db5aea252.tar.gz) - ExternalSource_Get("PYTHON_OPCODES" ${DOWNLOAD_NNPACK} ${PEACHPY_URL}) - - set(PYTHON_OPCODES_SOURCE_DIR ${PYTHON_OPCODES_SOURCE_DIR} PARENT_SCOPE) - set(PYTHON_OPCODES_SOURCE_FOUND ${PYTHON_OPCODES_SOURCE_GET} PARENT_SCOPE) -endfunction(_PeachpySource_import) - -_PeachpySource_import() diff --git a/infra/cmake/packages/PSIMDSourceConfig.cmake b/infra/cmake/packages/PSIMDSourceConfig.cmake deleted file mode 100644 index c14ad730d..000000000 --- a/infra/cmake/packages/PSIMDSourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_PSIMDSource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(PSIMD_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/psimd/archive/90a938f30ba414ada2f4b00674ee9631d7d85e19.tar.gz) - - ExternalSource_Get("PSIMD" ${DOWNLOAD_NNPACK} ${PSIMD_URL}) - - set(PSIMD_SOURCE_DIR ${PSIMD_SOURCE_DIR} PARENT_SCOPE) - set(PSIMD_SOURCE_FOUND ${PSIMD_SOURCE_GET} PARENT_SCOPE) -endfunction(_PSIMDSource_import) - -_PSIMDSource_import() diff --git a/infra/cmake/packages/PeachpySourceConfig.cmake b/infra/cmake/packages/PeachpySourceConfig.cmake deleted file mode 100644 index fea8d14a7..000000000 --- a/infra/cmake/packages/PeachpySourceConfig.cmake +++ /dev/null @@ -1,31 +0,0 @@ -function(_PeachpySource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(PEACHPY_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/PeachPy/archive/01d15157a973a4ae16b8046313ddab371ea582db.tar.gz) - - ExternalSource_Get("PYTHON_PEACHPY" ${DOWNLOAD_NNPACK} ${PEACHPY_URL}) - FIND_PACKAGE(PythonInterp) - - nnfw_find_package(SixSource REQUIRED) - nnfw_find_package(Enum34Source REQUIRED) - nnfw_find_package(OpcodesSource REQUIRED) - - # Generate opcodes: - SET(ENV{PYTHONPATH} ${PYTHON_PEACHPY_SOURCE_DIR}:${PYTHON_SIX_SOURCE_DIR}:${PYTHON_ENUM_SOURCE_DIR}:${PYTHON_OPCODES_SOURCE_DIR}) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ./codegen/x86_64.py - WORKING_DIRECTORY ${PYTHON_PEACHPY_SOURCE_DIR} - RESULT_VARIABLE BUILT_PP) - - if(NOT BUILT_PP EQUAL 0) - # Mark PYTHON_PEACHPY_SOURCE_FOUND as FALSE if source generation fails - set(PYTHON_PEACHPY_SOURCE_FOUND FALSE PARENT_SCOPE) - return() - endif(NOT BUILT_PP EQUAL 0) - - set(PYTHON_PEACHPY_SOURCE_DIR ${PYTHON_PEACHPY_SOURCE_DIR} PARENT_SCOPE) - set(PYTHON_PEACHPY_SOURCE_FOUND ${PYTHON_PEACHPY_SOURCE_GET} PARENT_SCOPE) -endfunction(_PeachpySource_import) - -_PeachpySource_import() diff --git a/infra/cmake/packages/PthreadpoolSourceConfig.cmake b/infra/cmake/packages/PthreadpoolSourceConfig.cmake deleted file mode 100644 index a570a9957..000000000 --- a/infra/cmake/packages/PthreadpoolSourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_pthreadpoolSource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(PTHREADPOOL_URL ${EXTERNAL_DOWNLOAD_SERVER}/Maratyszcza/pthreadpool/archive/6673a4c71fe35e077c6843a74017d9c25610c537.tar.gz) - - ExternalSource_Get("PTHREADPOOL" ${DOWNLOAD_NNPACK} ${PTHREADPOOL_URL}) - - set(PTHREADPOOL_SOURCE_DIR ${PTHREADPOOL_SOURCE_DIR} PARENT_SCOPE) - set(PTHREADPOOL_SOURCE_FOUND ${PTHREADPOOL_SOURCE_GET} PARENT_SCOPE) -endfunction(_pthreadpoolSource_import) - -_pthreadpoolSource_import() diff --git a/infra/cmake/packages/SixSourceConfig.cmake b/infra/cmake/packages/SixSourceConfig.cmake deleted file mode 100644 index f6f85ca7a..000000000 --- a/infra/cmake/packages/SixSourceConfig.cmake +++ /dev/null @@ -1,14 +0,0 @@ -function(_SIXSource_import) - nnas_include(ExternalSourceTools) - nnas_include(OptionTools) - - envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") - set(six_URL ${EXTERNAL_DOWNLOAD_SERVER}/benjaminp/six/archive/1.11.0.tar.gz) - - ExternalSource_Get("PYTHON_SIX" ${DOWNLOAD_NNPACK} ${six_URL}) - - set(PYTHON_SIX_SOURCE_DIR ${PYTHON_SIX_SOURCE_DIR} PARENT_SCOPE) - set(PYTHON_SIX_SOURCE_FOUND ${PYTHON_SIX_SOURCE_GET} PARENT_SCOPE) -endfunction(_SIXSource_import) - -_SIXSource_import() diff --git a/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfig.cmake b/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfig.cmake new file mode 100644 index 000000000..f84675596 --- /dev/null +++ b/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfig.cmake @@ -0,0 +1,20 @@ +function(_TensorFlowEigenSource_import) + if(NOT DOWNLOAD_EIGEN) + set(TensorFlowEigenSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT DOWNLOAD_EIGEN) + + nnas_include(ExternalSourceTools) + nnas_include(OptionTools) + + # Exact version used by TensorFlow v2.1.0. + # See tensorflow/tensorflow/workspace.bzl. + envoption(TENSORFLOW_2_1_0_EIGEN_URL https://gitlab.com/libeigen/eigen/-/archive/4e696901f873a2347f76d931cf2f701e31e15d05/eigen-4e696901f873a2347f76d931cf2f701e31e15d05.tar.gz) + + ExternalSource_Download(EIGEN DIRNAME TENSORFLOW-2.1.0-EIGEN ${TENSORFLOW_2_1_0_EIGEN_URL}) + + set(TensorFlowEigenSource_DIR ${EIGEN_SOURCE_DIR} PARENT_SCOPE) + set(TensorFlowEigenSource_FOUND TRUE PARENT_SCOPE) +endfunction(_TensorFlowEigenSource_import) + +_TensorFlowEigenSource_import() diff --git a/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfigVersion.cmake b/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfigVersion.cmake new file mode 100644 index 000000000..80f43dde8 --- /dev/null +++ b/infra/cmake/packages/TensorFlowEigenSource-2.1.0/TensorFlowEigenSourceConfigVersion.cmake @@ -0,0 +1,10 @@ +set(PACKAGE_VERSION "2.1.0") +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_UNSUITABLE TRUE) + +if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + set(PACKAGE_VERSION_UNSUITABLE FALSE) +endif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) diff --git a/infra/cmake/packages/TensorFlowEigenSource-2.3.0-rc0Config.cmake b/infra/cmake/packages/TensorFlowEigenSource-2.3.0-rc0Config.cmake new file mode 100644 index 000000000..207f7b5bd --- /dev/null +++ b/infra/cmake/packages/TensorFlowEigenSource-2.3.0-rc0Config.cmake @@ -0,0 +1,23 @@ +function(_TensorFlowEigenSource_import) + if(NOT DOWNLOAD_EIGEN) + set(TensorFlowEigenSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT DOWNLOAD_EIGEN) + + nnas_include(ExternalSourceTools) + nnas_include(OptionTools) + + # NOTE TensorFlow 2.3.0-rc0 uses the following URL + envoption(EXTERNAL_DOWNLOAD_SERVER "https://gitlab.com") + envoption(TENSORFLOW_2_3_0_EIGEN_URL ${EXTERNAL_DOWNLOAD_SERVER}/libeigen/eigen/-/archive/386d809bde475c65b7940f290efe80e6a05878c4/eigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz) + + ExternalSource_Download(EIGEN + DIRNAME TENSORFLOW-2.3.0-EIGEN + URL ${TENSORFLOW_2_3_0_EIGEN_URL} +) + + set(TensorFlowEigenSource_DIR ${EIGEN_SOURCE_DIR} PARENT_SCOPE) + set(TensorFlowEigenSource_FOUND TRUE PARENT_SCOPE) +endfunction(_TensorFlowEigenSource_import) + +_TensorFlowEigenSource_import() diff --git a/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfig.cmake b/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfig.cmake new file mode 100644 index 000000000..035264fa9 --- /dev/null +++ b/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfig.cmake @@ -0,0 +1,20 @@ +function(_TensorFlowGEMMLowpSource_import) + if(NOT DOWNLOAD_GEMMLOWP) + set(TensorFlowGEMMLowpSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT DOWNLOAD_GEMMLOWP) + + nnas_include(ExternalSourceTools) + nnas_include(OptionTools) + + # Exact version used by TensorFlow v2.1.0. + # See tensorflow/tensorflow/workspace.bzl. + envoption(TENSORFLOW_2_1_0_GEMMLOWP_URL https://github.com/google/gemmlowp/archive/12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3.zip) + + ExternalSource_Download(GEMMLOWP DIRNAME TENSORFLOW-2.1.0-GEMMLOWP ${TENSORFLOW_2_1_0_GEMMLOWP_URL}) + + set(TensorFlowGEMMLowpSource_DIR ${GEMMLOWP_SOURCE_DIR} PARENT_SCOPE) + set(TensorFlowGEMMLowpSource_FOUND TRUE PARENT_SCOPE) +endfunction(_TensorFlowGEMMLowpSource_import) + +_TensorFlowGEMMLowpSource_import() diff --git a/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfigVersion.cmake b/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfigVersion.cmake new file mode 100644 index 000000000..80f43dde8 --- /dev/null +++ b/infra/cmake/packages/TensorFlowGEMMLowpSource-2.1.0/TensorFlowGEMMLowpSourceConfigVersion.cmake @@ -0,0 +1,10 @@ +set(PACKAGE_VERSION "2.1.0") +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_UNSUITABLE TRUE) + +if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + set(PACKAGE_VERSION_UNSUITABLE FALSE) +endif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) diff --git a/infra/cmake/packages/TensorFlowLite-1.12/Lite/CMakeLists.txt b/infra/cmake/packages/TensorFlowLite-1.12/Lite/CMakeLists.txt index 068022fcf..337d6b24f 100644 --- a/infra/cmake/packages/TensorFlowLite-1.12/Lite/CMakeLists.txt +++ b/infra/cmake/packages/TensorFlowLite-1.12/Lite/CMakeLists.txt @@ -38,4 +38,4 @@ if(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) target_compile_options(tensorflowlite-1.12 PUBLIC -Wno-extern-c-compat) endif(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) target_compile_definitions(tensorflowlite-1.12 PUBLIC "GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK") -target_link_libraries(tensorflowlite-1.12 eigen gemmlowp neon2sse farmhash abseil dl) +target_link_libraries(tensorflowlite-1.12 eigen-fd6845384b86 gemmlowp neon2sse farmhash abseil dl) diff --git a/infra/cmake/packages/TensorFlowLite-1.12/TensorFlowLiteConfig.cmake b/infra/cmake/packages/TensorFlowLite-1.12/TensorFlowLiteConfig.cmake index 750c61390..ff15d8576 100644 --- a/infra/cmake/packages/TensorFlowLite-1.12/TensorFlowLiteConfig.cmake +++ b/infra/cmake/packages/TensorFlowLite-1.12/TensorFlowLiteConfig.cmake @@ -23,12 +23,12 @@ function(_TensorFlowLite_import) return() endif(NOT Farmhash_FOUND) - nnas_find_package(Eigen QUIET) + nnas_find_package(Eigen-fd6845384b86 QUIET) - if(NOT Eigen_FOUND) + if(NOT Eigen-fd6845384b86_FOUND) set(TensorFlowLite_FOUND FALSE PARENT_SCOPE) return() - endif(NOT Eigen_FOUND) + endif(NOT Eigen-fd6845384b86_FOUND) nnas_find_package(GEMMLowp QUIET) diff --git a/infra/cmake/packages/TensorFlowLite-1.13.1/Lite/CMakeLists.txt b/infra/cmake/packages/TensorFlowLite-1.13.1/Lite/CMakeLists.txt new file mode 100644 index 000000000..c35617497 --- /dev/null +++ b/infra/cmake/packages/TensorFlowLite-1.13.1/Lite/CMakeLists.txt @@ -0,0 +1,46 @@ +# NOTE The followings SHOULD be defined before using this CMakeLists.txt +# +# 'TensorFlowSource_DIR' variable +# 'FlatBuffersSource_DIR' variable +# 'eigen' target +# 'gemmlowp' target +# 'neon2sse' target +# 'farmhash' target +# 'abseil' target +# +message(STATUS "Build TensorFlow Lite from ${TensorFlowSource_DIR}") + +set(TensorFlowLiteSource_DIR ${TensorFlowSource_DIR}/tensorflow/lite) + +file(GLOB CORE_SRCS + "${TensorFlowLiteSource_DIR}/*.c" + "${TensorFlowLiteSource_DIR}/*.cc" + "${TensorFlowLiteSource_DIR}/c/*.c" + "${TensorFlowLiteSource_DIR}/core/*.cc" + "${TensorFlowLiteSource_DIR}/core/api/*.cc") +file(GLOB_RECURSE CORE_TESTS "${TensorFlowLiteSource_DIR}/*test*.cc") +list(REMOVE_ITEM CORE_SRCS ${CORE_TESTS}) + +file(GLOB_RECURSE KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/*.cc") +file(GLOB_RECURSE KERNEL_TESTS "${TensorFlowLiteSource_DIR}/kernels/*test*.cc") +list(REMOVE_ITEM KERNEL_SRCS ${KERNEL_TESTS}) +# Exclude buggy kernel(s) from the build +#list(REMOVE_ITEM KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/internal/spectrogram.cc") + +list(APPEND SRCS ${CORE_SRCS}) +list(APPEND SRCS ${KERNEL_SRCS}) + +include(CheckCXXCompilerFlag) + +CHECK_CXX_COMPILER_FLAG(-Wno-extern-c-compat COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) + +add_library(tensorflowlite-1.13.1 ${SRCS}) +set_target_properties(tensorflowlite-1.13.1 PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_include_directories(tensorflowlite-1.13.1 PUBLIC ${TensorFlowSource_DIR}) +target_include_directories(tensorflowlite-1.13.1 PUBLIC ${FlatBuffersSource_DIR}/include) +target_compile_options(tensorflowlite-1.13.1 PUBLIC -Wno-ignored-attributes) +if(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) + target_compile_options(tensorflowlite-1.13.1 PUBLIC -Wno-extern-c-compat) +endif(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) +target_compile_definitions(tensorflowlite-1.13.1 PUBLIC "GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK") +target_link_libraries(tensorflowlite-1.13.1 eigen gemmlowp neon2sse farmhash abseil dl) diff --git a/infra/cmake/packages/TensorFlowLite-1.7/TensorFlowLiteConfig.cmake b/infra/cmake/packages/TensorFlowLite-1.13.1/TensorFlowLiteConfig.cmake index 79b58e8d8..2c6bd9f7a 100644 --- a/infra/cmake/packages/TensorFlowLite-1.7/TensorFlowLiteConfig.cmake +++ b/infra/cmake/packages/TensorFlowLite-1.13.1/TensorFlowLiteConfig.cmake @@ -1,15 +1,12 @@ function(_TensorFlowLite_import) - nnas_find_package(TensorFlowSource EXACT 1.7 QUIET) + nnas_find_package(TensorFlowSource EXACT 1.13.1 QUIET) if(NOT TensorFlowSource_FOUND) set(TensorFlowLite_FOUND FALSE PARENT_SCOPE) return() endif(NOT TensorFlowSource_FOUND) - # TensorFlow 1.7 downloads FlatBuffers from https://github.com/google/flatbuffers/archive/971a68110e4.tar.gz - # - # FlatBuffers 1.8 is compatible with 971a68110e4. - nnas_find_package(FlatBuffersSource EXACT 1.8 QUIET) + nnas_find_package(FlatBuffersSource EXACT 1.10 QUIET) if(NOT FlatBuffersSource_FOUND) set(TensorFlowLite_FOUND FALSE PARENT_SCOPE) @@ -44,10 +41,17 @@ function(_TensorFlowLite_import) return() endif(NOT NEON2SSE_FOUND) - if(NOT TARGET tensorflowlite-1.7) + nnas_find_package(Abseil QUIET) + + if(NOT Abseil_FOUND) + set(TensorFlowLite_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT Abseil_FOUND) + + if(NOT TARGET tensorflowlite-1.13.1) nnas_include(ExternalProjectTools) - add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/Lite" tflite-1.7) - endif(NOT TARGET tensorflowlite-1.7) + add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/Lite" tflite-1.13.1) + endif(NOT TARGET tensorflowlite-1.13.1) set(TensorFlowLite_FOUND TRUE PARENT_SCOPE) endfunction(_TensorFlowLite_import) diff --git a/infra/cmake/packages/TensorFlowLite-1.7/TensorFlowLiteConfigVersion.cmake b/infra/cmake/packages/TensorFlowLite-1.13.1/TensorFlowLiteConfigVersion.cmake index 46609dc10..ed79ecd91 100644 --- a/infra/cmake/packages/TensorFlowLite-1.7/TensorFlowLiteConfigVersion.cmake +++ b/infra/cmake/packages/TensorFlowLite-1.13.1/TensorFlowLiteConfigVersion.cmake @@ -1,4 +1,4 @@ -set(PACKAGE_VERSION "1.7") +set(PACKAGE_VERSION "1.13.1") set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/infra/cmake/packages/TensorFlowLite-1.7/Lite/CMakeLists.txt b/infra/cmake/packages/TensorFlowLite-1.7/Lite/CMakeLists.txt deleted file mode 100644 index c5e89eebe..000000000 --- a/infra/cmake/packages/TensorFlowLite-1.7/Lite/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# NOTE The followings SHOULD be defined before using this CMakeLists.txt -# -# 'TensorFlowSource_DIR' variable -# 'FlatBuffersSource_DIR' variable -# 'eigen' target -# 'gemmlowp' target -# 'neon2sse' target -# 'farmhash' target -# -set(TensorFlowLiteSource_DIR ${TensorFlowSource_DIR}/tensorflow/contrib/lite) - -file(GLOB CORE_SRCS "${TensorFlowLiteSource_DIR}/*.c" "${TensorFlowLiteSource_DIR}/*.cc") -file(GLOB CORE_TESTS "${TensorFlowLiteSource_DIR}/*test*.cc") -list(REMOVE_ITEM CORE_SRCS ${CORE_TESTS}) - -file(GLOB_RECURSE KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/*.cc") -file(GLOB_RECURSE KERNEL_TESTS "${TensorFlowLiteSource_DIR}/kernels/*test*.cc") -list(REMOVE_ITEM KERNEL_SRCS ${KERNEL_TESTS}) -# Exclude buggy kernel(s) from the build -list(REMOVE_ITEM KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/internal/spectrogram.cc") - -list(APPEND SRCS ${CORE_SRCS}) -list(APPEND SRCS ${KERNEL_SRCS}) - -include(CheckCXXCompilerFlag) - -CHECK_CXX_COMPILER_FLAG(-Wno-extern-c-compat COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) - -add_library(tensorflowlite-1.7 ${SRCS}) -set_target_properties(tensorflowlite-1.7 PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_include_directories(tensorflowlite-1.7 PUBLIC ${TensorFlowSource_DIR}) -target_include_directories(tensorflowlite-1.7 PUBLIC ${FlatBuffersSource_DIR}/include) -target_compile_options(tensorflowlite-1.7 PUBLIC -Wno-ignored-attributes) -if(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) - target_compile_options(tensorflowlite-1.7 PUBLIC -Wno-extern-c-compat) -endif(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING) -target_compile_definitions(tensorflowlite-1.7 PUBLIC "GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK") -target_link_libraries(tensorflowlite-1.7 eigen gemmlowp neon2sse farmhash dl) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.12/TensorFlowProtoTextConfig.cmake b/infra/cmake/packages/TensorFlowProtoText-1.12/TensorFlowProtoTextConfig.cmake index 01d74a5c3..9c7c79679 100644 --- a/infra/cmake/packages/TensorFlowProtoText-1.12/TensorFlowProtoTextConfig.cmake +++ b/infra/cmake/packages/TensorFlowProtoText-1.12/TensorFlowProtoTextConfig.cmake @@ -10,7 +10,7 @@ function(_TensorFlowProtoText_import) require_package(TensorFlowSource EXACT 1.12) require_package(Abseil) - require_package(Eigen) + require_package(Eigen-fd6845384b86) require_package(Protobuf) require_package(GoogleDoubleConversion) require_package(GoogleNSync) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.12/build/CMakeLists.txt b/infra/cmake/packages/TensorFlowProtoText-1.12/build/CMakeLists.txt index 86d6e6fe5..ac8e43b7a 100644 --- a/infra/cmake/packages/TensorFlowProtoText-1.12/build/CMakeLists.txt +++ b/infra/cmake/packages/TensorFlowProtoText-1.12/build/CMakeLists.txt @@ -71,7 +71,7 @@ target_include_directories(tensorflow-prototext-1.12 PRIVATE ${TensorFlowSource_ target_include_directories(tensorflow-prototext-1.12 PRIVATE ${PROTO_TEXT_PROTO_INCLUDE_DIRS}) target_link_libraries(tensorflow-prototext-1.12 PRIVATE abseil) -target_link_libraries(tensorflow-prototext-1.12 PRIVATE eigen) +target_link_libraries(tensorflow-prototext-1.12 PRIVATE eigen-fd6845384b86) target_link_libraries(tensorflow-prototext-1.12 PRIVATE ${PROTO_TEXT_PROTO_LIBRARIES}) target_link_libraries(tensorflow-prototext-1.12 PRIVATE Google::DoubleConversion) target_link_libraries(tensorflow-prototext-1.12 PRIVATE Google::NSync) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfig.cmake b/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfig.cmake new file mode 100644 index 000000000..738b28240 --- /dev/null +++ b/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfig.cmake @@ -0,0 +1,104 @@ +function(_TensorFlowProtoText_import) + macro(require_package PKGNAME) + nnas_find_package(${PKGNAME} ${ARGN} QUIET) + if(NOT ${PKGNAME}_FOUND) + message(STATUS "Found TensorFlowProtoText: FALSE (${PKGNAME} is missing)") + set(TensorFlowProtoText_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT ${PKGNAME}_FOUND) + endmacro(require_package) + + require_package(TensorFlowSource EXACT 1.13.1) + require_package(Abseil) + require_package(Eigen) + require_package(Protobuf) + require_package(GoogleDoubleConversion) + require_package(GoogleNSync) + + if(NOT TARGET tensorflow-prototext-1.13.1) + nnas_include(ExternalProjectTools) + add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/build" TensorFlowProtoText-1.13.1) + endif(NOT TARGET tensorflow-prototext-1.13.1) + + set(TensorFlowProtoText_FOUND TRUE PARENT_SCOPE) +endfunction(_TensorFlowProtoText_import) + +_TensorFlowProtoText_import() + +if(TensorFlowProtoText_FOUND) + # CMAKE_CURRENT_LIST_DIR + # + # ... The value has dynamic scope. ... Therefore the value of the variable inside a macro + # or function is the directory of the file invoking the bottom-most entry on the call stack, + # not the directory of the file containing the macro or function definition. + # + # Reference: https://cmake.org/cmake/help/v3.1/variable/CMAKE_CURRENT_LIST_DIR.html + set(TENSORLFLOW_PROTO_TEXT_1_13_1_CMAKE_DIR + "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL + "Where to find make_directories" + ) + + # Comments from "gen_proto_text_functions.cc" + # > + # > Main program to take input protos and write output pb_text source files that + # > contain generated proto text input and output functions. + # > + # > Main expects: + # > - First argument is output path + # > - Second argument is the relative path of the protos to the root. E.g., + # > for protos built by a rule in tensorflow/core, this will be + # > tensorflow/core. + # > - Then any number of source proto file names, plus one source name must be + # > placeholder.txt from this gen tool's package. placeholder.txt is + # > ignored for proto resolution, but is used to determine the root at which + # > the build tool has placed the source proto files. + # > + function(ProtoText_Generate PREFIX OUTPUT_DIR) + # THIS SHOULD SUCCEED! + nnas_find_package(TensorFlowSource EXACT 1.13.1 REQUIRED) + + set(OUTPUT_REL "tensorflow") + set(PROTO_DIR "${TensorFlowSource_DIR}") + + set(PROTO_INPUTS ${ARGN}) + list(APPEND PROTO_INPUTS "tensorflow/tools/proto_text/placeholder.txt") + + get_filename_component(abs_output_dir ${OUTPUT_DIR} ABSOLUTE) + get_filename_component(abs_proto_dir ${TensorFlowSource_DIR} ABSOLUTE) + + # Let's reset variables before using them + # NOTE This DOES NOT AFFECT variables in the parent scope + unset(PROTO_FILES) + unset(OUTPUT_DIRS) + unset(OUTPUT_FILES) + + foreach(proto ${PROTO_INPUTS}) + get_filename_component(fil "${proto}" NAME) + get_filename_component(dir "${proto}" DIRECTORY) + + get_filename_component(fil_we "${fil}" NAME_WE) + + get_filename_component(abs_fil "${abs_proto_base}/${proto}" ABSOLUTE) + get_filename_component(abs_dir "${abs_fil}" DIRECTORY) + + list(APPEND PROTO_FILES "${abs_proto_dir}/${proto}") + + if(NOT ${fil} STREQUAL "placeholder.txt") + list(APPEND OUTPUT_DIRS "${abs_output_dir}/${dir}") + list(APPEND OUTPUT_FILES "${abs_output_dir}/${dir}/${fil_we}.pb_text.h") + list(APPEND OUTPUT_FILES "${abs_output_dir}/${dir}/${fil_we}.pb_text-impl.h") + list(APPEND OUTPUT_FILES "${abs_output_dir}/${dir}/${fil_we}.pb_text.cc") + endif(NOT ${fil} STREQUAL "placeholder.txt") + endforeach() + + add_custom_command(OUTPUT ${OUTPUT_FILES} + # "make_directory" in CMake 3.1 cannot create multiple directories at once. + # COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_DIRS} + COMMAND "${TENSORLFLOW_PROTO_TEXT_1_13_1_CMAKE_DIR}/make_directories.sh" ${OUTPUT_DIRS} + COMMAND "$<TARGET_FILE:tensorflow-prototext-1.13.1>" "${abs_output_dir}/${OUTPUT_REL}" "${OUTPUT_REL}" ${PROTO_FILES} + DEPENDS ${PROTO_FILES}) + + set(${PREFIX}_SOURCES ${OUTPUT_FILES} PARENT_SCOPE) + set(${PREFIX}_INCLUDE_DIRS ${abs_output_dir} PARENT_SCOPE) + endfunction(ProtoText_Generate) +endif(TensorFlowProtoText_FOUND) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfigVersion.cmake b/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfigVersion.cmake new file mode 100644 index 000000000..ed79ecd91 --- /dev/null +++ b/infra/cmake/packages/TensorFlowProtoText-1.13.1/TensorFlowProtoTextConfigVersion.cmake @@ -0,0 +1,9 @@ +set(PACKAGE_VERSION "1.13.1") +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_UNSUITABLE TRUE) + +if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + set(PACKAGE_VERSION_UNSUITABLE FALSE) +endif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.13.1/build/CMakeLists.txt b/infra/cmake/packages/TensorFlowProtoText-1.13.1/build/CMakeLists.txt new file mode 100644 index 000000000..7079aea03 --- /dev/null +++ b/infra/cmake/packages/TensorFlowProtoText-1.13.1/build/CMakeLists.txt @@ -0,0 +1,78 @@ +message(STATUS "Build TensorFlowProtoText from '${TensorFlowSource_DIR}'") + +# +# Build "proto_text" tool +# +unset(SOURCE_FILES) + +macro(Source_Add RPATH) + list(APPEND SOURCE_FILES "${TensorFlowSource_DIR}/${RPATH}") +endmacro(Source_Add) + +# This list comes from "tensorflow/contrib/makefile/proto_text_cc_files.txt" +Source_Add(tensorflow/core/lib/core/status.cc) +Source_Add(tensorflow/core/lib/core/threadpool.cc) +Source_Add(tensorflow/core/lib/hash/hash.cc) +Source_Add(tensorflow/core/lib/io/inputstream_interface.cc) +Source_Add(tensorflow/core/lib/io/random_inputstream.cc) +Source_Add(tensorflow/core/lib/io/buffered_inputstream.cc) +Source_Add(tensorflow/core/lib/io/inputbuffer.cc) +Source_Add(tensorflow/core/lib/io/iterator.cc) +Source_Add(tensorflow/core/lib/io/path.cc) +Source_Add(tensorflow/core/lib/strings/numbers.cc) +Source_Add(tensorflow/core/lib/strings/scanner.cc) +Source_Add(tensorflow/core/lib/strings/str_util.cc) +Source_Add(tensorflow/core/lib/strings/strcat.cc) +Source_Add(tensorflow/core/lib/strings/stringprintf.cc) +Source_Add(tensorflow/core/lib/strings/proto_text_util.cc) +Source_Add(tensorflow/core/platform/cpu_info.cc) +Source_Add(tensorflow/core/platform/denormal.cc) +Source_Add(tensorflow/core/platform/env.cc) +Source_Add(tensorflow/core/platform/env_time.cc) +Source_Add(tensorflow/core/platform/file_system.cc) +Source_Add(tensorflow/core/platform/file_system_helper.cc) +Source_Add(tensorflow/core/platform/protobuf_util.cc) +Source_Add(tensorflow/core/platform/setround.cc) +Source_Add(tensorflow/core/platform/tracing.cc) +Source_Add(tensorflow/core/platform/posix/env.cc) +Source_Add(tensorflow/core/platform/posix/env_time.cc) +Source_Add(tensorflow/core/platform/posix/error.cc) +Source_Add(tensorflow/core/platform/posix/load_library.cc) +Source_Add(tensorflow/core/platform/posix/port.cc) +Source_Add(tensorflow/core/platform/posix/posix_file_system.cc) +Source_Add(tensorflow/core/platform/default/logging.cc) +Source_Add(tensorflow/core/platform/default/mutex.cc) +Source_Add(tensorflow/core/platform/default/protobuf.cc) + +Source_Add(tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc) +Source_Add(tensorflow/tools/proto_text/gen_proto_text_functions.cc) + +unset(PROTO_FILES) + +macro(Proto_Add RPATH) + list(APPEND PROTO_FILES "${RPATH}") +endmacro(Proto_Add) + +Proto_Add(tensorflow/core/lib/core/error_codes.proto) +Proto_Add(tensorflow/core/framework/types.proto) +Proto_Add(tensorflow/core/framework/tensor.proto) +Proto_Add(tensorflow/core/framework/tensor_shape.proto) +Proto_Add(tensorflow/core/framework/summary.proto) +Proto_Add(tensorflow/core/framework/resource_handle.proto) + +Protobuf_Generate(PROTO_TEXT_PROTO + "${CMAKE_CURRENT_BINARY_DIR}/generated/proto_text" + "${TensorFlowSource_DIR}" + ${PROTO_FILES} +) + +add_executable(tensorflow-prototext-1.13.1 ${SOURCE_FILES} ${PROTO_TEXT_PROTO_SOURCES}) +target_include_directories(tensorflow-prototext-1.13.1 PRIVATE ${TensorFlowSource_DIR}) +target_include_directories(tensorflow-prototext-1.13.1 PRIVATE ${PROTO_TEXT_PROTO_INCLUDE_DIRS}) + +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE abseil) +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE eigen) +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE ${PROTO_TEXT_PROTO_LIBRARIES}) +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE Google::DoubleConversion) +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE Google::NSync) +target_link_libraries(tensorflow-prototext-1.13.1 PRIVATE dl) diff --git a/infra/cmake/packages/TensorFlowProtoText-1.13.1/make_directories.sh b/infra/cmake/packages/TensorFlowProtoText-1.13.1/make_directories.sh new file mode 100755 index 000000000..1fb2ab683 --- /dev/null +++ b/infra/cmake/packages/TensorFlowProtoText-1.13.1/make_directories.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +while [[ $# -ne 0 ]]; do + DIR=$1; shift + mkdir -p "${DIR}" +done diff --git a/infra/cmake/packages/TensorFlowSource-1.13.1/TensorFlowSourceConfig.cmake b/infra/cmake/packages/TensorFlowSource-1.13.1/TensorFlowSourceConfig.cmake index 2049ab927..d837af731 100644 --- a/infra/cmake/packages/TensorFlowSource-1.13.1/TensorFlowSourceConfig.cmake +++ b/infra/cmake/packages/TensorFlowSource-1.13.1/TensorFlowSourceConfig.cmake @@ -7,7 +7,8 @@ function(_TensorFlowSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - envoption(TENSORFLOW_1_13_1_URL https://github.com/tensorflow/tensorflow/archive/v1.13.1.tar.gz) + envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com") + envoption(TENSORFLOW_1_13_1_URL ${EXTERNAL_DOWNLOAD_SERVER}/tensorflow/tensorflow/archive/v1.13.1.tar.gz) ExternalSource_Download(TENSORFLOW DIRNAME TENSORFLOW-1.13.1 ${TENSORFLOW_1_13_1_URL}) diff --git a/infra/cmake/packages/TensorFlowSource-1.7/TensorFlowSourceConfig.cmake b/infra/cmake/packages/TensorFlowSource-2.2.0/TensorFlowSourceConfig.cmake index 8188ee082..71220d743 100644 --- a/infra/cmake/packages/TensorFlowSource-1.7/TensorFlowSourceConfig.cmake +++ b/infra/cmake/packages/TensorFlowSource-2.2.0/TensorFlowSourceConfig.cmake @@ -7,9 +7,9 @@ function(_TensorFlowSource_import) nnas_include(ExternalSourceTools) nnas_include(OptionTools) - envoption(TENSORFLOW_URL https://github.com/tensorflow/tensorflow/archive/v1.7.0.tar.gz) + envoption(TENSORFLOW_2_2_0_URL https://github.com/tensorflow/tensorflow/archive/v2.2.0.tar.gz) - ExternalSource_Download(TENSORFLOW ${TENSORFLOW_URL}) + ExternalSource_Download(TENSORFLOW DIRNAME TENSORFLOW-2.2.0 ${TENSORFLOW_2_2_0_URL}) set(TensorFlowSource_DIR ${TENSORFLOW_SOURCE_DIR} PARENT_SCOPE) set(TensorFlowSource_FOUND TRUE PARENT_SCOPE) diff --git a/infra/cmake/packages/TensorFlowSource-1.7/TensorFlowSourceConfigVersion.cmake b/infra/cmake/packages/TensorFlowSource-2.2.0/TensorFlowSourceConfigVersion.cmake index b1d5282b2..8269dc5d5 100644 --- a/infra/cmake/packages/TensorFlowSource-1.7/TensorFlowSourceConfigVersion.cmake +++ b/infra/cmake/packages/TensorFlowSource-2.2.0/TensorFlowSourceConfigVersion.cmake @@ -1,4 +1,4 @@ -set(PACKAGE_VERSION "1.7") +set(PACKAGE_VERSION "2.2.0") set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/infra/cmake/packages/TensorFlowSource-2.3.0-rc0Config.cmake b/infra/cmake/packages/TensorFlowSource-2.3.0-rc0Config.cmake new file mode 100644 index 000000000..82df579a1 --- /dev/null +++ b/infra/cmake/packages/TensorFlowSource-2.3.0-rc0Config.cmake @@ -0,0 +1,21 @@ +# find_package rejects version with extra string like "2.3.0-rc0" +# +# TODO Find a better way +function(_import) + if(NOT DOWNLOAD_TENSORFLOW) + set(TensorFlowSource_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT DOWNLOAD_TENSORFLOW) + + nnas_include(ExternalSourceTools) + nnas_include(OptionTools) + + envoption(TENSORFLOW_2_3_0_RC0_URL https://github.com/tensorflow/tensorflow/archive/v2.3.0-rc0.tar.gz) + + ExternalSource_Download(TENSORFLOW DIRNAME TENSORFLOW-2.3.0-RC0 ${TENSORFLOW_2_3_0_RC0_URL}) + + set(TensorFlowSource_DIR ${TENSORFLOW_SOURCE_DIR} PARENT_SCOPE) + set(TensorFlowSource_FOUND TRUE PARENT_SCOPE) +endfunction(_import) + +_import() |