cython_extension(generic LINKS prodigal EXTRA_SOURCES generic.c generic.h template.h)

if(HAVE_SSE2)
  cython_extension(sse2 LINKS prodigal EXTRA_SOURCES sse2.c sse2.h template.h)
  string(REPLACE " " ";" IMPL_FLAGS ${SSE2_C_FLAGS})
  foreach(_flag IN LISTS IMPL_FLAGS) 
    target_compile_options(pyrodigal.impl.sse2 PUBLIC ${_flag})
  endforeach()
endif()

if(HAVE_AVX2)
  cython_extension(avx2 LINKS prodigal EXTRA_SOURCES avx2.c avx2.h template.h)
  string(REPLACE " " ";" IMPL_FLAGS ${AVX2_C_FLAGS})
  foreach(_flag IN LISTS IMPL_FLAGS) 
    target_compile_options(pyrodigal.impl.avx2 PUBLIC ${_flag})
  endforeach()
endif()

if(HAVE_AVX512)
  cython_extension(avx512 LINKS prodigal EXTRA_SOURCES avx512.c avx512.h template.h)
  string(REPLACE " " ";" IMPL_FLAGS ${AVX512_C_FLAGS})
  foreach(_flag IN LISTS IMPL_FLAGS) 
    target_compile_options(pyrodigal.impl.avx512 PUBLIC ${_flag})
  endforeach()
endif()

if(HAVE_NEON)
  cython_extension(neon LINKS prodigal EXTRA_SOURCES neon.c neon.h template.h)
  string(REPLACE " " ";" IMPL_FLAGS ${NEON_C_FLAGS})
  foreach(_flag IN LISTS IMPL_FLAGS) 
    target_compile_options(pyrodigal.impl.neon PUBLIC ${_flag})
  endforeach()
endif()