File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ set(WITH_LFORTRAN_BINARY_MODFILES YES
80
80
set (WITH_RUNTIME_LIBRARY YES
81
81
CACHE BOOL "Compile and install the runtime library" )
82
82
83
+ set (WITH_INTRINSIC_MODULES no
84
+ CACHE BOOL "Compile intrinsic modules to .pyc (ASR) at build time" )
85
+
83
86
# Find ZLIB with our custom finder before including LLVM since the finder for LLVM
84
87
# might search for ZLIB again and find the shared libraries instead of the static ones
85
88
find_package (StaticZLIB REQUIRED)
Original file line number Diff line number Diff line change @@ -57,3 +57,31 @@ set_target_properties(lpython PROPERTIES
57
57
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /$<0:>
58
58
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /$<0:>
59
59
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /$<0:>)
60
+
61
+ if (WITH_INTRINSIC_MODULES)
62
+ macro (LPYTHON_COMPILE_MODULE name )
63
+ add_custom_command (
64
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /../runtime/${name} .pyc
65
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR} /lpython
66
+ ARGS --disable-main -c ${CMAKE_CURRENT_SOURCE_DIR} /../runtime/${name} .py -o ${name} .o
67
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /../runtime
68
+ DEPENDS lpython ${CMAKE_CURRENT_SOURCE_DIR} /../runtime/${name} .py ${ARGN}
69
+ COMMENT "LPython Compiling ${name} .py" )
70
+ endmacro (LPYTHON_COMPILE_MODULE)
71
+
72
+ LPYTHON_COMPILE_MODULE(lpython_intrinsic_numpy)
73
+ LPYTHON_COMPILE_MODULE(lpython_builtin)
74
+
75
+ add_custom_target (lpython_intrinsics
76
+ ALL
77
+ DEPENDS
78
+ ${CMAKE_CURRENT_BINARY_DIR} /../runtime/lpython_intrinsic_numpy.pyc
79
+ ${CMAKE_CURRENT_BINARY_DIR} /../runtime/lpython_builtin.pyc
80
+ )
81
+
82
+ install (
83
+ FILES ${CMAKE_CURRENT_BINARY_DIR} /../runtime/lpython_intrinsic_numpy.pyc
84
+ ${CMAKE_CURRENT_BINARY_DIR} /../runtime/lpython_builtin.pyc
85
+ DESTINATION share/lfortran/lib
86
+ )
87
+ endif ()
You can’t perform that action at this time.
0 commit comments