-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
95 lines (79 loc) · 3.01 KB
/
Copy pathCMakeLists.txt
File metadata and controls
95 lines (79 loc) · 3.01 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.20)
project(bxl C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Build type defaults to Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Compiler warnings
add_compile_options(-Wall -Wextra -Wpedantic)
# Suppress deprecated GC linker warnings on macOS
if(APPLE)
add_link_options(-Wl,-w)
endif()
# =============================================================================
# AK24 Dependency
# =============================================================================
set(AK24_ROOT "$ENV{HOME}/.ak24" CACHE PATH "AK24 installation directory")
find_library(AK24_LIBRARY
NAMES ak24_kernel
PATHS ${AK24_ROOT}/lib
NO_DEFAULT_PATH
REQUIRED
)
find_library(AK24_GC_LIBRARY
NAMES gc
PATHS ${AK24_ROOT}/lib
NO_DEFAULT_PATH
REQUIRED
)
find_path(AK24_INCLUDE_DIR
NAMES ak24/kernel.h
PATHS ${AK24_ROOT}/include
NO_DEFAULT_PATH
REQUIRED
)
# Create imported target for AK24
add_library(AK24::kernel STATIC IMPORTED)
set_target_properties(AK24::kernel PROPERTIES
IMPORTED_LOCATION ${AK24_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${AK24_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${AK24_GC_LIBRARY}
INTERFACE_COMPILE_DEFINITIONS "AK24_GC_ENABLED=1"
)
message(STATUS "Found AK24: ${AK24_LIBRARY}")
message(STATUS "Found AK24 GC: ${AK24_GC_LIBRARY}")
message(STATUS "AK24 includes: ${AK24_INCLUDE_DIR}")
# =============================================================================
# Public API Header
# =============================================================================
# The api/ directory contains the public API header that is:
# - Used internally by bxl for type definitions
# - Installed alongside the binary for user automata projects
# - Referenced by CJIT at runtime for automata compilation
set(BXL_API_DIR ${CMAKE_SOURCE_DIR}/api)
# =============================================================================
# Testing (enable before subdirectories so add_test works)
# =============================================================================
enable_testing()
# =============================================================================
# Package Libraries (pkg/)
# =============================================================================
add_subdirectory(pkg)
# =============================================================================
# Command Executables (cmd/)
# =============================================================================
add_subdirectory(cmd)
# =============================================================================
# Testing
# =============================================================================
enable_testing()
# =============================================================================
# Installation
# =============================================================================
# Install the public API header for user automata projects
install(FILES ${BXL_API_DIR}/bxl_api.h
DESTINATION include/bxl
)