Commit 45f03416 authored by Ghislain MARY's avatar Ghislain MARY

Add CMakeLists.txt.

parent 8971bd1a
############################################################################
# CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
cmake_minimum_required(VERSION 3.0)
project(MSCODEC2 VERSION 0.1 LANGUAGES C)
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
include(GNUInstallDirs)
if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake")
else()
find_package(Mediastreamer2 REQUIRED)
endif()
find_package(Codec2 REQUIRED)
include_directories(
${MEDIASTREAMER2_INCLUDE_DIRS}
${CODEC2_INCLUDE_DIRS}
)
set(LIBS ${MEDIASTREAMER2_LIBRARIES} ${CODEC2_LIBRARIES})
set(SOURCE_FILES mscodec2.c)
if(ENABLE_STATIC)
add_library(mscodec2-static STATIC ${SOURCE_FILES})
set_target_properties(mscodec2-static PROPERTIES OUTPUT_NAME mscodec2)
target_link_libraries(mscodec2-static ${LIBS})
install(TARGETS mscodec2-static
RUNTIME DESTINATION lib/mediastreamer/plugins
LIBRARY DESTINATION lib/mediastreamer/plugins
ARCHIVE DESTINATION lib/mediastreamer/plugins
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
if(ENABLE_SHARED)
add_library(mscodec2 MODULE ${SOURCE_FILES})
set_target_properties(mscodec2 PROPERTIES SOVERSION 0)
target_link_libraries(mscodec2 ${LIBS})
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libmscodec2.pdb
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
set_target_properties(mscodec2 PROPERTIES PREFIX "lib")
endif()
install(TARGETS mscodec2
RUNTIME DESTINATION lib/mediastreamer/plugins
LIBRARY DESTINATION lib/mediastreamer/plugins
ARCHIVE DESTINATION lib/mediastreamer/plugins
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
############################################################################
# FindCodec2.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
#
# - Find the codec2 include file and library
#
# CODEC2_FOUND - system has codec2
# CODEC2_INCLUDE_DIRS - the codec2 include directory
# CODEC2_LIBRARIES - The libraries needed to use codec2
include(CMakePushCheckState)
find_path(CODEC2_INCLUDE_DIRS
NAMES codec2/codec2.h
PATH_SUFFIXES include
)
if(CODEC2_INCLUDE_DIRS)
set(HAVE_CODEC2_CODEC2_H 1)
endif()
find_library(CODEC2_LIBRARIES NAMES codec2)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Codec2
DEFAULT_MSG
CODEC2_INCLUDE_DIRS CODEC2_LIBRARIES HAVE_CODEC2_CODEC2_H
)
mark_as_advanced(CODEC2_INCLUDE_DIRS CODEC2_LIBRARIES HAVE_CODEC2_CODEC2_H)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment