if (G2)
  set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DG2")
endif ()

set(TARGET icicle_curve)
set(FIELD_TARGET icicle_field)

set(SRC ${CMAKE_SOURCE_DIR}/src)

set(CURVE_SOURCE ${SRC}/curves/extern.cu)
if(G2)
  list(APPEND CURVE_SOURCE ${SRC}/curves/extern_g2.cu)
endif()
if(MSM)
  list(APPEND CURVE_SOURCE ${SRC}/msm/extern.cu)
  if(G2)
    list(APPEND CURVE_SOURCE ${SRC}/msm/extern_g2.cu)
  endif()
endif()
if(ECNTT)
  list(APPEND CURVE_SOURCE ${SRC}/ntt/extern_ecntt.cu)
  list(APPEND CURVE_SOURCE ${SRC}/ntt/kernel_ntt.cu)
endif()

add_library(${TARGET} STATIC ${CURVE_SOURCE})
target_include_directories(${TARGET} PUBLIC ${CMAKE_SOURCE_DIR}/include/)
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ingo_curve_${CURVE}")
target_compile_definitions(${TARGET} PUBLIC CURVE=${CURVE})
target_link_libraries(${TARGET} PRIVATE ${FIELD_TARGET})