@@ -25,6 +25,11 @@ endif()
2525set (FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
2626set (FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../flang-rt" )
2727
28+ # Python is needed for symbol extracting tool
29+ set (LLVM_MINIMUM_PYTHON_VERSION 3.8)
30+ find_package (Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
31+ COMPONENTS Interpreter)
32+
2833if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
2934 message (FATAL_ERROR "In-source builds are not allowed. \
3035 Please create a directory and run cmake from there,\
@@ -81,6 +86,13 @@ if (FLANG_STANDALONE_BUILD)
8186 mark_as_advanced (LLVM_ENABLE_ASSERTIONS)
8287 endif ()
8388
89+ # Build with _XOPEN_SOURCE on AIX to avoid errors caused by _ALL_SOURCE.
90+ # We need to enable the large-file API as well.
91+ if (UNIX AND CMAKE_SYSTEM_NAME MATCHES "AIX" )
92+ add_compile_definitions (_XOPEN_SOURCE=700)
93+ add_compile_definitions (_LARGE_FILE_API)
94+ endif ()
95+
8496 # If the user specifies a relative path to LLVM_DIR, the calls to include
8597 # LLVM modules fail. Append the absolute path to LLVM_DIR instead.
8698 if (LLVM_DIR)
@@ -125,6 +137,10 @@ if (FLANG_STANDALONE_BUILD)
125137 set (USE_NO_MAYBE_UNINITIALIZED 1)
126138 endif ()
127139
140+ # The path is needed to locate extract_symbols.py
141+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
142+ set (LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../llvm" )
143+ endif ()
128144 include (AddLLVM)
129145 include (HandleLLVMOptions)
130146 include (VersionFromVCS)
0 commit comments