CMakeLists.txt 3.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
############################################################################
# CMakeLists.txt
# Copyright (C) 2017  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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
############################################################################
22

23
add_custom_command(OUTPUT include/linphone++/linphone.hh src/linphone++.cc
24 25
	COMMAND ${CMAKE_COMMAND} -E remove_directory include
	COMMAND ${CMAKE_COMMAND} -E remove_directory src
26
	COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml"
27
	DEPENDS ${PROJECT_SOURCE_DIR}/tools/genapixml.py
François Grisez's avatar
François Grisez committed
28
	${PROJECT_SOURCE_DIR}/tools/metadoc.py
29
	${PROJECT_SOURCE_DIR}/tools/metaname.py
François Grisez's avatar
François Grisez committed
30
	${PROJECT_SOURCE_DIR}/tools/abstractapi.py
31 32 33 34 35 36
	genwrapper.py
	class_header.mustache
	class_impl.mustache
	enums_header.mustache
	main_header.mustache
	linphone-doc
37
	"${PROJECT_BINARY_DIR}/coreapi/help/doc/doxygen/xml/index.xml"
38
)
39 40 41

add_library(linphone++ SHARED
	object.cc
42
	tools.cc
43 44
	${CMAKE_CURRENT_BINARY_DIR}/src/linphone++.cc
)
45
target_compile_definitions(linphone++ PRIVATE "-DLINPHONECXX_EXPORTS")
46 47 48 49 50
target_link_libraries(linphone++
	PRIVATE ${BCTOOLBOX_CORE_LIBRARIES} ${BELLESIP_LIBRARIES} linphone
)
target_include_directories(linphone++
	PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
51 52
	PRIVATE ${PROJECT_BINARY_DIR}/include
	PRIVATE ${PROJECT_SOURCE_DIR}/include
53 54 55 56 57 58 59 60 61
	PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
	PRIVATE ${BCTOOLBOX_INCLUDE_DIRS}
	PRIVATE ${BELLESIP_INCLUDE_DIRS}
)
set_target_properties(linphone++ PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})

install(TARGETS linphone++ EXPORT LinphoneCxxTargets
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
62
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
)
install(FILES object.hh
	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone++
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/linphone++
	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
	"${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxVersion.cmake"
	VERSION ${PROJECT_VERSION}
	COMPATIBILITY AnyNewerVersion
)
export(EXPORT LinphoneCxxTargets
	FILE "${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxTargets.cmake"
)
80 81 82 83 84 85 86 87 88 89
configure_file(LinphoneCxxConfig.cmake.in LinphoneCxxConfig.cmake @ONLY)

install(EXPORT LinphoneCxxTargets
	FILE LinphoneCxxTargets.cmake
	DESTINATION "${CMAKE_INSTALL_DATADIR}/LinphoneCxx/cmake"
)
install(FILES
	"${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxConfig.cmake"
	"${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxVersion.cmake"
	DESTINATION "${CMAKE_INSTALL_DATADIR}/LinphoneCxx/cmake"
90
)