From b0d935676c9ec29e5794767aa3b294bffccaa1f3 Mon Sep 17 00:00:00 2001 From: Suleyman Poyraz Date: Fri, 1 Nov 2024 19:24:13 +0300 Subject: [PATCH] Changes that suggested on #770 Writing to the python helper script moved to `python/volk_modtool/CMakeLists.txt` 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 suspected about is there any upper config deletes CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BUILD_DIR and it overriding on 'CMakeLists.txt'. Signed-off-by: Suleyman Poyraz --- CMakeLists.txt | 54 ++++++++++++++++------------------ cmake/Modules/VolkPython.cmake | 2 +- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f0acb3..2ca2258f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,8 +61,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") "${CMAKE_C_FLAGS} -Werror=incompatible-pointer-types -Werror=pointer-sign") endif() -set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #allows this to be a sub-project -set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) #allows this to be a sub-project list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules )#location for custom "Modules" @@ -91,8 +89,8 @@ math(EXPR VOLK_VERSION_DECIMAL "${VERSION_INFO_MAJOR_VERSION} * 10000 + ${VERSION_INFO_MINOR_VERSION} * 100 + ${VERSION_INFO_MAINT_VERSION}") -configure_file(${CMAKE_SOURCE_DIR}/include/volk/volk_version.h.in - ${CMAKE_BINARY_DIR}/include/volk/volk_version.h @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_version.h.in + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk_version.h @ONLY) ######################################################################## # Environment setup @@ -236,31 +234,31 @@ set(VOLK_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}) set(VOLK_INCLUDE_DIR include) install( - DIRECTORY ${CMAKE_SOURCE_DIR}/kernels/volk + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/kernels/volk DESTINATION include COMPONENT "volk_devel" FILES_MATCHING PATTERN "*.h") install( - FILES ${CMAKE_SOURCE_DIR}/include/volk/volk_prefs.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_alloc.hh - ${CMAKE_SOURCE_DIR}/include/volk/volk_complex.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_common.h - ${CMAKE_SOURCE_DIR}/include/volk/saturation_arithmetic.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_avx_intrinsics.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_avx2_intrinsics.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_avx2_fma_intrinsics.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_sse_intrinsics.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_sse3_intrinsics.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_neon_intrinsics.h - ${CMAKE_BINARY_DIR}/include/volk/volk.h - ${CMAKE_BINARY_DIR}/include/volk/volk_cpu.h - ${CMAKE_BINARY_DIR}/include/volk/volk_config_fixed.h - ${CMAKE_BINARY_DIR}/include/volk/volk_typedefs.h - ${CMAKE_SOURCE_DIR}/include/volk/volk_malloc.h - ${CMAKE_BINARY_DIR}/include/volk/volk_version.h - ${CMAKE_SOURCE_DIR}/include/volk/constants.h + FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_prefs.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_alloc.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_complex.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_common.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/saturation_arithmetic.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_avx_intrinsics.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_avx2_intrinsics.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_avx2_fma_intrinsics.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_sse_intrinsics.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_sse3_intrinsics.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_neon_intrinsics.h + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk.h + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk_cpu.h + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk_config_fixed.h + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk_typedefs.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/volk_malloc.h + ${CMAKE_CURRENT_BINARY_DIR}/include/volk/volk_version.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/volk/constants.h DESTINATION include/volk COMPONENT "volk_devel") @@ -288,7 +286,7 @@ endif(APPLE) ######################################################################## # Create uninstall target ######################################################################## -configure_file(${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) # Only add the target if there isn't one defined already @@ -303,11 +301,11 @@ endif() # http://www.cmake.org/Wiki/CMake/Tutorials/Packaging ######################################################################## -configure_file(${CMAKE_SOURCE_DIR}/cmake/Modules/VolkConfig.cmake.in - ${CMAKE_BINARY_DIR}/cmake/Modules/VolkConfig.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/VolkConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/VolkConfig.cmake @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/cmake/Modules/VolkConfigVersion.cmake.in - ${CMAKE_BINARY_DIR}/cmake/Modules/VolkConfigVersion.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/VolkConfigVersion.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/VolkConfigVersion.cmake @ONLY) ######################################################################## # Install cmake search routine for external use diff --git a/cmake/Modules/VolkPython.cmake b/cmake/Modules/VolkPython.cmake index 7beff74b..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]