-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·62 lines (45 loc) · 1.62 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
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.18)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CMAKE_C_COMPILER /usr/local/bin/clang)
set(CMAKE_CXX_COMPILER /usr/local/bin/clang++)
set(CMAKE_LINKER /usr/local/bin/ld.lld)
set(CMAKE_RANLIB /usr/local/bin/llvm-ranlib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld -stdlib=libc++ -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC")
else()
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_LINKER ld.lld)
set(CMAKE_RANLIB llvm-ranlib)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "")
execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
project(YAPL)
include(CTest)
include_directories(include vendor)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
include_directories(/usr/local/opt/llvm/include)
endif()
file(GLOB test_files "tests/yapl/*.yapl")
message(STATUS "Found tests files ${test_files}")
add_subdirectory(libs)
add_subdirectory(vendor)
add_subdirectory(tests)
add_executable(yapl
main.cpp)
target_link_libraries(yapl PUBLIC cpplogger irgenerator)
add_custom_target(run_YAPL ALL DEPENDS yapl)
foreach(test_file IN LISTS test_files)
message(STATUS "Adding command for ${test_file}")
add_custom_command(
TARGET run_YAPL
POST_BUILD
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/yapl ${test_file}
COMMENT "Running test on ${test_file}"
VERBATIM)
endforeach()