# Linux/ICC fixes
- added "--icc" Premake flag, to disable PCH and set different warning flags - added required headers - changed debug_warn to not generate constant-expression-in-conditional warnings - changed FAM popup-warning into a log message, so it's not so irritating - Atlas: pass around wxGLCanvas instead of wxGLContext, because the context is sometimes just NULL This was SVN commit r4733.
This commit is contained in:
parent
15e7bae0ba
commit
1926317975
@ -1,5 +1,6 @@
|
||||
addoption("atlas", "Include Atlas scenario editor packages")
|
||||
addoption("collada", "Include COLLADA packages (requires FCollada library)")
|
||||
addoption("icc", "Use Intel C++ Compiler (Linux only; should set CXX=icpc before calling make)")
|
||||
addoption("outpath", "Location for generated project files")
|
||||
addoption("without-tests", "Disable generation of test projects")
|
||||
addoption("without-pch", "Disable generation and usage of precompiled headers")
|
||||
@ -25,6 +26,10 @@ else
|
||||
project.cxxtestpath = "../../build/bin/cxxtestgen.pl"
|
||||
end
|
||||
|
||||
if OS == "linux" and options["icc"] then
|
||||
options["without-pch"] = 1 -- ICC9.1 doesn't support GCC-style PCH
|
||||
end
|
||||
|
||||
source_root = "../../../source/" -- default for most projects - overridden by local in others
|
||||
|
||||
-- Rationale: packages should not have any additional include paths except for
|
||||
@ -56,7 +61,10 @@ end
|
||||
|
||||
function package_set_build_flags()
|
||||
|
||||
package.buildflags = { "with-symbols", "no-edit-and-continue", "extra-warnings" }
|
||||
package.buildflags = { "with-symbols", "no-edit-and-continue" }
|
||||
if not options["icc"] then
|
||||
tinsert(package.buildflags, "extra-warnings") -- this causes far too many warnings/remarks on ICC
|
||||
end
|
||||
|
||||
-- PremakeWiki says with-symbols and optimize are automatically set for
|
||||
-- Debug and Release builds, respectively. doesn't happen though, so do it manually.
|
||||
@ -74,30 +82,48 @@ function package_set_build_flags()
|
||||
-- use native wchar_t type (not typedef to unsigned short)
|
||||
tinsert(package.buildflags, "native-wchar_t")
|
||||
else -- *nix
|
||||
package.buildoptions = {
|
||||
"-Wall",
|
||||
"-Wunused-parameter", -- needs to be enabled explicitly
|
||||
"-Wno-switch", -- enumeration value not handled in switch
|
||||
"-Wno-reorder", -- order of initialization list in constructors
|
||||
"-Wno-non-virtual-dtor",
|
||||
|
||||
-- do something (?) so that ccache can handle compilation with PCH enabled
|
||||
"-fpch-preprocess",
|
||||
|
||||
-- speed up math functions by inlining. warning: this may result in
|
||||
-- non-IEEE-conformant results, but haven't noticed any trouble so far.
|
||||
"-ffast-math",
|
||||
}
|
||||
if options["icc"] then
|
||||
tinsert(package.buildoptions, {
|
||||
"-w1",
|
||||
"-Wabi",
|
||||
-- "-Wp64", -- complains about OBJECT_TO_JSVAL which is annoying
|
||||
"-Wpointer-arith",
|
||||
"-Wreturn-type",
|
||||
-- "-Wshadow",
|
||||
"-Wuninitialized",
|
||||
"-Wunknown-pragmas",
|
||||
"-Wunused-function",
|
||||
})
|
||||
tinsert(package.config["Debug"].buildoptions, {
|
||||
"-O0", -- ICC defaults to -O2
|
||||
})
|
||||
else
|
||||
tinsert(package.buildoptions, {
|
||||
"-Wall",
|
||||
"-Wunused-parameter", -- needs to be enabled explicitly
|
||||
"-Wno-switch", -- enumeration value not handled in switch
|
||||
"-Wno-reorder", -- order of initialization list in constructors
|
||||
"-Wno-non-virtual-dtor",
|
||||
|
||||
-- do something (?) so that ccache can handle compilation with PCH enabled
|
||||
"-fpch-preprocess",
|
||||
|
||||
-- speed up math functions by inlining. warning: this may result in
|
||||
-- non-IEEE-conformant results, but haven't noticed any trouble so far.
|
||||
"-ffast-math",
|
||||
})
|
||||
end
|
||||
package.includepaths = {
|
||||
"/usr/X11R6/include/X11",
|
||||
"/usr/include/X11",
|
||||
}
|
||||
package.libpaths = {
|
||||
"/usr/X11R6/lib"
|
||||
"/usr/X11R6/lib",
|
||||
"/usr/i686-pc-linux-gnu/lib", -- needed for ICC to find libbfd
|
||||
}
|
||||
package.defines = {
|
||||
"__STDC_VERSION__=199901L",
|
||||
"CONFIG_USE_MMGR"
|
||||
"CONFIG_USE_MMGR",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -352,8 +352,21 @@ STMT(\
|
||||
* completely eliminate the problem; replacing 0 literals with extern
|
||||
* volatile variables fools VC7 but isn't guaranteed to be free of overhead.
|
||||
* we therefore just squelch the warning (unfortunately non-portable).
|
||||
* this duplicates the code from debug_assert to avoid compiler warnings about
|
||||
* constant conditions.
|
||||
**/
|
||||
#define debug_warn(str) debug_assert((str) && 0)
|
||||
#define debug_warn(expr) \
|
||||
STMT(\
|
||||
static u8 suppress__;\
|
||||
switch(debug_assert_failed(#expr, &suppress__, __FILE__, __LINE__, __func__))\
|
||||
{\
|
||||
case ER_BREAK:\
|
||||
debug_break();\
|
||||
break;\
|
||||
default:\
|
||||
break;\
|
||||
}\
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "path_util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "string_s.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "lib.h"
|
||||
#include "posix/posix_types.h" // SIZE_MAX
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "lib/lib.h"
|
||||
#include "lib/res/file/file.h"
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
#include <fam.h>
|
||||
|
||||
@ -40,7 +41,7 @@ LibError dir_add_watch(const char* const n_full_path, intptr_t* const watch)
|
||||
else
|
||||
{
|
||||
initialized = -1;
|
||||
DISPLAY_ERROR(L"Error initializing FAM; hotloading will be disabled");
|
||||
LOG(ERROR, "", "Error initializing FAM; hotloading will be disabled");
|
||||
return ERR::FAIL; // NOWARN
|
||||
}
|
||||
}
|
||||
|
@ -21,13 +21,13 @@
|
||||
#define bfd_get_section_size bfd_get_section_size_before_reloc
|
||||
#endif
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#if OS_LINUX
|
||||
#define GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#if OS_LINUX
|
||||
# define DEBUGGER_WAIT 3
|
||||
# define DEBUGGER_CMD "gdb"
|
||||
# define DEBUGGER_ARG_FORMAT "--pid=%d"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#if !OS_WIN
|
||||
# include <fcntl.h>
|
||||
# include <signal.h>
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "lib/posix/posix_dlfcn.h"
|
||||
#include "lib/lib.h"
|
||||
#include "ps/CStr.h"
|
||||
|
||||
void* const HANDLE_UNAVAILABLE = (void*)-1;
|
||||
|
||||
|
@ -19,8 +19,8 @@ struct SColour : public CJSObject<SColour>
|
||||
public:
|
||||
float r, g, b, a; /* 0...1 */
|
||||
SColour() { SColourInit( 0.0f, 0.0f, 0.0f, 0.0f ); }
|
||||
SColour( float r, float g, float b ) { SColourInit( r, g, b, 1.0f ); }
|
||||
SColour( float r, float g, float b, float a ) { SColourInit( r, g, b, a ); }
|
||||
SColour( float r_, float g_, float b_ ) { SColourInit( r_, g_, b_, 1.0f ); }
|
||||
SColour( float r_, float g_, float b_, float a_ ) { SColourInit( r_, g_, b_, a ); }
|
||||
SColour( const SColour& other ) { SColourInit( other.r, other.g, other.b, other.a ); }
|
||||
void SColourInit( float r, float g, float b, float a );
|
||||
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "EntityHandles.h"
|
||||
#include "ps/Vector2D.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
// An order data field, which could represent different things depending on the type of order.
|
||||
struct SOrderData
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ ActorViewer::ActorViewer(wxWindow* parent)
|
||||
#ifdef __WXMSW__
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
#endif
|
||||
POST_MESSAGE(SetContext, (canvas->GetContext()));
|
||||
POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas)));
|
||||
|
||||
POST_MESSAGE(Init, (false));
|
||||
|
||||
|
@ -29,14 +29,14 @@ using namespace AtlasMessage;
|
||||
|
||||
// GL functions exported from DLL, and called by game (in a separate
|
||||
// thread to the standard wx one)
|
||||
ATLASDLLIMPEXP void Atlas_GLSetCurrent(void* context)
|
||||
ATLASDLLIMPEXP void Atlas_GLSetCurrent(void* canvas)
|
||||
{
|
||||
((wxGLContext*)context)->SetCurrent();
|
||||
static_cast<wxGLCanvas*>(canvas)->SetCurrent();
|
||||
}
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_GLSwapBuffers(void* context)
|
||||
ATLASDLLIMPEXP void Atlas_GLSwapBuffers(void* canvas)
|
||||
{
|
||||
((wxGLContext*)context)->SwapBuffers();
|
||||
static_cast<wxGLCanvas*>(canvas)->SwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
@ -396,13 +396,7 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
|
||||
|
||||
// Send setup messages to game engine:
|
||||
|
||||
/*canvas->Reparent(parent);
|
||||
//canvas->SetCurrent();
|
||||
canvas->Show(TRUE);*/
|
||||
|
||||
printf("posting setcontext with canvas %p\n", canvas->GetContext());
|
||||
if (canvas->GetContext() != 0)
|
||||
POST_MESSAGE(SetContext, (canvas->GetContext()));
|
||||
POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas)));
|
||||
|
||||
POST_MESSAGE(Init, (true));
|
||||
|
||||
|
@ -29,8 +29,8 @@ namespace AtlasMessage
|
||||
// Loaded from DLL:
|
||||
void (*Atlas_StartWindow)(const wchar_t* type);
|
||||
void (*Atlas_SetMessagePasser)(MessagePasser*);
|
||||
void (*Atlas_GLSetCurrent)(void* context);
|
||||
void (*Atlas_GLSwapBuffers)(void* context);
|
||||
void (*Atlas_GLSetCurrent)(void* cavas);
|
||||
void (*Atlas_GLSwapBuffers)(void* canvas);
|
||||
void (*Atlas_NotifyEndOfFrame)();
|
||||
void (*Atlas_DisplayError)(const wchar_t* text, unsigned int flags);
|
||||
namespace AtlasMessage
|
||||
@ -114,7 +114,7 @@ bool BeginAtlas(const CmdLineArgs& args, const DllLoader& dll)
|
||||
state.args = args;
|
||||
state.running = true;
|
||||
state.view = View::GetView_None();
|
||||
state.glContext = NULL;
|
||||
state.glCanvas = NULL;
|
||||
|
||||
double last_activity = get_time();
|
||||
|
||||
|
@ -14,7 +14,7 @@ struct GameLoopState
|
||||
bool running; // whether the Atlas game loop is still running
|
||||
View* view; // current 'view' (controls updates, rendering, etc)
|
||||
|
||||
const void* glContext;
|
||||
const void* glCanvas; // the wxGlCanvas to draw on
|
||||
float frameLength; // smoothed to avoid large jumps
|
||||
|
||||
struct Input
|
||||
|
@ -109,11 +109,11 @@ MESSAGEHANDLER(SetActorViewer)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MESSAGEHANDLER(SetContext)
|
||||
MESSAGEHANDLER(SetCanvas)
|
||||
{
|
||||
g_GameLoop->glContext = msg->context;
|
||||
printf("Setting gl context to %p\n", g_GameLoop->glContext);
|
||||
Atlas_GLSetCurrent((void*)g_GameLoop->glContext);
|
||||
g_GameLoop->glCanvas = msg->canvas;
|
||||
printf("Setting gl canvas to %p\n", g_GameLoop->glCanvas);
|
||||
Atlas_GLSetCurrent(const_cast<void*>(g_GameLoop->glCanvas));
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ QUERYHANDLER(CinemaRecord)
|
||||
{
|
||||
manager->MoveToPointAbsolute((float)frame/msg->framerate);
|
||||
Render();
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glContext);
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glCanvas);
|
||||
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, img);
|
||||
|
||||
// Swap the rows around, else the image will be upside down
|
||||
|
@ -43,8 +43,8 @@ QUERY(Ping, , );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MESSAGE(SetContext,
|
||||
((void*, context))
|
||||
MESSAGE(SetCanvas,
|
||||
((void*, canvas))
|
||||
);
|
||||
|
||||
MESSAGE(ResizeScreen,
|
||||
|
@ -55,7 +55,7 @@ void ViewActor::Render()
|
||||
camera.UpdateFrustum();
|
||||
|
||||
m_ActorViewer->Render();
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glContext);
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glCanvas);
|
||||
}
|
||||
|
||||
CCamera& ViewActor::GetCamera()
|
||||
@ -140,7 +140,7 @@ void ViewGame::Render()
|
||||
|
||||
::Render();
|
||||
AtlasMessage::AtlasRenderSelection();
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glContext);
|
||||
Atlas_GLSwapBuffers((void*)g_GameLoop->glCanvas);
|
||||
}
|
||||
|
||||
CCamera& ViewGame::GetCamera()
|
||||
|
Loading…
Reference in New Issue
Block a user