You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. cmake_minimum_required(VERSION 3.12)
  2. project("dbt-core" VERSION 1.0.0)
  3. include(GNUInstallDirs)
  4. find_package(Boost COMPONENTS thread REQUIRED)
  5. if(WITH_LLVM)
  6. if(DEFINED ENV{LLVM_HOME})
  7. find_path (LLVM_DIR LLVM-Config.cmake $ENV{LLVM_HOME}/lib/cmake/llvm)
  8. endif(DEFINED ENV{LLVM_HOME})
  9. find_package(LLVM REQUIRED CONFIG)
  10. message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
  11. message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
  12. llvm_map_components_to_libnames(llvm_libs support core mcjit x86codegen x86asmparser)
  13. endif()
  14. set(LIB_SOURCES
  15. src/dbgsrvbase.cpp
  16. src/gdb_session.cpp
  17. src/vm_base.cpp
  18. src/tcc_jit_helper.cpp
  19. src/cmdhandler.cpp
  20. src/target_adapter_base.cpp
  21. src/encoderdecoder.cpp
  22. )
  23. add_library(dbt-core ${LIB_SOURCES})
  24. if(WITH_LLVM)
  25. target_compile_definitions(dbt-core PUBLIC ${LLVM_DEFINITIONS})
  26. target_include_directories(dbt-core PRIVATE ${LLVM_INCLUDE_DIRS})
  27. endif()
  28. target_include_directories(dbt-core PUBLIC ${PROJECT_SOURCE_DIR}/incl)
  29. target_link_libraries(dbt-core PRIVATE scc-util)
  30. target_link_libraries(dbt-core PUBLIC CONAN_PKG::tcc CONAN_PKG::fmt ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
  31. set_target_properties(dbt-core PROPERTIES
  32. VERSION ${PROJECT_VERSION}
  33. FRAMEWORK FALSE
  34. PUBLIC_HEADER "${LIB_HEADERS}"
  35. )
  36. install(TARGETS dbt-core
  37. EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
  38. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
  39. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
  40. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib
  41. FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # for mac
  42. PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT devel # headers for mac (note the different component -> different package)
  43. INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
  44. )