@@ -2,44 +2,32 @@ cmake_minimum_required(VERSION 3.16)
22
33cmake_policy (SET CMP0144 NEW)
44
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-
115project (plugin_python CXX)
126
13- set (PYTHON_BUILD_PATH ${PYTHON_ROOT} /PCBuild/amd64 )
7+ set (Python_FIND_VIRTUALENV STANDARD )
148
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)
2413
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()
2921
3022# useful for naming DLL, zip, etc. (3.10 -> 310)
3123set (Python_VERSION_SHORT ${Python_VERSION_MAJOR}${Python_VERSION_MINOR} )
3224
33- # pybind11
34- add_subdirectory (${MO2_BUILD_PATH} /pybind11 ${CMAKE_CURRENT_BINARY_DIR} /pybind11)
35-
3625# projects
3726add_subdirectory (src)
38- set_property (DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT proxy)
3927
4028# 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 )
4331 enable_testing ()
4432 add_subdirectory (tests)
4533endif ()
0 commit comments