Shared library not quite working yet...

pull/2/head
Richard Shaw 2019-04-03 18:44:14 -05:00
parent 89bc3728c5
commit 4621fb771f
2 changed files with 33 additions and 2 deletions

View File

@ -5,6 +5,27 @@
cmake_minimum_required(VERSION 3.0)
project(LPCNet C)
include(GNUInstallDirs)
mark_as_advanced(CLEAR
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_LIBDIR
)
#
# Prevent in-source builds
# If an in-source build is attempted, you will still need to clean up a few
# files manually.
#
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not "
"allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a "
"separate build directory and run cmake from there.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
# Set default flags
set(CMAKE_C_FLAGS "-Wall -W -Wextra -Wno-unused-function -O3 -g -I. -MD ${CMAKE_C_FLAGS}")
execute_process(COMMAND grep -c "avx2" /proc/cpuinfo
@ -58,4 +79,3 @@ else()
endif()
add_subdirectory(src)

View File

@ -18,7 +18,18 @@ set(lpcnet_freedv_srcs
${lpcnet_SOURCE_DIR}/nnet_data.c
)
add_library(lpcnetfreedv STATIC ${lpcnet_freedv_srcs})
add_library(lpcnetfreedv ${lpcnet_freedv_srcs})
install(TARGETS lpcnetfreedv EXPORT lpcnet-config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lpcnet
)
install(EXPORT lpcnet-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lpcnet
)
add_executable(dump_data dump_data.c)
target_link_libraries(dump_data lpcnetfreedv m codec2)