@@ -5,139 +5,133 @@ if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
5
5
set (PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES} " )
6
6
endif ()
7
7
8
- set (PYBIND11_PYTHON_VERSION 3)
8
+ message (STATUS "Building pybind11 interfaces" )
9
+ # Split from main extension and converted to pybind11
10
+ pybind11_add_module(math SHARED
11
+ src/_ignition_math_pybind11.cc
12
+ src/Angle.cc
13
+ src/AxisAlignedBox.cc
14
+ src/Color.cc
15
+ src/DiffDriveOdometry.cc
16
+ src/Frustum.cc
17
+ src/GaussMarkovProcess.cc
18
+ src/Helpers.cc
19
+ src/Kmeans.cc
20
+ src/Material.cc
21
+ src/PID.cc
22
+ src/Rand.cc
23
+ src/RollingMean.cc
24
+ src/RotationSpline.cc
25
+ src/SemanticVersion.cc
26
+ src/SignalStats.cc
27
+ src/SphericalCoordinates.cc
28
+ src/Spline.cc
29
+ src/StopWatch.cc
30
+ src/Temperature.cc
31
+ src/Vector3Stats.cc
32
+ )
9
33
10
- find_package (pybind11 2.2 QUIET )
34
+ target_link_libraries (math PRIVATE
35
+ ${PROJECT_LIBRARY_TARGET_NAME}
36
+ )
11
37
12
- if (${pybind11_FOUND} )
13
- message (STATUS "Building pybind11 interfaces" )
14
- # Split from main extension and converted to pybind11
15
- pybind11_add_module(math SHARED
16
- src/_ignition_math_pybind11.cc
17
- src/Angle.cc
18
- src/AxisAlignedBox.cc
19
- src/Color.cc
20
- src/DiffDriveOdometry.cc
21
- src/Frustum.cc
22
- src/GaussMarkovProcess.cc
23
- src/Helpers.cc
24
- src/Kmeans.cc
25
- src/Material.cc
26
- src/PID.cc
27
- src/Rand.cc
28
- src/RollingMean.cc
29
- src/RotationSpline.cc
30
- src/SemanticVersion.cc
31
- src/SignalStats.cc
32
- src/SphericalCoordinates.cc
33
- src/Spline.cc
34
- src/StopWatch.cc
35
- src/Temperature.cc
36
- src/Vector3Stats.cc
37
- )
38
-
39
- target_link_libraries (math PRIVATE
40
- ${PROJECT_LIBRARY_TARGET_NAME}
41
- )
42
-
43
- if (USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
44
- if (${CMAKE_VERSION} VERSION_LESS "3.12.0" )
45
- execute_process (
46
- COMMAND "${PYTHON_EXECUTABLE} " -c "if True:
47
- from distutils import sysconfig as sc
48
- print(sc.get_python_lib(plat_specific=True))"
49
- OUTPUT_VARIABLE Python3_SITEARCH
50
- OUTPUT_STRIP_TRAILING_WHITESPACE)
51
- else ()
52
- # Get install variable from Python3 module
53
- # Python3_SITEARCH is available from 3.12 on, workaround if needed:
54
- find_package (Python3 COMPONENTS Interpreter)
55
- endif ()
38
+ if (USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
39
+ if (${CMAKE_VERSION} VERSION_LESS "3.12.0" )
40
+ execute_process (
41
+ COMMAND "${PYTHON_EXECUTABLE} " -c "if True:
42
+ from distutils import sysconfig as sc
43
+ print(sc.get_python_lib(plat_specific=True))"
44
+ OUTPUT_VARIABLE Python3_SITEARCH
45
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
46
+ else ()
47
+ # Get install variable from Python3 module
48
+ # Python3_SITEARCH is available from 3.12 on, workaround if needed:
49
+ find_package (Python3 COMPONENTS Interpreter)
50
+ endif ()
56
51
57
- if (USE_DIST_PACKAGES_FOR_PYTHON)
58
- string (REPLACE "site-packages" "dist-packages" IGN_PYTHON_INSTALL_PATH ${Python3_SITEARCH} )
59
- else ()
60
- # custom cmake command is returning dist-packages
61
- string (REPLACE "dist-packages" "site-packages" IGN_PYTHON_INSTALL_PATH ${Python3_SITEARCH} )
62
- endif ()
52
+ if (USE_DIST_PACKAGES_FOR_PYTHON)
53
+ string (REPLACE "site-packages" "dist-packages" IGN_PYTHON_INSTALL_PATH ${Python3_SITEARCH} )
63
54
else ()
64
- # If not a system installation, respect local paths
65
- set ( IGN_PYTHON_INSTALL_PATH ${IGN_LIB_INSTALL_DIR} /python )
55
+ # custom cmake command is returning dist-packages
56
+ string (REPLACE "dist-packages" "site-packages" IGN_PYTHON_INSTALL_PATH ${Python3_SITEARCH} )
66
57
endif ()
58
+ else ()
59
+ # If not a system installation, respect local paths
60
+ set (IGN_PYTHON_INSTALL_PATH ${IGN_LIB_INSTALL_DIR} /python)
61
+ endif ()
67
62
68
- set (IGN_PYTHON_INSTALL_PATH "${IGN_PYTHON_INSTALL_PATH} /ignition" )
63
+ set (IGN_PYTHON_INSTALL_PATH "${IGN_PYTHON_INSTALL_PATH} /ignition" )
69
64
70
- # Set the build location and install location for a CPython extension
71
- function (configure_build_install_location _library_name)
72
- # Install into test folder in build space for unit tests to import
73
- set_target_properties (${_library_name} PROPERTIES
74
- # Use generator expression to avoid prepending a build type specific directory on Windows
75
- LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR} /test >
76
- RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR} /test >)
65
+ # Set the build location and install location for a CPython extension
66
+ function (configure_build_install_location _library_name)
67
+ # Install into test folder in build space for unit tests to import
68
+ set_target_properties (${_library_name} PROPERTIES
69
+ # Use generator expression to avoid prepending a build type specific directory on Windows
70
+ LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR} /test >
71
+ RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR} /test >)
77
72
78
- # Install library for actual use
79
- install (TARGETS ${_library_name}
80
- DESTINATION "${IGN_PYTHON_INSTALL_PATH} /"
81
- )
82
- endfunction ()
73
+ # Install library for actual use
74
+ install (TARGETS ${_library_name}
75
+ DESTINATION "${IGN_PYTHON_INSTALL_PATH} /"
76
+ )
77
+ endfunction ()
83
78
84
- configure_build_install_location(math)
79
+ configure_build_install_location(math)
85
80
86
- if (BUILD_TESTING)
87
- # Add the Python tests
88
- set (python_tests
89
- Angle_TEST
90
- AxisAlignedBox_TEST
91
- Box_TEST
92
- Color_TEST
93
- Cylinder_TEST
94
- DiffDriveOdometry_TEST
95
- Filter_TEST
96
- Frustum_TEST
97
- GaussMarkovProcess_TEST
98
- Helpers_TEST
99
- Inertial_TEST
100
- Kmeans_TEST
101
- Line2_TEST
102
- Line3_TEST
103
- MassMatrix3_TEST
104
- Material_TEST
105
- Matrix3_TEST
106
- Matrix4_TEST
107
- MovingWindowFilter_TEST
108
- OrientedBox_TEST
109
- PID_TEST
110
- Plane_TEST
111
- Pose3_TEST
112
- Quaternion_TEST
113
- Rand_TEST
114
- RollingMean_TEST
115
- RotationSpline_TEST
116
- SemanticVersion_TEST
117
- SignalStats_TEST
118
- Sphere_TEST
119
- SphericalCoordinates_TEST
120
- Spline_TEST
121
- StopWatch_TEST
122
- Temperature_TEST
123
- Triangle3_TEST
124
- Triangle_TEST
125
- Vector2_TEST
126
- Vector3_TEST
127
- Vector3Stats_TEST
128
- Vector4_TEST
129
- )
81
+ if (BUILD_TESTING)
82
+ # Add the Python tests
83
+ set (python_tests
84
+ Angle_TEST
85
+ AxisAlignedBox_TEST
86
+ Box_TEST
87
+ Color_TEST
88
+ Cylinder_TEST
89
+ DiffDriveOdometry_TEST
90
+ Filter_TEST
91
+ Frustum_TEST
92
+ GaussMarkovProcess_TEST
93
+ Helpers_TEST
94
+ Inertial_TEST
95
+ Kmeans_TEST
96
+ Line2_TEST
97
+ Line3_TEST
98
+ MassMatrix3_TEST
99
+ Material_TEST
100
+ Matrix3_TEST
101
+ Matrix4_TEST
102
+ MovingWindowFilter_TEST
103
+ OrientedBox_TEST
104
+ PID_TEST
105
+ Plane_TEST
106
+ Pose3_TEST
107
+ Quaternion_TEST
108
+ Rand_TEST
109
+ RollingMean_TEST
110
+ RotationSpline_TEST
111
+ SemanticVersion_TEST
112
+ SignalStats_TEST
113
+ Sphere_TEST
114
+ SphericalCoordinates_TEST
115
+ Spline_TEST
116
+ StopWatch_TEST
117
+ Temperature_TEST
118
+ Triangle3_TEST
119
+ Triangle_TEST
120
+ Vector2_TEST
121
+ Vector3_TEST
122
+ Vector3Stats_TEST
123
+ Vector4_TEST
124
+ )
130
125
131
- foreach (test ${python_tests} )
132
- add_test (NAME ${test} .py COMMAND
133
- "${PYTHON_EXECUTABLE} " "${CMAKE_SOURCE_DIR} /src/python_pybind11/test/${test} .py" )
126
+ foreach (test ${python_tests} )
127
+ add_test (NAME ${test} .py COMMAND
128
+ "${PYTHON_EXECUTABLE} " "${CMAKE_SOURCE_DIR} /src/python_pybind11/test/${test} .py" )
134
129
135
- set (_env_vars)
136
- list (APPEND _env_vars "PYTHONPATH=${FAKE_INSTALL_PREFIX} /lib/python/" )
137
- list (APPEND _env_vars "LD_LIBRARY_PATH=${FAKE_INSTALL_PREFIX} /lib:$ENV{LD_LIBRARY_PATH} " )
138
- set_tests_properties (${test} .py PROPERTIES
139
- ENVIRONMENT "${_env_vars} " )
140
- endforeach ()
130
+ set (_env_vars)
131
+ list (APPEND _env_vars "PYTHONPATH=${FAKE_INSTALL_PREFIX} /lib/python/" )
132
+ list (APPEND _env_vars "LD_LIBRARY_PATH=${FAKE_INSTALL_PREFIX} /lib:$ENV{LD_LIBRARY_PATH} " )
133
+ set_tests_properties (${test} .py PROPERTIES
134
+ ENVIRONMENT "${_env_vars} " )
135
+ endforeach ()
141
136
142
- endif ()
143
137
endif ()
0 commit comments