2019-11-11 09:34:47 +01:00
|
|
|
# Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows
|
2018-03-20 01:26:35 +01:00
|
|
|
SET(CMAKE_SYSTEM_NAME @depends@)
|
2019-04-09 19:23:28 +02:00
|
|
|
SET(CMAKE_BUILD_TYPE @release_type@)
|
2018-03-20 01:26:35 +01:00
|
|
|
|
2019-04-09 19:23:28 +02: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 19:00:04 +02:00
|
|
|
SET(ARCH "default")
|
2019-04-09 19:23:28 +02:00
|
|
|
|
|
|
|
SET(BUILD_TESTS @build_tests@)
|
|
|
|
SET(TREZOR_DEBUG @build_tests@)
|
2018-03-20 01:26:35 +01:00
|
|
|
|
|
|
|
# where is the target environment
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)
|
|
|
|
|
2018-03-20 00:33:49 +01:00
|
|
|
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
|
|
|
|
|
2018-03-20 01:26:35 +01:00
|
|
|
SET(Readline_ROOT_DIR @prefix@)
|
2019-06-17 11:26:04 +02:00
|
|
|
SET(Readline_INCLUDE_DIR @prefix@/include)
|
2019-09-07 22:02:11 +02:00
|
|
|
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
|
2019-11-03 01:12:31 +01:00
|
|
|
SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a)
|
2018-03-20 01:26:35 +01:00
|
|
|
|
2019-11-01 04:38:13 +01:00
|
|
|
SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
|
|
|
|
|
2019-11-11 09:34:47 +01:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
|
2018-03-20 01:26:35 +01:00
|
|
|
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
|
|
|
|
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
|
|
|
|
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)
|
|
|
|
|
2019-11-11 09:34:47 +01:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
2018-10-07 19:16:22 +02:00
|
|
|
SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a)
|
|
|
|
SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a)
|
|
|
|
|
2018-12-04 22:01:03 +01: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")
|
2019-11-01 04:38:13 +01:00
|
|
|
endif()
|
2018-12-04 22:01:03 +01:00
|
|
|
|
2019-11-11 09:34:47 +01:00
|
|
|
endif()
|
|
|
|
|
2018-03-20 01:26:35 +01:00
|
|
|
SET(ZMQ_INCLUDE_PATH @prefix@/include)
|
|
|
|
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
|
|
|
|
|
2019-09-07 21:35:53 +02:00
|
|
|
SET(Boost_IGNORE_SYSTEM_PATH ON)
|
2018-03-20 00:33:49 +01:00
|
|
|
SET(BOOST_ROOT @prefix@)
|
2019-09-07 21:35:53 +02:00
|
|
|
SET(BOOST_INCLUDEDIR @prefix@/include)
|
2018-03-20 00:33:49 +01:00
|
|
|
SET(BOOST_LIBRARYDIR @prefix@/lib)
|
2019-09-07 21:35:53 +02: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-20 00:33:49 +01:00
|
|
|
|
|
|
|
SET(OpenSSL_DIR @prefix@/lib)
|
2018-09-18 02:52:57 +02:00
|
|
|
SET(ARCHITECTURE @arch@)
|
2018-03-20 01:26:35 +01: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
|
|
|
|
|
2019-02-22 16:18:32 +01:00
|
|
|
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "" FORCE)
|
|
|
|
|
2018-03-20 00:33:49 +01:00
|
|
|
# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
SET(CMAKE_C_COMPILER @prefix@/native/bin/clang)
|
|
|
|
SET(CMAKE_C_COMPILER_TARGET x86_64-apple-darwin11)
|
|
|
|
SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++)
|
|
|
|
SET(CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin11)
|
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-apple-darwin11-)
|
|
|
|
SET(APPLE True)
|
|
|
|
SET(BUILD_TAG "mac-x64")
|
|
|
|
SET(BUILD_64 ON)
|
|
|
|
SET(BREW OFF)
|
|
|
|
SET(PORT OFF)
|
|
|
|
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
|
|
|
|
SET(CMAKE_CXX_STANDARD 11)
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
|
|
SET(LLVM_ENABLE_PIC OFF)
|
|
|
|
SET(LLVM_ENABLE_PIE OFF)
|
2019-11-01 04:38:13 +01: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-20 00:33:49 +01:00
|
|
|
else()
|
|
|
|
SET(CMAKE_C_COMPILER @CC@)
|
|
|
|
SET(CMAKE_CXX_COMPILER @CXX@)
|
|
|
|
endif()
|
|
|
|
|
2018-09-18 02:52:57 +02:00
|
|
|
if(ARCHITECTURE STREQUAL "arm")
|
2018-09-10 23:22:41 +02:00
|
|
|
set(ARCH "armv7-a")
|
|
|
|
set(ARM ON)
|
|
|
|
set(ARM_ID "armv7-a")
|
2018-03-20 00:33:49 +01:00
|
|
|
set(BUILD_64 OFF)
|
|
|
|
set(CMAKE_BUILD_TYPE release)
|
2019-11-01 04:38:13 +01:00
|
|
|
if(ANDROID)
|
|
|
|
set(BUILD_TAG "android-armv7")
|
|
|
|
else()
|
|
|
|
set(BUILD_TAG "linux-armv7")
|
|
|
|
endif()
|
2018-09-10 23:22:41 +02:00
|
|
|
set(ARM7)
|
2018-09-18 02:52:57 +02:00
|
|
|
elseif(ARCHITECTURE STREQUAL "aarch64")
|
2018-09-10 23:22:41 +02:00
|
|
|
set(ARCH "armv8-a")
|
|
|
|
set(ARM ON)
|
|
|
|
set(ARM_ID "armv8-a")
|
2019-11-01 04:38:13 +01:00
|
|
|
if(ANDROID)
|
|
|
|
set(BUILD_TAG "android-armv8")
|
|
|
|
else()
|
|
|
|
set(BUILD_TAG "linux-armv8")
|
|
|
|
endif()
|
2018-09-10 23:22:41 +02:00
|
|
|
set(BUILD_64 ON)
|
2018-03-20 00:33:49 +01:00
|
|
|
endif()
|
2018-03-20 01:26:35 +01:00
|
|
|
|
2019-06-27 00:25:47 +02:00
|
|
|
if(ARCHITECTURE STREQUAL "riscv64")
|
|
|
|
set(NO_AES ON)
|
|
|
|
set(ARCH "rv64imafdc")
|
|
|
|
endif()
|
|
|
|
|
2019-09-25 05:28:20 +02:00
|
|
|
if(ARCHITECTURE STREQUAL "i686")
|
2019-02-22 16:18:32 +01:00
|
|
|
SET(ARCH_ID "i386")
|
2019-09-25 05:28:20 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
SET(LINUX_32 ON)
|
|
|
|
endif()
|
2019-02-22 16:18:32 +01:00
|
|
|
endif()
|
|
|
|
|
2019-09-25 05:28:20 +02:00
|
|
|
if(ARCHITECTURE STREQUAL "x86_64")
|
2019-02-22 16:18:32 +01:00
|
|
|
SET(ARCH_ID "x86_64")
|
2018-09-26 00:36:34 +02:00
|
|
|
endif()
|
|
|
|
|
2018-03-20 00:33:49 +01:00
|
|
|
#Create a new global cmake flag that indicates building with depends
|
2018-03-20 01:26:35 +01:00
|
|
|
set (DEPENDS true)
|