You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.5 KiB

  1. import os
  2. globalEnv = Environment()
  3. globalEnv["ROOTPATH"] = os.path.abspath('.')
  4. basicBuildPath = os.path.join(globalEnv['ROOTPATH'], 'build')
  5. globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'release')
  6. globalEnv['CONTRIBPATH'] = os.path.join(globalEnv['ROOTPATH'], 'contrib')
  7. globalEnv['MONGOCPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongoc')
  8. globalEnv['MONGOCXXPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongocxx')
  9. globalEnv["INIHSRC"] = os.path.join(
  10. os.path.join(globalEnv["CONTRIBPATH"],
  11. "iniParser"),
  12. "inih")
  13. globalEnv["INIHCPPSRC"] = os.path.join(globalEnv["INIHSRC"], "cpp")
  14. globalEnv["MINISATSRC"] = os.path.join(
  15. os.path.join(globalEnv["CONTRIBPATH"],
  16. "minisat"),
  17. "src")
  18. #compiler option
  19. AddOption('--dbg', action='store_true', dest='DEBUG')
  20. if GetOption('DEBUG'):
  21. globalEnv.Append(CCFLAGS="-g")
  22. globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'debug')
  23. globalEnv.Append(CXXFLAGS='-std=c++11')
  24. AddOption("--init", action="store_true", dest="INIT")
  25. #build libs
  26. #
  27. globalEnv['LIB_BUILD_PATH'] = os.path.join(globalEnv['BUILDPATH'], 'libs')
  28. #build mongoc
  29. globalEnv['MONGOC_LIB_PATH'] = os.path.join(globalEnv['LIB_BUILD_PATH'], 'mongoc')
  30. if GetOption("INIT"):
  31. globalEnv.SConscript(os.path.join(
  32. os.path.join(globalEnv['CONTRIBPATH'],
  33. 'mongoc'),
  34. 'SConscript'),
  35. variant_dir=globalEnv['MONGOC_LIB_PATH'],
  36. duplicate=0,
  37. exports='globalEnv')
  38. #build mongocxx
  39. globalEnv["MONGOCXX_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "mongocxx")
  40. if GetOption("INIT"):
  41. globalEnv.SConscript(os.path.join(
  42. os.path.join(globalEnv["CONTRIBPATH"],
  43. "mongocxx"),
  44. "SConscript"),
  45. variant_dir=globalEnv["MONGOCXX_LIB_PATH"],
  46. duplicate=0,
  47. exports="globalEnv")
  48. #build inih
  49. globalEnv["INIH_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "inih")
  50. globalEnv.SConscript(os.path.join(
  51. os.path.join(globalEnv["CONTRIBPATH"],
  52. "iniParser"),
  53. "SConscript"),
  54. variant_dir=globalEnv["INIH_LIB_PATH"],
  55. duplicate=0,
  56. exports="globalEnv")
  57. #build minisat
  58. globalEnv["MINISAT_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "minisat")
  59. globalEnv.SConscript(os.path.join(
  60. os.path.join(globalEnv["CONTRIBPATH"],
  61. "minisat"),
  62. "SConscript"),
  63. variant_dir=globalEnv["MINISAT_LIB_PATH"],
  64. duplicate=0,
  65. exports="globalEnv")
  66. mongocxxIncludeDir = os.path.join(
  67. os.path.join(
  68. os.path.join(globalEnv["MONGOCXX_LIB_PATH"],
  69. "include"),
  70. "mongocxx"),
  71. "v_noabi")
  72. bsoncxxIncludeDir = os.path.join(
  73. os.path.join(
  74. os.path.join(globalEnv["MONGOCXX_LIB_PATH"],
  75. "include"),
  76. "bsoncxx"),
  77. "v_noabi")
  78. inihIncludeDir = globalEnv["INIHSRC"]
  79. inihcppIncludeDir = globalEnv["INIHCPPSRC"]
  80. minisatIncludeDir = globalEnv["MINISATSRC"]
  81. globalEnv.Append(CPPPATH=[mongocxxIncludeDir,
  82. bsoncxxIncludeDir,
  83. inihIncludeDir,
  84. inihcppIncludeDir,
  85. minisatIncludeDir])
  86. globalEnv.Append(LIBPATH=[os.path.join(globalEnv["MONGOCXX_LIB_PATH"], "lib"),
  87. globalEnv["INIH_LIB_PATH"],
  88. globalEnv["MINISAT_LIB_PATH"]])
  89. #build runMinisat
  90. globalEnv.SConscript(os.path.join(
  91. os.path.join(globalEnv['ROOTPATH'],
  92. 'src'),
  93. 'SConscript'),
  94. variant_dir=globalEnv['BUILDPATH'],
  95. duplicate=0,
  96. exports='globalEnv')