mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-03-22 02:59:29 +08:00
cmake : add python support
This commit is contained in:
@@ -12,4 +12,14 @@ target_link_libraries(${TEST_TARGET} PRIVATE
|
||||
ggwave
|
||||
)
|
||||
|
||||
add_test(NAME ${TEST_TARGET} COMMAND $<TARGET_FILE:${TEST_TARGET}>)
|
||||
add_test(NAME ${TEST_TARGET}-cpp COMMAND $<TARGET_FILE:${TEST_TARGET}>)
|
||||
|
||||
if (GGWAVE_SUPPORT_PYTHON)
|
||||
add_test(NAME ${TEST_TARGET}-py
|
||||
COMMAND python test-ggwave.py
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set_tests_properties(${TEST_TARGET}-py
|
||||
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_SOURCE_DIR}/bindings/python")
|
||||
endif()
|
||||
|
||||
7
tests/test-ggwave.py
Executable file
7
tests/test-ggwave.py
Executable file
@@ -0,0 +1,7 @@
|
||||
import ggwave
|
||||
import numpy as np
|
||||
|
||||
instance = ggwave.init()
|
||||
|
||||
# generate audio waveform for string "hello python"
|
||||
waveform = ggwave.encode("hello python", txProtocolId = 1, volume = 20, instance = instance)
|
||||
Reference in New Issue
Block a user