-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
76 lines (63 loc) · 2.25 KB
/
Copy pathCMakeLists.txt
File metadata and controls
76 lines (63 loc) · 2.25 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required(VERSION 3.16)
project(ArcLang
VERSION 0.0.1
DESCRIPTION "The Arc Programming Language Project"
LANGUAGES C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set the C standard for the whole project
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
endif()
# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
message(STATUS "Building ArcLang with CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
# --- Build Options ---
option(ARC_BUILD_TESTS "Build Arc language tests" ON)
option(ARC_BUILD_EXAMPLES "Build Arc language examples" ON)
option(ARC_BUILD_TOOLS "Build Arc development tools" ON)
option(ARC_BUILD_BENCHMARKS "Build Arc benchmarks" ON)
# --- Subdirectories ---
add_subdirectory(compiler)
# --- Testing ---
if(ARC_BUILD_TESTS)
enable_testing()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
add_subdirectory(tests)
else()
message(WARNING "ARC_BUILD_TESTS is ON but tests/CMakeLists.txt not found")
endif()
endif()
# --- Examples ---
if(ARC_BUILD_EXAMPLES)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt")
add_subdirectory(examples)
else()
message(WARNING "ARC_BUILD_EXAMPLES is ON but examples/CMakeLists.txt not found")
endif()
endif()
# --- Tools ---
if(ARC_BUILD_TOOLS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt")
add_subdirectory(tools)
else()
message(WARNING "ARC_BUILD_TOOLS is ON but tools/CMakeLists.txt not found")
endif()
endif()
# --- Benchmarks ---
if(ARC_BUILD_BENCHMARKS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/CMakeLists.txt")
add_subdirectory(benchmarks)
else()
message(WARNING "ARC_BUILD_BENCHMARKS is ON but benchmarks/CMakeLists.txt not found")
endif()
endif()