prepare_packaging.cmake 3.65 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
############################################################################
# prepare_packaging.cmake
# Copyright (C) 2014  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.
#
############################################################################


if(MSVC)
	string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" MSVC_VERSION "${CMAKE_GENERATOR}")
Ghislain MARY's avatar
Ghislain MARY committed
26
	if(CMAKE_BUILD_TYPE STREQUAL "Debug")
27 28 29 30 31 32 33 34 35 36
		find_file(MSVCR_LIB msvcr${MSVC_VERSION}0d.dll PATHS "C:/Windows/System32")
	else()
		find_file(MSVCR_LIB msvcr${MSVC_VERSION}0.dll PATHS "C:/Windows/System32")
	endif()
endif()

set(OUTPUT_DIR "${OUTPUT_DIR}/build_${PACKAGE_TYPE}/linphone")
file(MAKE_DIRECTORY "${OUTPUT_DIR}/linphone")
configure_file("${INPUT_DIR}/__init__.py.cmake" "${OUTPUT_DIR}/linphone/__init__.py")
file(COPY "${LINPHONE_PYTHON_MODULE}" DESTINATION "${OUTPUT_DIR}/linphone")
Ghislain MARY's avatar
Ghislain MARY committed
37
if(UNIX AND NOT APPLE)
38 39 40 41 42 43 44 45
	foreach(reallib ${LINPHONE_DYNAMIC_LIBRARIES_TO_INSTALL})
		get_filename_component(libpath ${reallib} DIRECTORY)
		get_filename_component(reallibname ${reallib} NAME)
		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" libname ${reallibname})
		file(COPY ${reallib} DESTINATION "${OUTPUT_DIR}/linphone")
		file(RENAME "${OUTPUT_DIR}/linphone/${reallibname}" "${OUTPUT_DIR}/linphone/${libname}")
	endforeach()
else()
46
	file(COPY ${LINPHONE_DYNAMIC_LIBRARIES_TO_INSTALL} DESTINATION "${OUTPUT_DIR}/linphone")
47
endif()
Ghislain MARY's avatar
Ghislain MARY committed
48
if(MSVC AND NOT MSVC_VERSION STREQUAL "9")
49 50
	file(COPY ${MSVCR_LIB} DESTINATION "${OUTPUT_DIR}/linphone")
endif()
51 52 53 54
get_filename_component(LINPHONE_PYTHON_MODULE_PATH "${LINPHONE_PYTHON_MODULE}" DIRECTORY)
find_file(PDB_FILENAME "linphone.pdb" "${LINPHONE_PYTHON_MODULE_PATH}")
if(PDB_FILENAME)
	file(COPY "${PDB_FILENAME}" DESTINATION "${OUTPUT_DIR}/linphone")
55 56 57 58
endif()
file(COPY "${LINPHONE_RESOURCES_PREFIX}/share/images" DESTINATION "${OUTPUT_DIR}/linphone/share/")
file(COPY "${LINPHONE_RESOURCES_PREFIX}/share/linphone" DESTINATION "${OUTPUT_DIR}/linphone/share/")
file(COPY "${LINPHONE_RESOURCES_PREFIX}/share/sounds" DESTINATION "${OUTPUT_DIR}/linphone/share/")
59 60
file(COPY "${LINPHONE_SOURCE_DIR}/tools/python/unittests" DESTINATION "${OUTPUT_DIR}/linphone/")
file(COPY "${LINPHONE_SOURCE_DIR}/tester/certificates" DESTINATION "${OUTPUT_DIR}/linphone/unittests/")
61
file(COPY "${LINPHONE_SOURCE_DIR}/tester/images" DESTINATION "${OUTPUT_DIR}/linphone/unittests/")
62 63 64
file(COPY "${LINPHONE_SOURCE_DIR}/tester/rcfiles" DESTINATION "${OUTPUT_DIR}/linphone/unittests/")
file(COPY "${LINPHONE_SOURCE_DIR}/tester/sounds" DESTINATION "${OUTPUT_DIR}/linphone/unittests/")
file(COPY "${LINPHONE_SOURCE_DIR}/tester/tester_hosts" DESTINATION "${OUTPUT_DIR}/linphone/unittests/")
65
file(GLOB_RECURSE LINPHONE_DATA_FILES RELATIVE "${OUTPUT_DIR}/linphone" "${OUTPUT_DIR}/linphone/*")
Ghislain MARY's avatar
Ghislain MARY committed
66
if(PACKAGE_TYPE STREQUAL "msi")
67 68 69 70
	set(BUILD_VERSION ${LINPHONE_VERSION})
else()
	set(BUILD_VERSION ${LINPHONE_GIT_REVISION})
endif()
71
configure_file("${INPUT_DIR}/setup.py.cmake" "${OUTPUT_DIR}/setup.py" @ONLY)