align file location in build dir with install dir
Stefan Schuermans

Stefan Schuermans commited on 2020-07-31 18:03:55
Showing 5 changed files, with 23 additions and 12 deletions.

... ...
@@ -9,3 +9,9 @@ add_library(
9 9
 
10 10
 target_link_libraries(uptpl uptev)
11 11
 
12
+set_target_properties(
13
+  uptpl
14
+  PROPERTIES
15
+  LIBRARY_OUTPUT_DIRECTORY
16
+  ${CMAKE_BINARY_DIR}/lib/uproctrace
17
+)
... ...
@@ -1,17 +1,22 @@
1
+set(
2
+  PYTHON_UPT_DIR
3
+  ${CMAKE_BINARY_DIR}/lib/python3/dist-packages/uproctrace
4
+)
5
+
1 6
 add_custom_command(
2 7
   OUTPUT
3
-  ${CMAKE_CURRENT_BINARY_DIR}/uproctrace_pb2.py
8
+  ${PYTHON_UPT_DIR}/uproctrace_pb2.py
4 9
   DEPENDS
5 10
   ${CMAKE_SOURCE_DIR}/uproctrace.proto
6 11
   COMMAND
7 12
   protoc --proto_path ${CMAKE_SOURCE_DIR}
8
-         --python_out ${CMAKE_CURRENT_BINARY_DIR}
13
+         --python_out ${PYTHON_UPT_DIR}
9 14
          ${CMAKE_SOURCE_DIR}/uproctrace.proto
10 15
 )
11 16
 
12 17
 add_custom_command(
13 18
   OUTPUT
14
-  ${CMAKE_CURRENT_BINARY_DIR}/gui_glade.py
19
+  ${PYTHON_UPT_DIR}/gui_glade.py
15 20
   DEPENDS
16 21
   ${CMAKE_CURRENT_SOURCE_DIR}/gui.glade
17 22
   ${CMAKE_CURRENT_SOURCE_DIR}/gui_glade_header.py
... ...
@@ -21,20 +26,20 @@ add_custom_command(
21 26
   ${CMAKE_CURRENT_SOURCE_DIR}/gui_glade_header.py
22 27
   ${CMAKE_CURRENT_SOURCE_DIR}/gui.glade
23 28
   ${CMAKE_CURRENT_SOURCE_DIR}/gui_glade_footer.py
24
-  > ${CMAKE_CURRENT_BINARY_DIR}/gui_glade.py
29
+  > ${PYTHON_UPT_DIR}/gui_glade.py
25 30
 )
26 31
 
27 32
 function(pyfile NAME)
28 33
   add_custom_command(
29 34
     OUTPUT
30
-    ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.py
35
+    ${PYTHON_UPT_DIR}/${NAME}.py
31 36
     DEPENDS
32 37
     ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.py
33 38
     COMMAND
34 39
     cp -a ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.py
35
-          ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.py
40
+          ${PYTHON_UPT_DIR}/${NAME}.py
36 41
   )
37
-  list(APPEND PYFILES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.py)
42
+  list(APPEND PYFILES ${PYTHON_UPT_DIR}/${NAME}.py)
38 43
   set(PYFILES ${PYFILES} PARENT_SCOPE)
39 44
 endfunction(pyfile)
40 45
 
... ...
@@ -49,7 +54,7 @@ add_custom_target(
49 54
   python3_uproctrace
50 55
   ALL
51 56
   DEPENDS
52
-  ${CMAKE_CURRENT_BINARY_DIR}/uproctrace_pb2.py
53
-  ${CMAKE_CURRENT_BINARY_DIR}/gui_glade.py
57
+  ${PYTHON_UPT_DIR}/uproctrace_pb2.py
58
+  ${PYTHON_UPT_DIR}/gui_glade.py
54 59
   ${PYFILES}
55 60
 )
... ...
@@ -10,5 +10,5 @@ SET_TESTS_PROPERTIES(
10 10
   pylint
11 11
   PROPERTIES
12 12
   ENVIRONMENT
13
-  "PYTHONPATH=${CMAKE_BINARY_DIR}/python3"
13
+  "PYTHONPATH=${CMAKE_BINARY_DIR}/lib/python3/dist-packages"
14 14
 )
... ...
@@ -2,6 +2,6 @@
2 2
 
3 3
 UPT_HOME="$(readlink -f "$(dirname "$0")/..")"
4 4
 
5
-export PYTHONPATH="$UPT_HOME/python3${PYTHONPATH:+:${PYTHONPATH}}"
5
+export PYTHONPATH="$UPT_HOME/lib/python3/dist-packages${PYTHONPATH:+:${PYTHONPATH}}"
6 6
 
7 7
 exec "$UPT_HOME/lib/uproctrace/upt-tool.py" "$@"
... ...
@@ -12,6 +12,6 @@ UPT_HOME="$(readlink -f "$(dirname "$(dirname "$0")")")"
12 12
 
13 13
 touch "$TRACE_FILE"
14 14
 export UPTPL_OUTPUT="$(readlink -f "$TRACE_FILE")"
15
-export LD_PRELOAD="$UPT_HOME/libuptpl/libuptpl.so"
15
+export LD_PRELOAD="$UPT_HOME/lib/uproctrace/libuptpl.so"
16 16
 
17 17
 exec "$@"
18 18