Skip to content

Commit 55a4e3a

Browse files
linesightclaude
andcommitted
Make .pxi files static; remove cmake_generate_pxi.py
UNAME_SYSNAME and PY_MAJOR_VERSION are Cython built-in compile-time constants — no DEF needed. INT_MIN/INT_MAX now come from libc.limits via a direct cimport. The two platform_cimports.pxi files use Cython's own IF/ELIF/ELSE on UNAME_SYSNAME instead of being generated per-OS. Removes cmake_generate_pxi.py and its CMakeLists.txt custom command entirely — no generation step, no gitignore entries, no cmake target. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0757f80 commit 55a4e3a

5 files changed

Lines changed: 17 additions & 98 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,6 @@ message(STATUS "CEF_ROOT: ${CEF_ROOT}")
6565
set(SRC_DIR "${CMAKE_SOURCE_DIR}/src")
6666
set(PYX_STAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pyx_stage")
6767

68-
# ---- Generate .pxi files ----------------------------------------------------
69-
# These write into the source tree (matching the legacy behaviour so that IDE
70-
# tooling keeps working).
71-
set(PXI_OUTPUTS
72-
"${SRC_DIR}/compile_time_constants.pxi"
73-
"${SRC_DIR}/platform_cimports.pxi"
74-
"${SRC_DIR}/extern/cef/platform_cimports.pxi"
75-
)
76-
add_custom_command(
77-
OUTPUT ${PXI_OUTPUTS}
78-
COMMAND "${Python_EXECUTABLE}"
79-
"${CMAKE_SOURCE_DIR}/tools/cmake_generate_pxi.py"
80-
"${SRC_DIR}"
81-
DEPENDS "${CMAKE_SOURCE_DIR}/tools/cmake_generate_pxi.py"
82-
COMMENT "Generating Cython .pxi files"
83-
VERBATIM
84-
)
85-
add_custom_target(cefpython_pxi DEPENDS ${PXI_OUTPUTS})
86-
8768
# ---- Prepare .pyx files -----------------------------------------------------
8869
# Copies src/*.pyx + src/handlers/*.pyx to PYX_STAGE_DIR, flattening the
8970
# include paths and injecting version variables into the main file.
@@ -111,7 +92,6 @@ add_custom_command(
11192
--cef-version-header "${_cef_ver_header}"
11293
DEPENDS
11394
${_pyx_src_files}
114-
${PXI_OUTPUTS}
11595
"${CMAKE_SOURCE_DIR}/tools/cmake_prepare_pyx.py"
11696
COMMENT "Preparing .pyx files -> ${PYX_STAGE_DIR}"
11797
VERBATIM

src/compile_time_constants.pxi

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# This file was generated by setup.py
2-
3-
# Type this command to ignore changes to this file:
4-
# git update-index --assume-unchanged src/compile_time_constants.pxi
5-
6-
DEF UNAME_SYSNAME = "Windows"
7-
DEF PY_MAJOR_VERSION = 3
8-
cdef extern from "limits.h":
9-
cdef int INT_MIN
10-
cdef int INT_MAX
1+
# UNAME_SYSNAME and PY_MAJOR_VERSION are Cython built-in compile-time
2+
# constants; no DEF needed. INT_MIN/INT_MAX come from libc.limits.
3+
from libc.limits cimport INT_MIN, INT_MAX
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Generated by cmake_generate_pxi.py - do not edit
2-
# git update-index --assume-unchanged src/extern/cef/platform_cimports.pxi
3-
4-
from cef_win cimport *
1+
IF UNAME_SYSNAME == "Windows":
2+
from cef_win cimport *
3+
ELIF UNAME_SYSNAME == "Darwin":
4+
from cef_mac cimport *
5+
ELSE:
6+
from cef_linux cimport *

src/platform_cimports.pxi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Generated by cmake_generate_pxi.py - do not edit
2-
# git update-index --assume-unchanged src/platform_cimports.pxi
3-
4-
from windows cimport *
5-
from dpi_aware_win cimport *
1+
IF UNAME_SYSNAME == "Windows":
2+
from windows cimport *
3+
from dpi_aware_win cimport *
4+
ELIF UNAME_SYSNAME == "Darwin":
5+
from mac cimport *
6+
ELSE:
7+
from linux cimport *
8+
cimport x11

tools/cmake_generate_pxi.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)