1 Changing CMAKE_{SOURCE,BINARY}_DIR like volk does in its top-level
2 CMakeLists.txt no longer works with CMake 3.5.0.
4 Use PROJECT_{BINARY,SOURCE}_DIR instead.
6 Obtained from: http://pkgs.fedoraproject.org/cgit/rpms/gnuradio.git/commit/?id=b50c7e66f6e3a1e6a84e25505d3fd873756c2027
7 Upstream patch and discussion: https://github.com/gnuradio/volk/pull/65
9 Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
11 apps/CMakeLists.txt | 12 ++++++------
12 lib/CMakeLists.txt | 48 ++++++++++++++++++++++++------------------------
13 2 files changed, 30 insertions(+), 30 deletions(-)
15 diff --git a/volk/apps/CMakeLists.txt b/volk/apps/CMakeLists.txt
16 index 74ed18d..f9ef6e0 100644
17 --- a/volk/apps/CMakeLists.txt
18 +++ b/volk/apps/CMakeLists.txt
21 ########################################################################
23 - include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc)
24 + include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc)
28 ${CMAKE_CURRENT_SOURCE_DIR}
29 ${CMAKE_CURRENT_BINARY_DIR}
30 - ${CMAKE_SOURCE_DIR}/include
31 - ${CMAKE_BINARY_DIR}/include
32 - ${CMAKE_SOURCE_DIR}/lib
33 - ${CMAKE_BINARY_DIR}/lib
34 + ${PROJECT_SOURCE_DIR}/include
35 + ${PROJECT_BINARY_DIR}/include
36 + ${PROJECT_SOURCE_DIR}/lib
37 + ${PROJECT_BINARY_DIR}/lib
42 add_executable(volk_profile
43 ${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc
44 - ${CMAKE_SOURCE_DIR}/lib/qa_utils.cc
45 + ${PROJECT_SOURCE_DIR}/lib/qa_utils.cc
49 diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt
50 index 35b67dc..f00200a 100644
51 --- a/volk/lib/CMakeLists.txt
52 +++ b/volk/lib/CMakeLists.txt
53 @@ -90,7 +90,7 @@ endif()
54 ########################################################################
56 COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
57 - ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
58 + ${PROJECT_SOURCE_DIR}/gen/volk_compile_utils.py
59 --mode "arch_flags" --compiler "${COMPILER_NAME}"
60 OUTPUT_VARIABLE arch_flag_lines OUTPUT_STRIP_TRAILING_WHITESPACE
62 @@ -278,7 +278,7 @@ message(STATUS "Available architectures: ${available_archs}")
63 ########################################################################
65 COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
66 - ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
67 + ${PROJECT_SOURCE_DIR}/gen/volk_compile_utils.py
68 --mode "machines" --archs "${available_archs}"
69 OUTPUT_VARIABLE available_machines OUTPUT_STRIP_TRAILING_WHITESPACE
71 @@ -310,9 +310,9 @@ message(STATUS "Available machines: ${available_machines}")
72 ########################################################################
74 #dependencies are all python, xml, and header implementation files
75 -file(GLOB xml_files ${CMAKE_SOURCE_DIR}/gen/*.xml)
76 -file(GLOB py_files ${CMAKE_SOURCE_DIR}/gen/*.py)
77 -file(GLOB h_files ${CMAKE_SOURCE_DIR}/kernels/volk/*.h)
78 +file(GLOB xml_files ${PROJECT_SOURCE_DIR}/gen/*.xml)
79 +file(GLOB py_files ${PROJECT_SOURCE_DIR}/gen/*.py)
80 +file(GLOB h_files ${PROJECT_SOURCE_DIR}/kernels/volk/*.h)
82 macro(gen_template tmpl output)
83 list(APPEND volk_gen_sources ${output})
84 @@ -320,21 +320,21 @@ macro(gen_template tmpl output)
86 DEPENDS ${xml_files} ${py_files} ${h_files} ${tmpl}
87 COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
88 - ${CMAKE_SOURCE_DIR}/gen/volk_tmpl_utils.py
89 + ${PROJECT_SOURCE_DIR}/gen/volk_tmpl_utils.py
90 --input ${tmpl} --output ${output} ${ARGN}
92 endmacro(gen_template)
94 -make_directory(${CMAKE_BINARY_DIR}/include/volk)
95 +make_directory(${PROJECT_BINARY_DIR}/include/volk)
97 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk.h)
98 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk.c)
99 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_typedefs.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_typedefs.h)
100 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_cpu.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_cpu.h)
101 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_cpu.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk_cpu.c)
102 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_config_fixed.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_config_fixed.h)
103 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machines.tmpl.h ${CMAKE_BINARY_DIR}/lib/volk_machines.h)
104 -gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machines.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk_machines.c)
105 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk.tmpl.h ${PROJECT_BINARY_DIR}/include/volk/volk.h)
106 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk.tmpl.c ${PROJECT_BINARY_DIR}/lib/volk.c)
107 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_typedefs.tmpl.h ${PROJECT_BINARY_DIR}/include/volk/volk_typedefs.h)
108 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_cpu.tmpl.h ${PROJECT_BINARY_DIR}/include/volk/volk_cpu.h)
109 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_cpu.tmpl.c ${PROJECT_BINARY_DIR}/lib/volk_cpu.c)
110 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_config_fixed.tmpl.h ${PROJECT_BINARY_DIR}/include/volk/volk_config_fixed.h)
111 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_machines.tmpl.h ${PROJECT_BINARY_DIR}/lib/volk_machines.h)
112 +gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_machines.tmpl.c ${PROJECT_BINARY_DIR}/lib/volk_machines.c)
114 set(BASE_CFLAGS NONE)
115 string(TOUPPER ${CMAKE_BUILD_TYPE} CBTU)
116 @@ -362,12 +362,12 @@ set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FL
117 foreach(machine_name ${available_machines})
118 #generate machine source
119 set(machine_source ${CMAKE_CURRENT_BINARY_DIR}/volk_machine_${machine_name}.c)
120 - gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machine_xxx.tmpl.c ${machine_source} ${machine_name})
121 + gen_template(${PROJECT_SOURCE_DIR}/tmpl/volk_machine_xxx.tmpl.c ${machine_source} ${machine_name})
123 #determine machine flags
125 COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
126 - ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
127 + ${PROJECT_SOURCE_DIR}/gen/volk_compile_utils.py
128 --mode "machine_flags" --machine "${machine_name}" --compiler "${COMPILER_NAME}"
129 OUTPUT_VARIABLE ${machine_name}_flags OUTPUT_STRIP_TRAILING_WHITESPACE
131 @@ -393,9 +393,9 @@ string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO})
132 # Set local include directories first
133 ########################################################################
135 - ${CMAKE_BINARY_DIR}/include
136 - ${CMAKE_SOURCE_DIR}/include
137 - ${CMAKE_SOURCE_DIR}/kernels
138 + ${PROJECT_BINARY_DIR}/include
139 + ${PROJECT_SOURCE_DIR}/include
140 + ${PROJECT_SOURCE_DIR}/kernels
141 ${CMAKE_CURRENT_BINARY_DIR}
142 ${CMAKE_CURRENT_SOURCE_DIR}
144 @@ -420,8 +420,8 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
145 # setup architecture specific assembler flags
146 set(ARCH_ASM_FLAGS "-mfpu=neon -g")
148 - include_directories(${CMAKE_SOURCE_DIR}/kernels/volk/asm/neon)
149 - file(GLOB asm_files ${CMAKE_SOURCE_DIR}/kernels/volk/asm/neon/*.s)
150 + include_directories(${PROJECT_SOURCE_DIR}/kernels/volk/asm/neon)
151 + file(GLOB asm_files ${PROJECT_SOURCE_DIR}/kernels/volk/asm/neon/*.s)
152 foreach(asm_file ${asm_files})
153 list(APPEND volk_sources ${asm_file})
154 message(STATUS "Adding source file: ${asm_file}")
155 @@ -453,7 +453,7 @@ if(ORC_FOUND)
156 list(APPEND volk_libraries ${ORC_LIBRARIES})
159 - file(GLOB orc_files ${CMAKE_SOURCE_DIR}/kernels/volk/asm/orc/*.orc)
160 + file(GLOB orc_files ${PROJECT_SOURCE_DIR}/kernels/volk/asm/orc/*.orc)
161 foreach(orc_file ${orc_files})
163 #extract the name for the generated c source from the orc file
164 @@ -511,7 +511,7 @@ PROPERTIES COMPILE_DEFINITIONS "${machine_defs}")
167 #add compatibility includes for stdint types
168 - include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc)
169 + include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc)
170 add_definitions(-DHAVE_CONFIG_H)
171 #compile the sources as C++ due to the lack of complex.h under MSVC
172 set_source_files_properties(${volk_sources} PROPERTIES LANGUAGE CXX)