Fix the console build on Mac

cmake still does not create a nice bundle for it, but at least
the build does not fail anymore.
shapetextures
Armin Burgmeier 2015-12-23 16:30:01 -08:00 committed by Armin Burgmeier
parent 3899add001
commit d7a5ac373d
6 changed files with 21 additions and 15 deletions

View File

@ -621,6 +621,7 @@ list(APPEND MAPE_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/mape-icons.h)
# source files specific to an operating system
if(APPLE)
list(APPEND OC_SYSTEM_SOURCES
src/platform/C4AppMac.mm
src/platform/C4FileMonitorMac.mm
src/platform/C4AppDelegate.h
src/platform/C4AppDelegate.mm
@ -718,7 +719,6 @@ elseif(WIN32)
elseif(USE_COCOA)
list(APPEND OC_GUI_SOURCES
src/editor/C4ConsoleCocoa.mm
src/platform/C4AppMac.mm
src/platform/C4WindowMac.mm
src/platform/C4AppDelegate+MainMenuActions.h
src/platform/C4AppDelegate+MainMenuActions.mm
@ -1330,6 +1330,7 @@ if(USE_X11)
endif()
if(USE_COCOA)
TARGET_LINK_LIBRARIES(openclonk "-framework Cocoa -framework AppKit -framework Quartz -framework OpenAL -framework AudioToolbox")
TARGET_LINK_LIBRARIES(openclonk-server "-framework Cocoa")
endif()
if (WIN32)
# CMake is too incompetent to check whether these libraries can be linked to

View File

@ -156,15 +156,16 @@ protected:
public:
void HandleSDLEvent(SDL_Event& event);
#elif defined(USE_COCOA)
public:
StdStrBuf GetGameDataPath();
#elif defined(USE_CONSOLE)
protected:
C4StdInProc InProc;
#endif
#ifdef __APPLE__
public:
StdStrBuf GetGameDataPath();
#endif
#ifdef USE_WIN32_WINDOWS
private:
CStdMessageProc MessageProc;

View File

@ -34,8 +34,10 @@
{
NSMutableArray *gatheredArguments;
NSString *addonSupplied;
#ifdef USE_COCOA
C4EditorWindowController *editorWindowController;
C4WindowController *gameWindowController;
#endif
BOOL running;
std::vector<char*> args;
}

View File

@ -283,8 +283,10 @@
- (void) applicationDidBecomeActive:(NSNotification*)notification
{
#ifdef USE_COCOA
if (gameWindowController)
[gameWindowController.window makeKeyAndOrderFront:self];
#endif
}
@end

View File

@ -23,12 +23,13 @@
#include <C4Window.h>
#include <C4Draw.h>
#include "C4App.h"
#import <Cocoa/Cocoa.h>
#ifndef USE_CONSOLE
#import "C4WindowController.h"
#import "C4DrawGLMac.h"
#include "C4App.h"
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
@ -151,11 +152,6 @@ void C4AbstractApp::RestoreVideoMode()
{
}
StdStrBuf C4AbstractApp::GetGameDataPath()
{
return StdCopyStrBuf([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]);
}
bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int iColorDepth, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
{
fFullScreen &= !lionAndBeyond(); // Always false for Lion since then Lion's true(tm) Fullscreen is used
@ -190,7 +186,8 @@ bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int iColorDepth,
return true;
}
#endif
#endif // USE_COCOA
#endif // USE_CONSOLE
bool IsGermanSystem()
{
@ -215,3 +212,8 @@ bool EraseItemSafe(const char* szFilename)
files: [NSArray arrayWithObject: [filename lastPathComponent]]
tag: 0];
}
StdStrBuf C4AbstractApp::GetGameDataPath()
{
return StdCopyStrBuf([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]);
}

View File

@ -15,7 +15,6 @@
#include <C4Include.h>
#include <StdScheduler.h>
#ifdef USE_COCOA
#import <Cocoa/Cocoa.h>
using namespace std;
@ -296,4 +295,3 @@ void StdScheduler::Changed(StdSchedulerProc* pProc)
{
[[[SCHAdditions requestAdditionsForScheduler:this] additionForProc:pProc] changed];
}
#endif