-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathCMakeLists.txt
134 lines (118 loc) · 5.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
cmake_minimum_required(VERSION 3.24)
project(PythonExtensionPatterns)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/cpython/pymem.h:42:39: fatal error: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]
# PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6,
# ^
add_compile_options(
"-Wall"
"-Wextra"
"-Wpedantic"
"-Werror"
"-Wfatal-errors"
"-Wno-unused-variable" # Temporary
"-Wno-unused-parameter" # Temporary
"-fexceptions"
# To allow designated initialisers.
"-Wno-c99-extensions"
"-Wno-c++11-extensions"
"$<$<CONFIG:DEBUG>:-O0;-g3;-ggdb>"
# Temporary
-Wno-unused-function
)
function(dump_cmake_variables)
message(STATUS "==== dump_cmake_variables()")
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message(STATUS "==== dump_cmake_variables() DONE")
endfunction()
FIND_PACKAGE (Python3 3.11 EXACT REQUIRED COMPONENTS Interpreter Development)
#FIND_PACKAGE(PythonLibs 3.11 EXACT REQUIRED)
#SET(PythonLibs_DIR "/Library/Frameworks/Python.framework/Versions/3.8")
#FIND_PACKAGE(PythonLibs 3.8 REQUIRED PATHS ("/Library/Frameworks/Python.framework/Versions/3.8"))
#FindPythonLibs()
IF (Python3_FOUND)
INCLUDE_DIRECTORIES("${Python3_INCLUDE_DIRS}")
# get_filename_component(PYTHON_LINK_DIRECTORY ${PYTHON_LIBRARY} DIRECTORY)
# See: https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
message("Python3_VERSION: ${Python3_VERSION}")
message("Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
message("Python3_INTERPRETER_ID: ${Python3_INTERPRETER_ID}")
message("Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}")
message("Python3_STDLIB: ${Python3_STDLIB}")
message("Python3_STDARCH: ${Python3_STDARCH}")
message("Python3_LINK_OPTIONS: ${Python3_LINK_OPTIONS}")
message("Python3_LIBRARIES: ${Python3_LIBRARIES}")
ELSE ()
MESSAGE(FATAL_ERROR "Unable to find Python libraries.")
ENDIF ()
include_directories(src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList)
add_executable(PythonExtensionPatterns
PythonExtensionPatterns/PythonExtensionPatterns/main.c
PythonExtensionPatterns/PythonExtensionPatterns/PythonExtensionPatterns.c
src/cpy/cExceptions.c
src/cpy/cModuleGlobals.c
src/cpy/cObject.c
src/cpy/cParseArgs.c
src/cpy/cPyRefs.c
# TODO:
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/main.c
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/py_call_super.c
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/py_call_super.h
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/py_import_call_execute.c
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/py_import_call_execute.h
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/SubclassList.c
# src/debugging/XcodeExample/PythonSubclassList/PythonSubclassList/SubclassList.h
src/cCanonical.c
src/scratch.c
# Legacy code. Removed in the documentation for version 0.2.
src/cpy/cParseArgsHelper.cpp
src/cpy/Pickle/cCustomPickle.c
src/cpy/cParseArgsHelper.cpp
src/cpy/File/cFile.cpp
src/cpy/File/PythonFileWrapper.h
src/cpy/File/PythonFileWrapper.cpp
src/cpy/Capsules/spam.c
src/cpy/Capsules/spam_capsule.h
src/cpy/Capsules/spam_capsule.c
src/cpy/Capsules/spam_client.c
src/cpy/Capsules/datetimetz.c
src/cpy/cpp/placement_new.cpp
src/cpy/cpp/cUnicode.cpp
src/cpy/SimpleExample/cFibA.h
src/cpy/SimpleExample/cFibA.c
src/cpy/SimpleExample/cFibB.c
src/cpy/Util/py_call_super.h
src/cpy/Util/py_call_super.c
src/cpy/Iterators/cIterator.c
src/cpy/Threads/cThreadLock.h
src/cpy/SubClass/sublist.c
src/cpy/Threads/cppsublist.cpp
src/cpy/Threads/csublist.c
src/cpy/Logging/cLogging.c
src/cpy/RefCount/cRefCount.c)
#link_directories(${PYTHON_LINK_LIBRARY})
#target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARY})
link_directories(${Python3_LIBRARIES})
#target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${Python3_LIBRARIES})
MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
MESSAGE(STATUS "Library Type: " ${LIB_TYPE})
MESSAGE(STATUS "Compiler flags:" ${CMAKE_CXX_COMPILE_FLAGS})
MESSAGE(STATUS "Compiler cxx debug flags:" ${CMAKE_CXX_FLAGS_DEBUG})
MESSAGE(STATUS "Compiler cxx release flags:" ${CMAKE_CXX_FLAGS_RELEASE})
MESSAGE(STATUS "Compiler cxx min size flags:" ${CMAKE_CXX_FLAGS_MINSIZEREL})
MESSAGE(STATUS "Compiler cxx flags:" ${CMAKE_CXX_FLAGS})
dump_cmake_variables()