2020-04-25 00:51:14 -04:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2018-04-07 17:12:21 -05:00
|
|
|
|
2024-05-25 13:15:10 +02:00
|
|
|
cmake_policy(SET CMP0144 NEW)
|
|
|
|
|
|
2020-05-01 04:59:02 -05:00
|
|
|
if(DEFINED DEPENDENCIES_DIR)
|
2022-04-19 23:41:03 +02:00
|
|
|
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
|
2020-05-01 04:59:02 -05:00
|
|
|
else()
|
2022-04-19 23:41:03 +02:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
|
2020-05-01 04:59:02 -05:00
|
|
|
endif()
|
2021-12-10 09:35:32 -06:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
project(plugin_python CXX)
|
|
|
|
|
|
2022-04-28 21:38:27 +02:00
|
|
|
set(PYTHON_BUILD_PATH ${PYTHON_ROOT}/PCBuild/amd64)
|
|
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
# find Python - lots of "Hints" since we have a weird setup
|
|
|
|
|
set(Python_USE_STATIC_LIBS False)
|
|
|
|
|
set(Python_INCLUDE_DIR ${PYTHON_ROOT}/Include)
|
|
|
|
|
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python.exe)
|
2024-06-14 16:13:52 +02:00
|
|
|
if (EXISTS "${PYTHON_BUILD_PATH}/python_d.exe")
|
|
|
|
|
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python_d.exe)
|
|
|
|
|
endif()
|
2024-05-25 13:15:10 +02:00
|
|
|
file(GLOB Python_LIBRARY ${PYTHON_BUILD_PATH}/python[0-9][0-9]*.lib)
|
2022-05-06 17:40:11 +02:00
|
|
|
find_package(Python COMPONENTS Interpreter Development REQUIRED)
|
2022-04-21 23:57:05 +02:00
|
|
|
|
2024-05-25 13:15:10 +02:00
|
|
|
# pybind11 needs uppercase (at least EXECUTABLE and LIBRARY)
|
|
|
|
|
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
|
|
|
|
|
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR})
|
|
|
|
|
set(PYTHON_LIBRARY ${Python_LIBRARY})
|
|
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
# useful for naming DLL, zip, etc. (3.10 -> 310)
|
|
|
|
|
set(Python_VERSION_SHORT ${Python_VERSION_MAJOR}${Python_VERSION_MINOR})
|
|
|
|
|
|
|
|
|
|
# pybind11
|
2022-04-28 22:44:15 +02:00
|
|
|
add_subdirectory(${MO2_BUILD_PATH}/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11)
|
2022-04-21 23:57:05 +02:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
# projects
|
2022-05-06 08:31:10 +02:00
|
|
|
add_subdirectory(src)
|
2022-05-06 17:40:11 +02:00
|
|
|
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT proxy)
|
2022-04-24 22:23:30 +02:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
# tests (if requested)
|
2022-05-02 17:09:36 +02:00
|
|
|
set(PLUGIN_PYTHON_TESTS ${PLUGIN_PYTHON_TESTS} CACHE BOOL "build tests for plugin_python")
|
2022-04-29 20:01:14 +02:00
|
|
|
if (PLUGIN_PYTHON_TESTS)
|
2022-05-02 18:56:44 +02:00
|
|
|
enable_testing()
|
2022-04-29 20:01:14 +02:00
|
|
|
add_subdirectory(tests)
|
|
|
|
|
endif()
|