47 lines
1.1 KiB
CMake
47 lines
1.1 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 wraith.y ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c COMPILE_FLAGS -d)
|
|
FLEX_TARGET(Scanner wraith.lex ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c)
|
|
|
|
ADD_FLEX_BISON_DEPENDENCY(Scanner Parser)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_executable(
|
|
wraith
|
|
ast.c
|
|
stack.c
|
|
${BISON_Parser_OUTPUTS}
|
|
${FLEX_Scanner_OUTPUTS}
|
|
compiler.c
|
|
)
|
|
|
|
if(NOT MSVC)
|
|
set_property(TARGET wraith PROPERTY COMPILE_FLAGS "-std=gnu99 -Wall -Wno-strict-aliasing -pedantic")
|
|
endif()
|
|
|
|
target_link_libraries(wraith PUBLIC LLVM)
|