免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4191 | 回复: 0
打印 上一主题 下一主题

windows下面安装mongo c++ driver,求指点 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-05-11 12:44 |只看该作者 |倒序浏览
RT
安装mongo c++ driver,windows下面,报错说找不到 boost的hpp文件,boost我已经装了,怎么把inlude和lib的路径让scons知道,
环境变量或者Sconstruct文件该如何修改?

Sconstruct

  1. # scons file for MongoDB c++ client library and examples

  2. import os

  3. # options
  4. AddOption( "--extrapath",
  5.            dest="extrapath",
  6.            type="string",
  7.            nargs=1,
  8.            action="store",
  9.            help="comma separated list of add'l paths  (--extrapath /opt/foo/,/foo) static linking" )

  10. AddOption( "--prefix",
  11.            dest="prefix",
  12.            type="string",
  13.            nargs=1,
  14.            action="store",
  15.            default="/usr/local",
  16.            help="installation root" )


  17. env = Environment( MSVS_ARCH=None )

  18. def addExtraLibs( s ):
  19.     for x in s.split(","):
  20.         if os.path.exists( x ):
  21.             env.Append( CPPPATH=[ x + "/include" ] )
  22.             env.Append( LIBPATH=[ x + "/lib" ] )
  23.             env.Append( LIBPATH=[ x + "/lib64" ] )

  24. if GetOption( "extrapath" ) is not None:
  25.     addExtraLibs( GetOption( "extrapath" ) )

  26. env.Append( CPPPATH=[ "mongo/" ] )

  27. env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" ] )

  28. nix = False
  29. linux = False

  30. if "darwin" == os.sys.platform:
  31.     addExtraLibs( "/opt/local/" )
  32.     nix = True
  33. elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
  34.     nix = True
  35.     linux = True

  36. if nix:
  37.     env.Append( CPPFLAGS=" -O3" )
  38.     env.Append( LIBS=["pthread"] )
  39. if linux:
  40.     env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs " )

  41. boostLibs = [ "thread" , "filesystem" , "system", "thread" ]
  42. conf = Configure(env)
  43. for lib in boostLibs:
  44.     if not conf.CheckLib("boost_%s-mt" % lib):
  45.         conf.CheckLib("boost_%s" % lib)

  46. dirs = [ "" , "bson/" , "bson/util/" ,
  47.          "client/"  , "s/" , "shell/" ,
  48.          "db/" ,
  49.          "scripting/" ,
  50.          "util/" , "util/concurrency/" , "util/mongoutils/" , "util/net/" ]

  51. allClientFiles = []
  52. for x in dirs:
  53.     allClientFiles += Glob( "mongo/" + x + "*.cpp" )
  54. allClientFiles += Glob( "mongo/util/*.c" )

  55. libs = []
  56. libs += env.SharedLibrary( "mongoclient" , allClientFiles )
  57. libs += env.Library( "mongoclient" , allClientFiles )

  58. # install

  59. prefix = GetOption( "prefix" )

  60. for x in libs:
  61.     env.Install( prefix + "/lib/" , str(x) )

  62. for x in dirs:
  63.     x = "mongo/" + x
  64.     env.Install( prefix + "/include/" + x , Glob( x + "*.h" ) )

  65. env.Alias( "install" , prefix )


  66. # example setup

  67. clientTests = []
  68. clientEnv = env.Clone();
  69. clientEnv.Prepend( LIBS=["libmongoclient.a"])
  70. clientEnv.Prepend( LIBPATH=["."] )

  71. # examples

  72. clientTests += [ clientEnv.Program( "firstExample" , [ "client/examples/first.cpp" ] ) ]
  73. clientTests += [ clientEnv.Program( "secondExample" , [ "client/examples/second.cpp" ] ) ]
  74. clientTests += [ clientEnv.Program( "whereExample" , [ "client/examples/whereExample.cpp" ] ) ]
  75. clientTests += [ clientEnv.Program( "authTest" , [ "client/examples/authTest.cpp" ] ) ]
  76. clientTests += [ clientEnv.Program( "httpClientTest" , [ "client/examples/httpClientTest.cpp" ] ) ]
  77. clientTests += [ clientEnv.Program( "clientTest" , [ "client/examples/clientTest.cpp" ] ) ]
  78. clientEnv.Alias("clientTests", clientTests, [])


复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP