2021-04-18 21:10:15 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
|
|
|
project(WRAITH_LANG C)
|
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
|
2021-04-20 01:18:45 +00:00
|
|
|
# Build Type
|
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
# By default, we use Release
|
|
|
|
message(STATUS "Setting build type to 'Release' as none was specified.")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE
|
|
|
|
STRING "Choose the type of build." FORCE
|
|
|
|
)
|
|
|
|
|
|
|
|
# Set the possible values of build type for cmake-gui
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
|
|
|
STRINGS "Debug" "Release" "RelWithDebInfo"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-04-18 21:10:15 +00:00
|
|
|
find_package(BISON)
|
|
|
|
find_package(FLEX)
|
2021-04-18 22:29:54 +00:00
|
|
|
find_package(LLVM)
|
2021-04-18 21:10:15 +00:00
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR})
|
|
|
|
|
2021-05-07 00:16:10 +00:00
|
|
|
BISON_TARGET(Parser generators/wraith.y ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c COMPILE_FLAGS "-d -v -t")
|
2021-04-28 22:21:51 +00:00
|
|
|
FLEX_TARGET(Scanner generators/wraith.lex ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
|
2021-04-18 21:10:15 +00:00
|
|
|
|
|
|
|
ADD_FLEX_BISON_DEPENDENCY(Scanner Parser)
|
|
|
|
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2021-04-18 22:29:54 +00:00
|
|
|
|
2021-04-18 21:10:15 +00:00
|
|
|
add_executable(
|
2021-04-22 05:26:34 +00:00
|
|
|
wraith
|
2021-04-28 22:21:51 +00:00
|
|
|
# Libs
|
|
|
|
lib/dropt/dropt.h
|
|
|
|
lib/dropt/dropt_string.h
|
|
|
|
lib/dropt/dropt.c
|
|
|
|
lib/dropt/dropt_string.c
|
|
|
|
lib/dropt/dropt_handlers.c
|
|
|
|
# Source
|
|
|
|
src/ast.h
|
2021-04-28 23:10:17 +00:00
|
|
|
src/codegen.h
|
2021-05-07 00:16:10 +00:00
|
|
|
src/identcheck.h
|
2021-04-28 23:01:48 +00:00
|
|
|
src/parser.h
|
2021-04-28 22:21:51 +00:00
|
|
|
src/ast.c
|
2021-04-28 23:10:17 +00:00
|
|
|
src/codegen.c
|
2021-05-07 00:16:10 +00:00
|
|
|
src/identcheck.c
|
2021-04-28 23:01:48 +00:00
|
|
|
src/parser.c
|
|
|
|
src/main.c
|
2021-04-28 22:21:51 +00:00
|
|
|
# Generated code
|
2021-04-18 21:10:15 +00:00
|
|
|
${BISON_Parser_OUTPUTS}
|
|
|
|
${FLEX_Scanner_OUTPUTS}
|
|
|
|
)
|
2021-04-18 22:29:54 +00:00
|
|
|
|
2021-04-22 05:26:34 +00:00
|
|
|
if(NOT MSVC)
|
|
|
|
set_property(TARGET wraith PROPERTY COMPILE_FLAGS "-std=gnu99 -Wall -Wno-strict-aliasing -pedantic")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(wraith PUBLIC LLVM)
|