hogre 0.1.0 → 0.1.1
raw patch · 6 files changed
+148/−24 lines, 6 filessetup-changed
Files
- Setup.hs +55/−21
- headers/ogre.list +2/−0
- headers/ogre.list_win +30/−0
- hogre.cabal +6/−3
- interfaces/ogre.if +4/−0
- interfaces/ogre.if_win +51/−0
Setup.hs view
@@ -12,6 +12,7 @@ import Distribution.Simple.Program import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Setup+import Distribution.System import Distribution.Verbosity import Distribution.Version import qualified Distribution.ModuleName@@ -77,10 +78,11 @@ fullModuleName :: String -> Distribution.ModuleName.ModuleName fullModuleName s = Distribution.ModuleName.fromString $ "Graphics.Ogre." ++ s -mkLibrary :: IO Library-mkLibrary = do+mkLibrary :: LocalBuildInfo -> IO Library+mkLibrary lb = do genhsmodulenames <- map takeBaseName <$> getFiles "hs" resCgenHs cppfiles <- getFiles "cpp" resCgen+ includepaths <- getIncludePaths lb let expModules = map fullModuleName ["HOgre", "Types"] libbuildinfo = BuildInfo True [] [] [] [] [(Dependency (PackageName "OgreMain")@@ -88,40 +90,72 @@ [] cppfiles [resCgenHsBase] (filter (`notElem` expModules) (map fullModuleName genhsmodulenames))- [] ["OgreMain"] [] [] [] [] [] [] [] []+ [] ["OgreMain"] [] includepaths [] [] [] [] [] [] [Dependency (PackageName "base") (intersectVersionRanges (orLaterVersion (Version [3] [])) (earlierVersion (Version [5] []))), Dependency (PackageName "haskell98") anyVersion] return $ Library expModules True libbuildinfo- ++getConfiguredIncludePaths :: LocalBuildInfo -> [String]+getConfiguredIncludePaths lb = + case library (localPkgDescr lb) of+ Nothing -> []+ Just l -> includeDirs (libBuildInfo l)++getIncludePaths :: LocalBuildInfo -> IO [String]+getIncludePaths lb = do+ let defincludepaths = getConfiguredIncludePaths lb+ case buildOS of+ Windows -> return defincludepaths+ _ -> do+ pkgconfig <- getProgram "http://pkg-config.freedesktop.org/" "pkg-config"+ mogreincpath <- (filter (\w -> take 2 w == "-I") . words) <$> getProgramOutput normal pkgconfig ["--cflags", "OGRE"]+ case mogreincpath of+ [] -> do+ putStrLn "Warning: Could not find OGRE include path with pkg-config - will assume"+ putStrLn " the OGRE headers are in the default include path. If the"+ putStrLn " compilation fails, try installing pkg-config and make sure that"+ putStrLn " OGRE is installed and pkg-config correctly configured."+ putStrLn " Alternatively, use the cabal --extra-include-dirs option."+ return defincludepaths+ (x:_) -> return $ [drop 2 x]+ ogreBuildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO () ogreBuildHook pd lb uh bf = do- iffile <- getSrcFile pd "if"+ geniffile <- getSrcFile pd "if"+ winiffile <- getSrcFile pd "if_win" igfile <- getSrcFile pd "ig" hiffile <- getSrcFile pd "hif" listfile <- getSrcFile pd "list"+ winlistfile <- getSrcFile pd "list_win" cgen <- getProgram "Hackage" "cgen" grgen <- getProgram "Hackage" "grgen" cgenhs <- getProgram "Hackage" "cgen-hs"- pkgconfig <- getProgram "http://pkg-config.freedesktop.org/" "pkg-config"- headerlist <- lines <$> readFile listfile- mogreincpath <- (filter (\w -> take 2 w == "-I") . words) <$> getProgramOutput normal pkgconfig ["--cflags", "OGRE"]- case mogreincpath of- [] -> err "Could not find OGRE include path with pkg-config - make sure OGRE is installed and pkg-config configured."- (x:_) -> do- let ogreincpath = drop 2 x- runProgram normal cgen (["-o", resCgen, "--interface", iffile, "--include", ogreincpath] ++ headerlist)- runProgram normal grgen (["--interface", igfile, "--include", ogreincpath, "-o", graphFile] ++ headerlist)- headerfiles <- getFiles "h" resCgen- runProgram normal cgenhs (["--interface", hiffile, "-u", "HOgre.hs", "--hierarchy", "Graphics.Ogre.", "--inherit", graphFile, "-o", resCgenHs] ++ headerfiles)- createDirectoryIfMissing True resLib- lib <- mkLibrary- (buildHook simpleUserHooks) pd{library = Just lib} lb uh bf+ let headerlistfile = case buildOS of+ Windows -> winlistfile+ _ -> listfile+ let iffile = case buildOS of+ Windows -> winiffile+ _ -> geniffile+ headerlist <- lines <$> readFile headerlistfile+ includepaths <- getIncludePaths lb+ let includepath = case includepaths of+ [] -> ""+ (x:_) -> x+ when (not $ null includepath) $ putStrLn $ "Searching for OGRE headers in: " ++ includepath+ let includesetup = if null includepath then [] else ["--include", includepath]+ runProgram normal cgen (["-o", resCgen, "--interface", iffile] ++ includesetup ++ headerlist)+ runProgram normal grgen (["--interface", igfile] ++ includesetup ++ ["-o", graphFile] ++ headerlist)+ headerfiles <- getFiles "h" resCgen+ runProgram normal cgenhs (["--interface", hiffile, "-u", "HOgre.hs", "--hierarchy", "Graphics.Ogre.", "--inherit", graphFile, "-o", resCgenHs] ++ headerfiles)+ createDirectoryIfMissing True resLib+ lib <- mkLibrary lb+ (buildHook simpleUserHooks) pd{library = Just lib} lb uh bf ogreInstHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> InstallFlags -> IO () ogreInstHook pd lb uh ifl = do- lib <- mkLibrary+ lib <- mkLibrary lb (instHook simpleUserHooks) pd{library = Just lib} lb uh ifl ogreCleanHook pd n uh cf = do@@ -130,6 +164,6 @@ (cleanHook simpleUserHooks) pd n uh cf ogreHaddockHook pd lb uh hf = do- lib <- mkLibrary+ lib <- mkLibrary lb (haddockHook simpleUserHooks) pd{library = Just lib} lb uh hf
headers/ogre.list view
@@ -26,3 +26,5 @@ OgreWindowEventUtilities.h GLX/OgreTimerImp.h OgreAnimationState.h+GLX/OgreConfigDialogImp.h+GLX/OgreErrorDialogImp.h
+ headers/ogre.list_win view
@@ -0,0 +1,30 @@+OgreCamera.h+OgreEntity.h+OgreFrustum.h+OgreLight.h+OgreMaterial.h+OgreMath.h+OgreMesh.h+OgreNode.h+OgrePlane.h+OgreQuaternion.h+OgreRay.h+OgreRenderSystem.h+OgreRoot.h+OgreSceneManager.h+OgreSceneNode.h+OgreSceneQuery.h+OgreSkeleton.h+OgreTextureManager.h+OgreVector3.h+OgreViewport.h+OgreConfigFile.h+OgreResourceGroupManager.h+OgreRenderWindow.h+OgreRenderTarget.h+OgreColourValue.h+OgreWindowEventUtilities.h+WIN32/OgreTimerImp.h+OgreAnimationState.h+WIN32/OgreConfigDialogImp.h+WIN32/OgreErrorDialogImp.h
hogre.cabal view
@@ -1,11 +1,11 @@ Name: hogre-Version: 0.1.0+Version: 0.1.1 Cabal-Version: >= 1.6 License: MIT License-File: LICENSE Author: Antti Salonen<ajsalonen at gmail dot com> Maintainer: Antti Salonen<ajsalonen at gmail dot com>-Copyright: (c) 2010 Antti Salonen+Copyright: (c) 2010, 2011 Antti Salonen Stability: Experimental Homepage: http://anttisalonen.github.com/hogre Bug-reports: http://github.com/anttisalonen/hogre/issues@@ -16,7 +16,9 @@ (<http://www.ogre3d.org/>). Build-type: Custom Extra-source-files: headers/ogre.list,+ headers/ogre.list_win, interfaces/ogre.if,+ interfaces/ogre.if_win, interfaces/ogre.hif, interfaces/graph.ig @@ -28,6 +30,7 @@ Build-Depends: base >= 3 && < 5, haskell98 Ghc-options: -Wall cc-options: -Wall- pkgconfig-depends: OGRE+ if !os(windows)+ pkgconfig-depends: OGRE extra-libraries: OgreMain
interfaces/ogre.if view
@@ -15,6 +15,10 @@ resourceModifiedTime @header+# TODO: reverse the ordering once cgen generates the+# header includes in the correct order+OGRE/GLX/OgreErrorDialogImp.h+OGRE/GLX/OgreConfigDialogImp.h OGRE/Ogre.h @rename
+ interfaces/ogre.if_win view
@@ -0,0 +1,51 @@+@exclude+^_.*+getShadowVolumeRenderableIterator+.*Listener+getResourceDeclarationList++# returns a String, which is converted to char* -> error.+getErrorDescription+getSetting+writeContentsToTimestampedFile+validateConfigOptions++# private class as parameter type.+resourceExists+resourceModifiedTime++@header+# TODO: reverse the ordering once cgen generates the+# header includes in the correct order+WIN32/OgreErrorDialogImp.h+WIN32/OgreConfigDialogImp.h+Ogre.h++@rename+# These may be defined twice, once in types.h, once in+# OGRE namespace. Resolve conflict.+uint|unsigned int+ulong|unsigned long+ushort|unsigned short++# Superclass typedefs.+ResourceCreateOrRetrieveResult|std::pair<ResourcePtr, bool>+TransformSpace|Node::TransformSpace+DebugRenderable|Node::DebugRenderable+WorldFragmentType|SceneQuery::WorldFragmentType++# OGRE typedefs.+Real|float+uchar|unsigned char++# Implicit coercion.+String|char*++@exclude-class+# Abstract class based on superclass.+AxisAlignedBoxSceneQuery+PlaneBoundedVolumeListSceneQuery+SphereSceneQuery++.*Listener+