-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
44 lines (32 loc) · 1.35 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
cmake_minimum_required(VERSION 3.0)
project(GazpreaBase)
# 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 "Gazprea")
set(ANTLR_NAMESPACE "gazprea")
# Generate sources.
include("${CMAKE_SOURCE_DIR}/cmake/antlr_generate.cmake")
# Include project headers.
include_directories("${CMAKE_SOURCE_DIR}/include")
# Add the source directory.
add_subdirectory("${CMAKE_SOURCE_DIR}/src")
# Add the runtime directory.
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/runtime")