Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify test #8

Merged
merged 3 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class SpeexDSPConan(ConanFile):
default_options = "shared=False"
generators = "cmake"

_speexdsp_pkg_name = "speexdsp-1.2rc3"
_speexdsp_libname = "speexdsp"
_pkg_name = "speexdsp-1.2rc3"
_libname = "speexdsp"

def source(self):
url = "http://downloads.xiph.org/releases/speex/{}.tar.gz".format(self._speexdsp_pkg_name)
url = "http://downloads.xiph.org/releases/speex/{}.tar.gz".format(self._pkg_name)
self.output.info("Downloading {}".format(url))
tools.get(url)
self._createCMakeLists()
Expand All @@ -33,27 +33,27 @@ def configure(self):
def build(self):
if self._isVisualStudioBuild():
cmake = CMake(self)
cmake.configure(source_dir=self._speexdsp_pkg_name)
cmake.configure(source_dir=self._pkg_name)
cmake.build()
else:
autotools = AutoToolsBuildEnvironment(self)
autotools.configure(configure_dir=self._speexdsp_pkg_name)
autotools.configure(configure_dir=self._pkg_name)
autotools.make()
autotools.install()

def package(self):
self.copy("include/speex/*.h", dst=".", src=self._speexdsp_pkg_name)
self.copy("include/speex/*.h", dst=".", src=self._pkg_name)
self.copy("speexdsp_config_types.h", dst="include/speex", src=".")
if self._isVisualStudioBuild():
self.copy("win32/config.h", dst="include", src=self._speexdsp_pkg_name)
self.copy("win32/config.h", dst="include", src=self._pkg_name)
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="lib", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)

def package_info(self):
self.cpp_info.libs = [self._speexdsp_libname]
self.cpp_info.libs = [self._libname]
if self._isVisualStudioBuild():
# in include/win32 config.h is provided
self.cpp_info.includedirs = ["include", "include/win32"]
Expand Down Expand Up @@ -201,10 +201,10 @@ def _createCMakeLists(self):
elseif (HAVE_SYS_TYPES_H)
target_compile_definitions(${{LIBSPEEXDSP}} PRIVATE HAVE_SYS_TYPES_H)
endif ()
'''.format(self._speexdsp_libname)
'''.format(self._libname)

self.output.info("create CMakeLists.txt file")
cmake_file = os.path.join(self._speexdsp_pkg_name, "CMakeLists.txt")
cmake_file = os.path.join(self._pkg_name, "CMakeLists.txt")
f = open(cmake_file, "w+")
f.write(content)
f.close()
40 changes: 14 additions & 26 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
cmake_minimum_required(VERSION 3.5)
project(LibSpeexDSPTest)
cmake_minimum_required (VERSION 3.5)
project (SpeexDSPTest)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
set (CMAKE_CXX_STANDARD 11)

include (${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

include (CheckIncludeFiles)
check_include_files (stdint.h HAVE_STDINT_H)
check_include_files (inttypes.h HAVE_INTTYPES_H)
check_include_files (sys/types.h HAVE_SYS_TYPES_H)

if (NOT MSVC)
set (CONAN_LIBS ${CONAN_LIBS} m)
endif ()

# the tests are taken over from libspeexdsp src folder
foreach (TEST testdenoise testecho testjitter testresample testresample2)

add_executable(${TEST} ${TEST}.c)
add_executable (speexdsptest speexdsptest.cpp)

if (MSVC)
# _USE_MATH_DEFINES needed for M_PI
target_compile_definitions(${TEST} PRIVATE HAVE_CONFIG_H _USE_MATH_DEFINES)
endif ()

if (HAVE_STDINT_H)
target_compile_definitions(${TEST} PRIVATE HAVE_STDINT_H)
elseif (HAVE_INTTYPES_H)
target_compile_definitions(${TEST} PRIVATE HAVE_INTTYPES_H)
elseif (HAVE_SYS_TYPES_H)
target_compile_definitions(${TEST} PRIVATE HAVE_SYS_TYPES_H)
endif ()

target_link_libraries(${TEST} ${CONAN_LIBS})
if (HAVE_STDINT_H)
target_compile_definitions(speexdsptest PRIVATE HAVE_STDINT_H)
elseif (HAVE_INTTYPES_H)
target_compile_definitions(speexdsptest PRIVATE HAVE_INTTYPES_H)
elseif (HAVE_SYS_TYPES_H)
target_compile_definitions(speexdsptest PRIVATE HAVE_SYS_TYPES_H)
endif ()

endforeach ()
conan_target_link_libraries (speexdsptest)
7 changes: 1 addition & 6 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,4 @@ def imports(self):
def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
for test in ["testdenoise", "testecho", "testjitter", "testresample", "testresample2"]:
if test == "testjitter":
self.output.info("running '{}'".format(test))
self.run(".{}{}".format(os.sep, test))
else:
self.output.warn("skip running '{}' - as it can't be executed within this test environment".format(test))
self.run(".{}speexdsptest".format(os.sep))
16 changes: 16 additions & 0 deletions test_package/speexdsptest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <speex/speex_jitter.h>


int main()
{
auto* jitterBuffer = jitter_buffer_init(32);

if (jitterBuffer)
{
jitter_buffer_reset(jitterBuffer);
}

jitter_buffer_destroy(jitterBuffer);

return 0;
}
44 changes: 0 additions & 44 deletions test_package/testdenoise.c

This file was deleted.

53 changes: 0 additions & 53 deletions test_package/testecho.c

This file was deleted.

75 changes: 0 additions & 75 deletions test_package/testjitter.c

This file was deleted.

Loading