mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-24 19:30:26 +01:00
c09d18623e
This makes cross-compiling easier, and saves having to build once each for TFE and TSE. I considered using CMake's import/export feature, but there's little point when you're only importing one binary target. Pointing the ECC variable at the ecc binary itself is simpler. I copied the minimum CMake version of 2.8.7 from the parent project. To be confident this would actually work, I tested building under CentOS 7 with CMake 2.8.12.
26 lines
962 B
CMake
26 lines
962 B
CMake
macro(add_parser_and_scanner _PARSER _SCANNER)
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${_SCANNER}.cpp"
|
|
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${_SCANNER}.l"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMAND flex
|
|
ARGS -o${_SCANNER}.cpp ${_SCANNER}.l
|
|
)
|
|
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${_PARSER}.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/${_PARSER}.hpp"
|
|
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${_PARSER}.y"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMAND bison
|
|
ARGS -o${_PARSER}.cpp ${_PARSER}.y -d
|
|
)
|
|
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${_PARSER}.h"
|
|
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${_PARSER}.hpp"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMAND ${CMAKE_COMMAND}
|
|
ARGS -E copy ${_PARSER}.hpp ${_PARSER}.h
|
|
)
|
|
endmacro()
|