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

View File

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

View File

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

View File

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

View File

@ -23,12 +23,13 @@
#include <C4Window.h> #include <C4Window.h>
#include <C4Draw.h> #include <C4Draw.h>
#include "C4App.h"
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#ifndef USE_CONSOLE
#import "C4WindowController.h" #import "C4WindowController.h"
#import "C4DrawGLMac.h" #import "C4DrawGLMac.h"
#include "C4App.h"
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard) bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
{ {
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; 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) 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 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; return true;
} }
#endif #endif // USE_COCOA
#endif // USE_CONSOLE
bool IsGermanSystem() bool IsGermanSystem()
{ {
@ -215,3 +212,8 @@ bool EraseItemSafe(const char* szFilename)
files: [NSArray arrayWithObject: [filename lastPathComponent]] files: [NSArray arrayWithObject: [filename lastPathComponent]]
tag: 0]; tag: 0];
} }
StdStrBuf C4AbstractApp::GetGameDataPath()
{
return StdCopyStrBuf([[[NSBundle mainBundle] resourcePath] fileSystemRepresentation]);
}

View File

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