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) add_executable(meta src/main.cc src/clang/cursor.cc src/clang/cursor_type.cc src/clang/parser.cc src/generators/base_generator.cc src/types/base_type.cc src/types/class.cc src/types/field.cc src/types/method.cc src/registry.cc # runtime/test.gen.cc # runtime/reflection.gen.cc ) ### add clang set(CLANG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/include") if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CLANG_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LLVM/bin/Linux") set(CLANG_LIB_LIBRARIES "${CLANG_LIB_DIR}/libclang.so.12") 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() add_executable(test test/main.cc) target_include_directories(test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(test PRIVATE sled) target_include_directories(meta PRIVATE ${CLANG_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/runtime ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/inja) target_link_libraries(meta PRIVATE sled ${CLANG_LIB_LIBRARIES})