-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
33 lines (33 loc) · 1022 Bytes
/
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
cmake_minimum_required(VERSION 3.0)
project(compiler-2)
find_program(NASM nasm REQUIRED)
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CXX_STANDARD 20)
add_compile_options(
-O3
-Werror
-Wfatal-errors
-Weverything
-Wno-c++98-compat
-Wno-weak-vtables
-Wno-padded
-Wno-unqualified-std-cast-call
-Wno-unsafe-buffer-usage
)
add_executable(baz src/main.cpp)
add_custom_command(TARGET baz POST_BUILD
COMMAND echo "* compiling prog.baz to gen.s"
COMMAND ../baz ../prog.baz > gen.s
# COMMAND grep -v -e'^\\s*;.*$' -e'^\\s*$' gen.s > gen-m.s
COMMAND echo "* compiling gen.s with ${NASM} to executable 'gen'"
COMMAND ${NASM} -f elf64 gen.s
COMMAND ld -s -o gen gen.o
COMMAND echo
COMMAND ls --color -la baz gen
COMMAND rm -f gen.o diff.baz
COMMAND echo
COMMAND echo "* running gen"
COMMAND echo "---------------------------------------------------------"
COMMAND ./gen
COMMAND echo "---------------------------------------------------------"
)