feather/contrib/depends/toolchain.cmake.in
2024-11-02 23:31:21 +01:00

180 lines
5.2 KiB
CMake

# Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows
SET(CMAKE_SYSTEM_NAME @depends@)
SET(CMAKE_SYSTEM_PROCESSOR @arch@)
SET(CMAKE_BUILD_TYPE @release_type@)
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)
SET(ARCH "default")
SET(BUILD_TESTS @build_tests@)
SET(TREZOR_DEBUG @build_tests@)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH @prefix@)
SET(LIB_DIR @prefix@/lib)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# WMF libs
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} $ENV{WMF_LIBS})
endif()
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
# use CACHE here because we need to be able to override these later
SET(TOR_DIR @prefix@/Tor CACHE STRING "Tor dir")
SET(TOR_VERSION @tor_version@ CACHE STRING "Tor version")
SET(Readline_ROOT_DIR @prefix@)
SET(Readline_INCLUDE_DIR @prefix@/include)
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a)
SET(UNBOUND_INCLUDE_DIR @prefix@/include)
SET(UNBOUND_LIBRARIES @prefix@/lib/libunbound.a)
SET(CMAKE_FIND_USE_PACKAGE_ROOT_PATH ON)
SET(absl_ROOT @prefix@)
SET(NATIVE_BIN_PATH @prefix@/native/bin CACHE FILEPATH "path to native binaries" FORCE)
SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
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)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a)
SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a)
endif()
endif()
SET(ZMQ_INCLUDE_PATH @prefix@/include)
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
SET(Boost_IGNORE_SYSTEM_PATH ON)
SET(BOOST_ROOT @prefix@)
SET(BOOST_INCLUDEDIR @prefix@/include)
SET(BOOST_LIBRARYDIR @prefix@/lib)
SET(Boost_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
SET(Boost_NO_SYSTEM_PATHS ON)
SET(Boost_USE_STATIC_LIBS ON)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(Boost_USE_STATIC_RUNTIME ON)
endif()
SET(OPENSSL_ROOT_DIR @prefix@)
SET(ARCHITECTURE @arch@)
# 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
# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(ARCHITECTURE STREQUAL "aarch64")
SET(CLANG_TARGET "arm64-apple-darwin")
SET(CONF_TRIPLE "aarch64-apple-darwin")
SET(BUILD_TAG "mac-armv8")
SET(CMAKE_OSX_ARCHITECTURES "arm64")
set(ARM ON)
set(ARM_ID "armv8-a")
else()
SET(CLANG_TARGET "x86_64-apple-darwin")
SET(CONF_TRIPLE "x86_64-apple-darwin")
SET(BUILD_TAG "mac-x64")
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
SET(CMAKE_SYSTEM_VERSION 20.1)
SET(_CMAKE_TOOLCHAIN_PREFIX @prefix@/native/bin/${CONF_TRIPLE}-)
SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_C_FLAGS "@CFLAGS@")
SET(CMAKE_CXX_COMPILER @CXX@ -stdlib=libc++)
SET(CMAKE_CXX_FLAGS "@CXXFLAGS@")
SET(CMAKE_EXE_LINKER_FLAGS "@LDFLAGS@")
SET(CMAKE_MODULE_LINKER_FLAGS "@LDFLAGS@")
SET(CMAKE_SHARED_LINKER_FLAGS "@LDFLAGS@")
SET(CMAKE_INSTALL_NAME_TOOL llvm-install-name-tool)
SET(CMAKE_ASM_COMPILER clang)
SET(CMAKE_ASM-ATT_COMPILER llvm-as)
SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_AR llvm-ar)
SET(CMAKE_RANLIB llvm-ranlib)
SET(APPLE True)
SET(BUILD_64 ON)
SET(BREW OFF)
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
SET(CMAKE_CXX_STANDARD 17)
else()
SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_CXX_COMPILER @CXX@)
endif()
if(ARCHITECTURE STREQUAL "arm")
set(ARCH "armv7-a")
set(ARM ON)
set(ARM_ID "armv7-a")
set(BUILD_64 OFF)
set(CMAKE_BUILD_TYPE release)
if(ANDROID)
set(BUILD_TAG "android-armv7")
else()
set(BUILD_TAG "linux-armv7")
endif()
set(ARM7)
elseif(ARCHITECTURE STREQUAL "aarch64")
set(ARCH "armv8-a")
set(ARM ON)
set(ARM_ID "armv8-a")
if(ANDROID)
set(BUILD_TAG "android-armv8")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BUILD_TAG "linux-armv8")
endif()
set(BUILD_64 ON)
endif()
if(ARCHITECTURE STREQUAL "riscv64")
set(NO_AES ON)
set(ARCH "rv64imafdc")
endif()
if(ARCHITECTURE STREQUAL "x86_64")
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()
SET(ARCH_ID "x86_64")
endif()
#Create a new global cmake flag that indicates building with depends
set (DEPENDS true)
set(CMAKE_EXE_LINKER_FLAGS_INIT "@guix_ldflags@")
if(DEFINED ENV{PYTHONPATH})
set(PYTHONPATH "@prefix@/native/lib/python3/dist-packages:$ENV{PYTHONPATH}")
else()
set(PYTHONPATH "@prefix@/native/lib/python3/dist-packages")
endif()
set(CMAKE_INSTALL_NAME_TOOL "@CMAKE_INSTALL_NAME_TOOL@" CACHE FILEPATH "")
set(CMAKE_INSTALL_NAME_TOOL "@CMAKE_INSTALL_NAME_TOOL@")
set(OTOOL "@OTOOL@")