cmake_minimum_required(VERSION 3.9.0)
+option(LINK_WITH_FIR "Link driver with FIR and LLVM" OFF)
+
# Pass -DGCC=... to cmake to use a specific gcc installation.
if( GCC )
set(CMAKE_CXX_COMPILER "${GCC}/bin/g++")
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}" )
find_package(LLVM REQUIRED CONFIG)
-message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in ${LLVM_INSTALL_PREFIX}")
+message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in ${LLVM_DIR}")
# Get names for the LLVM libraries
#
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
-llvm_map_components_to_libnames(LLVM_COMMON_LIBS support)
-message(STATUS "LLVM libraries: ${LLVM_COMMON_LIBS}")
+if(LINK_WITH_FIR)
+ message(STATUS "Linking driver with FIR and LLVM")
+ llvm_map_components_to_libnames(LLVM_COMMON_LIBS support)
+ message(STATUS "LLVM libraries: ${LLVM_COMMON_LIBS}")
+endif()
if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# See the License for the specific language governing permissions and
# limitations under the License.
+if(LINK_WITH_FIR)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINK_WITH_FIR")
+ set(FORTRAN_FIR_LIB "FortranFIR")
+endif()
+
add_executable(f18
f18.cc
dump.cc
FortranParser
FortranEvaluate
FortranSemantics
-# FortranFIR
-# ${LLVM_COMMON_LIBS}
+ ${FORTRAN_FIR_LIB}
+ ${LLVM_COMMON_LIBS}
)
// Temporary Fortran front end driver main program for development scaffolding.
-#ifdef FIR
+#ifdef LINK_WITH_FIR
#include "../../lib/FIR/afforestation.h"
#include "../../lib/FIR/graph-writer.h"
#endif
}
}
if (driver.dumpGraph) {
-#ifdef FIR
- auto *fir{Fortran::FIR::CreateFortranIR(parseTree,
- semanticsContext, driver.debugLinearFIR)};
+#ifdef LINK_WITH_FIR
+ auto *fir{Fortran::FIR::CreateFortranIR(
+ parseTree, semanticsContext, driver.debugLinearFIR)};
Fortran::FIR::GraphWriter::print(*fir);
#endif
return {};