Remove FindSDL2 find-module, use sdl2-config.cmake instead
This requires SDL >= 2.0.4.
Since <https://bugzilla.libsdl.org/show_bug.cgi?id=2464> was fixed in
SDL 2.0.4, SDL behaves as a CMake "config-file package", even if it was
not itself built using CMake: it installs a sdl2-config.cmake file to
${libdir}/cmake/SDL2, which tells CMake where to find SDL's headers and
library, analogous to a pkg-config .pc file.
As a result, we no longer need to copy/paste a "find-module package"
to be able to find a system copy of SDL >= 2.0.4 with find_package(SDL2).
Find-module packages are now discouraged by the CMake developers, in
favour of having upstream projects behave as config-file packages.
This results in a small API change: FindSDL2 used to set SDL2_INCLUDE_DIR
and SDL2_LIBRARY, but the standard behaviour for config-file packages is
to set <name>_INCLUDE_DIRS and <name>_LIBRARIES. Use the CONFIG keyword
to make sure we search in config-file package mode, and will not find a
FindSDL2.cmake in some other directory that implements the old interface.
In addition to deleting redundant code, this avoids some assumptions in
FindSDL2 about the layout of a SDL installation. The current libsdl2-dev
package in Debian breaks those assumptions; this is considered a bug
and will hopefully be fixed soon, but it illustrates how fragile these
assumptions can be. We can be more robust against different installation
layouts by relying on SDL's own CMake integration.
When linking to a copy of CMake in a non-standard location, users can
now set the SDL2_DIR or CMAKE_PREFIX_PATH environment variable to point
to it; previously, these users would have used the SDL2DIR environment
variable. This continues to be unnecessary if using matching system-wide
installations of CMake and SDL2, for example both from Debian.
module PascalUnitSyntaxTree where
data PascalUnit =
Program Identifier Implementation Phrase
| Unit Identifier Interface Implementation (Maybe Initialize) (Maybe Finalize)
| System [TypeVarDeclaration]
| Redo [TypeVarDeclaration]
deriving (Show, Read, Eq)
data Interface = Interface Uses TypesAndVars
deriving (Show, Read, Eq)
data Implementation = Implementation Uses TypesAndVars
deriving (Show, Read, Eq)
data Identifier = Identifier String BaseType
deriving (Show, Read, Eq)
data TypesAndVars = TypesAndVars [TypeVarDeclaration]
deriving (Show, Read, Eq)
data TypeVarDeclaration = TypeDeclaration Identifier TypeDecl
| VarDeclaration Bool Bool ([Identifier], TypeDecl) (Maybe InitExpression)
| FunctionDeclaration Identifier Bool Bool Bool TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase))
| OperatorDeclaration String Identifier Bool TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase))
deriving (Show, Read, Eq)
data TypeDecl = SimpleType Identifier
| RangeType Range
| Sequence [Identifier]
| ArrayDecl (Maybe Range) TypeDecl
| RecordType [TypeVarDeclaration] (Maybe [[TypeVarDeclaration]])
| PointerTo TypeDecl
| String
| AString
| Set TypeDecl
| FunctionType TypeDecl [TypeVarDeclaration]
| DeriveType InitExpression
| VoidType
| VarParamType TypeDecl -- this is a hack
deriving (Show, Read, Eq)
data Range = Range Identifier
| RangeFromTo InitExpression InitExpression
| RangeInfinite
deriving (Show, Read, Eq)
data Initialize = Initialize String
deriving (Show, Read, Eq)
data Finalize = Finalize String
deriving (Show, Read, Eq)
data Uses = Uses [Identifier]
deriving (Show, Read, Eq)
data Phrase = ProcCall Reference [Expression]
| IfThenElse Expression Phrase (Maybe Phrase)
| WhileCycle Expression Phrase
| RepeatCycle Expression [Phrase]
| ForCycle Identifier Expression Expression Phrase Bool -- The last Boolean indicates wether it's up or down counting
| WithBlock Reference Phrase
| Phrases [Phrase]
| SwitchCase Expression [([InitExpression], Phrase)] (Maybe [Phrase])
| Assignment Reference Expression
| BuiltInFunctionCall [Expression] Reference
| NOP
deriving (Show, Read, Eq)
data Expression = Expression String
| BuiltInFunCall [Expression] Reference
| PrefixOp String Expression
| PostfixOp String Expression
| BinOp String Expression Expression
| StringLiteral String
| PCharLiteral String
| CharCode String
| HexCharCode String
| NumberLiteral String
| FloatLiteral String
| HexNumber String
| Reference Reference
| SetExpression [Identifier]
| Null
deriving (Show, Read, Eq)
data Reference = ArrayElement [Expression] Reference
| FunCall [Expression] Reference
| TypeCast Identifier Expression
| SimpleReference Identifier
| Dereference Reference
| RecordField Reference Reference
| Address Reference
| RefExpression Expression
deriving (Show, Read, Eq)
data InitExpression = InitBinOp String InitExpression InitExpression
| InitPrefixOp String InitExpression
| InitReference Identifier
| InitArray [InitExpression]
| InitRecord [(Identifier, InitExpression)]
| InitFloat String
| InitNumber String
| InitHexNumber String
| InitString String
| InitPChar String
| InitChar String
| BuiltInFunction String [InitExpression]
| InitSet [InitExpression]
| InitAddress InitExpression
| InitNull
| InitRange Range
| InitTypeCast Identifier InitExpression
deriving (Show, Read, Eq)
data BaseType = BTUnknown
| BTChar
| BTString
| BTAString
| BTInt Bool -- second param indicates whether signed or not
| BTBool
| BTFloat
| BTRecord String [(String, BaseType)]
| BTArray Range BaseType BaseType
| BTFunction Bool Bool [(Bool, BaseType)] BaseType -- in (Bool, BaseType), Bool indiciates whether var or not
| BTPointerTo BaseType
| BTUnresolved String
| BTSet BaseType
| BTEnum [String]
| BTVoid
| BTUnit
| BTVarParam BaseType
deriving (Show, Read, Eq)