2024-03-01 19:43:13 +08:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(meta LANGUAGES CXX VERSION 0.1.0)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
add_subdirectory(3rdparty/sled EXCLUDE_FROM_ALL)
|
|
|
|
|
2024-03-01 22:34:29 +08:00
|
|
|
add_executable(meta
|
|
|
|
src/main.cc
|
|
|
|
src/clang/cursor.cc
|
|
|
|
src/clang/cursor_type.cc
|
2024-03-03 00:16:56 +08:00
|
|
|
src/clang/parser.cc
|
2024-03-03 17:19:41 +08:00
|
|
|
src/types/base_type.cc
|
|
|
|
src/types/class.cc
|
|
|
|
src/types/field.cc
|
|
|
|
src/types/method.cc
|
|
|
|
src/registry.cc
|
2024-03-01 22:34:29 +08:00
|
|
|
)
|
2024-03-01 19:43:13 +08:00
|
|
|
|
2024-03-01 22:34:29 +08:00
|
|
|
### add clang
|
|
|
|
set(CLANG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/include")
|
|
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2024-03-02 18:06:59 +08:00
|
|
|
set(CLANG_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/bin/Linux")
|
|
|
|
set(CLANG_LIB_LIBRARIES "${CLANG_LIB_DIR}/libclang.so.12")
|
2024-03-01 22:34:29 +08:00
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
message(FATAL "${CMAKE_SYSTEM_NAME} is not supported")
|
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
set(OSX_DEVELOPER_ROOT "/Applications/Xcode.app/Contents/Developer/")
|
|
|
|
set(CLANG_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/bin/macOS")
|
|
|
|
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
|
|
|
set(CLANG_LIB_LIBRARIES ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib)
|
|
|
|
else()
|
|
|
|
set(CLANG_LIB_LIBRARIES "${CLANG_LIB_DIR}/libclang.dylib")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-03-02 18:06:59 +08:00
|
|
|
target_include_directories(meta PRIVATE ${CLANG_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
2024-03-01 22:34:29 +08:00
|
|
|
target_link_libraries(meta PRIVATE sled ${CLANG_LIB_LIBRARIES})
|