Skip to content

Commit

Permalink
add install target and libm dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
j-schultz committed Jul 15, 2020
1 parent b3f2140 commit 7d6f71f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
41 changes: 35 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
cmake_minimum_required(VERSION 3.1)
project(rnnoise)
include(CheckLibraryExists)

option(RNNOISE_COMPILE_OPUS ON)
project(rnnoise LANGUAGES C)

if(RNNOISE_COMPILE_OPUS)
add_definitions(-DCOMPILE_OPUS)
endif()
add_definitions(-DCOMPILE_OPUS)

# Ignore CRT warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
Expand Down Expand Up @@ -36,4 +34,35 @@ endif()
target_include_directories(rnnoise PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
PRIVATE src)

# dependencies
if(NOT WIN32)
check_library_exists(m cos "" HAVE_LIBM)
if(HAVE_LIBM)
#find_library(LIBM m)
set(LIBM m)
endif()
endif()
if(HAVE_LIBM)
if(BUILD_SHARED_LIBS)
target_link_libraries(rnnoise PRIVATE ${LIBM})
else()
target_link_libraries(rnnoise PUBLIC ${LIBM})
endif()
endif()

install(TARGETS rnnoise
EXPORT ${CMAKE_PROJECT_NAME}Config
LIBRARY DESTINATION lib COMPONENT lib
ARCHIVE DESTINATION lib COMPONENT lib
RUNTIME DESTINATION bin COMPONENT bin)

install(DIRECTORY "include"
DESTINATION . COMPONENT dev
FILES_MATCHING
PATTERN "*.h")

install(EXPORT ${CMAKE_PROJECT_NAME}Config
DESTINATION cmake)

2 changes: 1 addition & 1 deletion src/kiss_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,4 +600,4 @@ void opus_ifft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin,kiss_fft_cpx *
for (i=0;i<st->nfft;i++)
fout[i].i = -fout[i].i;
}
#endif
#endif

0 comments on commit 7d6f71f

Please sign in to comment.