Warning, /graphics/glaxnimate/src/python/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0002 # SPDX-License-Identifier: BSD-2-Clause
0003 
0004 set(SOURCES
0005     python.cpp
0006     miscdefs.cpp
0007 )
0008 add_library(${LIB_NAME_PYTHON} OBJECT ${SOURCES} embed.cpp)
0009 kde_target_enable_exceptions(${LIB_NAME_PYTHON} PUBLIC)
0010 #target_include_directories (${LIB_NAME_PYTHON} PUBLIC
0011         #${Python3_INCLUDE_DIRS}
0012         #${CMAKE_SOURCE_DIR}/external/QtAppSetup/external/pybind11/include
0013 #)
0014 target_link_libraries(${LIB_NAME_PYTHON} PUBLIC ${LIB_NAME_CORE} QtAppSetup)
0015 
0016 pybind11_add_module(glaxnimate_python EXCLUDE_FROM_ALL ${SOURCES} module.cpp)
0017 set_target_properties(
0018     glaxnimate_python PROPERTIES
0019     OUTPUT_NAME ${PROJECT_SLUG}
0020     LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/lib"
0021 )
0022 target_link_libraries(glaxnimate_python PUBLIC ${LIB_NAME_CORE} QtAppSetup)
0023 add_custom_command(TARGET glaxnimate_python PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/build/lib")
0024 
0025 
0026 get_target_property(pain1 glaxnimate_python PREFIX)
0027 get_target_property(pain2 glaxnimate_python OUTPUT_NAME)
0028 get_target_property(pain3 glaxnimate_python SUFFIX)
0029 set(MODULE_LIB_NAME "${pain1}${pain2}${pain3}")
0030 
0031 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_BINARY_DIR}/README.md COPYONLY)
0032 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.in.py ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
0033 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in.in ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
0034 
0035 
0036 if(PYTHON_PIP)
0037     add_custom_target(
0038         glaxnimate_python_depends_install
0039         COMMAND ${PYTHON_PIP} install -r ${CMAKE_CURRENT_SOURCE_DIR}/build-requirements.txt
0040     )
0041 endif()
0042 
0043 
0044 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
0045     set(WHEEL_CMD "--plat-name" "manylinux1_x86_64")
0046 elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
0047     set(WHEEL_CMD "--plat-name" "win32")
0048 elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
0049     execute_process(
0050         COMMAND echo "from distutils.util import get_platform; print(get_platform().replace('.', '_').replace('-', '_')).replace('x_11_x', 'x_11_0_x')"
0051         COMMAND python3
0052         OUTPUT_VARIABLE MAC_PY_PLATFORM_TAG
0053         OUTPUT_STRIP_TRAILING_WHITESPACE
0054     )
0055     set(WHEEL_CMD "--plat-name" ${MAC_PY_PLATFORM_TAG})
0056 else()
0057     set(WHEEL_CMD)
0058 endif()
0059 
0060 add_custom_target(
0061     glaxnimate_python_wheel
0062     COMMAND rm -f ./dist/*.whl
0063     COMMAND ./setup.py build bdist_wheel ${WHEEL_CMD}
0064     #DEPENDS glaxnimate_python
0065     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
0066 )
0067 
0068 add_custom_target(
0069     glaxnimate_python_upload
0070     COMMAND ${Python3_EXECUTABLE} -m twine upload dist/*.whl --verbose
0071     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
0072 )