Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.74 KB | None | 0 0
  1. import os
  2.  
  3. source_files = []
  4. object_files = []
  5.  
  6. optimization = "-O0"
  7. debug        = "-g3"
  8. nara_dir     = "../"
  9. system       = "win32/"
  10. exe_name     = "Nara2D.exe"
  11.  
  12. libraries = [  
  13.     "comdlg32",
  14.     "XInput",
  15.     "luabindd",
  16.     "lua51",
  17.     "SDL2",
  18.     "SFML-Graphics-d",
  19.     "SFML-Audio-d",
  20.     "SFML-System-d",
  21.     "SFML-Window-d",
  22.     "SFGUI-d",
  23.     "Box2D",
  24.     "boost_filesystem-mgw47-mt-1_55",
  25.     "boost_thread-mgw47-mt-1_55",
  26.     "boost_chrono-mgw47-mt-1_55",
  27.     "boost_system-mgw47-mt-1_55"
  28. ]
  29.  
  30. include_dir = nara_dir + "thirdparty/libraries/include"
  31. lib_dir = nara_dir + "thirdparty/libraries/" + system
  32. cpp_flags = optimization + " " + debug +" -Wall -fno-omit-frame-pointer -c -fmessage-length=0 -std=gnu++11 -DNARA_DEBUG -D__GXX_EXPERIMENTAL_CXX0X__"
  33.  
  34. def grab_all_files(root, type, lst):
  35.     for root, dirs, files in os.walk(root):
  36.         for name in files:
  37.             if name.endswith(type):
  38.                 lst.append(os.path.join(root, name))
  39.  
  40. def list_to_string(lst, postfix):
  41.     retstr = ""
  42.     for elem in lst:
  43.         retstr += postfix + elem + " "
  44.     return retstr
  45.  
  46. print("Compiling Nara2D\n")
  47.  
  48. grab_all_files(nara_dir + "src", ".cpp", source_files)
  49. grab_all_files(nara_dir + "thirdparty", ".cpp", source_files)
  50.  
  51. for source in source_files:
  52.     print("\nCompiling " + source)
  53.     error = os.system("g++ -IC:" + nara_dir + "/thirdparty/flux/include -IC:" + include_dir + " " + cpp_flags + " " + source)
  54.    
  55.     if error != 0:
  56.         exit()
  57.  
  58. print("\n Compilation step successful\n")
  59.  
  60. grab_all_files(nara_dir+"build", ".o", object_files)
  61.  
  62. print("Invoking Linker")
  63. error = os.system("g++ -LC:" + lib_dir + " -o " + exe_name + " " + list_to_string(object_files, "") + " " + list_to_string(libraries, "-l"))
  64.  
  65. if error != 0:
  66.     exit()
  67.  
  68. print("\n Linking step successful")
  69. copyfile(exe_name, "nara_dir/"+exe_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement