cmake_minimum_required(VERSION 3.5)
project(tw-ldm-interface-lib)

set(REPO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
set(TW_ROOT ${REPO_ROOT}/ThingWorx-edge-c-sdk)

set(OS "linux")
message(STATUS "OS: " ${OS})
message(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
message(STATUS "TW_ROOT: " ${TW_ROOT})
add_definitions(-DTW_OS_INCLUDE="twLinux-openssl.h")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
include_directories(${TW_ROOT}/src/api ${TW_ROOT}/src/config ${TW_ROOT}/src/fileTransfer ${TW_ROOT}/src/messaging ${TW_ROOT}/src/porting)
include_directories(${TW_ROOT}/src/tls ${TW_ROOT}/src/utils ${TW_ROOT}/src/websocket ${TW_ROOT}/src/tunneling ${TW_ROOT}/src/shapes ${TW_ROOT}/src/primitiveUtils)
include_directories(${TW_ROOT}/src/standardProps ${TW_ROOT}/src/threadUtils ${TW_ROOT}/src/subscribedProps)
include_directories(${TW_ROOT}/src/thirdParty/cJSON ${TW_ROOT}/src/thirdParty/wildcard ${TW_ROOT}/src/thirdParty/tomcrypt/src/headers ${TW_ROOT}/src/stubs)
include_directories(${TW_ROOT}/src/thirdParty/ntlm ${TW_ROOT}/src/thirdParty/libcfu/src ${TW_ROOT}/src/thirdParty/zlib ${TW_ROOT}/src/thirdParty/zlib/contrib/minizip)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -std=gnu++17 -pthread")

set(SOURCE_FILES
    inc/tw-ldm-interface-lib.h
	src/tw-ldm-interface-lib.c
    inc/load_and_parse_configuration_file.h
	src/load_and_parse_configuration_file.c
    )

message(STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY: " ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

link_directories(${TW_ROOT}/build/debian/Release)

add_library(tw-ldm-interface-lib SHARED ${SOURCE_FILES})
add_library(tw-ldm-interface-lib_static STATIC ${SOURCE_FILES})
