# AUTO BUILD DEPS set (AUTOBUILD_OPENSSL TRUE) set (AUTOBUILD_ZLIB TRUE) set (AUTOBUILD_ZZIP TRUE) set (AUTOBUILD_LIBZIP TRUE) set (AUTOBUILD_JPEG TRUE) set (AUTOBUILD_PNG TRUE) set (AUTOBUILD_FREETYPE TRUE) set (AUTOBUILD_HARFBUZZ TRUE) set (AUTOBUILD_CURL TRUE) set (AUTOBUILD_OPENAL TRUE) set (AUTOBUILD_OGG TRUE) set (AUTOBUILD_VORBIS TRUE) set (AUTOBUILD_OPENCV TRUE) set (AUTOBUILD_FFMPEG TRUE) set (AUTOBUILD_EIGEN TRUE) set (AUTOBUILD_CERES_SOLVER TRUE) set (AUTOBUILD_LIBUSB TRUE) if (NOT APPLE AND NOT PIZERO) set (AUTOBUILD_RE2 TRUE) set (AUTOBUILD_PROTOBUF TRUE) set (AUTOBUILD_NSYNC TRUE) set (AUTOBUILD_PYTORCH_CPUINFO TRUE) set (AUTOBUILD_OPENBLAS TRUE) set (AUTOBUILD_KALDI TRUE) set (AUTOBUILD_ONNXRUNTIME TRUE) # if (RPI) # set (AUTOBUILD_FP16 TRUE) # set (AUTOBUILD_PTHREADPOOL TRUE) # set (AUTOBUILD_XNNPACK TRUE) # else() set (AUTOBUILD_FP16 FALSE) set (AUTOBUILD_PTHREADPOOL FALSE) set (AUTOBUILD_XNNPACK FALSE) # endif() else() set (AUTOBUILD_RE2 FALSE) set (AUTOBUILD_PROTOBUF FALSE) set (AUTOBUILD_NSYNC FALSE) set (AUTOBUILD_PYTORCH_CPUINFO FALSE) set (AUTOBUILD_OPENBLAS FALSE) set (AUTOBUILD_KALDI FALSE) set (AUTOBUILD_ONNXRUNTIME FALSE) endif() if (NOT ANDROID AND NOT IOS) set (AUTOBUILD_SDL2 TRUE) set (AUTOBUILD_NFDE TRUE) else() set (AUTOBUILD_SDL2 FALSE) set (AUTOBUILD_NFDE FALSE) endif() set (AUTOBUILD_YAML-CPP FALSE) set (AUTOBUILD_G2O FALSE) set (AUTOBUILD_DBOW2 FALSE) set (AUTOBUILD_SUITESPARSE FALSE) if (APPLE) set (AUTOBUILD_QT TRUE) endif () macro(build_common_deps DEPS_BINARY_DIR) message("Build common dependencies in ${CMAKE_INSTALL_PREFIX}") if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release) endif() # lists like CMAKE_MODULE_PATH need quotes in command line #message("Module paths: ${CMAKE_MODULE_PATH}") set(BUILD_SHARED FALSE) set(BUILD_COMMAND_OPTS --config ${CMAKE_BUILD_TYPE} --target install) if(${CMAKE_VERSION} VERSION_LESS "3.12.0") if (RPI) set(BUILD_COMMAND_OPTS ${BUILD_COMMAND_OPTS} -- -j2) elseif (APPLE) set(BUILD_COMMAND_OPTS ${BUILD_COMMAND_OPTS} -- -j 2) elseif (NOT ANDROID) set(BUILD_COMMAND_OPTS ${BUILD_COMMAND_OPTS} -- -j2) endif () else() set(BUILD_COMMAND_OPTS ${BUILD_COMMAND_OPTS} --parallel 2) endif() set(BUILD_COMMON_OPTS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -G ${CMAKE_GENERATOR}) if(CMAKE_TOOLCHAIN_FILE) MESSAGE("Use toolchain ${CMAKE_TOOLCHAIN_FILE}") set(CROSS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") if(ANDROID) set(CROSS ${CROSS} -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK}) endif() if(APPLE_IOS) set(CROSS ${CROSS} -DBUILD_FRAMEWORK=OFF -DIOS_PLATFORM=${IOS_PLATFORM}) endif() endif() ##### Download all packages if needed ##### set(DEPS_DOWNLOAD_DIR "${DEPS_BINARY_DIR}/../../../dl") if (AUTOBUILD_ZLIB) set(ZLIB_FILE_VERSION "zlib-1.3.1") if(MSVC OR EMSCRIPTEN OR LINUX32 OR LINUX64 OR RPI OR APPLE) # other platforms ship zlib if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${ZLIB_FILE_VERSION}.tar.gz) message(STATUS "Downloading zlib") file(DOWNLOAD https://zlib.net/current/zlib.tar.gz ${DEPS_DOWNLOAD_DIR}/${ZLIB_FILE_VERSION}.tar.gz) endif() endif() endif() if (AUTOBUILD_ZZIP) set(ZZIP_FILE_VERSION "ZZIPlib-master") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${ZZIP_FILE_VERSION}.tar.gz) message(STATUS "Downloading ZZIPlib") file(DOWNLOAD https://github.com/paroj/ZZIPlib/archive/master.tar.gz ${DEPS_DOWNLOAD_DIR}/${ZZIP_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_ZZIP) if (AUTOBUILD_LIBZIP) set(LIBZIP_FILE_VERSION "libzip-1.5.1") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${LIBZIP_FILE_VERSION}.tar.gz) message(STATUS "Download libZIP") file(DOWNLOAD https://libzip.org/download/${LIBZIP_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/${LIBZIP_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_LIBZIP) if (AUTOBUILD_PNG) set(LIBPNG_FILE_VERSION "1.6.37") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/v${LIBPNG_FILE_VERSION}.tar.gz) message(STATUS "Download libPNG") file(DOWNLOAD https://github.com/glennrp/libpng/archive/v${LIBPNG_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/v${LIBPNG_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_PNG) if (AUTOBUILD_FREETYPE) set(FREETYPE_FILE_VERSION "freetype-2.9") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${FREETYPE_FILE_VERSION}.tar.gz) message(STATUS "Download freetype") file(DOWNLOAD https://download-mirror.savannah.gnu.org/releases/freetype/${FREETYPE_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/${FREETYPE_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_FREETYPE) if (AUTOBUILD_HARFBUZZ) set(HARFBUZZ_FILE_VERSION "2.6.6") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}.tar.gz) message(STATUS "Download harfbuzz") file(DOWNLOAD https://github.com/harfbuzz/harfbuzz/archive/${HARFBUZZ_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_HARFBUZZ) if (AUTOBUILD_CURL) set(CURL_FILE_VERSION "curl-7.64.0") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${CURL_FILE_VERSION}.tar.gz) message(STATUS "Download Curl") file(DOWNLOAD https://curl.se/download/${CURL_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/${CURL_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_CURL) if (AUTOBUILD_FFMPEG) set(FFMPEG_FILE_VERSION "4.3") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/ffpmeg-${FFMPEG_FILE_VERSION}.tar.gz) file(DOWNLOAD https://github.com/FFmpeg/FFmpeg/archive/release/${FFMPEG_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/ffpmeg-${FFMPEG_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_FFMPEG) if (AUTOBUILD_OPENAL) if (NOT APPLE_IOS) #if (ANDROID OR RPI OR PIZERO) set (OPENAL_FILE_VERSION "openal-soft-1.23.1") set (OPENAL_SOURCE "https://github.com/kcat/openal-soft/archive/refs/tags/1.23.1.tar.gz") #else (ANDROID OR RPI OR PIZERO) # set (OPENAL_FILE_VERSION "openal-soft-1.19") # set (OPENAL_SOURCE "https://github.com/kcat/openal-soft/archive/v1.19.tar.gz") #endif(ANDROID OR RPI OR PIZERO) if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${OPENAL_FILE_VERSION}.tar.gz) message(STATUS "Download OpenAL-soft") file(DOWNLOAD ${OPENAL_SOURCE} ${DEPS_DOWNLOAD_DIR}/${OPENAL_FILE_VERSION}.tar.gz) endif() endif (NOT APPLE_IOS) endif (AUTOBUILD_OPENAL) if (AUTOBUILD_EIGEN) set(EIGEN_FILE_VERSION "eigen-3.3") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${EIGEN_FILE_VERSION}.tar.gz) message(STATUS "Download EIGEN") file(DOWNLOAD https://gitlab.com/libeigen/eigen/-/archive/3.3/${EIGEN_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/${EIGEN_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_EIGEN) if (AUTOBUILD_RE2) set(RE2_FILE_VERSION "2022-06-01") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/re2-${RE2_FILE_VERSION}.zip) message(STATUS "Download RE2") file(DOWNLOAD https://github.com/google/re2/archive/refs/tags/${RE2_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/re2-${RE2_FILE_VERSION}.zip) endif() endif (AUTOBUILD_RE2) if (AUTOBUILD_PROTOBUF) #Cannot use zip file, submodules are missing set(PROTOBUF_FILE_VERSION "3.20.2") set(PROTOBUF_URL "https://github.com/protocolbuffers/protobuf.git") set(PROTOBUF_BINARY_DIR ${DEPS_BINARY_DIR}/protobuf-${PROTOBUF_FILE_VERSION}) set(PROTOBUF_SRC_DIR ${DEPS_DOWNLOAD_DIR}/protobuf-${PROTOBUF_FILE_VERSION}) if(NOT EXISTS ${PROTOBUF_SRC_DIR}) message(STATUS "Cloning Protobuf repository") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROTOBUF_SRC_DIR}) # Clone the repository execute_process( COMMAND git clone ${PROTOBUF_URL} ${PROTOBUF_SRC_DIR} RESULT_VARIABLE clone_result OUTPUT_VARIABLE clone_output ERROR_VARIABLE clone_error WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) if(NOT ${clone_result} EQUAL 0) message(FATAL_ERROR "Failed to clone repository: ${clone_error}") endif() # Change to the Protobuf directory and checkout the tag execute_process( COMMAND git checkout tags/v${PROTOBUF_FILE_VERSION} RESULT_VARIABLE checkout_result OUTPUT_VARIABLE checkout_output ERROR_VARIABLE checkout_error WORKING_DIRECTORY ${PROTOBUF_SRC_DIR} ) if(NOT ${checkout_result} EQUAL 0) message(FATAL_ERROR "Failed to checkout tag: ${checkout_error}") endif() # Initialize and update submodules execute_process( COMMAND git submodule update --init --recursive RESULT_VARIABLE submodule_result OUTPUT_VARIABLE submodule_output ERROR_VARIABLE submodule_error WORKING_DIRECTORY ${PROTOBUF_SRC_DIR} ) if(NOT ${submodule_result} EQUAL 0) message(FATAL_ERROR "Failed to update submodules: ${submodule_error}") endif() endif() # if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/protobuf-${PROTOBUF_FILE_VERSION}.zip) # message(STATUS "Download Protobuf") # file(DOWNLOAD # https://github.com/protocolbuffers/protobuf/archive/refs/tags/v${PROTOBUF_FILE_VERSION}.zip # ${DEPS_DOWNLOAD_DIR}/protobuf-${PROTOBUF_FILE_VERSION}.zip) # endif() endif (AUTOBUILD_PROTOBUF) if (AUTOBUILD_NSYNC) set(NSYNC_FILE_VERSION "1.23.0") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/nsync-${NSYNC_FILE_VERSION}.zip) message(STATUS "Download nsync") file(DOWNLOAD https://github.com/google/nsync/archive/refs/tags/${NSYNC_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/nsync-${NSYNC_FILE_VERSION}.zip) endif() endif (AUTOBUILD_NSYNC) if (AUTOBUILD_PYTORCH_CPUINFO) set(PYTORCH_CPUINFO_FILE_VERSION "5916273f79a21551890fd3d56fc5375a78d1598d") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}.zip) message(STATUS "Download Pytorch cpuinfo") file(DOWNLOAD https://github.com/pytorch/cpuinfo/archive/${PYTORCH_CPUINFO_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}.zip) endif() endif(AUTOBUILD_PYTORCH_CPUINFO) if (AUTOBUILD_FP16) set(FP16_FILE_VERSION "0a92994d729ff76a58f692d3028ca1b64b145d91") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/FP16-${FP16_FILE_VERSION}.zip) message(STATUS "Download FP16") file(DOWNLOAD https://github.com/Maratyszcza/FP16/archive/${FP16_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/FP16-${FP16_FILE_VERSION}.zip) endif() endif(AUTOBUILD_FP16) if (AUTOBUILD_PTHREADPOOL) set(PTHREADPOOL_FILE_VERSION "1787867f6183f056420e532eec640cba25efafea") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}.zip) message(STATUS "Download pthreadpool") file(DOWNLOAD https://github.com/Maratyszcza/pthreadpool/archive/${PTHREADPOOL_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}.zip) endif() endif(AUTOBUILD_PTHREADPOOL) if (AUTOBUILD_XNNPACK) set(XNNPACK_FILE_VERSION "003c580e696a774afdc984996ee909b7c8d8128c") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}.zip) message(STATUS "Download XNNPack") file(DOWNLOAD https://github.com/google/XNNPACK/archive/${XNNPACK_FILE_VERSION}.zip ${DEPS_DOWNLOAD_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}.zip) endif() endif(AUTOBUILD_XNNPACK) if (AUTOBUILD_YAML-CPP) set(YAML_FILE_VERSION "yaml-cpp-master") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${YAML_FILE_VERSION}.tar.gz) message(STATUS "Download YAML-CPP") file(DOWNLOAD https://github.com/loot/yaml-cpp/archive/master.tar.gz ${DEPS_DOWNLOAD_DIR}/${YAML_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_YAML-CPP) if (AUTOBUILD_OPENCV) set(OPENCV_FILE_VERSION "4.5.1") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/opencv-${OPENCV_FILE_VERSION}.tar.gz) message(STATUS "Download OPENCV") file(DOWNLOAD https://github.com/opencv/opencv/archive/refs/tags/${OPENCV_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/opencv-${OPENCV_FILE_VERSION}.tar.gz) endif() # if(NOT EXISTS ${DEPS_BINARY_DIR}/opencv-contrib-${OPENCV_FILE_VERSION}.tar.gz) # file(DOWNLOAD # https://github.com/opencv/opencv_contrib/archive/${OPENCV_FILE_VERSION}.tar.gz # ${DEPS_BINARY_DIR}/opencv-contrib-${OPENCV_FILE_VERSION}.tar.gz) # execute_process(COMMAND ${CMAKE_COMMAND} # -E tar xf opencv-contrib-${OPENCV_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) # execute_process(COMMAND ${CMAKE_COMMAND} -E copy # ${CMAKE_SOURCE_DIR}/CMake/Utils/cv_freetype_CMakeLists.txt # ${DEPS_BINARY_DIR}/opencv_contrib-${OPENCV_FILE_VERSION}/modules/freetype/CMakeLists.txt # WORKING_DIRECTORY ${DEPS_BINARY_DIR}) # endif() endif(AUTOBUILD_OPENCV) if (AUTOBUILD_G2O) set(G2O_FILE_VERSION "g2o-master") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${G2O_FILE_VERSION}.tar.gz) message(STATUS "Download G2O") file(DOWNLOAD https://github.com/RainerKuemmerle/g2o/archive/master.tar.gz ${DEPS_DOWNLOAD_DIR}/${G2O_FILE_VERSION}.tar.gz) endif() endif(AUTOBUILD_G2O) if (AUTOBUILD_CERES_SOLVER) set(CERES_VERSION "2.0.0") set(CERES_FILE_VERSION "ceres-solver-${CERES_VERSION}") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${CERES_FILE_VERSION}.tar.gz) message(STATUS "Download Ceres-Solver") file(DOWNLOAD https://github.com/ceres-solver/ceres-solver/archive/refs/tags/${CERES_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/${CERES_FILE_VERSION}.tar.gz) endif() endif(AUTOBUILD_CERES_SOLVER) if (AUTOBUILD_OPENBLAS) set(OPENBLAS_FILE_VERSION "0.3.23") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}.tar.gz) message(STATUS "Download OpenBlas") file(DOWNLOAD https://github.com/xianyi/OpenBLAS/archive/v${OPENBLAS_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_OPENBLAS) if (AUTOBUILD_KALDI) set(KALDI_FILE_VERSION "kaldi-master") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${KALDI_FILE_VERSION}.tar.gz) message(STATUS "Downloading Kaldi") file(DOWNLOAD https://github.com/alphacep/kaldi/archive/master.tar.gz ${DEPS_DOWNLOAD_DIR}/${KALDI_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_KALDI) if (AUTOBUILD_ONNXRUNTIME) set(ONNXRUNTIME_FILE_VERSION "1.14.1") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/onnxruntime-${ONNXRUNTIME_FILE_VERSION}.tar.gz) message(STATUS "Downloading onnxruntime") file(DOWNLOAD https://github.com/microsoft/onnxruntime/archive/refs/tags/v${ONNXRUNTIME_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/onnxruntime-${ONNXRUNTIME_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_ONNXRUNTIME) if (AUTOBUILD_SDL2) set(SDL2_FILE_VERSION "2.30.7") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/SDL2-${SDL2_FILE_VERSION}.tar.gz) message(STATUS "Downloading SDL2") file(DOWNLOAD https://github.com/libsdl-org/SDL/archive/refs/tags/release-${SDL2_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/SDL2-${SDL2_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_SDL2) if (AUTOBUILD_NFDE) set(NFDE_FILE_VERSION "1.2.1") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/NFDE-${NFDE_FILE_VERSION}.tar.gz) message(STATUS "Downloading Nativefiledialog-extended") file(DOWNLOAD https://github.com/btzy/nativefiledialog-extended/archive/refs/tags/v${NFDE_FILE_VERSION}.tar.gz ${DEPS_DOWNLOAD_DIR}/NFDE-${NFDE_FILE_VERSION}.tar.gz) endif() endif (AUTOBUILD_NFDE) ##### BUILD ##### ##### OpenSSL ##### if (AUTOBUILD_OPENSSL) message(STATUS "Building OpenSSL") if (WIN64) execute_process(COMMAND $ENV{SCOL_DEPENDENCIES_PATH}/OpenSSL/build-openssl.bat $ENV{DEFAULT_SCOL_MSVC_VER} x64 release $ENV{SCOL_DEPENDENCIES_PATH}/OpenSSL ${DEPS_BINARY_DIR}/OpenSSL ${CMAKE_INSTALL_PREFIX}) elseif (WIN32) execute_process(COMMAND $ENV{SCOL_DEPENDENCIES_PATH}/OpenSSL/build-openssl.bat $ENV{DEFAULT_SCOL_MSVC_VER} x86 release $ENV{SCOL_DEPENDENCIES_PATH}/OpenSSL ${DEPS_BINARY_DIR}/OpenSSL ${CMAKE_INSTALL_PREFIX}) else() execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/OpenSSL) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/OpenSSL/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DOPENSSL_API_COMPAT=0x10000000L $ENV{SCOL_DEPENDENCIES_PATH}/OpenSSL WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenSSL/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/OpenSSL/build ${BUILD_COMMAND_OPTS}) endif() endif (AUTOBUILD_OPENSSL) ##### ZLIB ##### if (AUTOBUILD_ZLIB) if(MSVC OR EMSCRIPTEN OR LINUX32 OR LINUX64 OR RPI OR APPLE) # other platforms ship zlib message(STATUS "Building zlib") if(NOT EXISTS ${DEPS_BINARY_DIR}/${ZLIB_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${ZLIB_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${ZLIB_FILE_VERSION}/build) endif() # patch toolchain #execute_process(COMMAND ${CMAKE_COMMAND} -E copy # ${CMAKE_SOURCE_DIR}/CMake/Utils/zlib_CMakeLists.txt # zlib-1.2.12/CMakeLists.txt #WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DZLIB_BUILD_EXAMPLES=OFF ${DEPS_BINARY_DIR}/${ZLIB_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${ZLIB_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${ZLIB_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif() endif (AUTOBUILD_ZLIB) ##### ZZIP ##### if (AUTOBUILD_ZZIP) message(STATUS "Building ZZIPlib") if(NOT EXISTS ${DEPS_BINARY_DIR}/${ZZIP_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${ZZIP_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${ZZIP_FILE_VERSION}/build) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${DEPS_BINARY_DIR}/${ZZIP_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${ZZIP_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${ZZIP_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_ZZIP) ##### LIBZIP ##### if (AUTOBUILD_LIBZIP) message(STATUS "Building libZIP") if(NOT EXISTS ${DEPS_BINARY_DIR}/${LIBZIP_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${LIBZIP_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${LIBZIP_FILE_VERSION}/build) endif() #Patch bzip execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/libzip_CMakeLists.txt ${LIBZIP_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DENABLE_OPENSSL=OFF -DENABLE_GNUTLS=OFF -DENABLE_COMMONCRYPTO=OFF -DHAVE_FTS_H=0 ${DEPS_BINARY_DIR}/${LIBZIP_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${LIBZIP_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${LIBZIP_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_LIBZIP) ##### LIBJPEG ##### if (AUTOBUILD_JPEG) message(STATUS "Building libJpeg") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libjpeg) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libjpeg/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} $ENV{SCOL_DEPENDENCIES_PATH}/libjpeg WORKING_DIRECTORY ${DEPS_BINARY_DIR}/libjpeg/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/libjpeg/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_JPEG) ##### LIBPNG ##### if (AUTOBUILD_PNG) message(STATUS "Building libPNG") if(NOT EXISTS ${DEPS_BINARY_DIR}/libpng-${LIBPNG_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/v${LIBPNG_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libpng-${LIBPNG_FILE_VERSION}/build) endif() if(APPLE) # patch toolchain for iOS execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/libpng_CMakeLists.txt libpng-${LIBPNG_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) set(BUILD_PNG_SYSTEM -DPNG_ARM_NEON=off) endif(APPLE) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${BUILD_PNG_SYSTEM} -DPNG_SHARED=${BUILD_SHARED} -DPNG_TESTS=OFF ${DEPS_BINARY_DIR}/libpng-${LIBPNG_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/libpng-${LIBPNG_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/libpng-${LIBPNG_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_PNG) ##### LUBUSB ##### if (AUTOBUILD_LIBUSB) if (ANDROID) message(STATUS "Building LibUsb") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libusb) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libusb/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} $ENV{SCOL_DEPENDENCIES_PATH}/libusb WORKING_DIRECTORY ${DEPS_BINARY_DIR}/libusb/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/libusb/build ${BUILD_COMMAND_OPTS}) endif(ANDROID) endif (AUTOBUILD_LIBUSB) ##### FREETYPE ##### if (AUTOBUILD_FREETYPE) message(STATUS "Building freetype") if(NOT EXISTS ${DEPS_BINARY_DIR}/${FREETYPE_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${FREETYPE_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() # patch toolchain for iOS execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/toolchain/IOS.toolchain.cmake ${FREETYPE_FILE_VERSION}/builds/cmake/iOS.cmake WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DWITH_BZip2=OFF # tries to use it on iOS otherwise -DWITH_HarfBuzz=OFF # workaround for broken iOS toolchain in freetype -DPROJECT_SOURCE_DIR=${DEPS_BINARY_DIR}/${FREETYPE_FILE_VERSION} ${DEPS_BINARY_DIR}/${FREETYPE_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${FREETYPE_FILE_VERSION}/objs) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${FREETYPE_FILE_VERSION}/objs ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_FREETYPE) ##### AUTOBUILD_HARFBUZZ ##### if (AUTOBUILD_HARFBUZZ) message(STATUS "Building harfbuzz") if(NOT EXISTS ${DEPS_BINARY_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}/build) endif() execute_process(COMMAND ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" ${CROSS} ${BUILD_COMMON_OPTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DHB_BUILD_SUBSET=ON -DHB_BUILD_TESTS=OFF -DHB_BUILD_UTILS=OFF -DHB_CHECK=OFF -DHB_HAVE_FREETYPE=ON -DHB_HAVE_CORETEXT=OFF -DBUILD_SHARED_LIBS=OFF ${DEPS_BINARY_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/harfbuzz-${HARFBUZZ_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_HARFBUZZ) ##### CURL ##### if (AUTOBUILD_CURL) message(STATUS "Building Curl") if(NOT EXISTS ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${CURL_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION}/build) endif() #Patch execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/libcurl_CMakeLists.txt ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_USE_OPENSSL=ON -DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF -DENABLE_MANUAL=OFF -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${CURL_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_CURL) ##### OPENAL SOFT ##### if (AUTOBUILD_OPENAL) if (NOT APPLE_IOS) message(STATUS "Building OpenAL-soft") if(NOT EXISTS ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${OPENAL_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) # patch for Windows SDK 8.1 execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/openal_config.h.in ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION}/config.h.in WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() ## openal-soft/native-tools must be built after the first cmake dependencies pass set(OPENAL_SOFT_PLATFORM_FLAGS "") if (ANDROID) set(OPENAL_SOFT_PLATFORM_FLAGS -DALSOFT_NATIVE_TOOLS_PATH=$ENV{SCOL_DEPENDENCIES_PATH}/openal-soft/native-tools -DALSOFT_CPUEXT_NEON=ON) elseif (RPI AND NOT PIZERO AND NOT PIFOUR) set(OPENAL_SOFT_PLATFORM_FLAGS -DALSOFT_CPUEXT_NEON=ON) elseif (RPI) set(OPENAL_SOFT_PLATFORM_FLAGS -DALSOFT_CPUEXT_NEON=OFF) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} ${OPENAL_SOFT_PLATFORM_FLAGS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_DEBUG_POSTFIX=d -DALSOFT_UTILS:BOOL=OFF -DALSOFT_EXAMPLES:BOOL=OFF -DALSOFT_NO_CONFIG_UTIL:BOOL=ON -DALSOFT_INSTALL_CONFIG:BOOL=OFF -DALSOFT_INSTALL_UTILS:BOOL=OFF -DALSOFT_TESTS:BOOL=OFF -DALSOFT_INSTALL:BOOL=ON -DALSOFT_INSTALL_EXAMPLES:BOOL=ON -DALSOFT_INSTALL_HRTF_DATA:BOOL=OFF -DALSOFT_BACKEND_SDL2:BOOL=OFF -DALSOFT_BACKEND_SNDIO:BOOL=OFF -DLIBTYPE:STRING=STATIC ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION}/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${OPENAL_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (NOT APPLE_IOS) endif (AUTOBUILD_OPENAL) ##### LIBOGG ##### if (AUTOBUILD_OGG) message(STATUS "Building libOgg") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libogg) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libogg/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} $ENV{SCOL_DEPENDENCIES_PATH}/libogg WORKING_DIRECTORY ${DEPS_BINARY_DIR}/libogg/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/libogg/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_OGG) ##### LIBVORBIS ##### if (AUTOBUILD_VORBIS) message(STATUS "Building libVorbis") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libvorbis) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/libvorbis/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} $ENV{SCOL_DEPENDENCIES_PATH}/libvorbis WORKING_DIRECTORY ${DEPS_BINARY_DIR}/libvorbis/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/libvorbis/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_VORBIS) ##### AUTOBUILD_EIGEN ##### if (AUTOBUILD_EIGEN) message(STATUS "Building EIGEN") if(NOT EXISTS ${DEPS_BINARY_DIR}/${EIGEN_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${EIGEN_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${EIGEN_FILE_VERSION}/build) endif() # patch x86 build #execute_process(COMMAND ${CMAKE_COMMAND} -E copy # ${CMAKE_SOURCE_DIR}/CMake/Utils/PacketMath.h.in # ${EIGEN_FILE_VERSION}/Eigen/src/Core/arch/SSE/PacketMath.h #WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TESTING=OFF ${DEPS_BINARY_DIR}/${EIGEN_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${EIGEN_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${EIGEN_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_EIGEN) ##### AUTOBUILD_RE2 ##### if (AUTOBUILD_RE2) message(STATUS "Building RE2") if(NOT EXISTS ${DEPS_BINARY_DIR}/${RE2_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/re2-${RE2_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/re2-${RE2_FILE_VERSION}/builddir) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DRE2_BUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/re2-${RE2_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/re2-${RE2_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/re2-${RE2_FILE_VERSION}/builddir --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/re2-${RE2_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_RE2) ##### AUTOBUILD_PROTOBUF ##### if (AUTOBUILD_PROTOBUF) message(STATUS "Building Protobuf") if(NOT EXISTS ${PROTOBUF_BINARY_DIR}) # Create a protobuff directory execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${PROTOBUF_BINARY_DIR} RESULT_VARIABLE mkdir_result OUTPUT_VARIABLE mkdir_output ERROR_VARIABLE mkdir_error ) if(NOT ${mkdir_result} EQUAL 0) message(FATAL_ERROR "Failed to create build directory: ${mkdir_error}") endif() # Create a build directory execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${PROTOBUF_BINARY_DIR}/builddir RESULT_VARIABLE mkdir_result OUTPUT_VARIABLE mkdir_output ERROR_VARIABLE mkdir_error ) if(NOT ${mkdir_result} EQUAL 0) message(FATAL_ERROR "Failed to create build directory: ${mkdir_error}") endif() execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/protobuf_CMakeLists.txt ${PROTOBUF_SRC_DIR}/cmake/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DCMAKE_DEBUG_POSTFIX=d ${PROTOBUF_SRC_DIR}/cmake WORKING_DIRECTORY ${PROTOBUF_BINARY_DIR}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR}/builddir --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR}/builddir ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_PROTOBUF) ##### AUTOBUILD_NSYNC ##### if (AUTOBUILD_NSYNC) message(STATUS "Building Google Nsync") if(NOT EXISTS ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/nsync-${NSYNC_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DNSYNC_ENABLE_TESTS=OFF -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir) #Install do not build the libs.... execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Debug --target nsync) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Debug --target nsync_cpp) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Release --target nsync) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Release --target nsync_cpp) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nsync-${NSYNC_FILE_VERSION}/builddir --config Release --target install) endif (AUTOBUILD_NSYNC) ##### AUTOBUILD_PYTORCH_CPUINFO ##### if (AUTOBUILD_PYTORCH_CPUINFO) message(STATUS "Building Pytorch cpuinfo") if(NOT EXISTS ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}/builddir) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCPUINFO_LIBRARY_TYPE=static -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCPUINFO_BUILD_TOOLS=OFF -DCPUINFO_BUILD_UNIT_TESTS=OFF -DCPUINFO_BUILD_MOCK_TESTS=OFF -DCPUINFO_BUILD_BENCHMARKS=OFF -DCPUINFO_LOG_TO_STDIO=OFF -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) #Copy missing install lib on unix platforms if(LINUX32 OR LINUX64 OR RPI) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BINARY_DIR}/cpuinfo-${PYTORCH_CPUINFO_FILE_VERSION}/builddir/libcpuinfo_internals.a ${CMAKE_INSTALL_PREFIX}/lib/libcpuinfo_internals.a WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() endif (AUTOBUILD_PYTORCH_CPUINFO) ##### AUTOBUILD_FP16 ##### if (AUTOBUILD_FP16) message(STATUS "Building FP16") if(NOT EXISTS ${DEPS_BINARY_DIR}/FP16-${FP16_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/FP16-${FP16_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/FP16-${FP16_FILE_VERSION}/builddir) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DFP16_BUILD_TESTS=OFF -DFP16_BUILD_BENCHMARKS=OFF -DFP16_BUILD_COMPARATIVE_BENCHMARKS=OFF -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/FP16-${FP16_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/FP16-${FP16_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/FP16-${FP16_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_FP16) ##### AUTOBUILD_PTHREADPOOL ##### if (AUTOBUILD_PTHREADPOOL) message(STATUS "Building pthreadpool") if(NOT EXISTS ${DEPS_BINARY_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}/builddir) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DPTHREADPOOL_LIBRARY_TYPE=static -DPTHREADPOOL_BUILD_TESTS=OFF -DPTHREADPOOL_BUILD_BENCHMARKS=OFF -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/pthreadpool-${PTHREADPOOL_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_PTHREADPOOL) ##### AUTOBUILD_XNNPACK ##### if (AUTOBUILD_XNNPACK) message(STATUS "Building XNNPACK") if(NOT EXISTS ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DOWNLOAD_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}.zip WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/xnnpack_CMakeLists.txt ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() set (XNNPACK_ARMV8 ON) #disable for armv < 8 if(CMAKE_SYSTEM_PROCESSOR MATCHES "^armv[5-7]") set (XNNPACK_ARMV8 OFF) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" -DXNNPACK_LIBRARY_TYPE=static -DXNNPACK_USE_SYSTEM_LIBS=ON -DXNNPACK_BUILD_TESTS=OFF -DXNNPACK_BUILD_BENCHMARKS=OFF -DXNNPACK_ENABLE_KLEIDIAI=OFF -DXNNPACK_ENABLE_ARM_DOTPROD=${XNNPACK_ARMV8} "-DCMAKE_INCLUDE_PATH=${CMAKE_INSTALL_PREFIX}/include" "-DPTHREADPOOL_SOURCE_DIR=${CMAKE_INSTALL_PREFIX}" "-DFP16_SOURCE_DIR=${CMAKE_INSTALL_PREFIX}" "-DCPUINFO_SOURCE_DIR=${CMAKE_INSTALL_PREFIX}" -DCMAKE_DEBUG_POSTFIX=d ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) #Copy missing install lib on unix platforms if(RPI) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/builddir/libmicrokernels-prod.a ${CMAKE_INSTALL_PREFIX}/lib/libmicrokernels-prod.a WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BINARY_DIR}/XNNPACK-${XNNPACK_FILE_VERSION}/builddir/libmicrokernels-all.a ${CMAKE_INSTALL_PREFIX}/lib/libmicrokernels-all.a WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() endif (AUTOBUILD_XNNPACK) ##### AUTOBUILD_YAML-CPP ##### if (AUTOBUILD_YAML-CPP) message(STATUS "Building YAML-CPP") if(NOT EXISTS ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${YAML_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION}/build) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION}/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${YAML_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_YAML-CPP) ##### OPENCV ##### if (AUTOBUILD_OPENCV) message(STATUS "Building OpenCV") if(NOT EXISTS ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/opencv-${OPENCV_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build) endif() if (ANDROID) set(OPENCV_PLATFORM_FLAGS -DANDROID_MIN_SDK_VERSION=${ANDROID_PLATFORM_LEVEL} -DANDROID_COMPILE_SDK_VERSION=28 -DANDROID_TARGET_SDK_VERSION=28 -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_ANDROID_PROJECTS=OFF -DWITH_OPENMP=OFF) if (ANDROID_ABI STREQUAL "armeabi-v7a" OR ANDROID_ABI STREQUAL "arm64-v8a") set(OPENCV_PLATFORM_FLAGS ${OPENCV_PLATFORM_FLAGS} -DENABLE_NEON=ON) endif () elseif (PITHREE OR PIFOUR) set(OPENCV_PLATFORM_FLAGS -DWITH_OPENMP=OFF -DWITH_GTK=OFF) elseif (RPI AND NOT PIZERO) set(OPENCV_PLATFORM_FLAGS -DENABLE_NEON=ON -DENABLE_VFPV3=ON -DWITH_OPENMP=OFF -DWITH_GTK=OFF) elseif (PIZERO) set(OPENCV_PLATFORM_FLAGS -DWITH_OPENMP=OFF -DWITH_GTK=OFF) elseif (LINUX AND NOT APPLE) set(OPENCV_PLATFORM_FLAGS -DWITH_OPENMP=OFF -DWITH_GTK=OFF -DBUILD_PROTOBUF=OFF) elseif (APPLE_IOS) set(OPENCV_PLATFORM_FLAGS -DENABLE_NEON=ON -DWITH_OPENMP=OFF) else () set(OPENCV_PLATFORM_FLAGS -DWITH_OPENMP=OFF -DWITH_GTK=OFF) endif() # -DOPENCV_EXTRA_MODULES_PATH=${DEPS_BINARY_DIR}/opencv_contrib-${OPENCV_FILE_VERSION}/modules # -DBUILD_opencv_aruco=OFF # -DBUILD_opencv_bgsegm=OFF # -DBUILD_opencv_bioinspired=OFF # -DBUILD_opencv_ccalib=OFF # -DBUILD_opencv_datasets=OFF # -DBUILD_opencv_dnn_objdetect=OFF # -DBUILD_opencv_dpm=OFF # -DBUILD_opencv_face=OFF # -DBUILD_opencv_fuzzy=OFF # -DBUILD_opencv_hfs=OFF # -DBUILD_opencv_img_hash=OFF # -DBUILD_opencv_line_descriptor=OFF # -DBUILD_opencv_optflow=OFF # -DBUILD_opencv_phase_unwrapping=OFF # -DBUILD_opencv_plot=OFF # -DBUILD_opencv_reg=OFF # -DBUILD_opencv_rgbd=OFF # -DBUILD_opencv_saliency=OFF # -DBUILD_opencv_shape=OFF # -DBUILD_opencv_stereo=OFF # -DBUILD_opencv_structured_light=OFF # -DBUILD_opencv_superres=OFF # -DBUILD_opencv_surface_matching=OFF # -DBUILD_opencv_text=OFF # -DBUILD_opencv_tracking=OFF # -DBUILD_opencv_videostab=OFF # -DBUILD_opencv_xfeatures2d=OFF # -DBUILD_opencv_ximgproc=OFF # -DBUILD_opencv_xobjdetect=OFF # -DBUILD_opencv_xphoto=OFF execute_process(COMMAND ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" ${CROSS} ${BUILD_COMMON_OPTS} ${OPENCV_PLATFORM_FLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/OpenCV -DBUILD_JPEG=OFF -DBUILD_PACKAGE=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_PNG=OFF -DBUILD_TESTS=OFF -DBUILD_TIFF=OFF -DBUILD_WITH_STATIC_CRT=OFF -DBUILD_ZLIB=OFF -DBUILD_opencv_python3=OFF -DBUILD_opencv_python_tests=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_java_bindings_generator=OFF -DBUILD_opencv_python_bindings_generator=OFF -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_MSMF_DXVA=OFF -DWITH_TIFF=OFF ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build) if(WIN32) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build --config Debug --target install) else(WIN32) if (APPLE) function(retryOpenCVbuild) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build ${BUILD_COMMAND_OPTS} RESULT_VARIABLE ocv_result) #if(NOT "${ocv_result}" STREQUAL "0") # message(WARNING "OpenCV FAIL: retry !!") # retryOpenCVbuild() #endif() endfunction(retryOpenCVbuild) retryOpenCVbuild() else (APPLE) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/opencv-${OPENCV_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (APPLE) endif(WIN32) #endif(APPLE_IOS) endif (AUTOBUILD_OPENCV) ##### AUTOBUILD_G2O ##### if (AUTOBUILD_G2O) message(STATUS "Building G2O") if(NOT EXISTS ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${G2O_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION}/build) endif() # patch install debug execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/g2o_Config.cmake.in ${G2O_FILE_VERSION}/cmake_modules/Config.cmake.in WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF -DBUILD_LGPL_SHARED_LIBS=OFF -DG2O_USE_OPENGL=OFF -DG2O_BUILD_EXAMPLES=OFF -DG2O_BUILD_APPS=OFF ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION}/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${G2O_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_G2O) ##### AUTOBUILD_DBOW2 ##### if (AUTOBUILD_DBOW2) message(STATUS "Building DBOW2") if(NOT EXISTS ${DEPS_BINARY_DIR}/dbow2-master.tar.gz) file(DOWNLOAD https://github.com/shinsumicco/DBoW2/archive/master.tar.gz ${DEPS_BINARY_DIR}/dbow2-master.tar.gz) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf dbow2-master.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() # patch install debug execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/DBoW2.cmake.in DBoW2-master/DBoW2.cmake.in WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/DBoW2_CMakeLists.txt DBoW2-master/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/dbow2-master/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DWIN64=${WIN64} -DCMAKE_DEBUG_POSTFIX=_d -DBUILD_SHARED_LIBS=OFF -DBUILD_UTILS=OFF ${DEPS_BINARY_DIR}/dbow2-master WORKING_DIRECTORY ${DEPS_BINARY_DIR}/dbow2-master/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/dbow2-master/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/dbow2-master/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_DBOW2) ##### AUTOBUILD_SUITESPARSE ##### if (AUTOBUILD_SUITESPARSE) message(STATUS "Building SUITESPARSE") if(NOT EXISTS ${DEPS_BINARY_DIR}/suitesparse-master.tar.gz) file(DOWNLOAD https://github.com/jlblancoc/suitesparse-metis-for-windows/archive/master.tar.gz ${DEPS_BINARY_DIR}/suitesparse-master.tar.gz) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf suitesparse-master.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() # patch install debug execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/SuiteSparse-config-install.cmake.in suitesparse-metis-for-windows-master/cmake/SuiteSparse-config-install.cmake.in WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/SuiteSparse-CMakeLists.txt suitesparse-metis-for-windows-master/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/suitesparse-metis-for-windows-master/build) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DWIN64=${WIN64} -DBUILD_SHARED_LIBS=OFF -DBUILD_METIS=OFF ${DEPS_BINARY_DIR}/suitesparse-metis-for-windows-master WORKING_DIRECTORY ${DEPS_BINARY_DIR}/suitesparse-metis-for-windows-master/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/suitesparse-metis-for-windows-master/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/suitesparse-metis-for-windows-master/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_SUITESPARSE) ##### AUTOBUILD_CERES_SOLVER ##### if (AUTOBUILD_CERES_SOLVER) message(STATUS "Building Ceres-Solver") if(NOT EXISTS ${DEPS_DOWNLOAD_DIR}/${CERES_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${CERES_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION}/builddir) endif() if(APPLE_IOS) #Patch execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/ceres_CMakeLists.txt ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif(APPLE_IOS) # patch eigen find #execute_process(COMMAND ${CMAKE_COMMAND} -E copy # ${CMAKE_SOURCE_DIR}/CMake/Packages/FindEigen3.cmake # ${CERES_FILE_VERSION}/cmake/FindEigen3.cmake #WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DWIN64=${WIN64} -DBUILD_SHARED_LIBS=OFF -DMINIGLOG=ON -DGFLAGS=OFF -DSUITESPARSE=OFF -DCXSPARSE=OFF -DOPENBLAS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARKS=OFF -DPROVIDE_UNINSTALL_TARGET=OFF ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION}/builddir) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION}/builddir --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${CERES_FILE_VERSION}/builddir ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_CERES_SOLVER) ##### FFMPEG ##### if (AUTOBUILD_FFMPEG) message(STATUS "Building FFmpeg") if(NOT EXISTS ${DEPS_BINARY_DIR}/FFmpeg-release-${FFMPEG_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/ffpmeg-${FFMPEG_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() #patch${DEPS_DOWNLOAD_DIR}/ffpmeg-${FFMPEG_FILE_VERSION}.tar.gz execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/ffmpeg/sources/patch/configure ${DEPS_BINARY_DIR}/FFmpeg-release-${FFMPEG_FILE_VERSION}/configure WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) # If buildding from Windows, checks if msys2 exists if(WIN32 OR ANDROID) if(EXISTS "C:/msys64/msys2_shell.cmd") set (MSYS_CMD "C:/msys64/msys2_shell.cmd") elseif(EXISTS "C:/msys32/msys2_shell.cmd") set (MSYS_CMD "C:/msys32/msys2_shell.cmd") else() message(ERROR "Msys2 is needed to build FFmpeg") endif() endif(WIN32 OR ANDROID) set(FFMPEG_TOOLS "${CMAKE_SOURCE_DIR}/ffmpeg/sources") set(FFMPEG_SRC "${DEPS_BINARY_DIR}/FFmpeg-release-${FFMPEG_FILE_VERSION}") if(ANDROID) execute_process(COMMAND "${FFMPEG_TOOLS}/buildFromWindows.bat" "${MSYS_CMD}" "${FFMPEG_TOOLS}" "${ANDROID_ABI}" "ffmpeg_build.sh android release ${FFMPEG_SRC} ${CMAKE_INSTALL_PREFIX} ${ANDROID_NDK} ${ANDROID_PLATFORM_LEVEL} ${ANDROID_ABI} ${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(WIN32) if(WIN64) set(FFMPEG_TARGET "win64") set(FFMPEG_ARCH "x64") else() set(FFMPEG_TARGET "win32") set(FFMPEG_ARCH "x86") endif() execute_process(COMMAND "${FFMPEG_TOOLS}/buildFromWindows.bat" "${MSYS_CMD}" "${FFMPEG_TOOLS}" "${FFMPEG_ARCH}" "ffmpeg_build.sh ${FFMPEG_TARGET} release ${FFMPEG_SRC} ${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(APPLE_IOS) configure_file("${CMAKE_SOURCE_DIR}/ffmpeg/sources/ffmpeg_build_iOS.sh.in" "${CMAKE_SOURCE_DIR}/ffmpeg/sources/ffmpeg_build_iOS.sh" @ONLY) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build_iOS.sh" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(OSX) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build_OSX.sh" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(PIZERO) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "rpizero" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(PITHREE) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "rpithree" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(PIFOUR) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "rpifour" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(RPI) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "rpi" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(LINUX32) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "linux32" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(LINUX64) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "linux64" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) elseif(EMSCRIPTEN) execute_process(COMMAND "${FFMPEG_TOOLS}/ffmpeg_build.sh" "emscripten" "release" "${FFMPEG_SRC}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY ${FFMPEG_TOOLS}) endif() endif (AUTOBUILD_FFMPEG) ##### QT ##### if (AUTOBUILD_QT) if(NOT EXISTS $ENV{SCOL_DEPENDENCIES_PATH}/qt/sources/init-repository) message(STATUS "Get QT sources") execute_process(COMMAND "${CMAKE_SOURCE_DIR}/qt/getSources.sh" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/qt) #if (NOT APPLE) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/configure-linux.json ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/gui/configure.json WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) #endif(NOT APPLE) if (RPI) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/qmake-rpi1.conf ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/qtbase/mkspecs/devices/linux-rasp-pi-g++/qmake.conf WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/qmake-rpi2.conf ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/qtbase/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/qmake-rpi3.conf ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/qmake-rpi3-vc4.conf ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/qtbase/mkspecs/devices/linux-rasp-pi3-v4c-g++/qmake.conf WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif(RPI) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/printsupport_main.cpp ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/plugins/printsupport/cocoa/main.cpp WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/qt/patches/qfloat16.cpp ${CMAKE_SOURCE_DIR}/qt/sources/qtbase/src/corelib/global/qfloat16.cpp WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif() endif (AUTOBUILD_QT) ##### OPENBLAS ##### if (AUTOBUILD_OPENBLAS) message(STATUS "Building OPENBLAS") if(NOT EXISTS ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/build) endif() #Patch execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CMake/Utils/OpenBlas_CMakeLists.txt ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 32) set(OPENBLAS_MULTIARCH "") set(OPENBLAS_CC "") if(RPI) if (PIZERO) set(OPENBLAS_TARGET ARMV6) set(OPENBLAS_BINARY 32) set(OPENBLAS_CC CC=arm-linux-gnueabihf-gcc) elseif (PITHREE OR PIFOUR) set(OPENBLAS_TARGET ARMV8) set(OPENBLAS_BINARY 64) set(OPENBLAS_CC CC=aarch64-linux-gnu-gcc) else() set(OPENBLAS_TARGET ARMV7) set(OPENBLAS_BINARY 32) set(OPENBLAS_CC CC=arm-linux-gnueabihf-gcc) endif() elseif(WIN32 OR WIN64) if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i586") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 32) set(OPENBLAS_MULTIARCH "-DDYNAMIC_ARCH=ON -DDYNAMIC_OLDER=ON") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 64) set(OPENBLAS_MULTIARCH "-DDYNAMIC_ARCH=ON -DDYNAMIC_OLDER=ON") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7") set(OPENBLAS_TARGET ARMV7) set(OPENBLAS_BINARY 32) elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv8") set(OPENBLAS_TARGET ARMV8) set(OPENBLAS_BINARY 64) endif() elseif(APPLE) if(IOS) if (IOS_ARCH STREQUAL "arm") set(OPENBLAS_TARGET ARMV7) set(OPENBLAS_BINARY 32) elseif (IOS_ARCH STREQUAL "arm64") set(OPENBLAS_TARGET ARMV8) set(OPENBLAS_BINARY 64) endif() else() if (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 64) else() set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 32) endif() endif() elseif(ANDROID) if (ANDROID_ABI STREQUAL "armeabi-v7a") set(OPENBLAS_TARGET ARMV7) set(OPENBLAS_BINARY 32) elseif(ANDROID_ABI STREQUAL "arm64-v8a") set(OPENBLAS_TARGET ARMV8) set(OPENBLAS_BINARY 64) elseif(ANDROID_ABI STREQUAL "x86_64") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 64) else() set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 32) endif() elseif(LINUX) if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i586" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i386") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 32) elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") set(OPENBLAS_TARGET CORE2) set(OPENBLAS_BINARY 64) elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7") set(OPENBLAS_TARGET ARMV7) set(OPENBLAS_BINARY 32) elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv8") set(OPENBLAS_TARGET ARMV8) set(OPENBLAS_BINARY 64) endif() endif() if (WIN32 OR WIN64 OR LINUX64 AND NOT ANDROID AND NOT RPI) execute_process(COMMAND ${CMAKE_COMMAND} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON -DC_LAPACK:BOOL=ON -DBUILD_TESTING:BOOL=OFF ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) elseif(RPI) #execute_process(COMMAND make clean # WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}) execute_process(COMMAND make TARGET=${OPENBLAS_TARGET} HOSTCC=gcc ${OPENBLAS_CC} USE_THREAD=1 NO_SHARED=1 NOFORTRAN=1 WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} RESULT_VARIABLE MAKE_BUILD_RESULT) if(MAKE_BUILD_RESULT) message(FATAL_ERROR "Failed to build OpenBLAS") endif() execute_process(COMMAND make PREFIX=${CMAKE_INSTALL_PREFIX} install TARGET=${OPENBLAS_TARGET} HOSTCC=gcc ${OPENBLAS_CC} USE_THREAD=1 NO_SHARED=1 NOFORTRAN=1 WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} RESULT_VARIABLE MAKE_INSTALL_RESULT ) if(MAKE_INSTALL_RESULT) message(FATAL_ERROR "Failed to install OpenBLAS") endif() elseif(LINUX32) #execute_process(COMMAND make clean # WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}) execute_process(COMMAND make TARGET=${OPENBLAS_TARGET} BINARY=${OPENBLAS_BINARY} USE_THREAD=1 NO_SHARED=1 NOFORTRAN=1 WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} RESULT_VARIABLE MAKE_BUILD_RESULT) if(MAKE_BUILD_RESULT) message(FATAL_ERROR "Failed to build OpenBLAS") endif() execute_process(COMMAND make PREFIX=${CMAKE_INSTALL_PREFIX} install TARGET=${OPENBLAS_TARGET} BINARY=${OPENBLAS_BINARY} USE_THREAD=1 NO_SHARED=1 NOFORTRAN=1 WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} RESULT_VARIABLE MAKE_INSTALL_RESULT ) if(MAKE_INSTALL_RESULT) message(FATAL_ERROR "Failed to install OpenBLAS") endif() else() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON -DC_LAPACK:BOOL=ON -DBUILD_TESTING:BOOL=OFF -DTARGET:STRING=${OPENBLAS_TARGET} -DBINARY:STRING=${OPENBLAS_BINARY} ${OPENBLAS_MULTIARCH} ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/OpenBLAS-${OPENBLAS_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif() endif (AUTOBUILD_OPENBLAS) if (AUTOBUILD_KALDI) message(STATUS "Building KALDI") if(NOT EXISTS ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/${KALDI_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/build) endif() #Patch execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/vosk-api/depends/kaldi_CMakeLists.txt ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/vosk-api/depends/sp-matrix.cc ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/src/matrix/sp-matrix.cc WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/vosk-api/depends/openfst.cmake ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/cmake/third_party/openfst.cmake WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/vosk-api/depends/gen_cmake_skeleton.py ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/cmake/gen_cmake_skeleton.py WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DKALDI_BUILD_EXE:BOOL=OFF -DKALDI_BUILD_TEST:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DKALDI_VERSION=5.5 ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/build) if(WIN32) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/build --config Debug --target install) else() execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/${KALDI_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif() endif (AUTOBUILD_KALDI) if (AUTOBUILD_ONNXRUNTIME) message(STATUS "Building onnxruntime") if(NOT EXISTS ${DEPS_BINARY_DIR}/onnxruntime-${ONNXRUNTIME_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/onnxruntime-${ONNXRUNTIME_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/piper/patch/onnxruntime-CMakeLists.txt ${DEPS_BINARY_DIR}/onnxruntime-${ONNXRUNTIME_FILE_VERSION}/CMakeLists.txt WORKING_DIRECTORY ${DEPS_BINARY_DIR}) endif() endif (AUTOBUILD_ONNXRUNTIME) if (AUTOBUILD_SDL2) message(STATUS "Building SDL2") if(NOT EXISTS ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/SDL2-${SDL2_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION}/build) endif() if (WIN32) set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=OFF -DSDL_SHARED=ON) elseif (PIZERO) set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=ON -DSDL_SHARED=OFF -DSDL_OPENGL=OFF -DSDL_RPI=ON) elseif (RPI) set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=ON -DSDL_SHARED=OFF -DSDL_RPI=OFF -DSDL_KMSDRM=ON) elseif (LINUX AND NOT APPLE) set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=ON -DSDL_SHARED=OFF) elseif (APPLE_IOS) set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=ON -DSDL_SHARED=OFF) else () set(SDL2_PLATFORM_FLAGS -DSDL_STATIC=ON -DSDL_SHARED=OFF) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} ${SDL2_PLATFORM_FLAGS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DSDL_TEST=OFF -DSDL2_DISABLE_SDL2MAIN=ON -DSDL_AUDIO=OFF ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION}/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/SDL-release-${SDL2_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_SDL2) if (AUTOBUILD_NFDE) message(STATUS "Building Nativefiledialog-extended") if(NOT EXISTS ${DEPS_BINARY_DIR}/NFDE-${NFDE_FILE_VERSION}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${DEPS_DOWNLOAD_DIR}/NFDE-${NFDE_FILE_VERSION}.tar.gz WORKING_DIRECTORY ${DEPS_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BINARY_DIR}/nativefiledialog-extended-${NFDE_FILE_VERSION}/build) endif() execute_process(COMMAND ${CMAKE_COMMAND} ${CROSS} ${BUILD_COMMON_OPTS} "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DNFD_BUILD_TESTS=OFF -DNFD_INSTALL=ON -DNFD_PORTAL=ON ${DEPS_BINARY_DIR}/nativefiledialog-extended-${NFDE_FILE_VERSION} WORKING_DIRECTORY ${DEPS_BINARY_DIR}/nativefiledialog-extended-${NFDE_FILE_VERSION}/build) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nativefiledialog-extended-${NFDE_FILE_VERSION}/build --config Debug --target install) execute_process(COMMAND ${CMAKE_COMMAND} --build ${DEPS_BINARY_DIR}/nativefiledialog-extended-${NFDE_FILE_VERSION}/build ${BUILD_COMMAND_OPTS}) endif (AUTOBUILD_NFDE) endmacro()