diff options
Diffstat (limited to 'cmake/Modules/GrSwig.cmake')
-rw-r--r-- | cmake/Modules/GrSwig.cmake | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake index 0d4cce2b3..0fa1c7b77 100644 --- a/cmake/Modules/GrSwig.cmake +++ b/cmake/Modules/GrSwig.cmake @@ -17,12 +17,12 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -IF(DEFINED __INCLUDED_GR_SWIG_CMAKE) - RETURN() -ENDIF() -SET(__INCLUDED_GR_SWIG_CMAKE TRUE) +if(DEFINED __INCLUDED_GR_SWIG_CMAKE) + return() +endif() +set(__INCLUDED_GR_SWIG_CMAKE TRUE) -INCLUDE(GrPython) +include(GrPython) ######################################################################## # Build a swig target for the common gnuradio use case. Usage: @@ -35,11 +35,11 @@ INCLUDE(GrPython) # - GR_SWIG_SOURCE_DEPS # - GR_SWIG_TARGET_DEPS ######################################################################## -MACRO(GR_SWIG_MAKE name) - SET(ifiles ${ARGN}) +macro(GR_SWIG_MAKE name) + set(ifiles ${ARGN}) #determine include dependencies for swig file - EXECUTE_PROCESS( + execute_process( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/get_swig_deps.py "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}" OUTPUT_STRIP_TRAILING_WHITESPACE @@ -48,30 +48,30 @@ MACRO(GR_SWIG_MAKE name) ) #append the specified include directories - INCLUDE_DIRECTORIES(${GR_SWIG_INCLUDE_DIRS}) - LIST(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS}) + include_directories(${GR_SWIG_INCLUDE_DIRS}) + list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS}) - FIND_PACKAGE(PythonLibs) - INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) + find_package(PythonLibs) + include_directories(${PYTHON_INCLUDE_DIRS}) #setup the swig flags with flags and include directories - SET(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) - FOREACH(dir ${GR_SWIG_INCLUDE_DIRS}) - LIST(APPEND CMAKE_SWIG_FLAGS "-I${dir}") - ENDFOREACH(dir) + set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) + foreach(dir ${GR_SWIG_INCLUDE_DIRS}) + list(APPEND CMAKE_SWIG_FLAGS "-I${dir}") + endforeach(dir) #set the C++ property on the swig .i file so it builds - SET_SOURCE_FILES_PROPERTIES(${ifiles} PROPERTIES CPLUSPLUS ON) + set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON) #setup the actual swig library target to be built - INCLUDE(UseSWIG) + include(UseSWIG) SWIG_ADD_MODULE(${name} python ${ifiles}) SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) - IF(GR_SWIG_TARGET_DEPS) - ADD_DEPENDENCIES(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS}) - ENDIF(GR_SWIG_TARGET_DEPS) + if(GR_SWIG_TARGET_DEPS) + add_dependencies(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS}) + endif(GR_SWIG_TARGET_DEPS) -ENDMACRO(GR_SWIG_MAKE) +endmacro(GR_SWIG_MAKE) ######################################################################## # Install swig targets generated by GR_SWIG_MAKE. Usage: @@ -81,25 +81,25 @@ ENDMACRO(GR_SWIG_MAKE) # [COMPONENT component] # ) ######################################################################## -MACRO(GR_SWIG_INSTALL) +macro(GR_SWIG_INSTALL) - INCLUDE(CMakeParseArgumentsCopy) + include(CMakeParseArgumentsCopy) CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) - FOREACH(name ${GR_SWIG_INSTALL_TARGETS}) - INSTALL(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} + foreach(name ${GR_SWIG_INSTALL_TARGETS}) + install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} DESTINATION ${GR_SWIG_INSTALL_DESTINATION} COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) - INCLUDE(GrPython) + include(GrPython) GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py DESTINATION ${GR_SWIG_INSTALL_DESTINATION} COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) - ENDFOREACH(name) + endforeach(name) -ENDMACRO(GR_SWIG_INSTALL) +endmacro(GR_SWIG_INSTALL) ######################################################################## # Generate a python file that can determine swig dependencies. @@ -107,7 +107,7 @@ ENDMACRO(GR_SWIG_INSTALL) # When you build C++, CMake figures out the header dependencies. # This code essentially performs that logic for swig includes. ######################################################################## -FILE(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py " +file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py " import os, sys, re |