-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
50 lines (37 loc) · 1.57 KB
/
Copy pathCMakeLists.txt
File metadata and controls
50 lines (37 loc) · 1.57 KB
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.11)
project(___Base)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Ensure tool dependencies.
include(ExternalProject) # Required to download and build external projects (i.e. ANTLR).
find_package(Git REQUIRED) # Need git to download ANTLR through ExternalProject.
find_package(Java COMPONENTS Runtime REQUIRED) # Need java to run ANTLR, but only the runtime.
# Ensure we have LLVM.
include("${CMAKE_SOURCE_DIR}/cmake/get_mlir.cmake")
# Link against the pthreads library to make std::call_once
# in generated ANTLR code to run without producing system errors
# (see issue https://github.com/antlr/antlr4/issues/3708).
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
# Set C++ standards.
set(CMAKE_CXX_STANDARD 17)
# Add CXX flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# Include cmake utilities.
include("${CMAKE_SOURCE_DIR}/cmake/symlink_to_bin.cmake")
# Grab ANTLR.
include("${CMAKE_SOURCE_DIR}/cmake/get_antlr.cmake")
# Set up paths and info to generate ANTLR sources with.
set(GRAMMAR_NAME "Underscore")
set(ANTLR_NAMESPACE "underscore")
# Generate sources.
include("${CMAKE_SOURCE_DIR}/cmake/antlr_generate.cmake")
# Include project headers.
include_directories("${CMAKE_SOURCE_DIR}/include")
# Built project headers from dialect .tg files
include_directories("${CMAKE_BINARY_DIR}/include")
# Add the source directory.
add_subdirectory("${CMAKE_SOURCE_DIR}/src")
# Add the runtime directory.
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/runtime")
# Add the dialect directory.
add_subdirectory("${CMAKE_SOURCE_DIR}/lib/dialect")