61 lines
1.4 KiB
CMake
61 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 2.8.12)
|
|
project(WRAITH_LANG C)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
# 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()
|
|
|
|
find_package(BISON)
|
|
find_package(FLEX)
|
|
find_package(LLVM)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR})
|
|
|
|
BISON_TARGET(Parser generators/wraith.y ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c COMPILE_FLAGS "-d -v -t")
|
|
FLEX_TARGET(Scanner generators/wraith.lex ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
|
|
|
|
ADD_FLEX_BISON_DEPENDENCY(Scanner Parser)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_executable(
|
|
wraith
|
|
# 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
|
|
src/codegen.h
|
|
src/parser.h
|
|
src/stack.h
|
|
src/ast.c
|
|
src/codegen.c
|
|
src/parser.c
|
|
src/stack.c
|
|
src/main.c
|
|
# Generated code
|
|
${BISON_Parser_OUTPUTS}
|
|
${FLEX_Scanner_OUTPUTS}
|
|
)
|
|
|
|
if(NOT MSVC)
|
|
set_property(TARGET wraith PROPERTY COMPILE_FLAGS "-std=gnu99 -Wall -Wno-strict-aliasing -pedantic")
|
|
endif()
|
|
|
|
target_link_libraries(wraith PUBLIC LLVM)
|