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 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. cmake_minimum_required(VERSION 3.8)
  2. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir
  3. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir
  4. # CMake useful variables
  5. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
  6. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  7. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  8. # Set the name of your project here
  9. project("dbt-core")
  10. # Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
  11. set(VERSION_MAJOR "1")
  12. set(VERSION_MINOR "0")
  13. set(VERSION_PATCH "0")
  14. set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
  15. include(Common)
  16. if(DEFINED ENV{LLVM_HOME})
  17. find_path (LLVM_DIR LLVM-Config.cmake $ENV{LLVM_HOME}/lib/cmake/llvm)
  18. endif()
  19. find_package(LLVM REQUIRED CONFIG)
  20. add_subdirectory(external)
  21. set(LIB_SOURCES
  22. src/dbgsrvbase.cpp
  23. src/gdb_session.cpp
  24. src/llvm_jit_helper.cpp
  25. src/tcc_jit_helper.cpp
  26. src/vm_base.cpp
  27. src/cmdhandler.cpp
  28. src/target_adapter_base.cpp
  29. src/encoderdecoder.cpp
  30. )
  31. # Define two variables in order not to repeat ourselves.
  32. set(LIBRARY_NAME dbt-core)
  33. # Define the library
  34. add_library(${LIBRARY_NAME} ${LIB_SOURCES})
  35. target_compile_definitions(${LIBRARY_NAME} PUBLIC ${LLVM_DEFINITIONS})
  36. target_include_directories(${LIBRARY_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/incl)
  37. target_include_directories(${LIBRARY_NAME} PRIVATE ${LLVM_INCLUDE_DIRS})
  38. target_include_directories(${LIBRARY_NAME} PUBLIC /opt/shared/tcc/0.9.27/include) #FIXME: quick hack
  39. #set_target_properties(foo PROPERTIES LINK_FLAGS "My lib link flags")
  40. #set_target_properties(exe PROPERTIES LINK_FLAGS "My exe link flags")
  41. #target_link_options(${LIBRARY_NAME} BEFORE INTERFACE -Wl,-whole-archive INTERFACE -Wl,-no-whole-archive)
  42. target_link_libraries(${LIBRARY_NAME} PRIVATE scc-util)
  43. # Set the build version. It will be used in the name of the lib, with corresponding
  44. # symlinks created. SOVERSION could also be specified for api version.
  45. set_target_properties(${LIBRARY_NAME} PROPERTIES
  46. VERSION ${VERSION}
  47. FRAMEWORK FALSE
  48. PUBLIC_HEADER "${LIB_HEADERS}"
  49. )
  50. # Says how and where to install software
  51. # Targets:
  52. # * <prefix>/lib/<libraries>
  53. # * header location after install: <prefix>/include/<project>/*.h
  54. # * headers can be included by C++ code `#<project>/Bar.hpp>`
  55. install(TARGETS ${LIBRARY_NAME}
  56. EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
  57. RUNTIME DESTINATION bin
  58. LIBRARY DESTINATION lib COMPONENT libs # shared lib
  59. ARCHIVE DESTINATION lib COMPONENT libs # static lib
  60. FRAMEWORK DESTINATION bin COMPONENT libs # for mac
  61. PUBLIC_HEADER DESTINATION include COMPONENT devel # headers for mac (note the different component -> different package)
  62. INCLUDES DESTINATION incl # headers
  63. )