-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
61 lines (46 loc) · 1.88 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.5)
set(PROJECT_NAME Vertices-SDK)
project(${PROJECT_NAME})
# Set variable VERTICES_ROOT to absolute path of that file location
get_filename_component(VERTICES_ROOT . ABSOLUTE)
add_definitions(-DVERTICES_ROOT="${VERTICES_ROOT}")
include(utils/utils.cmake)
message(STATUS "💎 Loading targets")
# Module path to find libs
set(CMAKE_MODULE_PATH ${VERTICES_ROOT}/utils/)
# Set blockchain
set(ENV{BLOCKCHAIN_PROVIDER} algorand)
# default behaviour is to compile Unix example if current CMake file is used as
# project root CMake
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(COMPILE_UNIX ON)
endif()
# At this point there are two different targets possible:
# - ESP32 microcontrollers: check whether running from idf.py or if CMAKE_TOOLCHAIN_FILE is
# set to utils/toolchain-esp32.cmake
# - Unix-based OS: default if this file is the CMake source dir, otherwise check variable COMPILE_UNIX
# if CMake has been imported from another location, do not compile for Unix
if (COMPILE_ESP OR ESP_PLATFORM)
message(STATUS "Vertices SDK examples: esp32")
# set project name for generated ESP32 elf/binary files
project(esp32_example)
# add_subdirectory(examples/esp32)
add_subdirectory(examples/esp32)
elseif (COMPILE_UNIX)
message(STATUS "Vertices SDK examples: unix")
set(CMAKE_MACOSX_RPATH 1)
include(utils/libs.cmake)
add_subdirectory(examples/unix)
add_subdirectory(external/mbedtls)
add_subdirectory(external/cJSON)
else()
message(STATUS "Vertices SDK examples: generic")
# build CJSON static lib insteado of default shared lib
set(CJSON_OVERRIDE_BUILD_SHARED_LIBS ON)
set(CJSON_BUILD_SHARED_LIBS OFF)
# Let's use the mbedtls and cJSON library provided with the SDK
add_subdirectory(external/mbedtls)
add_subdirectory(external/cJSON)
endif ()
# Add vertices library
add_subdirectory(src)