
#rights reserved
cmake_minimum_required(VERSION 2.8)

include(${ROOT_DIR}/buildtools/cmake/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.cmake)
#project name
set(PROJECT_NAME "leo-das")

message(INFO " SYSTEM_ARCH:${SYSTEM_ARCH}\n")
set(CMAKE_BUILD_TYPE RELEASE)
set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x")

# 获取当前的分支
set(GIT_BRANCH "")
get_git_branch(GIT_BRANCH)
string(REGEX REPLACE ".*/(.*)" "\\1" _git_branch "${GIT_BRANCH}")
message(STATUS "Git branch is ${_git_branch}")                     # 宏的结束

add_definitions(-DDAS_VERSION=\"${_git_branch}\")

project(${PROJECT_NAME})

set(PROJECT_SOURCE_DIR ${ROOT_DIR})
set(PROJECT_BINARY_DIR ${ROOT_DIR}/out/${PRODUCT_NAME})
set(CMAKE_SOURCE_DIR ${ROOT_DIR})
set(CMAKE_BINARY_DIR ${ROOT_DIR}/out/${PRODUCT_NAME})
set(CMAKE_INSTALL_PREFIX ${ROOT_DIR}/out/${PRODUCT_NAME}/install)
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}, PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}")

add_definitions(-DHTNICE_C2)
add_definitions(-DUSE_HTNICE)
add_definitions(-DHTNICE_K4)
# add_definitions(-DLINUX)
# add_definitions(-D__arm__)

set(BUILD_SHARED_LIBS OFF)
set(EVENT_LIBRARY_TYPE STATIC)


include_directories(${PRODUCT_ROOT_DIR})
include_directories(${PRODUCT_ROOT_DIR}/vendor/${PRODUCT_NAME})

# build_subdirectory(thirdparty/openssl link thirdparty/openssl/ssl)
# build_subdirectory(thirdparty/mbedtls)
# build_subdirectory(thirdparty/zlib)

set(LIBXML2_WITH_PYTHON OFF)
# build_subdirectory(thirdparty/libxml2)

# build_subdirectory(thirdparty/SQLiteCpp include thirdparty/SQLiteCpp/sqlite3)

build_subdirectory(utils)

build_subdirectory(foundation/gw_leo)
build_subdirectory(foundation/leo-das)