Separate op-finder into library and executable
This commit is contained in:
parent
83ca2deb0e
commit
53c24c6d5e
@ -5,4 +5,5 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
|
||||
|
||||
add_subdirectory(op-finder-lib)
|
||||
add_subdirectory(op-finder)
|
||||
|
||||
47
op-finder-lib/CMakeLists.txt
Normal file
47
op-finder-lib/CMakeLists.txt
Normal file
@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
|
||||
find_package(Clang REQUIRED)
|
||||
find_package(LLVM REQUIRED COMPONENTS Support Option Core)
|
||||
|
||||
# LLVM is typically compiled without RTTI. Weird linker errors ensue if
|
||||
# you keep RTTI on and try to link.
|
||||
if (NOT LLVM_ENABLE_RTTI)
|
||||
if (MSVC)
|
||||
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
else ()
|
||||
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
llvm_map_components_to_libnames(llvm_libs support option core)
|
||||
|
||||
add_library(op-finder-lib STATIC
|
||||
src/OperationFinder.cpp
|
||||
src/OperationStorage.cpp
|
||||
src/OperationAstMatcher.cpp
|
||||
src/OperationFinderAstVisitor.cpp
|
||||
src/OperationFinderAstConsumer.cpp
|
||||
src/OperationFinderAstAction.cpp
|
||||
src/OperationLog.cpp)
|
||||
|
||||
target_include_directories(op-finder-lib
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/dependencies
|
||||
${LLVM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_compile_definitions(op-finder-lib
|
||||
PUBLIC
|
||||
${LLVM_DEFINITIONS}
|
||||
)
|
||||
|
||||
target_link_libraries(op-finder-lib
|
||||
PRIVATE
|
||||
${llvm_libs}
|
||||
clangTooling
|
||||
clangBasic
|
||||
clangASTMatchers
|
||||
)
|
||||
@ -1,4 +1,4 @@
|
||||
//
|
||||
//src
|
||||
// Created by erki on 02.03.21.
|
||||
//
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
|
||||
find_package(Clang REQUIRED)
|
||||
find_package(LLVM REQUIRED COMPONENTS Support Option Core)
|
||||
|
||||
# LLVM is typically compiled without RTTI. Weird linker errors ensue if
|
||||
# you keep RTTI on and try to link.
|
||||
if (NOT LLVM_ENABLE_RTTI)
|
||||
@ -15,33 +12,9 @@ if (NOT LLVM_ENABLE_RTTI)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
llvm_map_components_to_libnames(llvm_libs support option core)
|
||||
|
||||
add_executable(op-finder
|
||||
main.cpp
|
||||
OperationFinder.cpp
|
||||
OperationStorage.cpp
|
||||
OperationAstMatcher.cpp
|
||||
OperationFinderAstVisitor.cpp
|
||||
OperationFinderAstConsumer.cpp
|
||||
OperationFinderAstAction.cpp
|
||||
OperationLog.cpp)
|
||||
|
||||
target_include_directories(op-finder
|
||||
PRIVATE
|
||||
${LLVM_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/dependencies
|
||||
)
|
||||
|
||||
target_compile_definitions(op-finder
|
||||
PRIVATE
|
||||
${LLVM_DEFINITIONS}
|
||||
)
|
||||
main.cpp)
|
||||
|
||||
target_link_libraries(op-finder
|
||||
PRIVATE
|
||||
${llvm_libs}
|
||||
clangTooling
|
||||
clangBasic
|
||||
clangASTMatchers
|
||||
)
|
||||
PUBLIC
|
||||
op-finder-lib)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user