cmake_minimum_required(VERSION 3.14)
project(wtpp)

set(CMAKE_CXX_STANDARD 17)

add_subdirectory(lib/pybind11)

add_executable(wtpp src/wtpp.cpp)

pybind11_add_module(py-wave SHARED src/wave.cpp)
pybind11_add_module(py-wavetable SHARED src/wavetable.cpp)
# pybind11_add_module(common SHARED src/common.cpp)
# pybind11_add_module(generators SHARED src/generators.cpp)
add_library(wave src/wave.cpp)
add_library(wavetable src/wavetable.cpp)
add_library(common src/common.cpp)
add_library(generators src/generators.cpp)

target_link_libraries(wtpp wave wavetable common generators)

include(FetchContent)
FetchContent_Declare(
  googletest
  URL https://github.com/google/googletest/archive/95d8c7ac4389b38b197bc7521dffb62508653eb5.zip
)

FetchContent_MakeAvailable(googletest)

enable_testing()

add_executable(wave_test tests/wave_test.cpp)
add_executable(wavetable_test tests/wavetable_test.cpp)
add_executable(generators_test tests/generators_test.cpp)

target_link_libraries(wave_test wave GTest::gtest_main)
target_link_libraries(wavetable_test wave wavetable GTest::gtest_main)
target_link_libraries(generators_test generators GTest::gtest_main)

include(GoogleTest)

gtest_discover_tests(wave_test)
gtest_discover_tests(wavetable_test)
gtest_discover_tests(generators_test)
