- Added basic cmake setup files. It seems to compile for now.
This commit is contained in:
parent
179cc9e3be
commit
dadf2e02fb
34
src/CMakeLists.txt
Normal file
34
src/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
################################################################
|
||||
# Name: CMakeLists.txt
|
||||
# Purpose: Input file for CMake for the Scyther tool
|
||||
# Author: Cas Cremers
|
||||
################################################################
|
||||
|
||||
# Scyther project
|
||||
project (Scyther)
|
||||
# I need 2.4 for flex/etc although it does not run yet
|
||||
#CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
# List all the source files
|
||||
set (Scyther_sources
|
||||
arachne.c binding.c claim.c color.c compiler.c cost.c
|
||||
debug.c depend.c dotout.c error.c heuristic.c hidelevel.c
|
||||
intruderknowledge.c knowledge.c label.c list.c main.c mgu.c
|
||||
prune_bounds.c prune_theorems.c role.c
|
||||
specialterm.c states.c switches.c symbol.c system.c tac.c
|
||||
termlist.c termmap.c term.c timer.c type.c warshall.c xmlout.c
|
||||
parser.c scanner.c
|
||||
)
|
||||
|
||||
# If we are in a debug mode we want to be strict
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -DDEBUG")
|
||||
|
||||
# Determine version number
|
||||
include (SVNVersion.cmake)
|
||||
|
||||
# Make scanner and parser
|
||||
include (ScannerParser.cmake)
|
||||
|
||||
# Make the Scyther linux binary
|
||||
add_executable (scyther-linux ${Scyther_sources})
|
||||
|
32
src/FindBISON.cmake
Normal file
32
src/FindBISON.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
# - Try to find Bison
|
||||
# Once done this will define
|
||||
#
|
||||
# BISON_FOUND - system has Bison
|
||||
# BISON_EXECUTABLE - path of the bison executable
|
||||
# BISON_VERSION - the version string, like "2.5.31"
|
||||
#
|
||||
|
||||
|
||||
FIND_PROGRAM(BISON_EXECUTABLE NAMES bison)
|
||||
|
||||
#INCLUDE(MacroEnsureVersion)
|
||||
|
||||
IF(BISON_EXECUTABLE)
|
||||
SET(BISON_FOUND TRUE)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE _BISON_VERSION
|
||||
)
|
||||
string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}")
|
||||
ENDIF(BISON_EXECUTABLE)
|
||||
|
||||
IF(BISON_FOUND)
|
||||
IF(NOT Bison_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}")
|
||||
ENDIF(NOT Bison_FIND_QUIETLY)
|
||||
ELSE(BISON_FOUND)
|
||||
IF(Bison_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Bison")
|
||||
ENDIF(Bison_FIND_REQUIRED)
|
||||
ENDIF(BISON_FOUND)
|
||||
|
32
src/FindFLEX.cmake
Normal file
32
src/FindFLEX.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
# - Try to find Flex
|
||||
# Once done this will define
|
||||
#
|
||||
# FLEX_FOUND - system has Flex
|
||||
# FLEX_EXECUTABLE - path of the flex executable
|
||||
# FLEX_VERSION - the version string, like "2.5.31"
|
||||
#
|
||||
|
||||
|
||||
FIND_PROGRAM(FLEX_EXECUTABLE NAMES flex)
|
||||
|
||||
#INCLUDE(MacroEnsureVersion)
|
||||
|
||||
IF(FLEX_EXECUTABLE)
|
||||
SET(FLEX_FOUND TRUE)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE _FLEX_VERSION
|
||||
)
|
||||
string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" FLEX_VERSION "${_FLEX_VERSION}")
|
||||
ENDIF(FLEX_EXECUTABLE)
|
||||
|
||||
IF(FLEX_FOUND)
|
||||
IF(NOT Flex_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Flex: ${FLEX_EXECUTABLE}")
|
||||
ENDIF(NOT Flex_FIND_QUIETLY)
|
||||
ELSE(FLEX_FOUND)
|
||||
IF(Flex_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Flex")
|
||||
ENDIF(Flex_FIND_REQUIRED)
|
||||
ENDIF(FLEX_FOUND)
|
||||
|
31
src/SVNVersion.cmake
Normal file
31
src/SVNVersion.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
################################################################
|
||||
# Name: SVNVersion.cmake
|
||||
# Purpose: Determine subversion revision id for Scyther
|
||||
# and write it into a macro in version.h
|
||||
# Author: Cas Cremers
|
||||
################################################################
|
||||
|
||||
# TODO: Technically, this only needs to be redone each time a file
|
||||
# changes, so this might be a target with dependencies on all files.
|
||||
|
||||
# Checkout version info
|
||||
set_source_files_properties(version.h
|
||||
PROPERTIES
|
||||
GENERATED true)
|
||||
find_program (SVNVERSION_EXECUTABLE NAMES svnversion)
|
||||
if (SVNVERSION_EXECUTABLE)
|
||||
# svnversion found; we should always build this
|
||||
message (STATUS "Generating version.h using svnversion command")
|
||||
exec_program (${SVNVERSION_EXECUTABLE}
|
||||
OUTPUT_VARIABLE SVN_Version
|
||||
)
|
||||
message (STATUS "svnversion gave ${SVN_Version}")
|
||||
file (WRITE version.h
|
||||
"#define SVNVERSION \"${SVN_Version}\"\n"
|
||||
)
|
||||
else (SVNVERSION_EXECUTABLE)
|
||||
# No svnversion. what do we write then? just empty...?
|
||||
message (STATUS "Generating empty version.h")
|
||||
file (WRITE version.h "")
|
||||
endif (SVNVERSION_EXECUTABLE)
|
||||
|
41
src/ScannerParser.cmake
Normal file
41
src/ScannerParser.cmake
Normal file
@ -0,0 +1,41 @@
|
||||
################################################################
|
||||
# Name: ScannerParser.cmake
|
||||
# Purpose: If flex/bison are available, generate parser and scanner
|
||||
# Author: Cas Cremers
|
||||
################################################################
|
||||
|
||||
# Make the scanner using flex, if it can be found
|
||||
include(FindFLEX.cmake)
|
||||
if (FLEX_FOUND)
|
||||
set_source_files_properties(scanner.c PROPERTIES GENERATED true)
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT scanner.c
|
||||
DEPENDS scanner.l
|
||||
COMMAND ${FLEX_EXECUTABLE}
|
||||
# TODO: I should look up from which version the -o
|
||||
# switch works, might not be portable.
|
||||
ARGS -o scanner.c scanner.l
|
||||
COMMENT "Building scanner.c from scanner.l using flex"
|
||||
)
|
||||
else (FLEX_FOUND)
|
||||
message (STATUS "Because flex is not found, we will use the existing scanner.c")
|
||||
endif (FLEX_FOUND)
|
||||
|
||||
# Make the parser using bison, if it can be found
|
||||
include(FindBISON.cmake)
|
||||
if (BISON_FOUND)
|
||||
set_source_files_properties(parser.c PROPERTIES GENERATED true)
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT parser.c
|
||||
DEPENDS parser.y
|
||||
COMMAND ${BISON_EXECUTABLE}
|
||||
# TODO: I should look up from which version the -o
|
||||
# switch works, might not be portable.
|
||||
ARGS -o parser.c parser.y
|
||||
COMMENT "Building parser.c from parser.y using bison"
|
||||
)
|
||||
else (BISON_FOUND)
|
||||
message (STATUS "Because bison is not found, we will use the existing parser.c")
|
||||
endif (BISON_FOUND)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user