You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the below CMakeLists.txt that I tried to change the pyd file name on all operating systems but it does not get changed. I would appreciate your help. Thank you.
I am currently running it on Windows 11 64 bit.
cmake_minimum_required(VERSION 3.24)
set(PYTHON_LIB_NAME "${Container_NAME}Py")
# Ensure that the build type is Release unless explicitly overridden
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# Find Python using the specified Python executable
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Concurrent Xml Network Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Concurrent Xml Network Sql)
# Find pybind11 using HINTS
find_package(pybind11 REQUIRED CONFIG HINTS ${PYBIND11_HINTS_PATH})
set(BINDING_FILES
bindcontainer.cpp
containerext.cpp
packageext.cpp
containermapext.cpp
)
# Create a Python binding module
pybind11_add_module(${PYTHON_LIB_NAME} MODULE ${BINDING_FILES})
# Rename the .pyd output file to ContainerPy.pyd
set_target_properties(${PYTHON_LIB_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION ON
CXX_VISIBILITY_PRESET ON
VISIBILITY_INLINES_HIDDEN ON
OUTPUT_NAME "ContainerPy")
target_sources(${PYTHON_LIB_NAME}
PRIVATE
containerext.h
# containerext.cpp
packageext.h
# packageext.cpp
containermapext.h
# containermapext.cpp
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Add the include directory where 'container.h' is located
target_include_directories(${PYTHON_LIB_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src/containerlib
)
# Link against the library target from the sibling project
target_link_libraries(${PYTHON_LIB_NAME} PRIVATE Container)
# Link against the required Qt libraries
target_link_libraries(${PYTHON_LIB_NAME} PRIVATE Qt6::Core Qt6::Concurrent Qt6::Network Qt6::Xml Qt6::Sql)
# Use the Python::Python target from find_package
target_link_libraries(${PYTHON_LIB_NAME} PRIVATE Python::Python)
# Ensure Container project is built first
add_dependencies(${PYTHON_LIB_NAME} ${Container_NAME})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have the below CMakeLists.txt that I tried to change the pyd file name on all operating systems but it does not get changed. I would appreciate your help. Thank you.
I am currently running it on Windows 11 64 bit.
Beta Was this translation helpful? Give feedback.
All reactions