| 89 | | envCafu.Append(LIBPATH=['ExtLibs/DirectX7/lib']) |
| 90 | | envCafu.Append(LIBS=Split("SceneGraph MatSys SoundSys cfsLib cfsCoreLib cfs_png cfs_jpeg bulletcollision minizip z lua ClipSys GuiSysNullEditor")) |
| 91 | | envCafu.Append(LIBS=Split("lightwave")) # For the GuiSys::ModelWindowT class. |
| 92 | | envCafu.Append(LIBS=Split("gdi32 opengl32 user32 wsock32") + ['dinput', 'dxguid']) |
| 93 | | WinResource=envCafu.RES("Ca3DE/Dialog1.rc") + envCafu.RES("Ca3DE/Cafu.rc", CPPPATH=[CompilerSetup.wxMSW_Path+'/include']) |
| 94 | | |
| 95 | | elif sys.platform=="linux2": |
| 96 | | WinResource=[] |
| 97 | | # -Wl,-rpath,. is so that also the . directory is searched for dynamic libraries when they're opened. |
| 98 | | # -Wl,--export-dynamic is so that the exe exports its symbols so that the MatSys, SoundSys and game .so libs can in turn resolve theirs. |
| 99 | | envCafu.Append(LINKFLAGS = ['-Wl,-rpath,.', '-Wl,--export-dynamic']) |
| 100 | | envCafu.Append(LIBS=Split("MatSys SoundSys SceneGraph cfsLib cfsCoreLib cfs_png cfs_jpeg bulletdynamics bulletcollision bulletmath openal alut mpg123 ogg vorbis vorbisfile minizip z lua lightwave ClipSys GuiSysNullEditor")) |
| 101 | | # We need GLU for e.g. gluBuild2DMipmaps() in the renderers. |
| 102 | | # pthread is needed because some libraries that we load (possibly indirectly), e.g. the libCg.so and libopenal.so, use functions |
| 103 | | # from the pthread library, but have not been linked themselves against it. They rely on the executable to be linked appropriately |
| 104 | | # in order to resolve the pthread symbols. Paul Pluzhnikov states in a newsgroup posting (see [1]) that even if the .so libs were |
| 105 | | # linked against libpthread.so, the main exe still *must* link with -lpthread, too, because: |
| 106 | | # "Note that dlopen()ing an MT library from non-MT executable is not supported on most platforms, certainly not on Linux." |
| 107 | | # [1] http://groups.google.de/group/gnu.gcc.help/browse_thread/thread/1e8f8dfd6027d7fa/ |
| 108 | | # rt is required in order to resolve clock_gettime() in openal-soft. |
| 109 | | envCafu.Append(LIBS=Split("GL GLU rt pthread")) |
| 110 | | # Wrapping -lcfsLib in --whole-archive and --no-whole-archive is required so that the linker puts all symbols that are in libcfsLib.a |
| 111 | | # into the executable, because otherwise, it would omit e.g. some ParticleEngine-related stuff that is not referenced by the engine, |
| 112 | | # and when the game DLL later needs it, we get an "undefined symbol" error from dlopen(). |
| 113 | | # See my post "Having the GNU linker *not* remove unused symbols..." to the gnu.g++.help newsgroup on 2006-04-07, |
| 114 | | # and the replies by Maett and Paul Pluzhnikov. |
| 115 | | # Implementing this by appending to LINKCOM and using --allow-multiple-definition is a SCons-specific hack though, |
| 116 | | # because SCons currently does not support such kind of "wrapping". See my post to the scons-users mailing list on 2006-04-09 |
| 117 | | # at http://scons.tigris.org/servlets/BrowseList?list=users&by=thread&from=455553. |
| 118 | | # The "-llightwave, ..." are all needed as a direct consequence of the forced --whole-archive for cfsLib, |
| 119 | | # which in turn requires these... |
| 120 | | # Note that this (using --whole-archive) is actually the proper strategy under Linux (vs. Windows), because this is *the* way |
| 121 | | # in order to make sure that the -fPIC can be handled correctly - otherwise we had to link .so libs with non-fPIC object files... |
| 122 | | envCafu.Append(LINKCOM=" -Wl,--allow-multiple-definition -Wl,--whole-archive -lcfsLib -lbulletdynamics -lbulletcollision -lbulletmath -lopenal -lalut -lmpg123 -logg -lvorbis -lvorbisfile -Wl,--no-whole-archive -llightwave -lz") |
| 123 | | |
| 124 | | envCafu.Program('Ca3DE/Cafu', |
| 125 | | CafuMainObj + EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"] + WinResource + |
| 126 | | Glob("Ca3DE/Client/*.cpp")) |
| 127 | | |
| 128 | | # Build an explicit dedicated server currently only under Linux. |
| 129 | | # Build it with env.Program() instead of envCafu.Program()? I used env before, and lazily fixed link problems by switching to envCafu... |
| 130 | | if sys.platform=="linux2": |
| 131 | | envCafu.Program('Ca3DE/Cafu-dedicated', CafuMainDediObj + EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"]) |
| 132 | | |
| 133 | | |
| 134 | | |
| 135 | | SourceFilesList=(Glob("CaWE/*.cpp") |
| 136 | | +Glob("CaWE/FontWizard/*.cpp") |
| 137 | | +Glob("CaWE/GuiEditor/*.cpp")+Glob("CaWE/GuiEditor/Commands/*.cpp")+Glob("CaWE/GuiEditor/EditorData/*.cpp") |
| 138 | | +Glob("CaWE/MapCommands/*.cpp") |
| 139 | | +Glob("CaWE/MaterialBrowser/*.cpp") |
| 140 | | +Glob("CaWE/ModelEditor/*.cpp") |
| 141 | | +Glob("CaWE/wxExt/*.cpp") |
| 142 | | +Glob("CaWE/wxFB/*.cpp")) |
| 143 | | |
| 144 | | wxEnv = env.Clone() |
| 145 | | wxEnv.Append(CPPPATH=['ExtLibs/lua/src', |
| 146 | | 'ExtLibs/noise/src']) |
| 147 | | |
| 148 | | if sys.platform=="win32": |
| 149 | | wxPath=CompilerSetup.wxMSW_Path; |
| | 82 | wxPath="#/ExtLibs/wxWidgets"; |
| 183 | | wxEnv.Append(CPPPATH=['/usr/include/freetype2']) # As of 2009-09-10, this line is to become unnecessary in the future, see /usr/include/ftbuild.h for details. |
| 184 | | wxEnv.Append(LINKFLAGS = ['-Wl,--export-dynamic']) # Need this so that the Renderer DLLs can have their unresolved symbols dynamically resolved at load time. |
| 185 | | wxEnv.Append(LIBS = Split("SceneGraph MatSys cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision noise lua minizip lightwave z")) |
| | 130 | # We need GLU for e.g. gluBuild2DMipmaps() in the renderers. |
| | 131 | # pthread is needed because some libraries that we load (possibly indirectly), e.g. the libCg.so and libopenal.so, use functions |
| | 132 | # from the pthread library, but have not been linked themselves against it. They rely on the executable to be linked appropriately |
| | 133 | # in order to resolve the pthread symbols. Paul Pluzhnikov states in a newsgroup posting (see [1]) that even if the .so libs were |
| | 134 | # linked against libpthread.so, the main exe still *must* link with -lpthread, too, because: |
| | 135 | # "Note that dlopen()ing an MT library from non-MT executable is not supported on most platforms, certainly not on Linux." |
| | 136 | # [1] http://groups.google.de/group/gnu.gcc.help/browse_thread/thread/1e8f8dfd6027d7fa/ |
| | 137 | # rt is required in order to resolve clock_gettime() in openal-soft. |
| | 138 | envCafu.Append(LIBS=Split("GL GLU rt pthread")) |
| 187 | | wxEnv.Append(LIBS = Split("wx_gtk2u_gl-2.9 wx_gtk2u_aui-2.9 wx_gtk2u_propgrid-2.9 wx_gtk2u_xrc-2.9 wx_gtk2u_qa-2.9 wx_gtk2u_html-2.9 wx_gtk2u_adv-2.9 wx_gtk2u_core-2.9 wx_baseu_xml-2.9 wx_baseu_net-2.9 wx_baseu-2.9")) |
| 188 | | wxEnv.ParseConfig(wxPath + "/build-gtk/wx-config --cxxflags --libs std,gl") |
| | 140 | # Wrapping -lcfsLib in --whole-archive and --no-whole-archive is required so that the linker puts all symbols that are in libcfsLib.a |
| | 141 | # into the executable, because otherwise, it would omit e.g. some ParticleEngine-related stuff that is not referenced by the engine, |
| | 142 | # and when the game DLL later needs it, we get an "undefined symbol" error from dlopen(). |
| | 143 | # See my post "Having the GNU linker *not* remove unused symbols..." to the gnu.g++.help newsgroup on 2006-04-07, |
| | 144 | # and the replies by Maett and Paul Pluzhnikov. |
| | 145 | # Implementing this by appending to LINKCOM and using --allow-multiple-definition is a SCons-specific hack though, |
| | 146 | # because SCons currently does not support such kind of "wrapping". See my post to the scons-users mailing list on 2006-04-09 |
| | 147 | # at http://scons.tigris.org/servlets/BrowseList?list=users&by=thread&from=455553. |
| | 148 | # The "-llightwave, ..." are all needed as a direct consequence of the forced --whole-archive for cfsLib, |
| | 149 | # which in turn requires these... |
| | 150 | # Note that this (using --whole-archive) is actually the proper strategy under Linux (vs. Windows), because this is *the* way |
| | 151 | # in order to make sure that the -fPIC can be handled correctly - otherwise we had to link .so libs with non-fPIC object files... |
| | 152 | envCafu.Append(LINKCOM=" -Wl,--allow-multiple-definition -Wl,--whole-archive -lcfsLib -lbulletdynamics -lbulletcollision -lbulletmath -lopenal -lalut -lmpg123 -logg -lvorbis -lvorbisfile -Wl,--no-whole-archive -llightwave -lz") |
| 192 | | wxEnv.Program('CaWE/CaWE', SourceFilesList + WinResource + CommonWorldObject) |
| | 156 | EngineCommonAndServerObjs = envCafu.StaticObject(Split("""Ca3DE/AppCafu.cpp Ca3DE/MainCanvas.cpp Ca3DE/MainFrame.cpp Ca3DE/ConDefs.cpp |
| | 157 | Ca3DE/Both/Ca3DEWorld.cpp Ca3DE/Both/EntityManager.cpp Ca3DE/Both/EngineEntity.cpp |
| | 158 | Ca3DE/Server/Server.cpp Ca3DE/Server/ServerWorld.cpp Ca3DE/Server/ClientInfo.cpp""")) |
| | 159 | |
| | 160 | envCafu.Program('Ca3DE/Cafu', |
| | 161 | EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"] + WinResource + |
| | 162 | Glob("Ca3DE/Client/*.cpp")) |
| | 163 | |
| | 164 | |
| | 165 | |
| | 166 | envCaWE = wxEnv.Clone() |
| | 167 | envCaWE.Append(CPPPATH=['ExtLibs/lua/src', 'ExtLibs/noise/src']) |
| | 168 | envCaWE.Append(LIBS = Split("SceneGraph MatSys cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision noise lua minizip lightwave z")) |
| | 169 | |
| | 170 | if sys.platform=="win32": |
| | 171 | envCaWE.Append(CPPPATH=['ExtLibs/freetype/include']) # Windows builds use our local copy, Linux builds (must) use the systems freetype library instead. |
| | 172 | envCaWE.Append(LIBS = Split("freetype")) |
| | 173 | envCaWE.Append(LIBS = Split("advapi32 comctl32 comdlg32 gdi32 ole32 oleaut32 opengl32 rpcrt4 shell32 user32 winspool wsock32")) |
| | 174 | |
| | 175 | WinResource=envCaWE.RES("CaWE/CaWE.rc") |
| | 176 | |
| | 177 | elif sys.platform=="linux2": |
| | 178 | envCaWE.Append(CPPPATH=['/usr/include/freetype2']) # As of 2009-09-10, this line is to become unnecessary in the future, see /usr/include/ftbuild.h for details. |
| | 179 | envCaWE.Append(LINKFLAGS = ['-Wl,--export-dynamic']) # Need this so that the Renderer DLLs can have their unresolved symbols dynamically resolved at load time. |
| | 180 | |
| | 181 | WinResource=[] |
| | 182 | |
| | 183 | SourceFilesList=(Glob("CaWE/*.cpp") |
| | 184 | +Glob("CaWE/FontWizard/*.cpp") |
| | 185 | +Glob("CaWE/GuiEditor/*.cpp")+Glob("CaWE/GuiEditor/Commands/*.cpp")+Glob("CaWE/GuiEditor/EditorData/*.cpp") |
| | 186 | +Glob("CaWE/MapCommands/*.cpp") |
| | 187 | +Glob("CaWE/MaterialBrowser/*.cpp") |
| | 188 | +Glob("CaWE/ModelEditor/*.cpp") |
| | 189 | +Glob("CaWE/wxExt/*.cpp") |
| | 190 | +Glob("CaWE/wxFB/*.cpp")) |
| | 191 | |
| | 192 | envCaWE.Program('CaWE/CaWE', SourceFilesList + WinResource + CommonWorldObject) |