@@ -20,13 +20,15 @@ project(GraphCompiler VERSION "0.1.0" LANGUAGES C CXX)
2020
2121set (CMAKE_CXX_STANDARD 17)
2222set (CMAKE_CXX_STANDARD_REQUIRED ON )
23+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0" )
2324
2425set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
2526
2627list (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR} /cmake" )
2728
2829option (GC_LEGACY_ENABLE ON )
2930option (GC_TEST_ENABLE "Build the tests" ON )
31+ option (GC_USE_GPU "Enable GPU backend" OFF )
3032option (GC_ENABLE_BINDINGS_PYTHON "Enable Graph Complier Python Binding" ON )
3133option (GC_DEV_LINK_LLVM_DYLIB "Link dynamic libraries of LLVM and MLIR. For developers only. Do not use it in packing the library." OFF )
3234
@@ -51,6 +53,13 @@ include(AddLLVM)
5153include (AddMLIR)
5254include (HandleLLVMOptions)
5355
56+ if (GC_USE_GPU)
57+ include (imex)
58+ if (GC_DEV_LINK_LLVM_DYLIB)
59+ message (WARN "GPU backend may not be compatible with dynamic linking to LLVM" )
60+ endif ()
61+ endif ()
62+
5463if (GC_ENABLE_BINDINGS_PYTHON AND NOT MLIR_ENABLE_BINDINGS_PYTHON)
5564 message (STATUS "Failed to enable Python API due to the 'MLIR_ENABLE_BINDINGS_PYTHON' for LLVM is not ON." )
5665 set (GC_ENABLE_BINDINGS_PYTHON OFF CACHE BOOL "" FORCE)
@@ -95,13 +104,12 @@ if(GC_ENABLE_BINDINGS_PYTHON)
95104endif ()
96105
97106set (GC_LIB_LINKED_LIBS
98- GCPasses
99- GCAnalysis
100- MLIROneDNNGraph
107+ GCJitWrapper
108+ GCCpuRuntime
101109)
102- add_library (graph_compiler SHARED ${GC_LIB_SOURCES} )
110+ add_mlir_library (graph_compiler SHARED ${GC_LIB_SOURCES} )
103111target_include_directories (graph_compiler PUBLIC ${GC_LIB_INCLUDES} )
104- target_compile_options (graph_compiler PRIVATE -fvisibility=hidden)
112+ target_compile_options (graph_compiler PRIVATE -fvisibility=hidden -fexceptions )
105113target_link_options (graph_compiler PRIVATE -Wl,--gc-sections)
106114target_link_libraries (graph_compiler PRIVATE ${GC_LIB_LINKED_LIBS} )
107115
0 commit comments