# library
set( LIB_NAME Core )

# get source files
file( GLOB_RECURSE SRC_FILES "*.cpp" )
file( GLOB_RECURSE INC_FILES "*.h" )


# special flags
file( GLOB_RECURSE AVX2_SRC_FILES "*_avx2.cpp"  )
file( GLOB_RECURSE SSE42_SRC_FILES "*_sse.cpp" )


# library
add_library( ${LIB_NAME} STATIC ${SRC_FILES} ${INC_FILES}  )
if( SET_ENABLE_TRACING )
  if( ENABLE_TRACING )
    target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_TRACING=1 )
  else()
    target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_TRACING=0 )
  endif()
endif()
  

# set needed compile flags
if( MSVC )
  set_property( SOURCE ${AVX2_SRC_FILES}  APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
elseif( UNIX OR MINGW )
  set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" )
  set_property( SOURCE ${AVX2_SRC_FILES}  APPEND PROPERTY COMPILE_FLAGS "-mavx2" )
endif()

target_include_directories( ${LIB_NAME} PUBLIC ..  )
target_link_libraries( ${LIB_NAME} libmd5 Trace HLS)

set_target_properties( ${LIB_NAME} PROPERTIES FOLDER lib )
