diff --git a/cmake/Modules/GrccCompile.cmake b/cmake/Modules/GrccCompile.cmake index 4a917c5..a33969a 100644 --- a/cmake/Modules/GrccCompile.cmake +++ b/cmake/Modules/GrccCompile.cmake @@ -30,11 +30,19 @@ ) string(REPLACE ";" ":" PYTHONPATH "${PYTHONPATH}") +if(UNIX) + set(LD_PATH_VAR "LD_LIBRARY_PATH") + if(APPLE) + set(LD_PATH_VAR "DYLD_LIBRARY_PATH") + endif() + set(LD_PATH ${CMAKE_BINARY_DIR}/lib) +endif(UNIX) + macro(GRCC_COMPILE file_name) if(${CMAKE_VERSION} VERSION_LESS "3.2.0") #use wrapper script to set the environment on systems without cmake 3.2 ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file_name} - COMMAND /bin/sh ${CMAKE_SOURCE_DIR}/cmake/Modules/GrccCompileWrapper.sh "${PYTHONPATH}" "${CMAKE_SOURCE_DIR}/grc" "${PC_GNURADIO_RUNTIME_PREFIX}/${GR_RUNTIME_DIR}/grcc -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.grc" + COMMAND /bin/sh ${CMAKE_SOURCE_DIR}/cmake/Modules/GrccCompileWrapper.sh "${PYTHONPATH}" ${LD_PATH_VAR} ${LD_PATH} "${CMAKE_SOURCE_DIR}/grc" "${PC_GNURADIO_RUNTIME_PREFIX}/${GR_RUNTIME_DIR}/grcc -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.grc" COMMAND "${CMAKE_COMMAND}" -E rename ${CMAKE_CURRENT_BINARY_DIR}/${file_name}.py ${CMAKE_CURRENT_BINARY_DIR}/${file_name} DEPENDS ${file_name}.grc ) @@ -42,7 +50,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file_name} COMMAND "${CMAKE_COMMAND}" - -E env PYTHONPATH="${PYTHONPATH}" GRC_BLOCKS_PATH=${CMAKE_SOURCE_DIR}/grc + -E env PYTHONPATH="${PYTHONPATH}" ${LD_PATH_VAR}="${LD_PATH}" GRC_BLOCKS_PATH=${CMAKE_SOURCE_DIR}/grc ${PC_GNURADIO_RUNTIME_PREFIX}/${GR_RUNTIME_DIR}/grcc -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.grc COMMAND "${CMAKE_COMMAND}" -E rename ${CMAKE_CURRENT_BINARY_DIR}/${file_name}.py ${CMAKE_CURRENT_BINARY_DIR}/${file_name} diff --git a/cmake/Modules/GrccCompileWrapper.sh b/cmake/Modules/GrccCompileWrapper.sh index 6c7f60f..e1fb199 100644 --- a/cmake/Modules/GrccCompileWrapper.sh +++ b/cmake/Modules/GrccCompileWrapper.sh @@ -1,3 +1,4 @@ export PYTHONPATH="$1" export GRC_BLOCKS_PATH="$2" -eval "$3" +export $3="$4" +eval "$5"