2019-11-11 03:34:47 -05:00
|
|
|
# Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows
|
2023-09-26 10:37:29 -04:00
|
|
|
SET(CMAKE_SYSTEM_NAME @cmake_system_name@)
|
2019-11-15 09:08:28 -05:00
|
|
|
SET(CMAKE_SYSTEM_PROCESSOR @arch@)
|
2019-04-09 13:23:28 -04:00
|
|
|
SET(CMAKE_BUILD_TYPE @release_type@)
|
2018-03-19 20:26:35 -04:00
|
|
|
|
2019-04-09 13:23:28 -04:00
|
|
|
OPTION(STATIC "Link libraries statically" ON)
|
|
|
|
OPTION(TREZOR_DEBUG "Main trezor debugging switch" OFF)
|
|
|
|
OPTION(BUILD_TESTS "Build tests." OFF)
|
|
|
|
|
|
|
|
SET(STATIC ON)
|
|
|
|
SET(UNBOUND_STATIC ON)
|
2019-06-11 13:00:04 -04:00
|
|
|
SET(ARCH "default")
|
2019-04-09 13:23:28 -04:00
|
|
|
|
|
|
|
SET(BUILD_TESTS @build_tests@)
|
|
|
|
SET(TREZOR_DEBUG @build_tests@)
|
2018-03-19 20:26:35 -04:00
|
|
|
|
|
|
|
# where is the target environment
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)
|
|
|
|
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
|
|
|
|
|
2018-03-19 20:26:35 -04:00
|
|
|
SET(Readline_ROOT_DIR @prefix@)
|
2019-06-17 05:26:04 -04:00
|
|
|
SET(Readline_INCLUDE_DIR @prefix@/include)
|
2019-09-07 16:02:11 -04:00
|
|
|
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
|
2019-11-02 20:12:31 -04:00
|
|
|
SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a)
|
2018-03-19 20:26:35 -04:00
|
|
|
|
2021-07-06 20:51:14 -04:00
|
|
|
SET(UNBOUND_INCLUDE_DIR @prefix@/include)
|
|
|
|
SET(UNBOUND_LIBRARIES @prefix@/lib/libunbound.a)
|
|
|
|
|
2018-10-07 13:16:22 -04:00
|
|
|
SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a)
|
|
|
|
SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a)
|
|
|
|
|
2018-12-04 16:01:03 -05:00
|
|
|
SET(Protobuf_FOUND 1)
|
|
|
|
SET(Protobuf_PROTOC_EXECUTABLE @prefix@/native/bin/protoc CACHE FILEPATH "Path to the native protoc")
|
|
|
|
SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir")
|
|
|
|
SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir")
|
|
|
|
SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library")
|
|
|
|
|
2023-09-29 13:13:37 -04:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|
|
|
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
|
|
|
|
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
|
|
|
|
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)
|
2019-11-11 03:34:47 -05:00
|
|
|
endif()
|
|
|
|
|
2018-03-19 20:26:35 -04:00
|
|
|
SET(ZMQ_INCLUDE_PATH @prefix@/include)
|
|
|
|
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
|
|
|
|
|
2019-09-07 15:35:53 -04:00
|
|
|
SET(Boost_IGNORE_SYSTEM_PATH ON)
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(BOOST_ROOT @prefix@)
|
2019-09-07 15:35:53 -04:00
|
|
|
SET(BOOST_INCLUDEDIR @prefix@/include)
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(BOOST_LIBRARYDIR @prefix@/lib)
|
2019-09-07 15:35:53 -04:00
|
|
|
SET(Boost_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
|
|
|
|
SET(Boost_NO_SYSTEM_PATHS ON)
|
|
|
|
SET(Boost_USE_STATIC_LIBS ON)
|
|
|
|
SET(Boost_USE_STATIC_RUNTIME ON)
|
2018-03-19 19:33:49 -04:00
|
|
|
|
2020-06-25 13:52:10 -04:00
|
|
|
SET(OPENSSL_ROOT_DIR @prefix@)
|
2018-09-17 20:52:57 -04:00
|
|
|
SET(ARCHITECTURE @arch@)
|
2018-03-19 20:26:35 -04:00
|
|
|
|
|
|
|
# for libraries and headers in the target directories
|
|
|
|
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
|
|
|
|
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
|
|
|
|
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
|
|
|
|
|
2018-03-19 19:33:49 -04:00
|
|
|
# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2022-05-03 10:51:34 -04:00
|
|
|
if(ARCHITECTURE STREQUAL "aarch64")
|
2023-09-27 01:37:01 -04:00
|
|
|
SET(CLANG_TARGET "arm64-apple-darwin")
|
|
|
|
SET(CONF_TRIPLE "aarch64-apple-darwin")
|
2022-05-03 10:51:34 -04:00
|
|
|
SET(BUILD_TAG "mac-armv8")
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "arm64")
|
|
|
|
set(ARM ON)
|
|
|
|
set(ARM_ID "armv8-a")
|
|
|
|
else()
|
2023-09-27 01:37:01 -04:00
|
|
|
SET(CLANG_TARGET "x86_64-apple-darwin")
|
|
|
|
SET(CONF_TRIPLE "x86_64-apple-darwin")
|
2022-05-03 10:51:34 -04:00
|
|
|
SET(BUILD_TAG "mac-x64")
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
|
|
endif()
|
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX @prefix@/native/bin/${CONF_TRIPLE}-)
|
2023-07-02 15:00:24 -04:00
|
|
|
SET(CMAKE_C_COMPILER @CC@)
|
2022-05-03 10:51:34 -04:00
|
|
|
SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET})
|
|
|
|
SET(CMAKE_C_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
|
2023-07-02 15:00:24 -04:00
|
|
|
SET(CMAKE_CXX_COMPILER @CXX@ -stdlib=libc++)
|
2022-05-03 10:51:34 -04:00
|
|
|
SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET})
|
|
|
|
SET(CMAKE_CXX_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
|
2023-07-02 15:00:24 -04:00
|
|
|
SET(CMAKE_ASM_COMPILER clang)
|
|
|
|
SET(CMAKE_ASM-ATT_COMPILER as)
|
2022-05-03 10:51:34 -04:00
|
|
|
SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET})
|
|
|
|
SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET})
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(APPLE True)
|
|
|
|
SET(BUILD_64 ON)
|
|
|
|
SET(BREW OFF)
|
|
|
|
SET(PORT OFF)
|
2022-05-05 11:29:11 -04:00
|
|
|
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
2023-07-06 18:13:12 -04:00
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
|
2023-06-29 10:08:03 -04:00
|
|
|
SET(CMAKE_CXX_STANDARD 17)
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(LLVM_ENABLE_PIC OFF)
|
|
|
|
SET(LLVM_ENABLE_PIE OFF)
|
2019-10-31 23:38:13 -04:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|
|
|
SET(ANDROID TRUE)
|
|
|
|
if(ARCHITECTURE STREQUAL "arm")
|
|
|
|
SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a")
|
|
|
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7-a")
|
|
|
|
SET(CMAKE_ANDROID_ARM_MODE ON)
|
|
|
|
SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi)
|
|
|
|
SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi)
|
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi-)
|
|
|
|
elseif(ARCHITECTURE STREQUAL "aarch64")
|
|
|
|
SET(CMAKE_ANDROID_ARCH_ABI "arm64-v8a")
|
|
|
|
SET(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
|
|
|
endif()
|
|
|
|
SET(CMAKE_ANDROID_STANDALONE_TOOLCHAIN @prefix@/native)
|
|
|
|
SET(CMAKE_C_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang")
|
|
|
|
SET(CMAKE_CXX_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang++")
|
2018-03-19 19:33:49 -04:00
|
|
|
else()
|
2023-07-02 15:00:24 -04:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
SET(CMAKE_ASM_COMPILER clang)
|
|
|
|
SET(CMAKE_ASM-ATT_COMPILER as)
|
|
|
|
endif()
|
|
|
|
|
2018-03-19 19:33:49 -04:00
|
|
|
SET(CMAKE_C_COMPILER @CC@)
|
|
|
|
SET(CMAKE_CXX_COMPILER @CXX@)
|
|
|
|
endif()
|
|
|
|
|
2018-09-17 20:52:57 -04:00
|
|
|
if(ARCHITECTURE STREQUAL "arm")
|
2018-09-10 17:22:41 -04:00
|
|
|
set(ARCH "armv7-a")
|
|
|
|
set(ARM ON)
|
|
|
|
set(ARM_ID "armv7-a")
|
2018-03-19 19:33:49 -04:00
|
|
|
set(BUILD_64 OFF)
|
|
|
|
set(CMAKE_BUILD_TYPE release)
|
2019-10-31 23:38:13 -04:00
|
|
|
if(ANDROID)
|
|
|
|
set(BUILD_TAG "android-armv7")
|
|
|
|
else()
|
|
|
|
set(BUILD_TAG "linux-armv7")
|
|
|
|
endif()
|
2018-09-10 17:22:41 -04:00
|
|
|
set(ARM7)
|
2018-09-17 20:52:57 -04:00
|
|
|
elseif(ARCHITECTURE STREQUAL "aarch64")
|
2018-09-10 17:22:41 -04:00
|
|
|
set(ARCH "armv8-a")
|
|
|
|
set(ARM ON)
|
|
|
|
set(ARM_ID "armv8-a")
|
2019-10-31 23:38:13 -04:00
|
|
|
if(ANDROID)
|
|
|
|
set(BUILD_TAG "android-armv8")
|
2022-05-03 10:51:34 -04:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2019-10-31 23:38:13 -04:00
|
|
|
set(BUILD_TAG "linux-armv8")
|
|
|
|
endif()
|
2018-09-10 17:22:41 -04:00
|
|
|
set(BUILD_64 ON)
|
2018-03-19 19:33:49 -04:00
|
|
|
endif()
|
2018-03-19 20:26:35 -04:00
|
|
|
|
2019-06-26 18:25:47 -04:00
|
|
|
if(ARCHITECTURE STREQUAL "riscv64")
|
2024-03-09 15:15:28 -05:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set(BUILD_TAG "linux-riscv64")
|
|
|
|
endif()
|
2023-10-20 10:58:28 -04:00
|
|
|
set(ARCH_ID "riscv64")
|
|
|
|
set(ARCH "rv64gc")
|
2019-06-26 18:25:47 -04:00
|
|
|
endif()
|
|
|
|
|
2019-09-24 23:28:20 -04:00
|
|
|
if(ARCHITECTURE STREQUAL "i686")
|
2019-02-22 10:18:32 -05:00
|
|
|
SET(ARCH_ID "i386")
|
2019-09-24 23:28:20 -04:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2019-12-18 07:07:33 -05:00
|
|
|
set(BUILD_TAG "linux-x86")
|
2019-09-24 23:28:20 -04:00
|
|
|
SET(LINUX_32 ON)
|
2019-12-18 07:07:33 -05:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
set(BUILD_TAG "win-x32")
|
2019-09-24 23:28:20 -04:00
|
|
|
endif()
|
2019-02-22 10:18:32 -05:00
|
|
|
endif()
|
|
|
|
|
2019-09-24 23:28:20 -04:00
|
|
|
if(ARCHITECTURE STREQUAL "x86_64")
|
2019-12-18 07:07:33 -05:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set(BUILD_TAG "linux-x64")
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
set(BUILD_TAG "freebsd-x64")
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
set(BUILD_TAG "win-x64")
|
|
|
|
endif()
|
2019-02-22 10:18:32 -05:00
|
|
|
SET(ARCH_ID "x86_64")
|
2018-09-25 18:36:34 -04:00
|
|
|
endif()
|
|
|
|
|
2018-03-19 19:33:49 -04:00
|
|
|
#Create a new global cmake flag that indicates building with depends
|
2018-03-19 20:26:35 -04:00
|
|
|
set (DEPENDS true)
|