@@ -2,44 +2,32 @@ cmake_minimum_required(VERSION 3.16)
2
2
3
3
cmake_policy (SET CMP0144 NEW)
4
4
5
- if (DEFINED DEPENDENCIES_DIR)
6
- include (${DEPENDENCIES_DIR} /modorganizer_super/cmake_common/mo2.cmake)
7
- else ()
8
- include (${CMAKE_CURRENT_LIST_DIR} /../cmake_common/mo2.cmake)
9
- endif ()
10
-
11
5
project (plugin_python CXX)
12
6
13
- set (PYTHON_BUILD_PATH ${PYTHON_ROOT} /PCBuild/amd64 )
7
+ set (Python_FIND_VIRTUALENV STANDARD )
14
8
15
- # find Python - lots of "Hints" since we have a weird setup
16
- set (Python_USE_STATIC_LIBS False )
17
- set (Python_INCLUDE_DIR ${PYTHON_ROOT} /Include )
18
- set (Python_EXECUTABLE ${PYTHON_BUILD_PATH} /python.exe)
19
- if (EXISTS "${PYTHON_BUILD_PATH} /python_d.exe" )
20
- set (Python_EXECUTABLE ${PYTHON_BUILD_PATH} /python_d.exe)
21
- endif ()
22
- file (GLOB Python_LIBRARY ${PYTHON_BUILD_PATH} /python[0-9][0-9]*.lib)
23
- find_package (Python COMPONENTS Interpreter Development REQUIRED)
9
+ # find Python before include mo2-cmake, otherwise this will trigger a bunch of CMP0111
10
+ # due to the imported configuration mapping variables defined in mo2.cmake
11
+ find_package (Python ${MO2_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED)
12
+ find_package (pybind11 CONFIG REQUIRED)
24
13
25
- # pybind11 needs uppercase (at least EXECUTABLE and LIBRARY)
26
- set (PYTHON_EXECUTABLE ${Python_EXECUTABLE} )
27
- set (PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR} )
28
- set (PYTHON_LIBRARY ${Python_LIBRARY} )
14
+ find_package (mo2-cmake CONFIG REQUIRED)
15
+
16
+ get_filename_component (Python_HOME ${Python_EXECUTABLE} PATH )
17
+ set (Python_DLL_DIR "${Python_HOME} /DLLs" )
18
+ set (Python_LIB_DIR "${Python_HOME} /Lib" )
19
+
20
+ mo2_python_install_pyqt()
29
21
30
22
# useful for naming DLL, zip, etc. (3.10 -> 310)
31
23
set (Python_VERSION_SHORT ${Python_VERSION_MAJOR}${Python_VERSION_MINOR} )
32
24
33
- # pybind11
34
- add_subdirectory (${MO2_BUILD_PATH} /pybind11 ${CMAKE_CURRENT_BINARY_DIR} /pybind11)
35
-
36
25
# projects
37
26
add_subdirectory (src)
38
- set_property (DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT proxy)
39
27
40
28
# tests (if requested)
41
- set (PLUGIN_PYTHON_TESTS ${PLUGIN_PYTHON_TESTS } CACHE BOOL "build tests for plugin_python" )
42
- if (PLUGIN_PYTHON_TESTS )
29
+ set (PLUGIN_PYTHON_TESTING ${BUILD_TESTING } CACHE BOOL "build tests for plugin_python" )
30
+ if (PLUGIN_PYTHON_TESTING )
43
31
enable_testing ()
44
32
add_subdirectory (tests)
45
33
endif ()
0 commit comments