Commit 98aa4c55 authored by Ghislain MARY's avatar Ghislain MARY

Split huge CMake builder file.

parent 637a6a65
......@@ -37,7 +37,7 @@ set(LINPHONE_BUILDER_EXTERNAL_SOURCE_PATH "" CACHE STRING "External path to sour
# Include macros definition to be used by builders
include(cmake/LinphoneCMakeBuilder.cmake)
include(cmake/CMakeLists.txt)
if(LINPHONE_BUILDER_CHECK_LATEST)
......
############################################################################
# LinphoneCMakeBuilder.cmake
# CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
......@@ -43,176 +43,9 @@ else()
endif()
find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Could not find python!")
endif()
if(MSVC)
find_program(SH_PROGRAM
NAMES sh.exe
HINTS "C:/MinGW/msys/1.0/bin"
)
if(NOT SH_PROGRAM)
message(FATAL_ERROR "Could not find MinGW!")
endif(NOT SH_PROGRAM)
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
find_file(GCC_LIBRARY
NAMES libgcc.a
HINTS "C:/MinGW/lib/gcc/mingw32/*"
)
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${GCC_LIBRARY}" "${CMAKE_INSTALL_PREFIX}/lib/gcc.lib")
find_file(MINGWEX_LIBRARY
NAMES libmingwex.a
HINTS "C:/MinGW/lib"
)
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${MINGWEX_LIBRARY}" "${CMAKE_INSTALL_PREFIX}/lib/mingwex.lib")
endif()
endif()
if(WIN32)
set(_windows_tools_dir ${CMAKE_BINARY_DIR}/windows_tools)
file(MAKE_DIRECTORY ${_windows_tools_dir})
if(NOT EXISTS "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip")
message(STATUS "Installing windows tools")
file(DOWNLOAD https://www.linphone.org/files/linphone_builder_windows_tools.zip "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip"
WORKING_DIRECTORY ${_windows_tools_dir}
)
file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin")
file(RENAME "${_windows_tools_dir}/awk.exe" "${CMAKE_INSTALL_PREFIX}/bin/awk.exe")
file(RENAME "${_windows_tools_dir}/nasm.exe" "${CMAKE_INSTALL_PREFIX}/bin/nasm.exe")
file(RENAME "${_windows_tools_dir}/patch.exe" "${CMAKE_INSTALL_PREFIX}/bin/patch.exe")
file(RENAME "${_windows_tools_dir}/sed.exe" "${CMAKE_INSTALL_PREFIX}/bin/sed.exe")
file(RENAME "${_windows_tools_dir}/bunzip2.exe" "${CMAKE_INSTALL_PREFIX}/bin/bunzip2.exe")
file(RENAME "${_windows_tools_dir}/bzip2.dll" "${CMAKE_INSTALL_PREFIX}/bin/bzip2.dll")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
file(RENAME "${_windows_tools_dir}/yasm-1.3.0-win64.exe" "C:/MinGW/bin/yasm.exe")
else()
file(RENAME "${_windows_tools_dir}/yasm-1.3.0-win32.exe" "C:/MinGW/bin/yasm.exe")
endif()
endif()
endif()
find_program(PATCH_PROGRAM
NAMES patch patch.exe
)
if(NOT PATCH_PROGRAM)
if(WIN32)
message(FATAL_ERROR "Could not find the patch.exe program. Please install it from http://gnuwin32.sourceforge.net/packages/patch.htm")
else()
message(FATAL_ERROR "Could not find the patch program.")
endif()
endif()
find_program(SED_PROGRAM
NAMES sed sed.exe
)
if(NOT SED_PROGRAM)
if(WIN32)
message(FATAL_ERROR "Could not find the sed.exe program. Please install it from http://gnuwin32.sourceforge.net/packages/sed.htm")
else()
message(FATAL_ERROR "Could not find the sed program.")
endif()
endif()
find_program(PKG_CONFIG_PROGRAM
NAMES pkg-config pkg-config.exe
HINTS "C:/MinGW/bin"
)
if(NOT PKG_CONFIG_PROGRAM)
if(WIN32)
message(STATUS "Installing pkg-config to C:/MinGW/bin")
set(_pkg_config_dir ${CMAKE_BINARY_DIR}/pkg-config)
file(MAKE_DIRECTORY ${_pkg_config_dir})
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip "${CMAKE_BINARY_DIR}/pkg-config.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/pkg-config.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.26-1_win32.zip "${CMAKE_BINARY_DIR}/pkg-config-dev.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/pkg-config-dev.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip "${CMAKE_BINARY_DIR}/gettext-runtime.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/gettext-runtime.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.acc.umu.se/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip "${CMAKE_BINARY_DIR}/glib.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/glib.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(RENAME "${_pkg_config_dir}/bin/pkg-config.exe" "C:/MinGW/bin/pkg-config.exe")
file(RENAME "${_pkg_config_dir}/share/aclocal/pkg.m4" "C:/MinGW/share/aclocal/pkg.m4")
file(RENAME "${_pkg_config_dir}/bin/libglib-2.0-0.dll" "C:/MinGW/bin/libglib-2.0-0.dll")
file(RENAME "${_pkg_config_dir}/bin/intl.dll" "C:/MinGW/bin/intl.dll")
unset(_pkg_config_dir)
endif()
# Check for build tools and show an error if one of them is not present
include(cmake/CheckBuildTools.cmake)
find_program(PKG_CONFIG_PROGRAM
NAMES pkg-config pkg-config.exe
HINTS "C:/MinGW/bin"
)
endif()
if(NOT PKG_CONFIG_PROGRAM AND NOT MSVC)
message(FATAL_ERROR "Could not find the pkg-config program.")
endif()
find_program(INTLTOOLIZE_PROGRAM
NAMES intltoolize
HINTS "C:/MinGW/msys/1.0/bin"
)
if(NOT INTLTOOLIZE_PROGRAM)
if(WIN32)
message(STATUS "Installing intltoolize to C:/MinGW/bin")
set(_intltoolize_dir ${CMAKE_BINARY_DIR}/intltoolize)
file(MAKE_DIRECTORY ${_intltoolize_dir})
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/intltool/0.40/intltool_0.40.4-1_win32.zip "${CMAKE_BINARY_DIR}/intltoolize.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/intltoolize.zip"
WORKING_DIRECTORY ${_intltoolize_dir}
)
execute_process(
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-extract"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-merge"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-prepare"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-update"
)
file(RENAME "${_intltoolize_dir}/bin/intltoolize" "C:/MinGW/msys/1.0/bin/intltoolize")
file(RENAME "${_intltoolize_dir}/bin/intltool-extract" "C:/MinGW/bin/intltool-extract")
file(RENAME "${_intltoolize_dir}/bin/intltool-merge" "C:/MinGW/bin/intltool-merge")
file(RENAME "${_intltoolize_dir}/bin/intltool-prepare" "C:/MinGW/bin/intltool-prepare")
file(RENAME "${_intltoolize_dir}/bin/intltool-update" "C:/MinGW/bin/intltool-update")
file(RENAME "${_intltoolize_dir}/share/aclocal/intltool.m4" "C:/MinGW/share/aclocal/intltool.m4")
file(MAKE_DIRECTORY "C:/MinGW/msys/1.0/share/intltool")
file(RENAME "${_intltoolize_dir}/share/intltool/Makefile.in.in" "C:/MinGW/msys/1.0/share/intltool/Makefile.in.in")
unset(_intltoolize_dir)
endif()
find_program(INTLTOOLIZE_PROGRAM
NAMES intltoolize
HINTS "C:/MinGW/msys/1.0/bin"
)
endif()
if(NOT INTLTOOLIZE_PROGRAM AND NOT MSVC)
message(FATAL_ERROR "Could not find the intltoolize program.")
endif()
if(MSVC)
# Install headers needed by MSVC
file(GLOB MSVC_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/MSVC/*.h")
file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/include/MSVC")
file(INSTALL ${MSVC_HEADER_FILES} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/MSVC")
endif()
set(LINPHONE_BUILDER_EP_VARS)
set(LINPHONE_BUILDER_INCLUDED_BUILDERS)
......@@ -436,7 +269,7 @@ macro(linphone_builder_apply_extra_flags PROJNAME)
set(CMAKE_EXE_LINKER_FLAGS${BUILD_CONFIG} "${CMAKE_EXE_LINKER_FLAGS${BUILD_CONFIG}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS${BUILD_CONFIG} "${CMAKE_MODULE_LINKER_FLAGS${BUILD_CONFIG}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS${BUILD_CONFIG} "${CMAKE_SHARED_LINKER_FLAGS${BUILD_CONFIG}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
endif(NOT "${EP_${PROJNAME}_EXTRA_LDFLAGS}" STREQUAL "")
endif()
endforeach()
endif()
endmacro()
......@@ -598,7 +431,7 @@ function(linphone_builder_add_project PROJNAME)
elseif("${EP_${PROJNAME}_BUILD_METHOD}" STREQUAL "rpm")
if(WIN32)
message( SEND_ERROR "rpm build not supported on WIN32")
message(SEND_ERROR "rpm build not supported on WIN32")
endif()
linphone_builder_create_autogen_command(${PROJNAME})
......
############################################################################
# CheckBuildTools.txt
# Copyright (C) 2015 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_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Could not find python!")
endif()
if(MSVC)
find_program(SH_PROGRAM
NAMES sh.exe
HINTS "C:/MinGW/msys/1.0/bin"
)
if(NOT SH_PROGRAM)
message(FATAL_ERROR "Could not find MinGW!")
endif()
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
find_file(GCC_LIBRARY
NAMES libgcc.a
HINTS "C:/MinGW/lib/gcc/mingw32/*"
)
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${GCC_LIBRARY}" "${CMAKE_INSTALL_PREFIX}/lib/gcc.lib")
find_file(MINGWEX_LIBRARY
NAMES libmingwex.a
HINTS "C:/MinGW/lib"
)
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${MINGWEX_LIBRARY}" "${CMAKE_INSTALL_PREFIX}/lib/mingwex.lib")
endif()
endif()
if(WIN32)
set(_windows_tools_dir ${CMAKE_BINARY_DIR}/windows_tools)
file(MAKE_DIRECTORY ${_windows_tools_dir})
if(NOT EXISTS "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip")
message(STATUS "Installing windows tools")
file(DOWNLOAD https://www.linphone.org/files/linphone_builder_windows_tools.zip "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/linphone_builder_windows_tools.zip"
WORKING_DIRECTORY ${_windows_tools_dir}
)
file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin")
file(RENAME "${_windows_tools_dir}/awk.exe" "${CMAKE_INSTALL_PREFIX}/bin/awk.exe")
file(RENAME "${_windows_tools_dir}/nasm.exe" "${CMAKE_INSTALL_PREFIX}/bin/nasm.exe")
file(RENAME "${_windows_tools_dir}/patch.exe" "${CMAKE_INSTALL_PREFIX}/bin/patch.exe")
file(RENAME "${_windows_tools_dir}/sed.exe" "${CMAKE_INSTALL_PREFIX}/bin/sed.exe")
file(RENAME "${_windows_tools_dir}/bunzip2.exe" "${CMAKE_INSTALL_PREFIX}/bin/bunzip2.exe")
file(RENAME "${_windows_tools_dir}/bzip2.dll" "${CMAKE_INSTALL_PREFIX}/bin/bzip2.dll")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
file(RENAME "${_windows_tools_dir}/yasm-1.3.0-win64.exe" "C:/MinGW/bin/yasm.exe")
else()
file(RENAME "${_windows_tools_dir}/yasm-1.3.0-win32.exe" "C:/MinGW/bin/yasm.exe")
endif()
endif()
endif()
find_program(PATCH_PROGRAM
NAMES patch patch.exe
)
if(NOT PATCH_PROGRAM)
if(WIN32)
message(FATAL_ERROR "Could not find the patch.exe program. Please install it from http://gnuwin32.sourceforge.net/packages/patch.htm")
else()
message(FATAL_ERROR "Could not find the patch program.")
endif()
endif()
find_program(SED_PROGRAM
NAMES sed sed.exe
)
if(NOT SED_PROGRAM)
if(WIN32)
message(FATAL_ERROR "Could not find the sed.exe program. Please install it from http://gnuwin32.sourceforge.net/packages/sed.htm")
else()
message(FATAL_ERROR "Could not find the sed program.")
endif()
endif()
find_program(PKG_CONFIG_PROGRAM
NAMES pkg-config pkg-config.exe
HINTS "C:/MinGW/bin"
)
if(NOT PKG_CONFIG_PROGRAM)
if(WIN32)
message(STATUS "Installing pkg-config to C:/MinGW/bin")
set(_pkg_config_dir ${CMAKE_BINARY_DIR}/pkg-config)
file(MAKE_DIRECTORY ${_pkg_config_dir})
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip "${CMAKE_BINARY_DIR}/pkg-config.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/pkg-config.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-dev_0.26-1_win32.zip "${CMAKE_BINARY_DIR}/pkg-config-dev.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/pkg-config-dev.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip "${CMAKE_BINARY_DIR}/gettext-runtime.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/gettext-runtime.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(DOWNLOAD http://ftp.acc.umu.se/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip "${CMAKE_BINARY_DIR}/glib.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/glib.zip"
WORKING_DIRECTORY ${_pkg_config_dir}
)
file(RENAME "${_pkg_config_dir}/bin/pkg-config.exe" "C:/MinGW/bin/pkg-config.exe")
file(RENAME "${_pkg_config_dir}/share/aclocal/pkg.m4" "C:/MinGW/share/aclocal/pkg.m4")
file(RENAME "${_pkg_config_dir}/bin/libglib-2.0-0.dll" "C:/MinGW/bin/libglib-2.0-0.dll")
file(RENAME "${_pkg_config_dir}/bin/intl.dll" "C:/MinGW/bin/intl.dll")
unset(_pkg_config_dir)
endif()
find_program(PKG_CONFIG_PROGRAM
NAMES pkg-config pkg-config.exe
HINTS "C:/MinGW/bin"
)
endif()
if(NOT PKG_CONFIG_PROGRAM AND NOT MSVC)
message(FATAL_ERROR "Could not find the pkg-config program.")
endif()
find_program(INTLTOOLIZE_PROGRAM
NAMES intltoolize
HINTS "C:/MinGW/msys/1.0/bin"
)
if(NOT INTLTOOLIZE_PROGRAM)
if(WIN32)
message(STATUS "Installing intltoolize to C:/MinGW/bin")
set(_intltoolize_dir ${CMAKE_BINARY_DIR}/intltoolize)
file(MAKE_DIRECTORY ${_intltoolize_dir})
file(DOWNLOAD http://ftp.gnome.org/pub/gnome/binaries/win32/intltool/0.40/intltool_0.40.4-1_win32.zip "${CMAKE_BINARY_DIR}/intltoolize.zip")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_BINARY_DIR}/intltoolize.zip"
WORKING_DIRECTORY ${_intltoolize_dir}
)
execute_process(
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-extract"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-merge"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-prepare"
COMMAND "${SED_PROGRAM}" "-i" "s;/opt/perl/bin/perl;/bin/perl;g" "${_intltoolize_dir}/bin/intltool-update"
)
file(RENAME "${_intltoolize_dir}/bin/intltoolize" "C:/MinGW/msys/1.0/bin/intltoolize")
file(RENAME "${_intltoolize_dir}/bin/intltool-extract" "C:/MinGW/bin/intltool-extract")
file(RENAME "${_intltoolize_dir}/bin/intltool-merge" "C:/MinGW/bin/intltool-merge")
file(RENAME "${_intltoolize_dir}/bin/intltool-prepare" "C:/MinGW/bin/intltool-prepare")
file(RENAME "${_intltoolize_dir}/bin/intltool-update" "C:/MinGW/bin/intltool-update")
file(RENAME "${_intltoolize_dir}/share/aclocal/intltool.m4" "C:/MinGW/share/aclocal/intltool.m4")
file(MAKE_DIRECTORY "C:/MinGW/msys/1.0/share/intltool")
file(RENAME "${_intltoolize_dir}/share/intltool/Makefile.in.in" "C:/MinGW/msys/1.0/share/intltool/Makefile.in.in")
unset(_intltoolize_dir)
endif()
find_program(INTLTOOLIZE_PROGRAM
NAMES intltoolize
HINTS "C:/MinGW/msys/1.0/bin"
)
endif()
if(NOT INTLTOOLIZE_PROGRAM AND NOT MSVC)
message(FATAL_ERROR "Could not find the intltoolize program.")
endif()
if(MSVC)
# Install headers needed by MSVC
file(GLOB MSVC_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/MSVC/*.h")
file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/include/MSVC")
file(INSTALL ${MSVC_HEADER_FILES} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/MSVC")
endif()
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