forked from mirrors/0ad
Moved X11 stuff out of unix/ folder, added osx/ sysdep folder, corresponding premake.lua changes, and a few misc other Mac OS X-related changes
This was SVN commit r5320.
This commit is contained in:
@@ -108,6 +108,7 @@ extern_lib_defs = {
|
||||
opengl = {
|
||||
win_names = { "opengl32", "glu32", "gdi32" },
|
||||
unix_names = { "GL", "GLU", "X11" },
|
||||
osx_frameworks = { "OpenGL" },
|
||||
dbg_suffix = "",
|
||||
},
|
||||
spidermonkey = {
|
||||
|
||||
+33
-22
@@ -110,6 +110,9 @@ function package_set_build_flags()
|
||||
tinsert(package.config["Debug"].buildoptions, {
|
||||
"-O0", -- ICC defaults to -O2
|
||||
})
|
||||
if OS == "macosx" then
|
||||
tinsert(package.linkoptions, {"-multiply_defined","suppress"})
|
||||
end
|
||||
else
|
||||
tinsert(package.buildoptions, {
|
||||
"-Wall",
|
||||
@@ -135,25 +138,27 @@ function package_set_build_flags()
|
||||
"-fvisibility-inlines-hidden",
|
||||
})
|
||||
|
||||
-- Include and lib paths:
|
||||
-- X11 includes may be installed in one of a gaszillion of three places
|
||||
-- And MacPorts uses /opt/local as its prefix
|
||||
-- Famous last words: "You can't include too much! ;-)"
|
||||
|
||||
package.includepaths = {
|
||||
"/usr/X11R6/include/X11",
|
||||
"/usr/X11R6/include",
|
||||
"/usr/include/X11",
|
||||
"/opt/local/include",
|
||||
}
|
||||
package.libpaths = {
|
||||
"/opt/local/lib",
|
||||
"/usr/X11R6/lib"
|
||||
}
|
||||
if OS == "macosx" then
|
||||
-- MacPorts uses /opt/local as its prefix
|
||||
package.includepaths = { "/opt/local/include" }
|
||||
package.libpaths = { "/opt/local/lib" }
|
||||
else
|
||||
-- X11 includes may be installed in one of a gadzillion of three places
|
||||
-- Famous last words: "You can't include too much! ;-)"
|
||||
package.includepaths = {
|
||||
"/usr/X11R6/include/X11",
|
||||
"/usr/X11R6/include",
|
||||
"/usr/include/X11"
|
||||
}
|
||||
package.libpaths = {
|
||||
"/usr/X11R6/lib"
|
||||
}
|
||||
end
|
||||
if OS == "linux" and options["icc"] then
|
||||
tinsert(package.libpaths,
|
||||
"/usr/i686-pc-linux-gnu/lib") -- needed for ICC to find libbfd
|
||||
end
|
||||
|
||||
package.defines = {
|
||||
-- "CONFIG_USE_MMGR",
|
||||
}
|
||||
@@ -412,15 +417,18 @@ function setup_all_libs ()
|
||||
"cryptopp",
|
||||
"valgrind"
|
||||
}
|
||||
setup_static_lib_package("lowlevel", source_dirs, extern_libs, {})
|
||||
sysdep_dirs = {
|
||||
linux = { "lib/sysdep/unix" },
|
||||
linux = { "lib/sysdep/unix", "lib/sysdep/unix/x" },
|
||||
-- note: RC file must be added to main_exe package.
|
||||
-- note: don't add "lib/sysdep/win/aken.cpp" because that must be compiled with the DDK.
|
||||
windows = { "lib/sysdep/win", "lib/sysdep/win/wposix", "lib/sysdep/win/whrt" },
|
||||
macosx = { "lib/sysdep/osx", "lib/sysdep/unix" },
|
||||
}
|
||||
tinsert(package.files, sourcesfromdirs(source_root, sysdep_dirs[OS]));
|
||||
for i,v in sysdep_dirs[OS] do
|
||||
tinsert(source_dirs, v);
|
||||
end
|
||||
-- tinsert(source_dirs, sysdep_dirs[OS]);
|
||||
setup_static_lib_package("lowlevel", source_dirs, extern_libs, {})
|
||||
end
|
||||
|
||||
|
||||
@@ -521,8 +529,6 @@ function setup_main_exe ()
|
||||
tinsert(package.links, { -- Utilities
|
||||
"pthread"
|
||||
})
|
||||
|
||||
tinsert(package.libpaths, "/usr/X11R6/lib")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -564,7 +570,7 @@ function setup_atlas_package(package_name, target_type, rel_source_dirs, rel_inc
|
||||
listconcat(package.links, extra_params["extra_links"])
|
||||
end
|
||||
|
||||
else -- Non-Windows, = Unix
|
||||
elseif OS == "linux" then
|
||||
tinsert(package.buildoptions, "-rdynamic")
|
||||
tinsert(package.linkoptions, "-rdynamic")
|
||||
|
||||
@@ -757,13 +763,18 @@ function setup_collada_package(package_name, target_type, rel_source_dirs, rel_i
|
||||
listconcat(package.links, extra_params["extra_links"])
|
||||
end
|
||||
|
||||
else -- Non-Windows, = Unix
|
||||
elseif OS == "linux" then
|
||||
tinsert(package.defines, "LINUX");
|
||||
tinsert(package.includepaths, "/usr/include/libxml2")
|
||||
tinsert(package.links, "xml2")
|
||||
|
||||
tinsert(package.buildoptions, "-rdynamic")
|
||||
tinsert(package.linkoptions, "-rdynamic")
|
||||
elseif OS == "macosx" then
|
||||
-- define MACOS-something?
|
||||
|
||||
tinsert(package.buildoptions, "`pkg-config libxml-2.0 --cflags`")
|
||||
tinsert(package.linkoptions, "`pkg-config libxml-2.0 --libs`")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -121,11 +121,11 @@ int gnu_cpp()
|
||||
|
||||
/* Write linker flags */
|
||||
io_print(" LDFLAGS += -L$(BINDIR) -L$(LIBDIR)");
|
||||
if (prj_is_kind("dll") && (g_cc == NULL || matches(g_cc, "gcc") || matches(g_cc, "icc")))
|
||||
if (prj_is_kind("dll") && (g_cc == NULL || matches(g_cc, "gcc") || matches(g_cc, "icc")) && !os_is("macosx"))
|
||||
io_print(" -shared");
|
||||
if (prj_has_flag("no-symbols"))
|
||||
io_print(" -s");
|
||||
if (os_is("macosx") && prj_has_flag("dylib"))
|
||||
if (os_is("macosx") && (prj_has_flag("dylib") || prj_is_kind("dll")))
|
||||
io_print(" -dynamiclib -flat_namespace");
|
||||
// Use start-group and end-group to get around the problem with the
|
||||
// order of link arguments.
|
||||
@@ -249,8 +249,15 @@ int gnu_cpp()
|
||||
io_print("\t-%s$(CMD_MKLIBDIR)\n", prefix);
|
||||
io_print("\t-%s$(CMD_MKOUTDIR)\n", prefix);
|
||||
if (os_is("macosx") && prj_is_kind("winexe"))
|
||||
{
|
||||
io_print("\t-%sif [ ! -d $(OUTDIR)/$(MACAPP)/MacOS ]; then mkdir -p $(OUTDIR)/$(MACAPP)/MacOS; fi\n", prefix);
|
||||
io_print("\t%s$(BLDCMD)\n\n", prefix);
|
||||
io_print("\t%s$(BLDCMD)\n", prefix);
|
||||
io_print("\t%scp $(OUTDIR)/$(TARGET) $(OUTDIR)/$(MACAPP)/MacOS/$(TARGET)\n\n", prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
io_print("\t%s$(BLDCMD)\n\n", prefix);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -268,8 +275,12 @@ int gnu_cpp()
|
||||
|
||||
if (os_is("macosx") && prj_is_kind("winexe"))
|
||||
{
|
||||
io_print("$(OUTDIR)/$(MACAPP)/PkgInfo:\n\n");
|
||||
io_print("$(OUTDIR)/$(MACAPP)/Info.plist:\n\n");
|
||||
io_print("$(OUTDIR)/$(MACAPP)/PkgInfo:\n"
|
||||
"\t%smkdir -p $(OUTDIR)/$(MACAPP)\n"
|
||||
"\t%stouch $@\n\n", prefix, prefix);
|
||||
io_print("$(OUTDIR)/$(MACAPP)/Info.plist:\n"
|
||||
"\t%smkdir -p $(OUTDIR)/$(MACAPP)\n"
|
||||
"\t%stouch $@\n\n", prefix, prefix);
|
||||
}
|
||||
|
||||
/* Write the "clean" target */
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
// license: GPL; see lib/license.txt
|
||||
|
||||
#if OS_MACOSX
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#if OS_WIN
|
||||
# include <GL/wglext.h>
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#if OS_WIN
|
||||
# include "lib/sysdep/win/wcpu.h"
|
||||
#endif
|
||||
#if OS_UNIX
|
||||
# include "lib/sysdep/unix/ucpu.h"
|
||||
#endif
|
||||
|
||||
|
||||
ERROR_ASSOCIATE(ERR::CPU_FEATURE_MISSING, "This CPU doesn't support a required feature", -1);
|
||||
@@ -241,12 +244,8 @@ LibError cpu_CallByEachCPU(CpuCallback cb, void* param)
|
||||
{
|
||||
#if OS_WIN
|
||||
return wcpu_CallByEachCPU(cb, param);
|
||||
#elif OS_LINUX
|
||||
return ucpu_CallByEachCPU(cb, param);
|
||||
#else
|
||||
UNUSED2(cb);
|
||||
UNUSED2(param);
|
||||
return ERR::NOT_IMPLEMENTED;
|
||||
return ucpu_CallByEachCPU(cb, param);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "lib/lib.h"
|
||||
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
#include "lib/sysdep/gfx.h"
|
||||
|
||||
// "copy" text into the clipboard. replaces previous contents.
|
||||
LibError sys_clipboard_set(const wchar_t* text)
|
||||
{
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
// allow "pasting" from clipboard. returns the current contents if they
|
||||
// can be represented as text, otherwise 0.
|
||||
// when it is no longer needed, the returned pointer must be freed via
|
||||
// sys_clipboard_free. (NB: not necessary if zero, but doesn't hurt)
|
||||
wchar_t* sys_clipboard_get(void)
|
||||
{
|
||||
// Remember to implement sys_clipboard_free when implementing this method!
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// frees memory used by <copy>, which must have been returned by
|
||||
// sys_clipboard_get. see note above.
|
||||
LibError sys_clipboard_free(wchar_t* copy)
|
||||
{
|
||||
// Since clipboard_get never returns allocated memory (unimplemented), we
|
||||
// should only ever get called with a NULL pointer.
|
||||
debug_assert(!copy);
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get current video mode.
|
||||
*
|
||||
* this is useful when choosing a new video mode.
|
||||
*
|
||||
* @param xres, yres (optional out) resolution [pixels]
|
||||
* @param bpp (optional out) bits per pixel
|
||||
* @param freq (optional out) vertical refresh rate [Hz]
|
||||
* @return LibError; INFO::OK unless: some information was requested
|
||||
* (i.e. pointer is non-NULL) but cannot be returned.
|
||||
* on failure, the outputs are all left unchanged (they are
|
||||
* assumed initialized to defaults)
|
||||
**/
|
||||
LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq)
|
||||
{
|
||||
// TODO Implement
|
||||
return ERR::NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -28,15 +28,6 @@ static size_t selection_size=0;
|
||||
// if we fail, outputs are unchanged (assumed initialized to defaults)
|
||||
LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq)
|
||||
{
|
||||
#if OS_MACOSX
|
||||
// There might not be X. Instead, we should use Carbon. For now however,
|
||||
// return some defaults.
|
||||
*xres = 1024;
|
||||
*yres = 768;
|
||||
*bpp = 32;
|
||||
*freq = 0;
|
||||
return INFO::OK;
|
||||
#else
|
||||
Display* disp = XOpenDisplay(0);
|
||||
if(!disp)
|
||||
WARN_RETURN(ERR::FAIL);
|
||||
@@ -64,7 +55,6 @@ LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq)
|
||||
*freq = 0;
|
||||
XCloseDisplay(disp);
|
||||
return INFO::OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
class wxTreeCtrl;
|
||||
class wxTreeEvent;
|
||||
|
||||
class ActorViewer : public wxFrame
|
||||
{
|
||||
|
||||
@@ -217,7 +217,15 @@ void FilePreviewer::PreviewFile(const wxString& filename, SeekableInputStream& s
|
||||
#else
|
||||
static wxSound snd;
|
||||
snd.Stop();
|
||||
// HACK, FIXME, XXX: I'd like to call the wx people idiots for
|
||||
// having different API:s on different platforms, as well as for
|
||||
// having public non-API methods.
|
||||
#if __APPLE__
|
||||
snd.~wxSound();
|
||||
new (&snd) wxSound((int)bufSize, (const wxByte*)buf);
|
||||
#else
|
||||
snd.Create((int)bufSize, (const wxByte*)buf);
|
||||
#endif
|
||||
snd.Play();
|
||||
#endif
|
||||
stream.ReleaseBuffer(buf);
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "EditableListCtrl/EditableListCtrl.h"
|
||||
|
||||
#include "wx/listctrl.h"
|
||||
|
||||
class DragCommand;
|
||||
|
||||
class DraggableListCtrl : public EditableListCtrl
|
||||
|
||||
@@ -26,6 +26,7 @@ Please complain if I forget to do those things.
|
||||
// ugly hack to make recent versions of FFmpeg work
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#undef _STDINT_H
|
||||
#undef _STDINT_H_
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
@@ -47,8 +48,12 @@ typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
#endif
|
||||
|
||||
#define UNUSED(arg)
|
||||
|
||||
extern "C" {
|
||||
#include "ffmpeg/avformat.h"
|
||||
#include "ffmpeg/swscale.h"
|
||||
}
|
||||
// (Have to use a sufficiently recent version to get swscale - it needs the ~x86 keyword on Gentoo)
|
||||
|
||||
struct VideoEncoderImpl
|
||||
@@ -269,7 +274,7 @@ struct VideoEncoderImpl
|
||||
frame_count++;
|
||||
}
|
||||
|
||||
void close_video(AVFormatContext *oc, AVStream *st)
|
||||
void close_video(AVFormatContext *UNUSED(oc), AVStream *st)
|
||||
{
|
||||
avcodec_close(st->codec);
|
||||
av_free(picture->data[0]);
|
||||
@@ -284,7 +289,7 @@ struct VideoEncoderImpl
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void log(void* v, int i, const char* format, va_list ap)
|
||||
void log(void* UNUSED(v), int i, const char* format, va_list ap)
|
||||
{
|
||||
char buf[512];
|
||||
vsnprintf(buf, sizeof(buf), format, ap);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "wx/filename.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ class TriggerBottomBar;
|
||||
class TriggerPage;
|
||||
class wxTreeItemId;
|
||||
class wxTreeItemData;
|
||||
class wxTreeEvent;
|
||||
class wxListEvent;
|
||||
class wxNotebook;
|
||||
class wxNotebookEvent;
|
||||
class wxTreeEvent;
|
||||
|
||||
@@ -17,7 +17,9 @@ MessagePasserImpl::MessagePasserImpl()
|
||||
{
|
||||
CStr name = "/wfg-atlas-msgpass-" + CStr(rand(100000, 1000000));
|
||||
sem_t* sem = sem_open(name, O_CREAT | O_EXCL, 0700, 0);
|
||||
if (sem == SEM_FAILED)
|
||||
// This cast should not be necessary, but apparently SEM_FAILED is not
|
||||
// a value of a pointer type
|
||||
if (sem == (sem_t*)SEM_FAILED)
|
||||
{
|
||||
int err = errno;
|
||||
if (err == EEXIST)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "Shareable.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class wxPoint;
|
||||
class CVector3D;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user