cmake_minimum_required(VERSION 3.5)
project(sparkd)

# proto sources
set (Protos)

include(${CMAKE_SOURCE_DIR}/tools/safe_dep_glob.cmake)
include(${CMAKE_SOURCE_DIR}/tools/Protobuf.cmake)

# DEPENDENCIES ------------------------------------------------------------ 

# protos
file(GLOB_RECURSE Protos RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto)

# normal cpps
file(GLOB_RECURSE Sparkd_Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.c)

# this is used to communicate to other repositories that the build
# needs to happen again (because a file was added)
update_deps_file("${Protos};${Sparkd_Sources}")
#END DEPENDENCIES ------------------------------------------------------------

protobuf_generate_cpp( Proto_Srcs PROTO_HDRS ${Protos} )
add_executable(sparkd ${Sparkd_Sources} ${Proto_Srcs})

#include paths
target_include_directories( sparkd PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src)

# linking
target_link_libraries( sparkd
  spark_lib
  cryptopp
  tbb
  double-conversion
  pugixml
  onixs-cmemdh-all-4.3.0
  quickfix
  benchmark
  lttng-ust
  -static-libgcc
  -static-libstdc++
  -pthread) 

# copy test data
file(COPY jetfix/tests/sample_fix.dat DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test_data)