Files
modorganizer-plugin_python/CMakeLists.txt
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.5 KiB
CMake
Raw Normal View History

2020-04-25 00:51:14 -04:00
cmake_minimum_required(VERSION 3.16)
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
project(plugin_python CXX)
set(PYTHON_BUILD_PATH ${PYTHON_ROOT}/PCBuild/amd64)
# 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)
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})
# useful for naming DLL, zip, etc. (3.10 -> 310)
set(Python_VERSION_SHORT ${Python_VERSION_MAJOR}${Python_VERSION_MINOR})
# pybind11
add_subdirectory(${MO2_BUILD_PATH}/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11)
2022-04-21 23:57:05 +02:00
# projects
2022-05-06 08:31:10 +02:00
add_subdirectory(src)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT proxy)
2022-04-24 22:23:30 +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()