comparison gen/linker.cpp @ 534:7e2867ed70d9

Get rid of isLinux and isWindows in favor of global.params.os.
author Christian Kamm <kamm incasoftware de>
date Sun, 24 Aug 2008 16:22:58 +0200
parents 723027dd9593
children c23f4cfe4f2b
comparison
equal deleted inserted replaced
532:0beebf923322 534:7e2867ed70d9
70 if (Module::rootModule) 70 if (Module::rootModule)
71 exestr = Module::rootModule->toChars(); 71 exestr = Module::rootModule->toChars();
72 else 72 else
73 exestr = "a.out"; 73 exestr = "a.out";
74 } 74 }
75 if (global.params.isWindows) 75 if (global.params.os == OSWindows)
76 exestr.append(".exe"); 76 exestr.append(".exe");
77 77
78 std::string outopt = "-o=" + exestr; 78 std::string outopt = "-o=" + exestr;
79 args.push_back(outopt.c_str()); 79 args.push_back(outopt.c_str());
80 80
149 char *p = (char *)global.params.libfiles->data[i]; 149 char *p = (char *)global.params.libfiles->data[i];
150 args.push_back(p); 150 args.push_back(p);
151 } 151 }
152 152
153 // default libs 153 // default libs
154 if(global.params.isLinux) 154 if(global.params.os == OSLinux)
155 { 155 {
156 args.push_back("-lpthread"); 156 args.push_back("-lpthread");
157 args.push_back("-ldl"); 157 args.push_back("-ldl");
158 args.push_back("-lm"); 158 args.push_back("-lm");
159 } 159 }
160 else if (global.params.isWindows) 160 else if (global.params.os == OSWindows)
161 { 161 {
162 // FIXME: I'd assume kernel32 etc 162 // FIXME: I'd assume kernel32 etc
163 } 163 }
164 164
165 // object files 165 // object files
172 // runtime library 172 // runtime library
173 // must be linked in last to null terminate the moduleinfo appending list 173 // must be linked in last to null terminate the moduleinfo appending list
174 std::string runtime_path(global.params.runtimePath); 174 std::string runtime_path(global.params.runtimePath);
175 175
176 // path seperator can be \ on windows, but we check for / 176 // path seperator can be \ on windows, but we check for /
177 if (global.params.isWindows) 177 #if _WIN32
178 { 178 int i=0;
179 int i=0; 179 while ((i = runtime_path.find("\\", i)) > 0)
180 while ((i = runtime_path.find("\\", i)) > 0) 180 runtime_path.replace(i, 1, "/");
181 runtime_path.replace(i, 1, "/"); 181 #endif
182 }
183 182
184 if (*runtime_path.rbegin() != '/') 183 if (*runtime_path.rbegin() != '/')
185 runtime_path.append("/"); 184 runtime_path.append("/");
186 runtime_path.append("libtango-base-llvmdc-native.a"); 185 runtime_path.append("libtango-base-llvmdc-native.a");
187 args.push_back(runtime_path.c_str()); 186 args.push_back(runtime_path.c_str());