1
This commit is contained in:
+3162
File diff suppressed because it is too large
Load Diff
+243
@@ -0,0 +1,243 @@
|
||||
# This function adds a python extension to the buildsystem.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# add_python_extension(
|
||||
# extension_name
|
||||
# SOURCES source1.c source2.c ...
|
||||
# [ REQUIRES variable1 variable2 ... ]
|
||||
# [ DEFINITIONS define1 define2 ... ]
|
||||
# [ LIBRARIES lib1 lib2 ... ]
|
||||
# [ INCLUDEDIRS dir1 dir2 ... ]
|
||||
# [ BUILTIN | ALWAYS_BUILTIN | NEVER_BUILTIN ]
|
||||
# )
|
||||
#
|
||||
# extension_name: the name of the library without any .so extension.
|
||||
# SOURCES: a list of filenames realtive to the Modules/ directory that make
|
||||
# up this extension.
|
||||
# REQUIRES: this extension will not be built unless all the variables listed
|
||||
# here evaluate to true. You should include any variables you use
|
||||
# in the LIBRARIES and INCLUDEDIRS sections.
|
||||
# DEFINITIONS: an optional list of definitions to pass to the compiler while
|
||||
# building this module. Do not include the -D prefix.
|
||||
# LIBRARIES: an optional list of additional libraries.
|
||||
# INCLUDEDIRS: an optional list of additional include directories.
|
||||
# BUILTIN: if this is set the module will be compiled statically into
|
||||
# libpython by default. The user can still override by setting
|
||||
# BUILTIN_[extension_name]=OFF.
|
||||
# ALWAYS_BUILTIN: if this is set the module will always be compiled statically into
|
||||
# libpython.
|
||||
# NEVER_BUILTIN: if this is set the module will never be compiled statically into
|
||||
# libpython. If WITH_STATIC_DEPENDENCIES is ON, extension is disabled.
|
||||
# NO_INSTALL: do not install or package the extension.
|
||||
#
|
||||
# Two user-settable options are created for each extension added:
|
||||
# ENABLE_[extension_name] defaults to ON. If set to OFF the extension will
|
||||
# not be added at all.
|
||||
# BUILTIN_[extension_name] defaults to the value of
|
||||
# BUILD_EXTENSIONS_AS_BUILTIN, which defaults to OFF,
|
||||
# unless BUILTIN is set when calling
|
||||
# add_python_extension. Adds the extension source
|
||||
# files to libpython instead of compiling a separate
|
||||
# library.
|
||||
# These options convert the extension_name to upper case first and remove any
|
||||
# leading underscores. So add_python_extension(_foo ...) will create the
|
||||
# options ENABLE_FOO and BUILTIN_FOO.
|
||||
|
||||
function(add_python_extension name)
|
||||
set(options BUILTIN ALWAYS_BUILTIN NEVER_BUILTIN NO_INSTALL)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs REQUIRES SOURCES DEFINITIONS LIBRARIES INCLUDEDIRS)
|
||||
cmake_parse_arguments(ADD_PYTHON_EXTENSION
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Remove _ from the beginning of the name.
|
||||
string(REGEX REPLACE "^_" "" pretty_name "${name}")
|
||||
|
||||
# Upper case the name.
|
||||
string(TOUPPER "${pretty_name}" upper_name)
|
||||
|
||||
# Add a prefix to the target name so it doesn't clash with any system
|
||||
# libraries that we might want to link against (eg. readline)
|
||||
set(target_name extension_${pretty_name})
|
||||
|
||||
set(enable_default ON)
|
||||
if(ADD_PYTHON_EXTENSION_NEVER_BUILTIN AND WITH_STATIC_DEPENDENCIES)
|
||||
set(enable_default OFF)
|
||||
endif()
|
||||
|
||||
# Add options that the user can set to control whether this extension is
|
||||
# compiled, and whether it is compiled in to libpython itself.
|
||||
option(ENABLE_${upper_name}
|
||||
"Controls whether the \"${name}\" extension will be built"
|
||||
${enable_default}
|
||||
)
|
||||
if(ENABLE_${upper_name})
|
||||
mark_as_advanced(FORCE ENABLE_${upper_name})
|
||||
else()
|
||||
mark_as_advanced(CLEAR ENABLE_${upper_name})
|
||||
endif()
|
||||
|
||||
if(ADD_PYTHON_EXTENSION_NEVER_BUILTIN AND WITH_STATIC_DEPENDENCIES AND ENABLE_${upper_name})
|
||||
set(reason " because extension is declared as NEVER_BUILTIN and WITH_STATIC_DEPENDENCIES is ON")
|
||||
set(ENABLE_${upper_name} OFF CACHE BOOL "Forced to OFF${reason}" FORCE)
|
||||
message(STATUS "Setting ENABLE_${upper_name} to OFF${reason}")
|
||||
endif()
|
||||
|
||||
# Check all the things we require are found.
|
||||
set(missing_deps "")
|
||||
foreach(dep ${ADD_PYTHON_EXTENSION_REQUIRES} ENABLE_${upper_name})
|
||||
string(REPLACE " " ";" list_dep ${dep})
|
||||
if(NOT (${list_dep}))
|
||||
set(missing_deps "${missing_deps}${dep} ")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ADD_PYTHON_EXTENSION_NEVER_BUILTIN)
|
||||
set(BUILTIN_${upper_name} 0)
|
||||
elseif(ADD_PYTHON_EXTENSION_ALWAYS_BUILTIN)
|
||||
set(BUILTIN_${upper_name} 1)
|
||||
else()
|
||||
# Add options that the extention is either external to libpython or
|
||||
# builtin. These will be marked as advanced unless different from default
|
||||
# values
|
||||
if(NOT ADD_PYTHON_EXTENSION_BUILTIN)
|
||||
set(ADD_PYTHON_EXTENSION_BUILTIN ${BUILD_EXTENSIONS_AS_BUILTIN})
|
||||
endif()
|
||||
cmake_dependent_option(
|
||||
BUILTIN_${upper_name}
|
||||
"If this is set the \"${name}\" extension will be compiled in to libpython"
|
||||
${ADD_PYTHON_EXTENSION_BUILTIN}
|
||||
"NOT missing_deps"
|
||||
OFF
|
||||
)
|
||||
if(NOT missing_deps)
|
||||
if((BUILTIN_${upper_name} AND BUILD_EXTENSIONS_AS_BUILTIN)
|
||||
OR (NOT BUILTIN_${upper_name} AND NOT BUILD_EXTENSIONS_AS_BUILTIN))
|
||||
mark_as_advanced(FORCE BUILTIN_${upper_name})
|
||||
else()
|
||||
mark_as_advanced(CLEAR BUILTIN_${upper_name})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If any dependencies were missing don't include this extension.
|
||||
if(missing_deps)
|
||||
string(STRIP "${missing_deps}" missing_deps)
|
||||
set(extensions_disabled "${extensions_disabled}${name} (not set: ${missing_deps});"
|
||||
CACHE INTERNAL "" FORCE)
|
||||
return()
|
||||
else()
|
||||
set(extensions_enabled "${extensions_enabled}${name};" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
# Callers to this function provide source files relative to the Modules/
|
||||
# directory. We need to get absolute paths for them all.
|
||||
set(absolute_sources "")
|
||||
foreach(source ${ADD_PYTHON_EXTENSION_SOURCES})
|
||||
get_filename_component(ext ${source} EXT)
|
||||
|
||||
# Treat assembler sources differently
|
||||
if(ext STREQUAL ".S")
|
||||
set_source_files_properties(Modules/${source} PROPERTIES LANGUAGE ASM)
|
||||
endif()
|
||||
set(absolute_src ${source})
|
||||
if(NOT IS_ABSOLUTE ${source})
|
||||
set(absolute_src ${SRC_DIR}/Modules/${source})
|
||||
endif()
|
||||
list(APPEND absolute_sources ${absolute_src})
|
||||
endforeach()
|
||||
|
||||
if(BUILTIN_${upper_name})
|
||||
if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
|
||||
list(APPEND ADD_PYTHON_EXTENSION_DEFINITIONS Py_BUILD_CORE_BUILTIN)
|
||||
endif()
|
||||
# This will be compiled into libpython instead of as a separate library
|
||||
set_property(GLOBAL APPEND PROPERTY builtin_extensions ${name})
|
||||
set_property(GLOBAL APPEND PROPERTY extension_${name}_sources ${absolute_sources})
|
||||
set_property(GLOBAL APPEND PROPERTY extension_${name}_link_libraries ${ADD_PYTHON_EXTENSION_LIBRARIES})
|
||||
set_property(GLOBAL APPEND PROPERTY extension_${name}_includedirs ${ADD_PYTHON_EXTENSION_INCLUDEDIRS})
|
||||
set_property(GLOBAL APPEND PROPERTY extension_${name}_definitions ${ADD_PYTHON_EXTENSION_DEFINITIONS})
|
||||
elseif(WIN32 AND NOT BUILD_LIBPYTHON_SHARED)
|
||||
# Extensions cannot be built against a static libpython on windows
|
||||
else()
|
||||
|
||||
add_library(${target_name} SHARED ${absolute_sources})
|
||||
target_include_directories(${target_name} PUBLIC "${ADD_PYTHON_EXTENSION_INCLUDEDIRS}")
|
||||
|
||||
if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
|
||||
list(APPEND ADD_PYTHON_EXTENSION_DEFINITIONS Py_BUILD_CORE_MODULE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
string(REGEX MATCH "Py_LIMITED_API" require_limited_api "${ADD_PYTHON_EXTENSION_DEFINITIONS}")
|
||||
if(require_limited_api STREQUAL "")
|
||||
list(APPEND ADD_PYTHON_EXTENSION_LIBRARIES libpython-shared)
|
||||
else()
|
||||
list(APPEND ADD_PYTHON_EXTENSION_LIBRARIES libpython3-shared)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(${target_name} ${ADD_PYTHON_EXTENSION_LIBRARIES})
|
||||
|
||||
if(WIN32)
|
||||
#list(APPEND ADD_PYTHON_EXTENSION_DEFINITIONS Py_NO_ENABLE_SHARED)
|
||||
if(MINGW)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
LINK_FLAGS -Wl,--enable-auto-import
|
||||
)
|
||||
endif()
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
SUFFIX .pyd
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
LINK_FLAGS -Wl,-undefined,dynamic_lookup
|
||||
SUFFIX .so
|
||||
)
|
||||
endif()
|
||||
|
||||
# Turn off the "lib" prefix and add any compiler definitions
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${ARCHIVEDIR}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${EXTENSION_BUILD_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXTENSION_BUILD_DIR}
|
||||
OUTPUT_NAME "${name}$<$<AND:$<BOOL:${UNIX}>,$<VERSION_GREATER_EQUAL:${PY_VERSION},3.8>>:.${SOABI}>"
|
||||
PREFIX ""
|
||||
)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
if(ADD_PYTHON_EXTENSION_DEFINITIONS)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
COMPILE_DEFINITIONS "${ADD_PYTHON_EXTENSION_DEFINITIONS}")
|
||||
endif()
|
||||
|
||||
if(NOT ADD_PYTHON_EXTENSION_NO_INSTALL)
|
||||
install(TARGETS ${target_name}
|
||||
ARCHIVE DESTINATION ${ARCHIVEDIR}
|
||||
LIBRARY DESTINATION ${EXTENSION_INSTALL_DIR}
|
||||
RUNTIME DESTINATION ${EXTENSION_INSTALL_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(show_extension_summary)
|
||||
if(extensions_disabled)
|
||||
message(STATUS "")
|
||||
message(STATUS "The following extensions will NOT be built:")
|
||||
message(STATUS "")
|
||||
foreach(line ${extensions_disabled})
|
||||
message(STATUS " ${line}")
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
endif()
|
||||
endfunction()
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindPatch
|
||||
# ---------
|
||||
#
|
||||
# The module defines the following variables:
|
||||
#
|
||||
# ``Patch_EXECUTABLE``
|
||||
# Path to patch command-line executable.
|
||||
# ``Patch_FOUND``
|
||||
# True if the patch command-line executable was found.
|
||||
#
|
||||
# The following :prop_tgt:`IMPORTED` targets are also defined:
|
||||
#
|
||||
# ``Patch::patch``
|
||||
# The command-line executable.
|
||||
#
|
||||
# Example usage:
|
||||
#
|
||||
# .. code-block:: cmake
|
||||
#
|
||||
# find_package(Patch)
|
||||
# if(Patch_FOUND)
|
||||
# message("Patch found: ${Patch_EXECUTABLE}")
|
||||
# endif()
|
||||
|
||||
set(_doc "Patch command line executable")
|
||||
set(_patch_path )
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(_patch_path
|
||||
"$ENV{LOCALAPPDATA}/Programs/Git/bin"
|
||||
"$ENV{LOCALAPPDATA}/Programs/Git/usr/bin"
|
||||
"$ENV{APPDATA}/Programs/Git/bin"
|
||||
"$ENV{APPDATA}/Programs/Git/usr/bin"
|
||||
)
|
||||
endif()
|
||||
|
||||
# First search the PATH
|
||||
find_program(Patch_EXECUTABLE
|
||||
NAME patch
|
||||
PATHS ${_patch_path}
|
||||
DOC ${_doc}
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
# Now look for installations in Git/ directories under typical installation
|
||||
# prefixes on Windows.
|
||||
find_program(Patch_EXECUTABLE
|
||||
NAMES patch
|
||||
PATH_SUFFIXES Git/usr/bin Git/bin GnuWin32/bin
|
||||
DOC ${_doc}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(Patch_EXECUTABLE AND NOT TARGET Patch::patch)
|
||||
add_executable(Patch::patch IMPORTED)
|
||||
set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
|
||||
|
||||
execute_process(COMMAND ${Patch_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE patch_version
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(_patch_version_regex ".*patch ([0-9]+\\.[0-9]+\\.[0-9]+)")
|
||||
if(patch_version MATCHES "${_patch_version_regex}")
|
||||
set(Patch_VERSION ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_patch_path)
|
||||
unset(_doc)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Patch
|
||||
REQUIRED_VARS Patch_EXECUTABLE
|
||||
VERSION_VAR Patch_VERSION)
|
||||
@@ -0,0 +1,93 @@
|
||||
# For building the bdist_wininst subdir
|
||||
|
||||
include_directories(
|
||||
${SRC_DIR}/Include
|
||||
${SRC_DIR}/Modules/zlib
|
||||
)
|
||||
|
||||
set(WININST_HEADERS
|
||||
${SRC_DIR}/PC/bdist_wininst/archive.h
|
||||
${SRC_DIR}/PC/bdist_wininst/resource.h
|
||||
)
|
||||
|
||||
set(WININST_SOURCES
|
||||
${SRC_DIR}/PC/bdist_wininst/extract.c
|
||||
${SRC_DIR}/PC/bdist_wininst/install.c
|
||||
${SRC_DIR}/Modules/zlib/adler32.c
|
||||
${SRC_DIR}/Modules/zlib/crc32.c
|
||||
${SRC_DIR}/Modules/zlib/inffast.c
|
||||
${SRC_DIR}/Modules/zlib/inflate.c
|
||||
${SRC_DIR}/Modules/zlib/inftrees.c
|
||||
${SRC_DIR}/Modules/zlib/zutil.c
|
||||
)
|
||||
|
||||
# Install tree directory
|
||||
set(WININST_INSTALL_DIR ${PYTHONHOME}/distutils/command)
|
||||
|
||||
# Build tree directory
|
||||
set(WININST_BUILD_DIR ${PROJECT_BINARY_DIR}/${WININST_INSTALL_DIR})
|
||||
|
||||
# Compiler version
|
||||
set(version "unknown")
|
||||
foreach(msvcmajver IN ITEMS 90 10 11 12 14)
|
||||
if(${MSVC${msvcmajver}})
|
||||
string(REGEX REPLACE "0$" "" msvcmajver ${msvcmajver})
|
||||
set(version "${msvcmajver}.0")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# System architecture
|
||||
set(arch "")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(arch "-amd64")
|
||||
endif()
|
||||
|
||||
# Set installer executable name
|
||||
set(WININST_EXE_NAME "wininst-${version}${arch}")
|
||||
message(STATUS "bdist_wininst: Generated 'Windows Installer' name is '${WININST_EXE_NAME}'")
|
||||
|
||||
# Check if windows installer is already bundled in the source tree
|
||||
set(_have_wininst_in_source 0)
|
||||
set(_msg "bdist_wininst: Looking for executable named '${WININST_EXE_NAME}${CMAKE_EXECUTABLE_SUFFIX}' in source tree")
|
||||
message(STATUS "${_msg}")
|
||||
set(_expected_wininst ${SRC_DIR}/${WININST_INSTALL_DIR}/${WININST_EXE_NAME}${CMAKE_EXECUTABLE_SUFFIX})
|
||||
if(EXISTS ${_expected_wininst})
|
||||
set(_have_wininst_in_source 1)
|
||||
message(STATUS "${_msg} - found \"${_expected_wininst}\"")
|
||||
else()
|
||||
message(STATUS "${_msg} - not found")
|
||||
endif()
|
||||
|
||||
# Skip if installer is already bundled in the source tree and BUILD_WININST_ALWAYS is OFF
|
||||
set(_configure_reason "")
|
||||
if(_have_wininst_in_source)
|
||||
if(NOT BUILD_WININST_ALWAYS)
|
||||
message(STATUS "bdist_wininst: Skipping installer configuration because it is already provided in the source tree.")
|
||||
return()
|
||||
else()
|
||||
set(_configure_reason " because BUILD_WININST_ALWAYS is ON")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "bdist_wininst: Configuring 'Windows Installer' named '${WININST_EXE_NAME}'${_configure_reason}")
|
||||
|
||||
# Configure installer
|
||||
add_executable(bdist_wininst WIN32 ${WININST_HEADERS} ${WININST_SOURCES})
|
||||
target_link_libraries(bdist_wininst
|
||||
imagehlp
|
||||
comctl32
|
||||
)
|
||||
set_target_properties(bdist_wininst PROPERTIES
|
||||
OUTPUT_NAME ${WININST_EXE_NAME}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${WININST_BUILD_DIR}
|
||||
)
|
||||
if(CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_command(TARGET bdist_wininst POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:bdist_wininst>
|
||||
${WININST_BUILD_DIR}/${WININST_EXE_NAME}${CMAKE_EXECUTABLE_SUFFIX}
|
||||
COMMENT "bdist_wininst: Copying installer into '${WININST_INSTALL_DIR}'"
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS bdist_wininst DESTINATION ${WININST_INSTALL_DIR})
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
|
||||
function(_add_executable_without_windows target_name)
|
||||
# Work around the lack of a "target_remove_definitions()" CMake command by
|
||||
# explicitly undefining _WINDOWS. The following alternatives are either ineffective
|
||||
# or not applicable:
|
||||
#
|
||||
# (1) Modifying and restoring CMAKE_C_FLAGS does not work reliably, as CMake appears
|
||||
# to apply cached values during the generation step after the function executes.
|
||||
#
|
||||
# (2) Using get_target_property/set_property to manipulate COMPILE_DEFINITIONS
|
||||
# is ineffective, since /D_WINDOWS is introduced via CMAKE_C_FLAGS and not
|
||||
# associated with the target's properties.
|
||||
#
|
||||
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/19796
|
||||
|
||||
add_executable(${target_name} ${ARGN})
|
||||
|
||||
# Note: /U_WINDOWS overrides the implicit /D_WINDOWS flag, resulting in MSVC warning D9025.
|
||||
# This warning is harmless and cannot be suppressed directly.
|
||||
target_compile_options(${target_name} PRIVATE /U_WINDOWS)
|
||||
endfunction()
|
||||
|
||||
# Install tree directory
|
||||
set(LAUNCHER_INSTALL_DIR ${BIN_BUILD_DIR})
|
||||
|
||||
# Build tree directory
|
||||
set(LAUNCHER_BUILD_DIR ${PROJECT_BINARY_DIR}/${LAUNCHER_INSTALL_DIR})
|
||||
|
||||
set(launcher_targets)
|
||||
|
||||
set(build_venvlauncher 0)
|
||||
# While support for building "venvlauncher" was introduced in Python 3.3,
|
||||
# we require at least Python 3.9 to avoid the need to generate "pythonnt_rc.h",
|
||||
# which was removed in python/cpython@4efc3360c9a ("bpo-41054: Simplify resource compilation on Windows (GH-21004)", 2020-06-24).
|
||||
if(PY_VERSION VERSION_GREATER_EQUAL "3.9")
|
||||
set(build_venvlauncher 1)
|
||||
endif()
|
||||
|
||||
if(build_venvlauncher)
|
||||
set(target_sources
|
||||
${SRC_DIR}/PC/launcher.c
|
||||
${SRC_DIR}/PC/pylauncher.rc
|
||||
)
|
||||
set(target_include_dirs
|
||||
${SRC_DIR}/PC/
|
||||
)
|
||||
set(target_libraries
|
||||
version
|
||||
)
|
||||
|
||||
# venvlauncher
|
||||
set(target_name "venvlauncher")
|
||||
|
||||
_add_executable_without_windows(${target_name} ${target_sources})
|
||||
target_include_directories(${target_name} PRIVATE ${target_include_dirs})
|
||||
target_link_libraries(${target_name} PRIVATE ${target_libraries})
|
||||
target_compile_definitions(${target_name}
|
||||
PRIVATE
|
||||
_CONSOLE
|
||||
_UNICODE
|
||||
VENV_REDIRECT
|
||||
PY_ICON # For "PC/pylauncher.rc"
|
||||
FIELD3=${PY_FIELD3_VALUE}
|
||||
)
|
||||
list(APPEND launcher_targets ${target_name})
|
||||
|
||||
# venvwlauncher
|
||||
set(target_name "venvwlauncher")
|
||||
|
||||
add_executable(${target_name} WIN32 ${target_sources})
|
||||
target_include_directories(${target_name} PRIVATE ${target_include_dirs})
|
||||
target_link_libraries(${target_name} PRIVATE ${target_libraries})
|
||||
target_compile_definitions(${target_name}
|
||||
PRIVATE
|
||||
_UNICODE
|
||||
_WINDOWS
|
||||
VENV_REDIRECT
|
||||
PYW_ICON # For "PC/pylauncher.rc"
|
||||
FIELD3=${PY_FIELD3_VALUE}
|
||||
)
|
||||
list(APPEND launcher_targets ${target_name})
|
||||
endif()
|
||||
|
||||
set(build_pylauncher 0)
|
||||
if(PY_VERSION VERSION_GREATER_EQUAL "3.11")
|
||||
set(build_pylauncher 1)
|
||||
endif()
|
||||
|
||||
if(build_pylauncher)
|
||||
set(target_sources
|
||||
${SRC_DIR}/PC/launcher2.c
|
||||
${SRC_DIR}/PC/pylauncher.rc
|
||||
)
|
||||
set(target_include_dirs
|
||||
${SRC_DIR}/PC/
|
||||
)
|
||||
set(target_libraries
|
||||
pathcch
|
||||
shell32
|
||||
)
|
||||
|
||||
# pylauncher
|
||||
set(target_name "pylauncher")
|
||||
|
||||
_add_executable_without_windows(${target_name} ${target_sources})
|
||||
target_include_directories(${target_name} PRIVATE ${target_include_dirs})
|
||||
target_link_libraries(${target_name} PRIVATE ${target_libraries})
|
||||
target_compile_definitions(${target_name}
|
||||
PRIVATE
|
||||
_CONSOLE
|
||||
_UNICODE
|
||||
FIELD3=${PY_FIELD3_VALUE}
|
||||
)
|
||||
list(APPEND launcher_targets ${target_name})
|
||||
|
||||
# pywlauncher
|
||||
set(target_name "pywlauncher")
|
||||
|
||||
add_executable(${target_name} WIN32 ${target_sources})
|
||||
target_include_directories(${target_name} PRIVATE ${target_include_dirs})
|
||||
target_link_libraries(${target_name} PRIVATE ${target_libraries})
|
||||
target_compile_definitions(${target_name}
|
||||
PRIVATE
|
||||
_UNICODE
|
||||
_WINDOWS
|
||||
FIELD3=${PY_FIELD3_VALUE}
|
||||
)
|
||||
|
||||
list(APPEND launcher_targets ${target_name})
|
||||
endif()
|
||||
|
||||
if(launcher_targets)
|
||||
set_target_properties(${launcher_targets}
|
||||
PROPERTIES
|
||||
LINK_FLAGS "/MANIFEST:NO"
|
||||
RUNTIME_OUTPUT_DIRECTORY ${LAUNCHER_INSTALL_DIR}
|
||||
)
|
||||
install(TARGETS ${launcher_targets} RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
|
||||
endif()
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
include(CMakeExpandImportedTargets)
|
||||
|
||||
macro(python_platform_test var description srcfile invert)
|
||||
if(NOT DEFINED "${var}_COMPILED")
|
||||
message(STATUS "${description}")
|
||||
|
||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${var} ${CMAKE_REQUIRED_FLAGS}")
|
||||
if(CMAKE_REQUIRED_LIBRARIES)
|
||||
# this one translates potentially used imported library targets to their files on disk
|
||||
CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
|
||||
else()
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
endif()
|
||||
if(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else()
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
endif()
|
||||
|
||||
try_compile(${var}_COMPILED
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${srcfile}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
# OUTPUT_VARIABLE OUTPUT # Do NOT use to make cross-compiling easier
|
||||
)
|
||||
if(${invert} MATCHES INVERT)
|
||||
if(${var}_COMPILED)
|
||||
message(STATUS "${description} - no")
|
||||
else()
|
||||
message(STATUS "${description} - yes")
|
||||
endif()
|
||||
else()
|
||||
if(${var}_COMPILED)
|
||||
message(STATUS "${description} - yes")
|
||||
else()
|
||||
message(STATUS "${description} - no")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(${invert} MATCHES INVERT)
|
||||
if(${var}_COMPILED)
|
||||
SET(${var} 0)
|
||||
else()
|
||||
SET(${var} 1)
|
||||
endif()
|
||||
else()
|
||||
if(${var}_COMPILED)
|
||||
SET(${var} 1)
|
||||
else()
|
||||
SET(${var} 0)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(python_platform_test_run var description srcfile invert)
|
||||
if(NOT DEFINED "${var}")
|
||||
message(STATUS "${description}")
|
||||
|
||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${var} ${CMAKE_REQUIRED_FLAGS}")
|
||||
if(CMAKE_REQUIRED_LIBRARIES)
|
||||
# this one translates potentially used imported library targets to their files on disk
|
||||
CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
|
||||
else()
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
endif()
|
||||
if(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else()
|
||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
endif()
|
||||
|
||||
try_run(${var} ${var}_COMPILED
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${srcfile}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
# OUTPUT_VARIABLE OUTPUT # Do NOT use to make cross-compiling easier
|
||||
)
|
||||
# Note that ${var} will be a 0 return value on success.
|
||||
if(NOT ${var}_COMPILED)
|
||||
set(${var} -1 CACHE INTERNAL "${description} failed to compile.")
|
||||
endif()
|
||||
|
||||
if(${invert} MATCHES INVERT)
|
||||
if(${var}_COMPILED)
|
||||
if(${var})
|
||||
message(STATUS "${description} - yes")
|
||||
else()
|
||||
message(STATUS "${description} - no")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${description} - failed to compile")
|
||||
endif()
|
||||
else()
|
||||
if(${var}_COMPILED)
|
||||
if(${var})
|
||||
message(STATUS "${description} - no")
|
||||
else()
|
||||
message(STATUS "${description} - yes")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "${description} - failed to compile")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${invert} MATCHES INVERT)
|
||||
if(${var}_COMPILED)
|
||||
if(${var})
|
||||
SET(${var} 1)
|
||||
else()
|
||||
SET(${var} 0)
|
||||
endif()
|
||||
else()
|
||||
SET(${var} 1)
|
||||
endif()
|
||||
else()
|
||||
if(${var}_COMPILED)
|
||||
if(${var})
|
||||
SET(${var} 0)
|
||||
else()
|
||||
SET(${var} 1)
|
||||
endif()
|
||||
else()
|
||||
SET(${var} 0)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(python_check_function name var)
|
||||
set(check_src ${PROJECT_BINARY_DIR}/CMakeFiles/ac_fn_c_check_func_${name}.c)
|
||||
file(WRITE ${check_src} "
|
||||
/* Define ${name} to an innocuous variant, in case <limits.h> declares ${name}.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define ${name} innocuous_${name}
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char ${name} (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef ${name}
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern \"C\"
|
||||
#endif
|
||||
char ${name} ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_${name} || defined __stub___${name}
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int main () { return ${name} (); }
|
||||
")
|
||||
|
||||
python_platform_test(
|
||||
${var}
|
||||
"Checking for ${name}"
|
||||
${check_src}
|
||||
DIRECT
|
||||
)
|
||||
endmacro()
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
if(NOT DEFINED PATCH_COMMAND)
|
||||
find_package(Git)
|
||||
if(Git_FOUND OR GIT_FOUND)
|
||||
set(PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix)
|
||||
# Initialize Git repo to ensure "git apply" works when source tree
|
||||
# is located within an already versioned tree.
|
||||
if(NOT EXISTS "${SRC_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} init
|
||||
WORKING_DIRECTORY ${SRC_DIR}
|
||||
RESULT_VARIABLE result
|
||||
ERROR_VARIABLE error
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "${output}\n${error}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
find_package(Patch)
|
||||
if(Patch_FOUND OR PATCH_FOUND)
|
||||
# Since support for git diffs which copy or rename files was
|
||||
# added in patch 2.7, we can not use older version.
|
||||
if("${Patch_VERSION}" VERSION_GREATER_EQUAL "2.7.0")
|
||||
set(PATCH_COMMAND ${Patch_EXECUTABLE} --quiet -p1 -i)
|
||||
else()
|
||||
set(_reason "Found Patch executable [${Patch_EXECUTABLE}] version [${Patch_VERSION}] older than 2.7.0 missing support for copy or rename files.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PATCH_COMMAND)
|
||||
message(FATAL_ERROR "Could NOT find a suitable version of Git or Patch executable to apply patches. ${_reason}")
|
||||
endif()
|
||||
|
||||
set(patches_dir "${Python_SOURCE_DIR}/patches")
|
||||
|
||||
function(_apply_patches _subdir)
|
||||
if(NOT EXISTS ${patches_dir}/${_subdir})
|
||||
message(STATUS "Skipping patches: Directory '${patches_dir}/${_subdir}' does not exist")
|
||||
return()
|
||||
endif()
|
||||
file(GLOB _patches RELATIVE ${patches_dir} "${patches_dir}/${_subdir}/*.patch")
|
||||
if(NOT _patches)
|
||||
return()
|
||||
endif()
|
||||
message(STATUS "")
|
||||
list(SORT _patches)
|
||||
foreach(patch IN LISTS _patches)
|
||||
set(msg "Applying '${patch}'")
|
||||
message(STATUS "${msg}")
|
||||
set(applied ${SRC_DIR}/.patches/${patch}.applied)
|
||||
# Handle case where source tree was patched using the legacy approach.
|
||||
set(legacy_applied ${PROJECT_BINARY_DIR}/CMakeFiles/patches/${patch}.applied)
|
||||
if(EXISTS ${legacy_applied})
|
||||
set(applied ${legacy_applied})
|
||||
endif()
|
||||
if(EXISTS ${applied})
|
||||
message(STATUS "${msg} - skipping (already applied)")
|
||||
continue()
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${PATCH_COMMAND} ${patches_dir}/${patch}
|
||||
WORKING_DIRECTORY ${SRC_DIR}
|
||||
RESULT_VARIABLE result
|
||||
ERROR_VARIABLE error
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(result EQUAL 0)
|
||||
message(STATUS "${msg} - done")
|
||||
#get_filename_component(_dir ${applied} DIRECTORY)
|
||||
get_filename_component(_dir ${applied} PATH)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_dir})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${applied})
|
||||
else()
|
||||
message(STATUS "${msg} - failed")
|
||||
message(FATAL_ERROR "${output}\n${error}")
|
||||
endif()
|
||||
endforeach()
|
||||
message(STATUS "")
|
||||
endfunction()
|
||||
|
||||
set(_py_version ${PY_VERSION})
|
||||
|
||||
# Apply patches
|
||||
_apply_patches("${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}")
|
||||
_apply_patches("${_py_version}")
|
||||
_apply_patches("${_py_version}/${CMAKE_SYSTEM_NAME}")
|
||||
_apply_patches("${_py_version}/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}")
|
||||
set(_version ${CMAKE_C_COMPILER_VERSION})
|
||||
if(MSVC)
|
||||
set(_version ${MSVC_VERSION})
|
||||
if ("${MSVC_VERSION}" VERSION_LESS "2000" AND
|
||||
("${MSVC_VERSION}" VERSION_GREATER_EQUAL "1900"))
|
||||
set(_version "1900")
|
||||
else()
|
||||
set(_version ${MSVC_VERSION})
|
||||
endif()
|
||||
endif()
|
||||
_apply_patches("${_py_version}/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}/${_version}")
|
||||
@@ -0,0 +1,66 @@
|
||||
if(APPLE)
|
||||
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "By default, build for 64-bit")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OSX_SDK)
|
||||
execute_process(
|
||||
COMMAND xcrun
|
||||
--show-sdk-version
|
||||
OUTPUT_VARIABLE
|
||||
SDK_VERSION
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Transform into a two-component string (e.g "10.15.6" -> "10.15")
|
||||
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" SDK_VERSION "${SDK_VERSION}")
|
||||
if(res)
|
||||
# Probably running on an older version of XCode, instead try to list all available
|
||||
# SDKs and extract the version of the first one.
|
||||
execute_process(
|
||||
COMMAND xcodebuild
|
||||
-showsdks
|
||||
OUTPUT_VARIABLE
|
||||
xcodebuild_sdks
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX MATCH "sdk macosx([0-9\\. ]+)" output "${xcodebuild_sdks}")
|
||||
if(res OR output STREQUAL "")
|
||||
message(FATAL_ERROR "Failed to detect CMAKE_OSX_SDK; please set manually (e.g. \"macosx10.6\")")
|
||||
endif()
|
||||
set(SDK_VERSION ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
set(CMAKE_OSX_SDK macosx${SDK_VERSION})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OSX_SYSROOT)
|
||||
execute_process(
|
||||
COMMAND xcodebuild
|
||||
-sdk ${CMAKE_OSX_SDK}
|
||||
-version Path
|
||||
OUTPUT_VARIABLE
|
||||
CMAKE_OSX_SYSROOT
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res)
|
||||
message(FATAL_ERROR "Cannot determine SDK path for SDK: ${CMAKE_OSX_SDK}")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
execute_process(
|
||||
COMMAND xcodebuild
|
||||
-sdk ${CMAKE_OSX_SDK}
|
||||
-version SDKVersion
|
||||
OUTPUT_VARIABLE
|
||||
CMAKE_OSX_DEPLOYMENT_TARGET
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res)
|
||||
message(FATAL_ERROR "Cannot determine SDK version for SDK: ${CMAKE_OSX_SDK}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
# PYTHON_USE_STATIC_LIB - Set to ON to force the use of the static
|
||||
# library. Default is OFF.
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(BUILD_LIBPYTHON_SHARED @BUILD_LIBPYTHON_SHARED@)
|
||||
if(BUILD_LIBPYTHON_SHARED)
|
||||
set(PYTHON_BUILD_SHARED 1)
|
||||
set(PYTHON_BUILD_STATIC 0)
|
||||
else()
|
||||
set(PYTHON_BUILD_SHARED 0)
|
||||
set(PYTHON_BUILD_STATIC 1)
|
||||
endif()
|
||||
|
||||
set_and_check(PYTHON_CONFIG_DIR "@PACKAGE_CONFIG_DIR_CONFIG@")
|
||||
set_and_check(PYTHON_INCLUDE_DIR "@PACKAGE_INCLUDE_DIR_CONFIG@")
|
||||
set_and_check(PYTHON_TARGETS "@PACKAGE_CONFIG_DIR_CONFIG@/PythonTargets.cmake")
|
||||
|
||||
@PYTHON_CONFIG_CODE@
|
||||
|
||||
if(NOT PYTHON_TARGETS_IMPORTED)
|
||||
set(PYTHON_TARGETS_IMPORTED 1)
|
||||
include(${PYTHON_TARGETS})
|
||||
endif()
|
||||
|
||||
if(TARGET libpython-shared)
|
||||
set(PYTHON_LIBRARY_SHARED libpython-shared)
|
||||
endif()
|
||||
if(TARGET libpython-static)
|
||||
set(PYTHON_LIBRARY_STATIC libpython-static)
|
||||
endif()
|
||||
|
||||
if(NOT Python_USE_STATIC_LIB)
|
||||
if(PYTHON_LIBRARY_SHARED)
|
||||
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY_SHARED})
|
||||
elseif(PYTHON_LIBRARY_STATIC)
|
||||
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY_STATIC})
|
||||
endif()
|
||||
else()
|
||||
if(PYTHON_LIBRARY_STATIC)
|
||||
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY_STATIC})
|
||||
else()
|
||||
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY_SHARED})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT Python_FIND_QUIETLY)
|
||||
message(STATUS "PYTHON_LIBRARIES set to ${PYTHON_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
|
||||
@@ -0,0 +1,269 @@
|
||||
|
||||
# Given a version string of the form "X.Y.Z[rcN|[a-z]N]", extract
|
||||
# major, minor, patch version as well as release level (rc, any letter)
|
||||
# and serial (an integer)
|
||||
#
|
||||
# The function will systematically set the following variable in the caller
|
||||
# scope:
|
||||
#
|
||||
# PY_VERSION_MAJOR - X
|
||||
# PY_VERSION_MINOR - Y
|
||||
# PY_VERSION_PATCH - Z
|
||||
# PY_RELEASE_LEVEL - rc, a, b, c, ..., z or an empty string
|
||||
# PY_RELEASE_SERIAL - an integer or an empty string
|
||||
# PY_VERSION - X.Y.Z
|
||||
#
|
||||
function(python_extract_version_info)
|
||||
set(options)
|
||||
set(oneValueArgs
|
||||
VERSION_STRING
|
||||
)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(MY
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Sanity checks
|
||||
# XXX TBD
|
||||
|
||||
set(version_str ${MY_VERSION_STRING})
|
||||
|
||||
# version_str : 2.7.14 | 2.7.14rc1 | 3.6.0a4 | 3.7.0b1
|
||||
# version_major : 2 | 2 | 3 | 3
|
||||
# version_minor : 7 | 7 | 6 | 7
|
||||
# version_patch : 14 | 14 | 0 | 0
|
||||
# release_level_and_serial: | rc1 | a4 | b1
|
||||
# release_level : | rc | a | b
|
||||
# release_serial : | 1 | 4 | 1
|
||||
# version : 2.7.14 | 2.7.14 | 3.6.0 | 3.7.0
|
||||
|
||||
# Code adpated from FindPythonLibs.cmake
|
||||
string(REGEX REPLACE "([0-9]+)\\..+" "\\1" version_major ${version_str})
|
||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\..+" "\\1" version_minor ${version_str})
|
||||
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" version_patch ${version_str})
|
||||
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" release_level_and_serial ${version_str})
|
||||
string(REGEX REPLACE "([a-z]+)[0-9]+" "\\1" release_level "${release_level_and_serial}")
|
||||
string(REGEX REPLACE "[a-z]+([0-9]+)" "\\1" release_serial "${release_level_and_serial}")
|
||||
|
||||
set(version "${version_major}.${version_minor}.${version_patch}")
|
||||
|
||||
set(PY_VERSION_MAJOR ${version_major} PARENT_SCOPE)
|
||||
set(PY_VERSION_MINOR ${version_minor} PARENT_SCOPE)
|
||||
set(PY_VERSION_PATCH ${version_patch} PARENT_SCOPE)
|
||||
set(PY_RELEASE_LEVEL ${release_level} PARENT_SCOPE)
|
||||
set(PY_RELEASE_SERIAL ${release_serial} PARENT_SCOPE)
|
||||
set(PY_VERSION ${version} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# cmake -DTEST_python_extract_version_info:BOOL=ON -P PythonExtractVersionInfo.cmake
|
||||
#
|
||||
function(python_extract_version_info_test)
|
||||
|
||||
function(display_output_values)
|
||||
foreach(varname
|
||||
VERSION_MAJOR
|
||||
VERSION_MINOR
|
||||
VERSION_PATCH
|
||||
RELEASE_LEVEL
|
||||
RELEASE_SERIAL
|
||||
VERSION
|
||||
)
|
||||
message("PY_${varname}: ${PY_${varname}}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
set(id 1)
|
||||
set(case${id}_input_version_long "2.7.14")
|
||||
set(case${id}_expected_PY_VERSION_MAJOR "2")
|
||||
set(case${id}_expected_PY_VERSION_MINOR "7")
|
||||
set(case${id}_expected_PY_VERSION_PATCH "14")
|
||||
set(case${id}_expected_PY_RELEASE_LEVEL "")
|
||||
set(case${id}_expected_PY_RELEASE_SERIAL "")
|
||||
set(case${id}_expected_PY_VERSION "2.7.14")
|
||||
|
||||
set(id 2)
|
||||
set(case${id}_input_version_long "2.7.14rc1")
|
||||
set(case${id}_expected_PY_VERSION_MAJOR "2")
|
||||
set(case${id}_expected_PY_VERSION_MINOR "7")
|
||||
set(case${id}_expected_PY_VERSION_PATCH "14")
|
||||
set(case${id}_expected_PY_RELEASE_LEVEL "rc")
|
||||
set(case${id}_expected_PY_RELEASE_SERIAL "1")
|
||||
set(case${id}_expected_PY_VERSION "2.7.14")
|
||||
|
||||
set(id 3)
|
||||
set(case${id}_input_version_long "3.6.0a4")
|
||||
set(case${id}_expected_PY_VERSION_MAJOR "3")
|
||||
set(case${id}_expected_PY_VERSION_MINOR "6")
|
||||
set(case${id}_expected_PY_VERSION_PATCH "0")
|
||||
set(case${id}_expected_PY_RELEASE_LEVEL "a")
|
||||
set(case${id}_expected_PY_RELEASE_SERIAL "4")
|
||||
set(case${id}_expected_PY_VERSION "3.6.0")
|
||||
|
||||
set(id 4)
|
||||
set(case${id}_input_version_long "10.744.42b66")
|
||||
set(case${id}_expected_PY_VERSION_MAJOR "10")
|
||||
set(case${id}_expected_PY_VERSION_MINOR "744")
|
||||
set(case${id}_expected_PY_VERSION_PATCH "42")
|
||||
set(case${id}_expected_PY_RELEASE_LEVEL "b")
|
||||
set(case${id}_expected_PY_RELEASE_SERIAL "66")
|
||||
set(case${id}_expected_PY_VERSION "10.744.42")
|
||||
|
||||
foreach(caseid RANGE 1 ${id})
|
||||
set(input "${case${caseid}_input_version_long}")
|
||||
python_extract_version_info(VERSION_STRING "${input}")
|
||||
foreach(varname
|
||||
VERSION_MAJOR
|
||||
VERSION_MINOR
|
||||
VERSION_PATCH
|
||||
RELEASE_LEVEL
|
||||
RELEASE_SERIAL
|
||||
VERSION
|
||||
)
|
||||
set(expected_varname "case${caseid}_expected_PY_${varname}")
|
||||
set(current_varname "PY_${varname}")
|
||||
if(NOT "${${expected_varname}}" STREQUAL "${${current_varname}}")
|
||||
message("input: ${input}")
|
||||
display_output_values()
|
||||
message(FATAL_ERROR "error: case ${caseid}: \n expected: ${expected_varname} [${${expected_varname}}]\n current: ${current_varname} [${${current_varname}}]")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
message("SUCCESS")
|
||||
endfunction()
|
||||
|
||||
if(TEST_python_extract_version_info)
|
||||
python_extract_version_info_test()
|
||||
endif()
|
||||
|
||||
# Compute the "Field3" value from a Python version's patch, release level, and serial.
|
||||
#
|
||||
# The Field3 value is defined as:
|
||||
# Field3 = patch * 1000 + release_level_number * 10 + release_serial
|
||||
#
|
||||
# Where release_level_number is:
|
||||
# - 10 for alpha (a)
|
||||
# - 11 for beta (b)
|
||||
# - 12 for release candidate (rc)
|
||||
# - 15 for final (no pre-release tag)
|
||||
#
|
||||
# Arguments:
|
||||
# VERSION_PATCH - Patch version (Z in X.Y.Z)
|
||||
# RELEASE_LEVEL - One of 'a', 'b', 'rc', or empty
|
||||
# RELEASE_SERIAL - An integer (or empty for final)
|
||||
#
|
||||
# Output:
|
||||
# Sets variable PY_FIELD3_VALUE in the caller's scope.
|
||||
function(python_compute_release_field3_value)
|
||||
set(options)
|
||||
set(oneValueArgs
|
||||
VERSION_PATCH
|
||||
RELEASE_LEVEL
|
||||
RELEASE_SERIAL
|
||||
)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(MY
|
||||
"${options}"
|
||||
"${oneValueArgs}"
|
||||
"${multiValueArgs}"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Default ReleaseLevelNumber = 15 (final release)
|
||||
set(_level_number 15)
|
||||
|
||||
# Map release level string to numeric code
|
||||
if(MY_RELEASE_LEVEL STREQUAL "a")
|
||||
set(_level_number 10)
|
||||
elseif(MY_RELEASE_LEVEL STREQUAL "b")
|
||||
set(_level_number 11)
|
||||
elseif(MY_RELEASE_LEVEL STREQUAL "rc")
|
||||
set(_level_number 12)
|
||||
endif()
|
||||
|
||||
# Fallback for empty serial
|
||||
if("${MY_RELEASE_SERIAL}" STREQUAL "")
|
||||
set(MY_RELEASE_SERIAL 0)
|
||||
endif()
|
||||
|
||||
# Convert to integers
|
||||
set(_patch "${MY_VERSION_PATCH}")
|
||||
set(_serial "${MY_RELEASE_SERIAL}")
|
||||
math(EXPR _field3 "${_patch} * 1000 + ${_level_number} * 10 + ${_serial}")
|
||||
|
||||
# Return in the variable specified by caller
|
||||
set(PY_FIELD3_VALUE "${_field3}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# cmake -DTEST_python_compute_release_field3_value:BOOL=ON -P PythonExtractVersionInfo.cmake
|
||||
#
|
||||
function(python_compute_release_field3_value_test)
|
||||
|
||||
function(display_field3_test_values)
|
||||
message(" PATCH: ${patch}")
|
||||
message(" LEVEL: ${level}")
|
||||
message(" SERIAL: ${serial}")
|
||||
message(" Expected: ${expected}")
|
||||
message(" Computed: ${PY_FIELD3_VALUE}")
|
||||
endfunction()
|
||||
|
||||
set(id 1)
|
||||
set(case${id}_patch 2)
|
||||
set(case${id}_level "") # final release
|
||||
set(case${id}_serial "") # default to 0
|
||||
set(case${id}_expected 2150) # 2*1000 + 15*10 + 0
|
||||
|
||||
set(id 2)
|
||||
set(case${id}_patch 2)
|
||||
set(case${id}_level a)
|
||||
set(case${id}_serial 1)
|
||||
set(case${id}_expected 2101) # 2*1000 + 10*10 + 1
|
||||
|
||||
set(id 3)
|
||||
set(case${id}_patch 5)
|
||||
set(case${id}_level b)
|
||||
set(case${id}_serial 0)
|
||||
set(case${id}_expected 5110) # 5*1000 + 11*10 + 0
|
||||
|
||||
set(id 4)
|
||||
set(case${id}_patch 14)
|
||||
set(case${id}_level rc)
|
||||
set(case${id}_serial 3)
|
||||
set(case${id}_expected 14123) # 14*1000 + 12*10 + 3
|
||||
|
||||
set(id 5)
|
||||
set(case${id}_patch 0)
|
||||
set(case${id}_level "") # final
|
||||
set(case${id}_serial "") # default 0
|
||||
set(case${id}_expected 150) # 0 * 1000 + 15 * 10 + 0
|
||||
|
||||
foreach(caseid RANGE 1 ${id})
|
||||
set(patch "${case${caseid}_patch}")
|
||||
set(level "${case${caseid}_level}")
|
||||
set(serial "${case${caseid}_serial}")
|
||||
set(expected "${case${caseid}_expected}")
|
||||
|
||||
python_compute_release_field3_value(
|
||||
VERSION_PATCH "${patch}"
|
||||
RELEASE_LEVEL "${level}"
|
||||
RELEASE_SERIAL "${serial}"
|
||||
)
|
||||
|
||||
if(NOT "${PY_FIELD3_VALUE}" STREQUAL "${expected}")
|
||||
message("FAILED: case ${caseid}")
|
||||
display_field3_test_values()
|
||||
message(FATAL_ERROR "Test failed at case ${caseid}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("SUCCESS")
|
||||
endfunction()
|
||||
|
||||
if(TEST_python_compute_release_field3_value)
|
||||
python_compute_release_field3_value_test()
|
||||
endif()
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
file(GLOB filenames "${PROJECT_BINARY_DIR}/${PYTHONHOME}/test/test_*.py")
|
||||
list(SORT filenames)
|
||||
|
||||
set(unittests)
|
||||
set(skipped_unittests)
|
||||
|
||||
# Since some tests call "support.requires(...)" spliting its arguments
|
||||
# over multiple lines and the current parsing does not support the arguments
|
||||
# extraction, the associated resource name is hard-coded below.
|
||||
set(test_zipfile64_resource "extralargefile")
|
||||
|
||||
foreach(filename IN LISTS filenames)
|
||||
get_filename_component(unittest ${filename} NAME_WE)
|
||||
|
||||
set(skip_unittest 0)
|
||||
|
||||
# Match only unindented support.requires(...) calls
|
||||
file(STRINGS "${filename}" matches REGEX "^(support\\.requires|requires)\\([^\\)]*\\)")
|
||||
|
||||
if(matches) # There are support.requires() calls
|
||||
foreach(match IN LISTS matches)
|
||||
# Extract the FIRST quoted argument only
|
||||
string(REGEX MATCH "['\"]([^'\"]*)['\"]" args "${match}")
|
||||
set(expected_resource ${CMAKE_MATCH_1})
|
||||
|
||||
# if not in SUPPORTED_TEST_RESOURCES, skip
|
||||
if(NOT "${expected_resource}" IN_LIST SUPPORTED_TEST_RESOURCES)
|
||||
set(skip_unittest 1)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Handle hardcoded resource override (e.g., due to unsupported multi-line call)
|
||||
if(DEFINED "${unittest}_resource")
|
||||
set(expected_resource "${${unittest}_resource}")
|
||||
if(NOT "${expected_resource}" IN_LIST SUPPORTED_TEST_RESOURCES)
|
||||
set(skip_unittest 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(skip_unittest)
|
||||
list(APPEND skipped_unittests ${unittest})
|
||||
message(STATUS " Ignoring '${unittest}' requiring '${expected_resource}' resource")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
list(APPEND unittests ${unittest})
|
||||
endforeach()
|
||||
|
||||
list(LENGTH skipped_unittests skippedcount)
|
||||
list(LENGTH filenames testcount)
|
||||
message(STATUS "Discovered ${testcount} tests (skipping ${skippedcount})")
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
#
|
||||
# Required by Python >= 2.7.5
|
||||
#
|
||||
# This cmake script allows to adapt the output of sysconfig._generate_posix_vars()
|
||||
# function to play nice with CMake build system.
|
||||
#
|
||||
# 1. Backup original pybuilddir.txt to pybuilddir.txt.backup
|
||||
# 2. Read the value PYBUILDDIR written in pybuilddir.txt
|
||||
# 3. Copy the file <PYBUILDDIR>/<SYSCONFIGDATA_PY> to <EXTENSION_INSTALL_DIR>
|
||||
# 4. Create a new pybuilddir.txt file with <EXTENSION_INSTALL_DIR>
|
||||
#
|
||||
|
||||
# Sanity checks
|
||||
foreach(var BIN_BUILD_DIR PYTHON_BINARY_DIR EXTENSION_INSTALL_DIR SYSCONFIGDATA_PY)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "CMake parameter -D${var} is missing !")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(_pybuilddir ${BIN_BUILD_DIR}/pybuilddir.txt)
|
||||
if(NOT EXISTS ${_pybuilddir})
|
||||
message(FATAL_ERROR "File ${_pybuilddir} does NOT exist")
|
||||
endif()
|
||||
|
||||
# Backup file
|
||||
if(NOT EXISTS ${_pybuilddir}.backup)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${_pybuilddir} ${_pybuilddir}.backup
|
||||
)
|
||||
endif()
|
||||
|
||||
# Read PYBUILDDIR value
|
||||
file(READ ${_pybuilddir}.backup PYBUILDDIR)
|
||||
|
||||
# Copy SYSCONFIGDATA_PY
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${BIN_BUILD_DIR}/${PYBUILDDIR}/${SYSCONFIGDATA_PY}
|
||||
${PYTHON_BINARY_DIR}/${EXTENSION_INSTALL_DIR}/${SYSCONFIGDATA_PY}
|
||||
)
|
||||
|
||||
# Create new file
|
||||
file(WRITE "${_pybuilddir}" "${EXTENSION_INSTALL_DIR}")
|
||||
@@ -0,0 +1 @@
|
||||
#include "../PC/errmap.h"
|
||||
+576
@@ -0,0 +1,576 @@
|
||||
#ifndef Py_CONFIG_H
|
||||
#define Py_CONFIG_H
|
||||
|
||||
/* pyconfig.h. NOT Generated automatically by configure.
|
||||
|
||||
This is a manually maintained version (initially based
|
||||
on "PC/pyconfig.h") used for (i686|x86_64)-w64-mingw32
|
||||
toolchains (provided by MXE).
|
||||
|
||||
WINDOWS DEFINES:
|
||||
The code specific to Windows should be wrapped around one of
|
||||
the following #defines
|
||||
|
||||
MS_WIN64 - Code specific to the MS Win64 API
|
||||
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
|
||||
MS_WINDOWS - Code specific to Windows, but all versions.
|
||||
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
|
||||
|
||||
NOTE: The following symbols are deprecated:
|
||||
NT, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
|
||||
MS_CORE_DLL.
|
||||
|
||||
WIN32 is still required for the locale module.
|
||||
|
||||
*/
|
||||
|
||||
/* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */
|
||||
#ifdef USE_DL_EXPORT
|
||||
# define Py_BUILD_CORE
|
||||
#endif /* USE_DL_EXPORT */
|
||||
|
||||
/* Define if you have the `hypot' function. [Python <= 3.10] */
|
||||
#define HAVE_HYPOT
|
||||
|
||||
#define HAVE_STRFTIME
|
||||
#define DONT_HAVE_SIG_ALARM
|
||||
#define DONT_HAVE_SIG_PAUSE
|
||||
#define LONG_BIT 32
|
||||
#define WORD_BIT 32
|
||||
#define PREFIX ""
|
||||
#define EXEC_PREFIX ""
|
||||
|
||||
#define MS_WIN32 /* only support win32 and greater. */
|
||||
#define MS_WINDOWS
|
||||
#ifndef PYTHONPATH
|
||||
# define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
|
||||
#endif
|
||||
#define NT_THREADS
|
||||
#define WITH_THREAD
|
||||
#ifndef NETSCAPE_PI
|
||||
#define USE_SOCKET
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* (i686|x86_64)-w64-mingw32 toolchains defines __MINGW32__ */
|
||||
#ifndef __MINGW32__
|
||||
# error "This file is should be used with MingW compiler"
|
||||
#endif
|
||||
|
||||
#define _Py_PASTE_VERSION(SUFFIX) \
|
||||
("\n[GCC v" __VERSION__ " " SUFFIX "]")
|
||||
|
||||
#ifndef COMPILER
|
||||
# ifdef __MINGW64__
|
||||
# define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
|
||||
# else
|
||||
# define COMPILER _Py_PASTE_VERSION("32 bit (i686)")
|
||||
# endif
|
||||
#endif /* !COMPILER */
|
||||
|
||||
/* MinGW defines __MINGWxx__ to differentiate the windows platform types
|
||||
|
||||
Note that for compatibility reasons __MINGW32__ is defined on Win32
|
||||
*and* on Win64. For the same reasons, in Python, MS_WIN32 is
|
||||
defined on Win32 *and* Win64. Win32 only code must therefore be
|
||||
guarded as follows:
|
||||
#if defined(MS_WIN32) && !defined(MS_WIN64)
|
||||
*/
|
||||
|
||||
#if !defined(MS_WIN64) && defined(__MINGW64__)
|
||||
# define MS_WIN64
|
||||
#endif
|
||||
|
||||
#ifdef MS_WIN64
|
||||
# define MS_WINX64
|
||||
#endif
|
||||
|
||||
/* set the version macros for the windows headers */
|
||||
#ifdef MS_WINX64
|
||||
/* 64 bit only runs on XP or greater */
|
||||
# define Py_WINVER _WIN32_WINNT_WINXP
|
||||
# define Py_NTDDI NTDDI_WINXP
|
||||
#else
|
||||
/* Python 2.6+ requires Windows 2000 or greater */
|
||||
# ifdef _WIN32_WINNT_WIN2K
|
||||
# define Py_WINVER _WIN32_WINNT_WIN2K
|
||||
# else
|
||||
# define Py_WINVER 0x0500
|
||||
# endif
|
||||
# define Py_NTDDI NTDDI_WIN2KSP4
|
||||
#endif
|
||||
|
||||
/* We only set these values when building Python - we don't want to force
|
||||
these values on extensions, as that will affect the prototypes and
|
||||
structures exposed in the Windows headers. Even when building Python, we
|
||||
allow a single source file to override this - they may need access to
|
||||
structures etc so it can optionally use new Windows features if it
|
||||
determines at runtime they are available.
|
||||
*/
|
||||
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
|
||||
# ifndef NTDDI_VERSION
|
||||
# define NTDDI_VERSION Py_NTDDI
|
||||
# endif
|
||||
# ifndef WINVER
|
||||
# define WINVER Py_WINVER
|
||||
# endif
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT Py_WINVER
|
||||
# endif
|
||||
#endif /* defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE) */
|
||||
|
||||
/* Define like size_t, omitting the "unsigned" */
|
||||
#define HAVE_SSIZE_T 1
|
||||
|
||||
#include <float.h>
|
||||
#define Py_IS_NAN _isnan
|
||||
#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
|
||||
#define Py_IS_FINITE(X) _finite(X)
|
||||
#define copysign _copysign
|
||||
|
||||
#include <basetsd.h>
|
||||
|
||||
/* ------------------------------------------------------------------------*/
|
||||
/* End of compilers - finish up */
|
||||
|
||||
#define HAVE_IO_H
|
||||
#define HAVE_SYS_UTIME_H
|
||||
#define HAVE_TEMPNAM
|
||||
#define HAVE_TMPFILE
|
||||
#define HAVE_TMPNAM
|
||||
#define HAVE_CLOCK
|
||||
#define HAVE_STRERROR
|
||||
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
|
||||
/* Define this if you have the type long long. [Python <= 3.5] */
|
||||
#define HAVE_LONG_LONG 1
|
||||
#ifndef PY_LONG_LONG
|
||||
# define PY_LONG_LONG __int64
|
||||
# define PY_LLONG_MAX _I64_MAX
|
||||
# define PY_LLONG_MIN _I64_MIN
|
||||
# define PY_ULLONG_MAX _UI64_MAX
|
||||
#endif
|
||||
|
||||
/* For Windows the Python core is in a DLL by default. Test
|
||||
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
|
||||
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
|
||||
# define MS_COREDLL /* deprecated old symbol */
|
||||
#endif /* !MS_NO_COREDLL && ... */
|
||||
|
||||
/* All windows compilers that use this header support __declspec */
|
||||
#define HAVE_DECLSPEC_DLL
|
||||
|
||||
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
|
||||
#ifdef MS_COREDLL
|
||||
# ifndef Py_BUILD_CORE /* not building the core - must be an ext */
|
||||
# if defined(_MSC_VER)
|
||||
/* So MSVC users need not specify the .lib file in
|
||||
their Makefile (other compilers are generally
|
||||
taken care of by distutils.) */
|
||||
# ifdef _DEBUG
|
||||
# pragma comment(lib,"python27_d.lib")
|
||||
# else
|
||||
# pragma comment(lib,"python27.lib")
|
||||
# endif /* _DEBUG */
|
||||
# endif /* _MSC_VER */
|
||||
# endif /* Py_BUILD_CORE */
|
||||
#endif /* MS_COREDLL */
|
||||
|
||||
#if defined(MS_WIN64)
|
||||
/* maintain "win32" sys.platform for backward compatibility of Python code,
|
||||
the Win64 API should be close enough to the Win32 API to make this
|
||||
preferable */
|
||||
# define SIZEOF_VOID_P 8
|
||||
# define SIZEOF_TIME_T 8
|
||||
# define SIZEOF_OFF_T 4
|
||||
# define SIZEOF_FPOS_T 8
|
||||
# define SIZEOF_HKEY 8
|
||||
# define SIZEOF_SIZE_T 8
|
||||
# define ALIGNOF_SIZE_T 8
|
||||
/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
|
||||
sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t).
|
||||
On Win64 the second condition is not true, but if fpos_t replaces off_t
|
||||
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
|
||||
should define this. */
|
||||
# define HAVE_LARGEFILE_SUPPORT
|
||||
#elif defined(MS_WIN32)
|
||||
# define HAVE_LARGEFILE_SUPPORT
|
||||
# define SIZEOF_VOID_P 4
|
||||
# define SIZEOF_OFF_T 4
|
||||
# define SIZEOF_FPOS_T 8
|
||||
# define SIZEOF_HKEY 4
|
||||
# define SIZEOF_SIZE_T 4
|
||||
# define ALIGNOF_SIZE_T 4
|
||||
# define SIZEOF_TIME_T 8
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
# define Py_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MS_WIN32
|
||||
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG 4
|
||||
#define ALIGNOF_LONG 4
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SIZEOF_DOUBLE 8
|
||||
#define SIZEOF_FLOAT 4
|
||||
|
||||
/* Define to 1 if the system has the type `uintptr_t'. [Python <= 3.5] */
|
||||
#define HAVE_UINTPTR_T 1
|
||||
|
||||
#define HAVE_INTPTR_T 1
|
||||
|
||||
#endif /* MS_WIN32 */
|
||||
|
||||
/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
|
||||
implementation of Python long integers. */
|
||||
#ifndef PY_UINT32_T
|
||||
#if SIZEOF_INT == 4
|
||||
/* Define if your compiler provides uint32_t. [Python <= 3.5] */
|
||||
#define HAVE_UINT32_T 1
|
||||
#define PY_UINT32_T unsigned int
|
||||
#elif SIZEOF_LONG == 4
|
||||
/* Define if your compiler provides uint32_t. [Python <= 3.5] */
|
||||
#define HAVE_UINT32_T 1
|
||||
#define PY_UINT32_T unsigned long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_UINT64_T
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
/* Define if your compiler provides uint64_t. [Python <= 3.5] */
|
||||
#define HAVE_UINT64_T 1
|
||||
#define PY_UINT64_T unsigned PY_LONG_LONG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_INT32_T
|
||||
#if SIZEOF_INT == 4
|
||||
/* Define if your compiler provides int32_t. [Python <= 3.5] */
|
||||
#define HAVE_INT32_T 1
|
||||
#define PY_INT32_T int
|
||||
#elif SIZEOF_LONG == 4
|
||||
/* Define if your compiler provides int32_t. [Python <= 3.5] */
|
||||
#define HAVE_INT32_T 1
|
||||
#define PY_INT32_T long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PY_INT64_T
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
#define HAVE_INT64_T 1
|
||||
#define PY_INT64_T PY_LONG_LONG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Fairly standard from here! */
|
||||
|
||||
/* Define to 1 if you have the `copysign' function. [Python <= 3.10] */
|
||||
#define HAVE_COPYSIGN 1
|
||||
|
||||
/* Define to 1 if you have the `round' function. [Python <= 3.10] */
|
||||
#define HAVE_ROUND 1
|
||||
|
||||
/* Define to 1 if you have the `isinf' macro. [Python <= 3.10] */
|
||||
#define HAVE_DECL_ISINF 1
|
||||
|
||||
/* Define to 1 if you have the `isnan' function. [Python <= 3.10] */
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #define const */
|
||||
|
||||
/* Define to 1 if you have the <conio.h> header file. */
|
||||
#define HAVE_CONIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <direct.h> header file. */
|
||||
#define HAVE_DIRECT_H 1
|
||||
|
||||
/* Define if you have dirent.h. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'.
|
||||
Usually this is either `int' or `gid_t'. */
|
||||
/* #undef GETGROUPS_T */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef gid_t */
|
||||
|
||||
/* Define if your struct tm has tm_zone. */
|
||||
/* #undef HAVE_TM_ZONE */
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
#define HAVE_TZNAME
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define if you don't have dirent.h, but have ndir.h. */
|
||||
/* #undef NDIR */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/dir.h. */
|
||||
/* #undef SYSDIR */
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/ndir.h. */
|
||||
/* #undef SYSNDIR */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. [Python <= 3.11] */
|
||||
/* #undef TIME_WITH_SYS_TIME */
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #define TM_IN_SYS_TIME 1 */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef uid_t */
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
/* #undef VOID_CLOSEDIR */
|
||||
|
||||
/* Define if getpgrp() must be called as getpgrp(0)
|
||||
and (consequently) setpgrp() as setpgrp(0, 0). */
|
||||
/* #undef GETPGRP_HAVE_ARGS */
|
||||
|
||||
/* Define this if your time.h defines altzone */
|
||||
/* #define HAVE_ALTZONE */
|
||||
|
||||
/* Define if you have the putenv function. [Python <= 3.8] */
|
||||
#define HAVE_PUTENV
|
||||
|
||||
/* Define if your compiler supports function prototypes */
|
||||
#define HAVE_PROTOTYPES
|
||||
|
||||
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
|
||||
(which you can't on SCO ODT 3.0). */
|
||||
/* #undef SYS_SELECT_WITH_SYS_TIME */
|
||||
|
||||
/* Define if you want documentation strings in extension modules */
|
||||
#define WITH_DOC_STRINGS 1
|
||||
|
||||
/* Define if you want to compile in rudimentary thread support */
|
||||
/* #undef WITH_THREAD */
|
||||
|
||||
/* Define if you want to use the GNU readline library */
|
||||
/* #define WITH_READLINE 1 */
|
||||
|
||||
/* Define as the size of the unicode type. [Python 2.7 to 3.2] */
|
||||
/* This is enough for unicodeobject.h to do the "right thing" on Windows. */
|
||||
#define Py_UNICODE_SIZE 2
|
||||
|
||||
/* Use Python's own small-block memory-allocator. */
|
||||
#define WITH_PYMALLOC 1
|
||||
|
||||
/* Define if you want to compile in object freelists optimization [Python 3.11] */
|
||||
#define WITH_FREELISTS 1
|
||||
|
||||
/* Define if you have clock. */
|
||||
/* #define HAVE_CLOCK */
|
||||
|
||||
/* Define when any dynamic module loading is enabled */
|
||||
#define HAVE_DYNAMIC_LOADING
|
||||
|
||||
/* Define if you have ftime. */
|
||||
#define HAVE_FTIME
|
||||
|
||||
/* Define if you have getpeername. */
|
||||
#define HAVE_GETPEERNAME
|
||||
|
||||
/* Define if you have getpgrp. */
|
||||
/* #undef HAVE_GETPGRP */
|
||||
|
||||
/* Define if you have getpid. */
|
||||
#define HAVE_GETPID
|
||||
|
||||
/* Define if you have gettimeofday. [Python <= 3.8] */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define if you have getwd. */
|
||||
/* #undef HAVE_GETWD */
|
||||
|
||||
/* Define if you have lstat. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define if you have the mktime function. */
|
||||
#define HAVE_MKTIME
|
||||
|
||||
/* Define if you have nice. */
|
||||
/* #undef HAVE_NICE */
|
||||
|
||||
/* Define if you have readlink. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define if you have select. [Python <= 3.6] */
|
||||
/* #undef HAVE_SELECT */
|
||||
|
||||
/* Define if you have setpgid. */
|
||||
/* #undef HAVE_SETPGID */
|
||||
|
||||
/* Define if you have setpgrp. */
|
||||
/* #undef HAVE_SETPGRP */
|
||||
|
||||
/* Define if you have setsid. */
|
||||
/* #undef HAVE_SETSID */
|
||||
|
||||
/* Define if you have setvbuf. */
|
||||
#define HAVE_SETVBUF
|
||||
|
||||
/* Define if you have siginterrupt. */
|
||||
/* #undef HAVE_SIGINTERRUPT */
|
||||
|
||||
/* Define if you have symlink. */
|
||||
/* #undef HAVE_SYMLINK */
|
||||
|
||||
/* Define if you have tcgetpgrp. */
|
||||
/* #undef HAVE_TCGETPGRP */
|
||||
|
||||
/* Define if you have tcsetpgrp. */
|
||||
/* #undef HAVE_TCSETPGRP */
|
||||
|
||||
/* Define if you have times. */
|
||||
/* #undef HAVE_TIMES */
|
||||
|
||||
/* Define if you have uname. */
|
||||
/* #undef HAVE_UNAME */
|
||||
|
||||
/* Define if you have waitpid. */
|
||||
/* #undef HAVE_WAITPID */
|
||||
|
||||
/* Define to 1 if you have the `wcscoll' function. */
|
||||
#define HAVE_WCSCOLL 1
|
||||
|
||||
/* Define if the zlib library has inflateCopy */
|
||||
#define HAVE_ZLIB_COPY 1
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <process.h> header file. */
|
||||
#define HAVE_PROCESS_H 1
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <stdarg.h> prototypes. [Python <= 3.11] */
|
||||
#define HAVE_STDARG_PROTOTYPES
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
/* Define if you have the <sys/audioio.h> header file. */
|
||||
/* #undef HAVE_SYS_AUDIOIO_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/* #define HAVE_SYS_PARAM_H 1 */
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #define HAVE_SYS_SELECT_H 1 */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
/* #define HAVE_SYS_TIME_H 1 */
|
||||
|
||||
/* Define if you have the <sys/times.h> header file. */
|
||||
/* #define HAVE_SYS_TIMES_H 1 */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/un.h> header file. */
|
||||
/* #define HAVE_SYS_UN_H 1 */
|
||||
|
||||
/* Define if you have the <sys/utime.h> header file. */
|
||||
/* #define HAVE_SYS_UTIME_H 1 */
|
||||
|
||||
/* Define if you have the <sys/utsname.h> header file. */
|
||||
/* #define HAVE_SYS_UTSNAME_H 1 */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
/* #define HAVE_UNISTD_H 1 */
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
/* #define HAVE_UTIME_H 1 */
|
||||
|
||||
/* Define if the compiler provides a wchar.h header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
/* #undef HAVE_LIBDL */
|
||||
|
||||
/* Define if you have the mpc library (-lmpc). */
|
||||
/* #undef HAVE_LIBMPC */
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#define HAVE_LIBNSL 1
|
||||
|
||||
/* Define if you have the seq library (-lseq). */
|
||||
/* #undef HAVE_LIBSEQ */
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#define HAVE_LIBSOCKET 1
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
/* #undef HAVE_LIBSUN */
|
||||
|
||||
/* Define if you have the termcap library (-ltermcap). */
|
||||
/* #undef HAVE_LIBTERMCAP */
|
||||
|
||||
/* Define if you have the termlib library (-ltermlib). */
|
||||
/* #undef HAVE_LIBTERMLIB */
|
||||
|
||||
/* Define if you have the thread library (-lthread). */
|
||||
/* #undef HAVE_LIBTHREAD */
|
||||
|
||||
/* WinSock does not use a bitmask in select, and uses
|
||||
socket handles greater than FD_SETSIZE */
|
||||
#define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
|
||||
|
||||
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
|
||||
least significant byte first */
|
||||
#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1
|
||||
|
||||
#endif /* !Py_CONFIG_H */
|
||||
+2093
File diff suppressed because it is too large
Load Diff
+58
@@ -0,0 +1,58 @@
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@config_inits@
|
||||
|
||||
/* -- ADDMODULE MARKER 1 -- */
|
||||
|
||||
extern PyObject* PyMarshal_Init(void);
|
||||
extern PyObject* @PyInit_imp@(void);
|
||||
extern PyObject* PyInit_gc(void);
|
||||
extern PyObject* PyInit__ast(void);
|
||||
extern PyObject* _PyWarnings_Init(void);
|
||||
extern PyObject* PyInit__string(void);
|
||||
|
||||
extern PyObject* PyInit__signal(void);
|
||||
|
||||
struct _inittab _PyImport_Inittab[] = {
|
||||
|
||||
@config_entries@
|
||||
|
||||
/* -- ADDMODULE MARKER 2 -- */
|
||||
|
||||
/* This module lives in marshal.c */
|
||||
{"marshal", PyMarshal_Init},
|
||||
|
||||
/* This lives in import.c */
|
||||
{"_imp", @PyInit_imp@},
|
||||
|
||||
/* This lives in Python/Python-ast.c */
|
||||
{"_ast", PyInit__ast},
|
||||
|
||||
/* These entries are here for sys.builtin_module_names */
|
||||
{"builtins", NULL},
|
||||
{"sys", NULL},
|
||||
|
||||
/* This lives in gcmodule.c */
|
||||
{"gc", PyInit_gc},
|
||||
|
||||
/* This lives in _warnings.c */
|
||||
{"_warnings", _PyWarnings_Init},
|
||||
|
||||
/* This lives in Objects/unicodeobject.c */
|
||||
{"_string", PyInit__string},
|
||||
|
||||
{"_signal", PyInit__signal},
|
||||
|
||||
/* Sentinel */
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
+1204
File diff suppressed because it is too large
Load Diff
Vendored
+402
@@ -0,0 +1,402 @@
|
||||
/* -----------------------------------------------------------------*-C-*-
|
||||
libffi 3.0.10rc0 - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
The basic API is described in the README file.
|
||||
|
||||
The raw API is designed to bypass some of the argument packing
|
||||
and unpacking on architectures for which it can be avoided.
|
||||
|
||||
The closure API allows interpreted functions to be packaged up
|
||||
inside a C function pointer, so that they can be called as C functions,
|
||||
with no understanding on the client side that they are interpreted.
|
||||
It can also be used in other cases in which it is necessary to package
|
||||
up a user specified parameter and a function pointer as a single
|
||||
function pointer.
|
||||
|
||||
The closure API must be implemented in order to get its functionality,
|
||||
e.g. for use by gij. Routines are provided to emulate the raw API
|
||||
if the underlying platform doesn't allow faster implementation.
|
||||
|
||||
More details on the raw and cloure API can be found in:
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
||||
|
||||
and
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
|
||||
-------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_H
|
||||
#define LIBFFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Specify which architecture libffi is configured for. */
|
||||
#define X86_64
|
||||
|
||||
/* ---- System configuration information --------------------------------- */
|
||||
|
||||
#include <ffitarget.h>
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(X)
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
|
||||
But we can find it either under the correct ANSI name, or under GNU
|
||||
C's internal name. */
|
||||
#ifdef LONG_LONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
|
||||
#else
|
||||
# ifdef LLONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LLONG_MAX
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The closure code assumes that this works on pointers, i.e. a size_t */
|
||||
/* can hold a pointer. */
|
||||
|
||||
typedef struct _ffi_type
|
||||
{
|
||||
size_t size;
|
||||
unsigned short alignment;
|
||||
unsigned short type;
|
||||
struct _ffi_type **elements;
|
||||
} ffi_type;
|
||||
|
||||
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
||||
#if SCHAR_MAX == 127
|
||||
# define ffi_type_uchar ffi_type_uint8
|
||||
# define ffi_type_schar ffi_type_sint8
|
||||
#else
|
||||
#error "char size not supported"
|
||||
#endif
|
||||
|
||||
#if SHRT_MAX == 32767
|
||||
# define ffi_type_ushort ffi_type_uint16
|
||||
# define ffi_type_sshort ffi_type_sint16
|
||||
#elif SHRT_MAX == 2147483647
|
||||
# define ffi_type_ushort ffi_type_uint32
|
||||
# define ffi_type_sshort ffi_type_sint32
|
||||
#else
|
||||
#error "short size not supported"
|
||||
#endif
|
||||
|
||||
#if INT_MAX == 32767
|
||||
# define ffi_type_uint ffi_type_uint16
|
||||
# define ffi_type_sint ffi_type_sint16
|
||||
#elif INT_MAX == 2147483647
|
||||
# define ffi_type_uint ffi_type_uint32
|
||||
# define ffi_type_sint ffi_type_sint32
|
||||
#elif INT_MAX == 9223372036854775807
|
||||
# define ffi_type_uint ffi_type_uint64
|
||||
# define ffi_type_sint ffi_type_sint64
|
||||
#else
|
||||
#error "int size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# if FFI_LONG_LONG_MAX != 9223372036854775807
|
||||
#error "no 64-bit data type supported"
|
||||
# endif
|
||||
#elif LONG_MAX != 9223372036854775807
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# define ffi_type_ulong ffi_type_uint32
|
||||
# define ffi_type_slong ffi_type_sint32
|
||||
#elif LONG_MAX == 9223372036854775807
|
||||
# define ffi_type_ulong ffi_type_uint64
|
||||
# define ffi_type_slong ffi_type_sint64
|
||||
#else
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
/* These are defined in types.c */
|
||||
extern ffi_type ffi_type_void;
|
||||
extern ffi_type ffi_type_uint8;
|
||||
extern ffi_type ffi_type_sint8;
|
||||
extern ffi_type ffi_type_uint16;
|
||||
extern ffi_type ffi_type_sint16;
|
||||
extern ffi_type ffi_type_uint32;
|
||||
extern ffi_type ffi_type_sint32;
|
||||
extern ffi_type ffi_type_uint64;
|
||||
extern ffi_type ffi_type_sint64;
|
||||
extern ffi_type ffi_type_float;
|
||||
extern ffi_type ffi_type_double;
|
||||
extern ffi_type ffi_type_pointer;
|
||||
|
||||
#if 1
|
||||
extern ffi_type ffi_type_longdouble;
|
||||
#else
|
||||
#define ffi_type_longdouble ffi_type_double
|
||||
#endif
|
||||
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
||||
|
||||
typedef enum {
|
||||
FFI_OK = 0,
|
||||
FFI_BAD_TYPEDEF,
|
||||
FFI_BAD_ABI
|
||||
} ffi_status;
|
||||
|
||||
typedef unsigned FFI_TYPE;
|
||||
|
||||
typedef struct {
|
||||
ffi_abi abi;
|
||||
unsigned nargs;
|
||||
ffi_type **arg_types;
|
||||
ffi_type *rtype;
|
||||
unsigned bytes;
|
||||
unsigned flags;
|
||||
#ifdef FFI_EXTRA_CIF_FIELDS
|
||||
FFI_EXTRA_CIF_FIELDS;
|
||||
#endif
|
||||
} ffi_cif;
|
||||
|
||||
/* ---- Definitions for the raw API -------------------------------------- */
|
||||
|
||||
#ifndef FFI_SIZEOF_ARG
|
||||
# if LONG_MAX == 2147483647
|
||||
# define FFI_SIZEOF_ARG 4
|
||||
# elif LONG_MAX == 9223372036854775807
|
||||
# define FFI_SIZEOF_ARG 8
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FFI_SIZEOF_JAVA_RAW
|
||||
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
ffi_sarg sint;
|
||||
ffi_arg uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_ARG];
|
||||
void* ptr;
|
||||
} ffi_raw;
|
||||
|
||||
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
|
||||
/* This is a special case for mips64/n32 ABI (and perhaps others) where
|
||||
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
|
||||
typedef union {
|
||||
signed int sint;
|
||||
unsigned int uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_JAVA_RAW];
|
||||
void* ptr;
|
||||
} ffi_java_raw;
|
||||
#else
|
||||
typedef ffi_raw ffi_java_raw;
|
||||
#endif
|
||||
|
||||
|
||||
void ffi_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_raw *avalue);
|
||||
|
||||
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
||||
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
||||
size_t ffi_raw_size (ffi_cif *cif);
|
||||
|
||||
/* This is analogous to the raw API, except it uses Java parameter */
|
||||
/* packing, even on 64-bit machines. I.e. on 64-bit machines */
|
||||
/* longs and doubles are followed by an empty 64-bit word. */
|
||||
|
||||
void ffi_java_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_java_raw *avalue);
|
||||
|
||||
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
|
||||
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
|
||||
size_t ffi_java_raw_size (ffi_cif *cif);
|
||||
|
||||
/* ---- Definitions for closures ----------------------------------------- */
|
||||
|
||||
#if FFI_CLOSURES
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(8))
|
||||
#endif
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
ffi_cif *cif;
|
||||
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||
void *user_data;
|
||||
#ifdef __GNUC__
|
||||
} ffi_closure __attribute__((aligned (8)));
|
||||
#else
|
||||
} ffi_closure;
|
||||
#endif
|
||||
|
||||
void *ffi_closure_alloc (size_t size, void **code);
|
||||
void ffi_closure_free (void *);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data,
|
||||
void*codeloc);
|
||||
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* if this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the transaltion, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_raw_closure;
|
||||
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* if this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the transaltion, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_java_raw_closure;
|
||||
|
||||
ffi_status
|
||||
ffi_prep_raw_closure (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
#endif /* FFI_CLOSURES */
|
||||
|
||||
/* ---- Public interface definition -------------------------------------- */
|
||||
|
||||
ffi_status ffi_prep_cif(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int nargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
void ffi_call(ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
void **avalue);
|
||||
|
||||
/* Useful for eliminating compiler warnings */
|
||||
#define FFI_FN(f) ((void (*)(void))f)
|
||||
|
||||
/* ---- Definitions shared with assembly code ---------------------------- */
|
||||
|
||||
#endif
|
||||
|
||||
/* If these change, update src/mips/ffitarget.h. */
|
||||
#define FFI_TYPE_VOID 0
|
||||
#define FFI_TYPE_INT 1
|
||||
#define FFI_TYPE_FLOAT 2
|
||||
#define FFI_TYPE_DOUBLE 3
|
||||
#if 1
|
||||
#define FFI_TYPE_LONGDOUBLE 4
|
||||
#else
|
||||
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
||||
#endif
|
||||
#define FFI_TYPE_UINT8 5
|
||||
#define FFI_TYPE_SINT8 6
|
||||
#define FFI_TYPE_UINT16 7
|
||||
#define FFI_TYPE_SINT16 8
|
||||
#define FFI_TYPE_UINT32 9
|
||||
#define FFI_TYPE_SINT32 10
|
||||
#define FFI_TYPE_UINT64 11
|
||||
#define FFI_TYPE_SINT64 12
|
||||
#define FFI_TYPE_STRUCT 13
|
||||
#define FFI_TYPE_POINTER 14
|
||||
|
||||
/* This should always refer to the last type code (for sanity checks) */
|
||||
#define FFI_TYPE_LAST FFI_TYPE_POINTER
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
/* fficonfig.h. Generated from fficonfig.h.in by configure. */
|
||||
/* fficonfig.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to the flags needed for the .section .eh_frame directive. */
|
||||
#define EH_FRAME_FLAGS "aw"
|
||||
|
||||
/* Define this if you want extra debugging. */
|
||||
/* #undef FFI_DEBUG */
|
||||
|
||||
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
|
||||
#cmakedefine FFI_EXEC_TRAMPOLINE_TABLE 1
|
||||
|
||||
/* Define this if you want to enable pax emulated trampolines */
|
||||
#cmakedefine FFI_MMAP_EXEC_EMUTRAMP_PAX 1
|
||||
|
||||
/* Cannot use malloc on this target, so, we revert to alternative means */
|
||||
/* #undef FFI_MMAP_EXEC_WRIT */
|
||||
|
||||
/* Define this if you do not want support for the raw API. */
|
||||
/* #undef FFI_NO_RAW_API */
|
||||
|
||||
/* Define this if you do not want support for aggregate types. */
|
||||
/* #undef FFI_NO_STRUCTS */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#cmakedefine HAVE_ALLOCA 1
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#cmakedefine HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define if your assembler supports .ascii. */
|
||||
#cmakedefine HAVE_AS_ASCII_PSEUDO_OP 1
|
||||
|
||||
/* Define if your assembler supports .cfi_* directives. */
|
||||
#cmakedefine HAVE_AS_CFI_PSEUDO_OP 1
|
||||
|
||||
/* Define if your assembler supports .register. */
|
||||
/* #undef HAVE_AS_REGISTER_PSEUDO_OP */
|
||||
|
||||
/* Define if your assembler and linker support unaligned PC relative relocs.
|
||||
*/
|
||||
/* #undef HAVE_AS_SPARC_UA_PCREL */
|
||||
|
||||
/* Define if your assembler supports .string. */
|
||||
#cmakedefine HAVE_AS_STRING_PSEUDO_OP 1
|
||||
|
||||
/* Define if your assembler supports unwind section type. */
|
||||
#cmakedefine HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1
|
||||
|
||||
/* Define if your assembler supports PC relative relocs. */
|
||||
#cmakedefine HAVE_AS_X86_PCREL 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if __attribute__((visibility("hidden"))) is supported. */
|
||||
#cmakedefine HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define if you have the long double type and it is bigger than a double */
|
||||
#cmakedefine HAVE_LONG_DOUBLE 1
|
||||
|
||||
/* Define if you support more than one size of the long double type */
|
||||
#cmakedefine HAVE_LONG_DOUBLE_VARIANT 1
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#cmakedefine HAVE_MMAP 1
|
||||
|
||||
/* Define if mmap with MAP_ANON(YMOUS) works. */
|
||||
#cmakedefine HAVE_MMAP_ANON 1
|
||||
|
||||
/* Define if mmap of /dev/zero works. */
|
||||
#cmakedefine HAVE_MMAP_DEV_ZERO 1
|
||||
|
||||
/* Define if read-only mmap of a plain file works. */
|
||||
#cmakedefine HAVE_MMAP_FILE 1
|
||||
|
||||
/* Define if .eh_frame sections should be read-only. */
|
||||
#cmakedefine HAVE_RO_EH_FRAME 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#cmakedefine HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libffi"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "http://github.com/atgreen/libffi/issues"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libffi"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libffi @LIBFFI_VERSION@"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libffi"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@LIBFFI_VERSION@"
|
||||
|
||||
/* The size of `double', as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@
|
||||
|
||||
/* The size of `long double', as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
|
||||
/* Define if symbols are underscored. */
|
||||
#cmakedefine SYMBOL_UNDERSCORE 1
|
||||
|
||||
/* Define this if you are using Purify and want to suppress spurious messages.
|
||||
*/
|
||||
/* #undef USING_PURIFY */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "@LIBFFI_VERSION@"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
|
||||
#ifdef LIBFFI_ASM
|
||||
#define FFI_HIDDEN(name) .hidden name
|
||||
#else
|
||||
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIBFFI_ASM
|
||||
#define FFI_HIDDEN(name)
|
||||
#else
|
||||
#define FFI_HIDDEN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# Install all the header files in Include/
|
||||
|
||||
set(includedir ${INCLUDE_BUILD_DIR})
|
||||
file(GLOB_RECURSE hfiles RELATIVE ${includedir} "${includedir}/*")
|
||||
|
||||
foreach(file ${hfiles})
|
||||
get_filename_component(path ${file} PATH)
|
||||
if(WIN32)
|
||||
file(COPY ${includedir}/${file} DESTINATION ${PROJECT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/${path})
|
||||
endif()
|
||||
if(INSTALL_DEVELOPMENT)
|
||||
install(FILES ${includedir}/${file} DESTINATION ${INCLUDE_INSTALL_DIR}/${path} COMPONENT Development)
|
||||
endif()
|
||||
endforeach()
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
# Install all the python module source from Lib/
|
||||
|
||||
set(libdir ${SRC_DIR}/Lib)
|
||||
file(GLOB_RECURSE libfiles RELATIVE ${libdir} "${libdir}/*")
|
||||
|
||||
if(UNIX)
|
||||
set(plat_subdir "plat-linux")
|
||||
endif()
|
||||
|
||||
foreach(file ${libfiles})
|
||||
# Don't install files for other platforms
|
||||
string(REGEX MATCH "^plat-" is_platform_file "${file}")
|
||||
if(plat_subdir)
|
||||
string(REGEX MATCH "^${plat_subdir}" is_matching_platform_file "${file}")
|
||||
endif()
|
||||
|
||||
# Exclude tests if BUILD_TESTING is OFF
|
||||
string(REGEX MATCH "^test" is_test "${file}")
|
||||
set(include_file 1)
|
||||
|
||||
if(is_test AND (NOT BUILD_TESTING OR NOT INSTALL_TEST))
|
||||
set(include_file 0)
|
||||
endif()
|
||||
|
||||
if(include_file AND (NOT is_platform_file OR is_matching_platform_file))
|
||||
get_filename_component(path ${file} PATH)
|
||||
|
||||
# Copy lib files to build tree
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PYTHONHOME}/${path})
|
||||
file(COPY ${libdir}/${file} DESTINATION ${PROJECT_BINARY_DIR}/${PYTHONHOME}/${path})
|
||||
|
||||
# Install
|
||||
install(FILES ${libdir}/${file} DESTINATION ${PYTHONHOME}/${path})
|
||||
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Generate grammar tables in install directory
|
||||
# XXX Should a custom target be added to generate file at built time ?
|
||||
install(CODE "find_program(
|
||||
PYTHON_EXECUTABLE python
|
||||
HINTS \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}
|
||||
NO_DEFAULT_PATH)
|
||||
set(wrapper)
|
||||
if(UNIX)
|
||||
set(_envvar LD_LIBRARY_PATH)
|
||||
if(APPLE)
|
||||
set(_envvar DYLD_LIBRARY_PATH)
|
||||
endif()
|
||||
set(wrapper env \${_envvar}=\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LIBPYTHON_LIBDIR})
|
||||
endif()
|
||||
execute_process(COMMAND \${wrapper} \${PYTHON_EXECUTABLE} -m lib2to3.pgen2.driver
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${PYTHONHOME}/lib2to3/Grammar.txt)
|
||||
execute_process(COMMAND \${wrapper} \${PYTHON_EXECUTABLE} -m lib2to3.pgen2.driver
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${PYTHONHOME}/lib2to3/PatternGrammar.txt)
|
||||
")
|
||||
+1045
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
# Sanity checks
|
||||
foreach(varname INPUT_DEF_FILE OUTPUT_DEF_FILE)
|
||||
if(NOT DEFINED ${varname})
|
||||
message(FATAL_ERROR "Variable '${varname}' is not defined.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(STRINGS ${INPUT_DEF_FILE} def_lines REGEX "^ (.+)=.+$")
|
||||
set(stub_def_lines "EXPORTS\n")
|
||||
foreach(line IN LISTS def_lines)
|
||||
string(REGEX MATCH "^ (.+)=.+$" output ${line})
|
||||
if(NOT "${output}" STREQUAL "")
|
||||
set(stub_def_lines "${stub_def_lines}${CMAKE_MATCH_1}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
file(WRITE ${OUTPUT_DEF_FILE} "${stub_def_lines}")
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
# === Variables set by makesetup ===
|
||||
|
||||
MODOBJS=
|
||||
MODLIBS=
|
||||
|
||||
# === Variables set by configure
|
||||
VERSION= @LIBPYTHON_VERSION@
|
||||
srcdir= @SRC_DIR@
|
||||
|
||||
|
||||
CC= @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_ARG1@ -pthread
|
||||
CXX= @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_ARG1@ -pthread
|
||||
MAINCC= $(CC)
|
||||
LINKCC= $(PURIFY) $(MAINCC)
|
||||
AR= @CMAKE_AR@
|
||||
RANLIB= @CMAKE_RANLIB@
|
||||
SOABI= @SOABI@
|
||||
LDVERSION= $(VERSION)$(ABIFLAGS)
|
||||
SVNVERSION= svnversion $(srcdir)
|
||||
HGVERSION=
|
||||
HGTAG=
|
||||
HGBRANCH=
|
||||
|
||||
GNULD= yes
|
||||
|
||||
# Shell used by make (some versions default to the login shell, which is bad)
|
||||
SHELL= /bin/sh
|
||||
|
||||
# Use this to make a link between python$(VERSION) and python in $(BINDIR)
|
||||
LN= ln
|
||||
|
||||
# Portable install script (configure doesn't always guess right)
|
||||
INSTALL= /usr/bin/install -c
|
||||
INSTALL_PROGRAM=${INSTALL}
|
||||
INSTALL_SCRIPT= ${INSTALL}
|
||||
INSTALL_DATA= ${INSTALL} -m 644
|
||||
# Shared libraries must be installed with executable mode on some systems;
|
||||
# rather than figuring out exactly which, we always give them executable mode.
|
||||
# Also, making them read-only seems to be a good idea...
|
||||
INSTALL_SHARED= ${INSTALL} -m 555
|
||||
|
||||
MAKESETUP= $(srcdir)/Modules/makesetup
|
||||
|
||||
# Compiler options
|
||||
OPT= @CMAKE_C_FLAGS@ -DNDEBUG
|
||||
BASECFLAGS= -Wno-unused-result -Wsign-compare -Wunreachable-code
|
||||
CFLAGS= @CMAKE_C_FLAGS@
|
||||
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
|
||||
# be able to build extension modules using the directories specified in the
|
||||
# environment variables
|
||||
CPPFLAGS= @CMAKE_CXX_FLAGS@
|
||||
LDFLAGS=
|
||||
LDLAST=
|
||||
SGI_ABI=
|
||||
CCSHARED= -fPIC
|
||||
LINKFORSHARED= -Xlinker -export-dynamic
|
||||
ARFLAGS= rc
|
||||
# Extra C flags added for building the interpreter object files.
|
||||
CFLAGSFORSHARED=
|
||||
# C flags used for building the interpreter object files
|
||||
PY_CFLAGS= @CMAKE_C_FLAGS@ -DPy_BUILD_CORE
|
||||
|
||||
|
||||
# Machine-dependent subdirectories
|
||||
MACHDEP= @PY_PLATFORM@
|
||||
|
||||
# Install prefix for architecture-independent files
|
||||
prefix= @CMAKE_INSTALL_PREFIX@
|
||||
|
||||
# Install prefix for architecture-dependent files
|
||||
exec_prefix= ${prefix}
|
||||
|
||||
# Install prefix for data files
|
||||
datarootdir= ${prefix}/share
|
||||
|
||||
# Expanded directories
|
||||
BINDIR= ${exec_prefix}/bin
|
||||
LIBDIR= ${exec_prefix}/lib
|
||||
MANDIR= ${datarootdir}/man
|
||||
INCLUDEDIR= ${prefix}/include
|
||||
CONFINCLUDEDIR= $(exec_prefix)/include
|
||||
SCRIPTDIR= $(prefix)/lib
|
||||
ABIFLAGS= @ABIFLAGS@
|
||||
|
||||
# Detailed destination directories
|
||||
BINLIBDEST= $(LIBDIR)/python$(VERSION)
|
||||
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
|
||||
INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
|
||||
CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
|
||||
LIBP= $(LIBDIR)/python$(VERSION)
|
||||
|
||||
# Symbols used for using shared libraries
|
||||
SHLIB_SUFFIX= .so
|
||||
EXT_SUFFIX= .$(SOABI).so
|
||||
SO= .so
|
||||
LDSHARED= $(CC) @MAKEFILE_LDSHARED_FLAGS@ $(LDFLAGS)
|
||||
BLDSHARED= $(CC) @MAKEFILE_LDSHARED_FLAGS@ $(LDFLAGS)
|
||||
LDCXXSHARED= $(CXX) @MAKEFILE_LDSHARED_FLAGS@
|
||||
DESTSHARED= $(BINLIBDEST)/lib-dynload
|
||||
|
||||
# Executable suffix (.exe on Windows and Mac OS X)
|
||||
EXE= @CMAKE_EXECUTABLE_SUFFIX@
|
||||
BUILDEXE= @CMAKE_EXECUTABLE_SUFFIX@
|
||||
|
||||
# Short name and location for Mac OS X Python framework
|
||||
UNIVERSALSDK=
|
||||
PYTHONFRAMEWORK=
|
||||
PYTHONFRAMEWORKDIR= no-framework
|
||||
PYTHONFRAMEWORKPREFIX=
|
||||
PYTHONFRAMEWORKINSTALLDIR=
|
||||
# Deployment target selected during configure, to be checked
|
||||
# by distutils. The export statement is needed to ensure that the
|
||||
# deployment target is active during build.
|
||||
MACOSX_DEPLOYMENT_TARGET=@CMAKE_OSX_DEPLOYMENT_TARGET@
|
||||
#export MACOSX_DEPLOYMENT_TARGET
|
||||
|
||||
# Environment to run shared python without installed libraries
|
||||
RUNSHARED=
|
||||
|
||||
# Modes for directories, executables and data files created by the
|
||||
# install process. Default to user-only-writable for all file types.
|
||||
DIRMODE= 755
|
||||
EXEMODE= 755
|
||||
FILEMODE= 644
|
||||
|
||||
# configure script arguments
|
||||
CONFIG_ARGS= '--prefix' '@CMAKE_INSTALL_PREFIX@'
|
||||
|
||||
# Subdirectories with code
|
||||
SRCDIRS= Parser Grammar Objects Python Modules Mac
|
||||
|
||||
# Other subdirectories
|
||||
SUBDIRSTOO= Include Lib Misc Demo
|
||||
|
||||
# Files and directories to be distributed
|
||||
CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
|
||||
DISTFILES= README ChangeLog $(CONFIGFILES)
|
||||
DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
|
||||
DIST= $(DISTFILES) $(DISTDIRS)
|
||||
|
||||
LIBRARY= libpython$(VERSION)$(ABIFLAGS).a
|
||||
LDLIBRARY= libpython$(VERSION)$(ABIFLAGS).a
|
||||
BLDLIBRARY= $(LDLIBRARY)
|
||||
DLLLIBRARY=
|
||||
LDLIBRARYDIR=
|
||||
INSTSONAME= $(LDLIBRARY)
|
||||
|
||||
|
||||
LIBS= -lpthread -ldl -lutil
|
||||
LIBM= -lm
|
||||
LIBC=
|
||||
SYSLIBS= $(LIBM) $(LIBC)
|
||||
SHLIBS= $(LIBS)
|
||||
|
||||
PYTHON= python$(EXE)
|
||||
BUILDPYTHON= python$(BUILDEXE)
|
||||
|
||||
PYTHON_FOR_BUILD=./$(BUILDPYTHON) -E
|
||||
_PYTHON_HOST_PLATFORM=
|
||||
BUILD_GNU_TYPE= x86_64-unknown-linux-gnu
|
||||
HOST_GNU_TYPE= x86_64-unknown-linux-gnu
|
||||
|
||||
# === Definitions added by makesetup ===
|
||||
|
||||
LOCALMODLIBS=
|
||||
BASEMODLIBS=
|
||||
GLHACK=-Dclear=__GLclear
|
||||
PYTHONPATH=$(COREPYTHONPATH)
|
||||
COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH)$(OLDPATH)
|
||||
OLDPATH=:lib-old
|
||||
TKPATH=:lib-tk
|
||||
EXTRAMACHDEPPATH=
|
||||
MACHDEPPATH=:plat-$(MACHDEP)
|
||||
TESTPATH=
|
||||
SITEPATH=
|
||||
DESTPATH=
|
||||
MACHDESTLIB=$(BINLIBDEST)
|
||||
DESTLIB=$(LIBDEST)
|
||||
|
||||
|
||||
LIBFFI_INCLUDEDIR=
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Rules
|
||||
|
||||
# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
|
||||
# minimal framework (not including the Lib directory and such) in the current
|
||||
# directory.
|
||||
RESSRCDIR=Mac/Resources/framework
|
||||
|
||||
# Install the library
|
||||
PLATDIR= plat-$(MACHDEP)
|
||||
EXTRAPLATDIR=
|
||||
EXTRAMACHDEPPATH=
|
||||
|
||||
# Install the library and miscellaneous stuff needed for extending/embedding
|
||||
# This goes into $(exec_prefix)
|
||||
LIBPL= $(LIBP)/config
|
||||
|
||||
# pkgconfig directory
|
||||
LIBPC= $(LIBDIR)/pkgconfig
|
||||
|
||||
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
// Based on code in Python's `configure` script (see conftest.c)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#undef bfin
|
||||
#undef cris
|
||||
#undef fr30
|
||||
#undef linux
|
||||
#undef hppa
|
||||
#undef hpux
|
||||
#undef i386
|
||||
#undef mips
|
||||
#undef powerpc
|
||||
#undef sparc
|
||||
#undef unix
|
||||
|
||||
char *PLATFORM_TRIPLET =
|
||||
|
||||
#if defined(__linux__)
|
||||
# if defined(__x86_64__) && defined(__LP64__)
|
||||
"x86_64-linux-gnu"
|
||||
# elif defined(__x86_64__) && defined(__ILP32__)
|
||||
"x86_64-linux-gnux32"
|
||||
# elif defined(__i386__)
|
||||
"i386-linux-gnu"
|
||||
# elif defined(__aarch64__) && defined(__AARCH64EL__)
|
||||
# if defined(__ILP32__)
|
||||
"aarch64_ilp32-linux-gnu"
|
||||
# else
|
||||
"aarch64-linux-gnu"
|
||||
# endif
|
||||
# elif defined(__aarch64__) && defined(__AARCH64EB__)
|
||||
# if defined(__ILP32__)
|
||||
"aarch64_be_ilp32-linux-gnu"
|
||||
# else
|
||||
"aarch64_be-linux-gnu"
|
||||
# endif
|
||||
# elif defined(__alpha__)
|
||||
"alpha-linux-gnu"
|
||||
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
|
||||
# if defined(__ARMEL__)
|
||||
"arm-linux-gnueabihf"
|
||||
# else
|
||||
"armeb-linux-gnueabihf"
|
||||
# endif
|
||||
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
|
||||
# if defined(__ARMEL__)
|
||||
"arm-linux-gnueabi"
|
||||
# else
|
||||
"armeb-linux-gnueabi"
|
||||
# endif
|
||||
# elif defined(__hppa__)
|
||||
"hppa-linux-gnu"
|
||||
# elif defined(__ia64__)
|
||||
"ia64-linux-gnu"
|
||||
# elif defined(__m68k__) && !defined(__mcoldfire__)
|
||||
"m68k-linux-gnu"
|
||||
# elif defined(__mips_hard_float) && defined(_MIPSEL)
|
||||
# if _MIPS_SIM == _ABIO32
|
||||
"mipsel-linux-gnu"
|
||||
# elif _MIPS_SIM == _ABIN32
|
||||
"mips64el-linux-gnuabin32"
|
||||
# elif _MIPS_SIM == _ABI64
|
||||
"mips64el-linux-gnuabi64"
|
||||
# else
|
||||
# "unknown platform triplet"
|
||||
# endif
|
||||
# elif defined(__mips_hard_float)
|
||||
# if _MIPS_SIM == _ABIO32
|
||||
"mips-linux-gnu"
|
||||
# elif _MIPS_SIM == _ABIN32
|
||||
"mips64-linux-gnuabin32"
|
||||
# elif _MIPS_SIM == _ABI64
|
||||
"mips64-linux-gnuabi64"
|
||||
# else
|
||||
# "unknown platform triplet"
|
||||
# endif
|
||||
# elif defined(__or1k__)
|
||||
"or1k-linux-gnu"
|
||||
# elif defined(__powerpc__) && defined(__SPE__)
|
||||
"powerpc-linux-gnuspe"
|
||||
# elif defined(__powerpc64__)
|
||||
# if defined(__LITTLE_ENDIAN__)
|
||||
"powerpc64le-linux-gnu"
|
||||
# else
|
||||
"powerpc64-linux-gnu"
|
||||
# endif
|
||||
# elif defined(__powerpc__)
|
||||
"powerpc-linux-gnu"
|
||||
# elif defined(__s390x__)
|
||||
"s390x-linux-gnu"
|
||||
# elif defined(__s390__)
|
||||
"s390-linux-gnu"
|
||||
# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
|
||||
"sh4-linux-gnu"
|
||||
# elif defined(__sparc__) && defined(__arch64__)
|
||||
"sparc64-linux-gnu"
|
||||
# elif defined(__sparc__)
|
||||
"sparc-linux-gnu"
|
||||
# else
|
||||
# "unknown platform triplet"
|
||||
# endif
|
||||
#elif defined(__FreeBSD_kernel__)
|
||||
# if defined(__LP64__)
|
||||
"x86_64-kfreebsd-gnu"
|
||||
# elif defined(__i386__)
|
||||
"i386-kfreebsd-gnu"
|
||||
# else
|
||||
# "unknown platform triplet"
|
||||
# endif
|
||||
#elif defined(__gnu_hurd__)
|
||||
"i386-gnu"
|
||||
#elif defined(__APPLE__)
|
||||
"darwin"
|
||||
#else
|
||||
# "unknown platform triplet"
|
||||
#endif
|
||||
;
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%s", PLATFORM_TRIPLET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: Python
|
||||
Description: Python library
|
||||
Requires:
|
||||
Version: @LIBPYTHON_VERSION@
|
||||
Libs.private: -lpthread -ldl -lutil
|
||||
Libs: -L${libdir} -l@LIBPYTHON@
|
||||
Cflags: -I${includedir}/@LIBPYTHON@
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
set(PYTHON_SOURCES
|
||||
${SRC_DIR}/$<IF:$<VERSION_GREATER_EQUAL:${PY_VERSION},3.5>,Programs,Modules>/python.c
|
||||
)
|
||||
|
||||
add_executable(python ${PYTHON_SOURCES})
|
||||
set_property(
|
||||
TARGET python
|
||||
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${BIN_BUILD_DIR}
|
||||
)
|
||||
target_compile_definitions(python PRIVATE Py_BUILD_CORE)
|
||||
add_definitions(-DPy_BUILD_CORE)
|
||||
|
||||
# Link against the shared libpython if it was built, otherwise use the static
|
||||
# version.
|
||||
if(BUILD_LIBPYTHON_SHARED)
|
||||
target_link_libraries(python libpython-shared)
|
||||
else()
|
||||
target_link_libraries(python libpython-static)
|
||||
set_target_properties(python PROPERTIES
|
||||
COMPILE_DEFINITIONS Py_NO_ENABLE_SHARED
|
||||
ENABLE_EXPORTS ON
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(python PROPERTIES LINK_FLAGS /STACK:2000000)
|
||||
endif()
|
||||
|
||||
# Export target
|
||||
set_property(GLOBAL APPEND PROPERTY PYTHON_TARGETS python)
|
||||
|
||||
install(TARGETS python EXPORT PythonTargets RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
|
||||
|
||||
# See "is_python_build()" in sysconfig.py
|
||||
add_custom_command(TARGET python PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BIN_BUILD_DIR}/${CMAKE_CFG_INTDIR}/Modules
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${BIN_BUILD_DIR}/${CMAKE_CFG_INTDIR}/Modules/Setup.local
|
||||
COMMENT "Creating '${BIN_INSTALL_DIR}/${CMAKE_CFG_INTDIR}/Modules/Setup.local'"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
# See "get_config_h_filename()" in sysconfig.py
|
||||
add_custom_command(TARGET python POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BIN_BUILD_DIR}/${CMAKE_CFG_INTDIR}/PC
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC_DIR}/PC/pyconfig.h ${BIN_BUILD_DIR}/${CMAKE_CFG_INTDIR}/PC/pyconfig.h
|
||||
COMMENT "Copying 'pyconfig.h' to '${BIN_INSTALL_DIR}/${CMAKE_CFG_INTDIR}/PC'"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
# Setup landmark allowing to run the interpreter from a build tree. See 'getpath.c' for details.
|
||||
set(_sysconfigdata_py "_sysconfigdata.py")
|
||||
if("${PY_VERSION}" VERSION_GREATER_EQUAL "3.6.0")
|
||||
# XXX Add support for _PYTHON_SYSCONFIGDATA_NAME env. variable
|
||||
set(MULTIARCH "")
|
||||
set(_sysconfigdata_py "_sysconfigdata_${ABIFLAGS}_${PY_PLATFORM}_${MULTIARCH}.py")
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${BIN_BUILD_DIR}/pybuilddir.txt ${EXTENSION_BUILD_DIR}/${_sysconfigdata_py}
|
||||
COMMAND ${PYTHON_WRAPPER_COMMAND}
|
||||
${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:python> -E -S -m sysconfig --generate-posix-vars
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DBIN_BUILD_DIR:PATH=${BIN_BUILD_DIR}
|
||||
-DSYSCONFIGDATA_PY:STRING=${_sysconfigdata_py}
|
||||
-DPYTHON_BINARY_DIR:PATH=${PROJECT_BINARY_DIR}
|
||||
-DEXTENSION_INSTALL_DIR:PATH=${EXTENSION_INSTALL_DIR}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/UpdateSysconfig.cmake
|
||||
COMMENT "Relocate ${_sysconfigdata_py} and update pybuilddir.txt"
|
||||
WORKING_DIRECTORY ${BIN_BUILD_DIR}
|
||||
DEPENDS python
|
||||
)
|
||||
add_custom_target(update_sysconfig ALL
|
||||
DEPENDS ${BIN_BUILD_DIR}/pybuilddir.txt ${EXTENSION_BUILD_DIR}/${_sysconfigdata_py}
|
||||
)
|
||||
install(FILES ${EXTENSION_BUILD_DIR}/${_sysconfigdata_py}
|
||||
DESTINATION ${PYTHONHOME}/)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT CMAKE_CROSSCOMPILING)
|
||||
install(CODE
|
||||
"message(STATUS \"Creating Python executable symlinks...\")
|
||||
execute_process(
|
||||
COMMAND \${CMAKE_COMMAND} -E create_symlink python
|
||||
python${PY_VERSION_MAJOR}
|
||||
COMMAND \${CMAKE_COMMAND} -E create_symlink python
|
||||
python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}
|
||||
WORKING_DIRECTORY
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}
|
||||
)"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy up the gdb python hooks into a position where they can be automatically
|
||||
# loaded by gdb during Lib/test/test_gdb.py
|
||||
#
|
||||
# Distributors are likely to want to install this somewhere else e.g. relative
|
||||
# to the stripped DWARF data for the shared library.
|
||||
|
||||
set(SRC_GDB_HOOKS ${SRC_DIR}/Tools/gdb/libpython.py)
|
||||
configure_file(
|
||||
${SRC_GDB_HOOKS}
|
||||
${BIN_BUILD_DIR}/python-gdb.py
|
||||
COPYONLY
|
||||
)
|
||||
if(INSTALL_DEVELOPMENT)
|
||||
install(FILES ${SRC_GDB_HOOKS} DESTINATION ${BIN_INSTALL_DIR} COMPONENT Development)
|
||||
endif()
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
set(files)
|
||||
|
||||
if(PY_VERSION VERSION_GREATER_EQUAL "3.6")
|
||||
list(APPEND files
|
||||
Tools/scripts/run_tests.py
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(file IN LISTS files)
|
||||
get_filename_component(path ${file} PATH)
|
||||
file(COPY ${SRC_DIR}/${file} DESTINATION ${PROJECT_BINARY_DIR}/${LIBDIR}/${path})
|
||||
install(FILES ${SRC_DIR}/${file} DESTINATION ${LIBDIR}/${path})
|
||||
endforeach()
|
||||
Reference in New Issue
Block a user