Skip to content

Commit 26692ef

Browse files
committed
Compare given and actual C API sources; add missing file
1 parent 916ab6a commit 26692ef

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

graalpython/com.oracle.graal.python.cext/CMakeLists.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require_var(TRUFFLE_H_INC)
4242
require_var(GRAALPY_EXT)
4343

4444
if(NOT DEFINED SRC_DIR)
45-
set(SRC_DIR ".")
45+
set(SRC_DIR "${CMAKE_SOURCE_DIR}")
4646
endif()
4747

4848
set(TARGET_LIBPYTHON "python")
@@ -106,9 +106,39 @@ set(SRC_FILES ${CAPI_SRC}/codecs.c ${CAPI_SRC}/setobject.c ${CAPI_SRC}/compile.c
106106
${CAPI_SRC}/typeobject_shared.c ${CAPI_SRC}/mystrtoul.c ${CAPI_SRC}/weakrefobject.c
107107
${CAPI_SRC}/modsupport_shared.c ${CAPI_SRC}/fileobject.c ${CAPI_SRC}/pystrcmp.c ${CAPI_SRC}/getversion.c
108108
${CAPI_SRC}/genobject.c ${CAPI_SRC}/methodobject.c ${CAPI_SRC}/boolobject.c ${CAPI_SRC}/pylifecycle.c
109-
${CAPI_SRC}/errors.c ${CAPI_SRC}/signals.c ${CAPI_SRC}/datetime.c
109+
${CAPI_SRC}/errors.c ${CAPI_SRC}/signals.c ${CAPI_SRC}/datetime.c ${CAPI_SRC}/bytearrayobject_shared.c
110110
)
111111

112+
file(GLOB_RECURSE ACTUAL_SRC_FILES
113+
LIST_DIRECTORIES FALSE
114+
"${CAPI_SRC}/*.c")
115+
116+
117+
function(list_equals lst0 lst1)
118+
list(LENGTH ${lst0} len0)
119+
list(LENGTH ${lst1} len1)
120+
if(NOT len0 EQUAL len1)
121+
message(FATAL_ERROR "The list of source files does not match the current file system. "
122+
"Different number of files: given len = ${len0} ;; actual len = ${len1}")
123+
endif()
124+
125+
# sort lists
126+
list(SORT ${lst0})
127+
list(SORT ${lst1})
128+
129+
# iterate over both lists in simultaneously
130+
foreach(item IN ZIP_LISTS ${lst0} ${lst1})
131+
if(NOT ${item_0} STREQUAL ${item_1})
132+
message(VERBOSE "given src files = ${lst0}")
133+
message(VERBOSE "actual src files = ${lst1}")
134+
message(FATAL_ERROR "The list of source files does not match the current file system. "
135+
"Different items: given file = ${item_0} ;; actual file = ${item_1}")
136+
endif()
137+
endforeach()
138+
endfunction()
139+
140+
list_equals(SRC_FILES ACTUAL_SRC_FILES)
141+
112142
include_directories(
113143
${CAPI_SRC}
114144
"${SRC_DIR}/include"

0 commit comments

Comments
 (0)