Update cmake modules from Gnuradio to fix parallel build bug

This commit is contained in:
Nick Foster 2012-08-20 14:23:56 -07:00
parent 6d6917f06b
commit ee542ded35
5 changed files with 52 additions and 32 deletions

View File

@ -1,17 +1,17 @@
# Copyright 2010-2011 Free Software Foundation, Inc. # Copyright 2010-2011 Free Software Foundation, Inc.
# #
# This file is part of GNU Radio # This file is part of GNU Radio
# #
# GNU Radio is free software; you can redistribute it and/or modify # GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option) # the Free Software Foundation; either version 3, or (at your option)
# any later version. # any later version.
# #
# GNU Radio is distributed in the hope that it will be useful, # GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to # along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, # the Free Software Foundation, Inc., 51 Franklin Street,
@ -155,7 +155,7 @@ function(GR_LIBRARY_FOO target)
GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR}) GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
#give the library a special name with ultra-zero soversion #give the library a special name with ultra-zero soversion
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
set(target_name lib${target}-${LIBVER}.so.0.0.0) set(target_name lib${target}-${LIBVER}.so.0.0.0)
#custom command to generate symlinks #custom command to generate symlinks

View File

@ -1,17 +1,17 @@
# Copyright 2011 Free Software Foundation, Inc. # Copyright 2011 Free Software Foundation, Inc.
# #
# This file is part of GNU Radio # This file is part of GNU Radio
# #
# GNU Radio is free software; you can redistribute it and/or modify # GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option) # the Free Software Foundation; either version 3, or (at your option)
# any later version. # any later version.
# #
# GNU Radio is distributed in the hope that it will be useful, # GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to # along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, # the Free Software Foundation, Inc., 51 Franklin Street,
@ -37,10 +37,18 @@ if(LINUX AND EXISTS "/etc/redhat-release")
set(REDHAT TRUE) set(REDHAT TRUE)
endif() endif()
if(LINUX AND EXISTS "/etc/slackware-version")
set(SLACKWARE TRUE)
endif()
######################################################################## ########################################################################
# when the library suffix should be 64 (applies to redhat linux family) # when the library suffix should be 64 (applies to redhat linux family)
######################################################################## ########################################################################
if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") if (REDHAT OR SLACKWARE)
set(LIB64_CONVENTION TRUE)
endif()
if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
set(LIB_SUFFIX 64) set(LIB_SUFFIX 64)
endif() endif()
set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")

View File

@ -76,10 +76,11 @@ macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c " COMMAND ${PYTHON_EXECUTABLE} -c "
######################################### #########################################
try: import ${mod} try:
except: exit(-1) import ${mod}
try: assert ${cmd} assert ${cmd}
except: exit(-1) except ImportError, AssertionError: exit(-1)
except: pass
#########################################" #########################################"
RESULT_VARIABLE ${have} RESULT_VARIABLE ${have}
) )
@ -181,6 +182,10 @@ function(GR_PYTHON_INSTALL)
#################################################################### ####################################################################
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
if (CMAKE_CROSSCOMPILING)
set(pyexe_native /usr/bin/env python)
endif()
foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
get_filename_component(pyfile_name ${pyfile} NAME) get_filename_component(pyfile_name ${pyfile} NAME)
get_filename_component(pyfile ${pyfile} ABSOLUTE) get_filename_component(pyfile ${pyfile} ABSOLUTE)

View File

@ -1,17 +1,17 @@
# Copyright 2010-2011 Free Software Foundation, Inc. # Copyright 2010-2011 Free Software Foundation, Inc.
# #
# This file is part of GNU Radio # This file is part of GNU Radio
# #
# GNU Radio is free software; you can redistribute it and/or modify # GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option) # the Free Software Foundation; either version 3, or (at your option)
# any later version. # any later version.
# #
# GNU Radio is distributed in the hope that it will be useful, # GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to # along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, # the Free Software Foundation, Inc., 51 Franklin Street,
@ -33,8 +33,7 @@ include(GrPython)
# - GR_SWIG_DOCS_TARGET_DEPS # - GR_SWIG_DOCS_TARGET_DEPS
######################################################################## ########################################################################
function(GR_SWIG_MAKE_DOCS output_file) function(GR_SWIG_MAKE_DOCS output_file)
find_package(Doxygen) if(ENABLE_DOXYGEN)
if(DOXYGEN_FOUND)
#setup the input files variable list, quote formated #setup the input files variable list, quote formated
set(input_files) set(input_files)
@ -76,17 +75,18 @@ function(GR_SWIG_MAKE_DOCS output_file)
#call the swig_doc script on the xml files #call the swig_doc script on the xml files
add_custom_command( add_custom_command(
OUTPUT ${output_file} OUTPUT ${output_file}
DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
${OUTPUT_DIRECTORY}/xml ${OUTPUT_DIRECTORY}/xml
${output_file} ${output_file}
COMMENT "Generating python docstrings for ${name}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
) )
else(DOXYGEN_FOUND) else(ENABLE_DOXYGEN)
file(WRITE ${output_file} "\n") #no doxygen -> empty file file(WRITE ${output_file} "\n") #no doxygen -> empty file
endif(DOXYGEN_FOUND) endif(ENABLE_DOXYGEN)
endfunction(GR_SWIG_MAKE_DOCS) endfunction(GR_SWIG_MAKE_DOCS)
######################################################################## ########################################################################
@ -105,12 +105,15 @@ endfunction(GR_SWIG_MAKE_DOCS)
macro(GR_SWIG_MAKE name) macro(GR_SWIG_MAKE name)
set(ifiles ${ARGN}) set(ifiles ${ARGN})
list(APPEND GR_SWIG_TARGET_DEPS ${GR_SWIG_LIBRARIES})
#do swig doc generation if specified #do swig doc generation if specified
if (GR_SWIG_DOC_FILE) if (GR_SWIG_DOC_FILE)
set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS}) set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS})
GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS}) GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE}) add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc)
endif() endif()
#append additional include directories #append additional include directories

View File

@ -1,17 +1,17 @@
# Copyright 2010-2011 Free Software Foundation, Inc. # Copyright 2010-2011 Free Software Foundation, Inc.
# #
# This file is part of GNU Radio # This file is part of GNU Radio
# #
# GNU Radio is free software; you can redistribute it and/or modify # GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option) # the Free Software Foundation; either version 3, or (at your option)
# any later version. # any later version.
# #
# GNU Radio is distributed in the hope that it will be useful, # GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to # along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, # the Free Software Foundation, Inc., 51 Franklin Street,
@ -33,7 +33,6 @@ set(__INCLUDED_GR_TEST_CMAKE TRUE)
######################################################################## ########################################################################
function(GR_ADD_TEST test_name) function(GR_ADD_TEST test_name)
if(WIN32)
#Ensure that the build exe also appears in the PATH. #Ensure that the build exe also appears in the PATH.
list(APPEND GR_TEST_TARGET_DEPS ${ARGN}) list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
@ -50,6 +49,7 @@ function(GR_ADD_TEST test_name)
endif(location) endif(location)
endforeach(target) endforeach(target)
if(WIN32)
#SWIG generates the python library files into a subdirectory. #SWIG generates the python library files into a subdirectory.
#Therefore, we must append this subdirectory into PYTHONPATH. #Therefore, we must append this subdirectory into PYTHONPATH.
#Only do this for the python directories matching the following: #Only do this for the python directories matching the following:
@ -74,15 +74,19 @@ function(GR_ADD_TEST test_name)
#SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
if(UNIX) if(UNIX)
set(LD_PATH_VAR "LD_LIBRARY_PATH")
if(APPLE)
set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
endif()
set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
#set both LD and DYLD paths to cover multiple UNIX OS library paths list(APPEND libpath "$${LD_PATH_VAR}")
list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
list(APPEND pypath "$PYTHONPATH") list(APPEND pypath "$PYTHONPATH")
#replace list separator with the path separator #replace list separator with the path separator
string(REPLACE ";" ":" libpath "${libpath}") string(REPLACE ";" ":" libpath "${libpath}")
string(REPLACE ";" ":" pypath "${pypath}") string(REPLACE ";" ":" pypath "${pypath}")
list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
#generate a bat file that sets the environment and runs the test #generate a bat file that sets the environment and runs the test
find_program(SHELL sh) find_program(SHELL sh)