-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
88 lines (67 loc) · 2.29 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
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
cmake_minimum_required(VERSION 3.0.0)
project(jab VERSION 0.1.0)
set (CMAKE_CXX_STANDARD 23)
cmake_policy(SET CMP0069 NEW)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
add_library(jab_lib OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/src/jab.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/module_builder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/jit_env.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/context.cpp
# Register stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/register_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/register_allocator.cpp
# Analysis stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/passes/analysis/liveness.cpp
# Optimization stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/passes/opt/register_coalescing.cpp
# Object File stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/link/coff.cpp
# Linking stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/link/windows_pe.cpp
# x86_64 stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/x86_64/mdir.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/x86_64/mdir_gen.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/arch/x86_64/encode.cpp
# Misc. stuff
${CMAKE_CURRENT_SOURCE_DIR}/src/misc/crc.cpp
)
target_include_directories(jab_lib
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/passes
)
set(cmd_driver_src
$<TARGET_OBJECTS:jab_lib>
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
)
add_executable(jab ${cmd_driver_src})
target_include_directories(jab
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/passes
)
set(test_driver_src
$<TARGET_OBJECTS:jab_lib>
${CMAKE_CURRENT_SOURCE_DIR}/tests/run_tests.cpp
)
add_executable(jab_tests ${test_driver_src})
target_include_directories(jab_tests
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/passes
)
if(${LTO})
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
if(MSVC)
target_compile_options(jab PRIVATE /W3)
target_compile_options(jab_tests PRIVATE /W3)
else()
target_compile_options(jab PRIVATE -Wall -Wextra -pedantic)
target_compile_options(jab_tests PRIVATE -Wall -Wextra -pedantic)
endif()