From 734e0ec1bd4814b2636c4606bd7be7dd4bf021f6 Mon Sep 17 00:00:00 2001 From: Suleyman Poyraz Date: Wed, 25 Sep 2024 21:04:44 +0300 Subject: [PATCH] Revert "Changes that suggested on #770" and Added way given on pull req. This reverts commit d4afa9ee1edbab2b4c737db288359e339d5a00a9 partially. as @jdemel stated: > CMAKE_CURRENT_BINARY_DIR would possibly be the preferred way to use. I'd suspect changing this variable in the original location would already fix your issue. That'd be great. That way we can keep the code in a more generic place that makes it easier to re-use. Also, thanks for your patience. I changed code with stated expression, and boom. it worked. --- cmake/Modules/VolkPython.cmake | 15 ++++++++++++++- python/volk_modtool/CMakeLists.txt | 13 ------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmake/Modules/VolkPython.cmake b/cmake/Modules/VolkPython.cmake index 0a839c84..629d6d79 100644 --- a/cmake/Modules/VolkPython.cmake +++ b/cmake/Modules/VolkPython.cmake @@ -140,7 +140,7 @@ file(TO_CMAKE_PATH ${VOLK_PYTHON_DIR} VOLK_PYTHON_DIR) # Usage: VOLK_UNIQUE_TARGET( ) ######################################################################## function(VOLK_UNIQUE_TARGET desc) - file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + file(RELATIVE_PATH reldir ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib unique = hashlib.sha256(b'${reldir}${ARGN}').hexdigest()[:5] @@ -259,3 +259,16 @@ function(VOLK_PYTHON_INSTALL) volk_unique_target("pygen" ${python_install_gen_targets}) endfunction(VOLK_PYTHON_INSTALL) + +######################################################################## +# Write the python helper script that generates byte code files +######################################################################## +file( + WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py + " +import sys, py_compile +files = sys.argv[1:] +srcs, gens = files[:len(files)//2], files[len(files)//2:] +for src, gen in zip(srcs, gens): + py_compile.compile(file=src, cfile=gen, doraise=True) +") diff --git a/python/volk_modtool/CMakeLists.txt b/python/volk_modtool/CMakeLists.txt index 92299aae..5f0f066c 100644 --- a/python/volk_modtool/CMakeLists.txt +++ b/python/volk_modtool/CMakeLists.txt @@ -6,19 +6,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later # -######################################################################## -# Write the python helper script that generates byte code files -######################################################################## -file( - WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py - " -import sys, py_compile -files = sys.argv[1:] -srcs, gens = files[:len(files)//2], files[len(files)//2:] -for src, gen in zip(srcs, gens): - py_compile.compile(file=src, cfile=gen, doraise=True) -") - ######################################################################## # Install python files and apps ########################################################################