-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
50 lines (37 loc) · 1.51 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.17)
project(luka C)
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
find_package(LLVM REQUIRED)
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_definitions(${LLVM_DEFINITIONS})
find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config)
execute_process(
COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs core analysis native bitwriter
OUTPUT_VARIABLE LLVM_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third_party/include)
file(GLOB_RECURSE SOURCES src/*.c)
file(GLOB_RECURSE LIBS libs/*)
file(GLOB SOURCES_WITHOUT_MAIN "${PROJECT_SOURCE_DIR}/src/*.c")
list(REMOVE_ITEM SOURCES_WITHOUT_MAIN "${PROJECT_SOURCE_DIR}/src/main.c")
add_executable(luka ${SOURCES})
add_library(vector STATIC libs/vector.c)
add_library(lukad STATIC ${SOURCES_WITHOUT_MAIN})
target_link_libraries(lukad vector)
target_link_libraries(lukad ${LLVM_LIBRARIES})
target_link_libraries(luka lukad)
target_compile_options(luka PRIVATE -Wall -Wextra -Wmost -Weverything -pedantic -Werror -Wno-padded)
add_custom_target(docs cd ${PROJECT_SOURCE_DIR}/docs
COMMAND doxygen && cd -
DEPENDS ${PROJECT_SOURCE_DIR}/docs/Doxyfile)
file(GLOB_RECURSE LUKA_LIB lib/*.luka)
file(GLOB_RECURSE LUKA_STDLIB lib/std/*.luka)
install(TARGETS luka DESTINATION bin)
install(FILES ${LUKA_LIB} DESTINATION lib/luka)
install(FILES ${LUKA_STDLIB} DESTINATION lib/luka/std)
enable_testing()
add_subdirectory(tests)