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.

157 lines
4.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  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['QBSCXXPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'qubosolver')
  10. globalEnv["INIHSRC"] = os.path.join(
  11. os.path.join(globalEnv["CONTRIBPATH"],
  12. "iniParser"),
  13. "inih")
  14. globalEnv["INIHCPPSRC"] = os.path.join(globalEnv["INIHSRC"], "cpp")
  15. globalEnv["MINISATSRC"] = os.path.join(
  16. os.path.join(globalEnv["CONTRIBPATH"],
  17. "minisat"),
  18. "src")
  19. globalEnv["QBSCXXSRC"] = os.path.join(
  20. os.path.join(
  21. os.path.join(globalEnv["CONTRIBPATH"],
  22. "qubosolver"),
  23. "qbscxx"),
  24. "src")
  25. globalEnv["QBSCXX_INCLUDE"] = os.path.join(
  26. os.path.join(
  27. os.path.join(globalEnv["CONTRIBPATH"],
  28. "qubosolver"),
  29. "qbscxx"),
  30. "include")
  31. #compiler option
  32. AddOption('--dbg', action='store_true', dest='DEBUG')
  33. globalEnv["BUILD_TYPE"] = "Release"
  34. if GetOption('DEBUG'):
  35. globalEnv["BUILD_TYPE"] = "Debug"
  36. globalEnv.Append(CCFLAGS="-g")
  37. globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'debug')
  38. globalEnv.Append(CXXFLAGS='-std=c++11')
  39. AddOption("--init", action="store_true", dest="INIT")
  40. #build libs
  41. #
  42. globalEnv['LIB_BUILD_PATH'] = os.path.join(globalEnv['BUILDPATH'], 'libs')
  43. #build mongoc
  44. globalEnv['MONGOC_LIB_PATH'] = os.path.join(globalEnv['LIB_BUILD_PATH'], 'mongoc')
  45. if GetOption("INIT"):
  46. globalEnv.SConscript(os.path.join(
  47. os.path.join(globalEnv['CONTRIBPATH'],
  48. 'mongoc'),
  49. 'SConscript'),
  50. variant_dir=globalEnv['MONGOC_LIB_PATH'],
  51. duplicate=0,
  52. exports='globalEnv')
  53. #build mongocxx
  54. globalEnv["MONGOCXX_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "mongocxx")
  55. if GetOption("INIT"):
  56. globalEnv.SConscript(os.path.join(
  57. os.path.join(globalEnv["CONTRIBPATH"],
  58. "mongocxx"),
  59. "SConscript"),
  60. variant_dir=globalEnv["MONGOCXX_LIB_PATH"],
  61. duplicate=0,
  62. exports="globalEnv")
  63. #build qbscxx
  64. globalEnv["QBSCXX_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "qbscxx")
  65. if GetOption("INIT"):
  66. globalEnv.SConscript(os.path.join(
  67. os.path.join(globalEnv["CONTRIBPATH"],
  68. "qubosolver"),
  69. "SConscript"),
  70. variant_dir=globalEnv["QBSCXX_LIB_PATH"],
  71. duplicate=0,
  72. exports="globalEnv")
  73. #build inih
  74. globalEnv["INIH_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "inih")
  75. globalEnv.SConscript(os.path.join(
  76. os.path.join(globalEnv["CONTRIBPATH"],
  77. "iniParser"),
  78. "SConscript"),
  79. variant_dir=globalEnv["INIH_LIB_PATH"],
  80. duplicate=0,
  81. exports="globalEnv")
  82. #build minisat
  83. globalEnv["MINISAT_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "minisat")
  84. globalEnv.SConscript(os.path.join(
  85. os.path.join(globalEnv["CONTRIBPATH"],
  86. "minisat"),
  87. "SConscript"),
  88. variant_dir=globalEnv["MINISAT_LIB_PATH"],
  89. duplicate=0,
  90. exports="globalEnv")
  91. mongocxxIncludeDir = os.path.join(
  92. os.path.join(
  93. os.path.join(globalEnv["MONGOCXX_LIB_PATH"],
  94. "include"),
  95. "mongocxx"),
  96. "v_noabi")
  97. bsoncxxIncludeDir = os.path.join(
  98. os.path.join(
  99. os.path.join(globalEnv["MONGOCXX_LIB_PATH"],
  100. "include"),
  101. "bsoncxx"),
  102. "v_noabi")
  103. inihIncludeDir = globalEnv["INIHSRC"]
  104. inihcppIncludeDir = globalEnv["INIHCPPSRC"]
  105. minisatIncludeDir = globalEnv["MINISATSRC"]
  106. globalEnv.Append(CPPPATH=[mongocxxIncludeDir,
  107. bsoncxxIncludeDir,
  108. inihIncludeDir,
  109. inihcppIncludeDir,
  110. minisatIncludeDir,
  111. globalEnv["QBSCXXSRC"],
  112. globalEnv["QBSCXX_INCLUDE"]])
  113. globalEnv.Append(LIBPATH=[os.path.join(globalEnv["MONGOCXX_LIB_PATH"], "lib"),
  114. globalEnv["INIH_LIB_PATH"],
  115. globalEnv["MINISAT_LIB_PATH"],
  116. globalEnv["QBSCXX_LIB_PATH"]])
  117. #build runMinisat
  118. globalEnv.SConscript(os.path.join(
  119. os.path.join(globalEnv['ROOTPATH'],
  120. 'src'),
  121. 'SConscript'),
  122. variant_dir=globalEnv['BUILDPATH'],
  123. duplicate=0,
  124. exports='globalEnv')