Commit 94081993 authored by Ghislain MARY's avatar Ghislain MARY

Improve autotools handling + add -fPIC compilation flag for Python config.

parent 84697422
......@@ -57,12 +57,6 @@ else()
endif()
# Get build tools and flags for autotools projects (except for Windows Phone where we cannot build with MinGW)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
linphone_builder_get_autotools_configuration()
endif()
# Create targets list from the given LINPHONE_BUILDER_TARGET
linphone_builder_create_targets_list()
......@@ -73,8 +67,17 @@ else()
include(${LINPHONE_BUILDER_CONFIG_FILE})
# Apply build flags and add external projects
# Apply build flags
linphone_builder_apply_flags()
# Get build tools and flags for autotools projects (except for Windows Phone where we cannot build with MinGW)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
linphone_builder_get_autotools_configuration()
endif()
# Add external projects
linphone_builder_add_projects()
linphone_builder_add_dummy_libraries_generation()
......
......@@ -44,8 +44,8 @@ set(AUTOTOOLS_C_COMPILER_NO_LAUNCHER "@CMAKE_C_COMPILER@" CACHE PATH "Initial ca
set(AUTOTOOLS_CXX_COMPILER_NO_LAUNCHER "@CMAKE_CXX_COMPILER@" CACHE PATH "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_COMPILER_NO_LAUNCHER "@CMAKE_C_COMPILER@" CACHE PATH "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS "@CMAKE_CXX_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS "@CMAKE_EXE_LINKER_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS "@AUTOTOOLS_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS "@AUTOTOOLS_CXX_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS "@AUTOTOOLS_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS "@AUTOTOOLS_LINKER_FLAGS@" CACHE STRING "Initial cache" FORCE)
############################################################################
# CMakeLists.txt
# 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.
#
############################################################################
cmake_minimum_required(VERSION 2.8)
configure_file(${CMAKE_SOURCE_DIR}/Autotools.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Autotools.cmake @ONLY)
......@@ -134,31 +134,8 @@ endif()
function(linphone_builder_get_autotools_configuration)
if(MSVC)
set(_generator "MinGW Makefiles")
else()
set(_generator "${CMAKE_GENERATOR}")
endif()
set(_autotools_command ${CMAKE_COMMAND} -G "${_generator}")
if(CMAKE_TOOLCHAIN_FILE)
list(APPEND _autotools_command "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()
if(CMAKE_OSX_ARCHITECTURES)
list(APPEND _autotools_command "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
endif()
if(CMAKE_C_COMPILER_LAUNCHER)
list(APPEND _autotools_command "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}")
endif()
if(CMAKE_CXX_COMPILER_LAUNCHER)
list(APPEND _autotools_command "-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}")
endif()
list(APPEND _autotools_command "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Autotools/")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/Autotools)
execute_process(COMMAND ${_autotools_command} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Autotools)
unset(_autotools_command)
unset(_extra_generator)
unset(_generator)
include(${CMAKE_BINARY_DIR}/Autotools/Autotools.cmake)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Autotools.cmake.in" "${CMAKE_BINARY_DIR}/Autotools.cmake" @ONLY)
include(${CMAKE_BINARY_DIR}/Autotools.cmake)
endfunction()
......@@ -298,19 +275,24 @@ macro(linphone_builder_apply_extra_flags PROJNAME)
set(ep_objcflags "${ep_objcflags} ${EP_${PROJNAME}_EXTRA_OBJCFLAGS}")
set(ep_ldflags "${ep_ldflags} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
else()
foreach(BUILD_CONFIG "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
if(EP_${PROJNAME}_EXTRA_CFLAGS)
set(CMAKE_C_FLAGS${BUILD_CONFIG} "${CMAKE_C_FLAGS${BUILD_CONFIG}} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_CXXFLAGS)
set(CMAKE_CXX_FLAGS${BUILD_CONFIG} "${CMAKE_CXX_FLAGS${BUILD_CONFIG}} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_LDFLAGS)
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()
endforeach()
set(BUILD_TYPES "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
list(FIND BUILD_TYPES "${CMAKE_BUILD_TYPE}" BUILD_TYPE_FOUND)
set(BUILD_TYPE_SUFFIX "")
if(NOT ${BUILD_TYPE_FOUND} EQUAL -1)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
set(BUILD_TYPE_SUFFIX "_${UPPER_BUILD_TYPE}")
endif()
if(EP_${PROJNAME}_EXTRA_CFLAGS)
set(CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_C_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_CFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_CXXFLAGS)
set(CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_CXX_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_CXXFLAGS}")
endif()
if(EP_${PROJNAME}_EXTRA_LDFLAGS)
set(CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_EXE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_MODULE_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX} "${CMAKE_SHARED_LINKER_FLAGS${BUILD_TYPE_SUFFIX}} ${EP_${PROJNAME}_EXTRA_LDFLAGS}")
endif()
endif()
endmacro()
......@@ -770,7 +752,6 @@ endfunction()
macro(linphone_builder_add_dummy_libraries_generation)
if(LINPHONE_BUILDER_DUMMY_LIBRARIES)
# linphone_builder_apply_flags()
linphone_builder_set_ep_directories(dummy_libraries)
linphone_builder_expand_external_project_vars()
ExternalProject_Add(EP_dummy_libraries
......
......@@ -58,6 +58,7 @@ if (UNIX)
set(LINPHONE_BUILDER_OBJCFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(LINPHONE_BUILDER_LDFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
else()
set(LINPHONE_BUILDER_CPPFLAGS "-fPIC")
set(LINPHONE_BUILDER_LDFLAGS "-Wl,-Bsymbolic -fPIC")
endif()
endif()
......@@ -118,7 +119,6 @@ set(EP_vpx_LINKING_TYPE "--enable-static" "--disable-shared" "--enable-pic")
if(NOT PACKAGE_NAME)
set(PACKAGE_NAME "linphone")
endif()
linphone_builder_apply_flags()
linphone_builder_set_ep_directories(pylinphone)
linphone_builder_expand_external_project_vars()
ExternalProject_Add(TARGET_pylinphone
......
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