mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
OS X native backend no longer use files from src/sdl directly
Cocoa backend is compiling but failed to link Some files are referenced using symbolic links Apple's HID Utilities were moved to own directory
This commit is contained in:
parent
0cf8c1baea
commit
8d16c2e3c0
25 changed files with 161 additions and 77 deletions
|
@ -545,7 +545,7 @@ set( PLAT_WIN32_SOURCES
|
|||
win32/i_system.cpp
|
||||
win32/st_start.cpp
|
||||
win32/win32video.cpp )
|
||||
set( PLAT_SDL_SYSTEM_SOURCES
|
||||
set( PLAT_SDL_SOURCES
|
||||
sdl/crashcatcher.c
|
||||
sdl/hardware.cpp
|
||||
sdl/i_cd.cpp
|
||||
|
@ -553,8 +553,7 @@ set( PLAT_SDL_SYSTEM_SOURCES
|
|||
sdl/i_movie.cpp
|
||||
sdl/i_system.cpp
|
||||
sdl/sdlvideo.cpp
|
||||
sdl/st_start.cpp )
|
||||
set( PLAT_SDL_SPECIAL_SOURCES
|
||||
sdl/st_start.cpp
|
||||
sdl/i_gui.cpp
|
||||
sdl/i_input.cpp
|
||||
sdl/i_joystick.cpp
|
||||
|
@ -563,39 +562,27 @@ set( PLAT_MAC_SOURCES
|
|||
cocoa/iwadpicker_cocoa.mm
|
||||
cocoa/i_system_cocoa.mm )
|
||||
set( PLAT_COCOA_SOURCES
|
||||
cocoa/HID_Config_Utilities.c
|
||||
cocoa/HID_Error_Handler.c
|
||||
cocoa/HID_Name_Lookup.c
|
||||
cocoa/HID_Queue_Utilities.c
|
||||
cocoa/HID_Utilities.c
|
||||
cocoa/IOHIDDevice_.c
|
||||
cocoa/IOHIDElement_.c
|
||||
cocoa/ImmrHIDUtilAddOn.c
|
||||
cocoa/hid/HID_Config_Utilities.c
|
||||
cocoa/hid/HID_Error_Handler.c
|
||||
cocoa/hid/HID_Name_Lookup.c
|
||||
cocoa/hid/HID_Queue_Utilities.c
|
||||
cocoa/hid/HID_Utilities.c
|
||||
cocoa/hid/IOHIDDevice_.c
|
||||
cocoa/hid/IOHIDElement_.c
|
||||
cocoa/hid/ImmrHIDUtilAddOn.c
|
||||
cocoa/critsec.cpp
|
||||
cocoa/i_backend_cocoa.mm
|
||||
cocoa/i_cd.cpp
|
||||
cocoa/i_joystick.cpp
|
||||
cocoa/i_movie.cpp
|
||||
cocoa/st_start.cpp
|
||||
cocoa/i_timer.cpp
|
||||
cocoa/zdoom.icns )
|
||||
|
||||
if( APPLE )
|
||||
set( PLAT_SDL_SOURCES ${PLAT_SDL_SYSTEM_SOURCES} "${FMOD_LIBRARY}" )
|
||||
|
||||
if( OSX_COCOA_BACKEND )
|
||||
set( PLAT_MAC_SOURCES ${PLAT_MAC_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
add_definitions( -DUSE_NATIVE_COCOA )
|
||||
else( OSX_COCOA_BACKEND )
|
||||
set( PLAT_MAC_SOURCES ${PLAT_MAC_SOURCES} ${PLAT_SDL_SPECIAL_SOURCES} )
|
||||
endif( OSX_COCOA_BACKEND )
|
||||
|
||||
set_source_files_properties( cocoa/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
set_source_files_properties( "${FMOD_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks )
|
||||
else( APPLE )
|
||||
set( PLAT_SDL_SOURCES ${PLAT_SDL_SYSTEM_SOURCES} ${PLAT_SDL_SPECIAL_SOURCES} )
|
||||
endif( APPLE )
|
||||
|
||||
if( WIN32 )
|
||||
set( SYSTEM_SOURCES_DIR win32 )
|
||||
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ${PLAT_MAC_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_SDL_SOURCES} ${PLAT_MAC_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
|
||||
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||
# CMake is not set up to compile and link rc files with GCC. :(
|
||||
|
@ -606,15 +593,25 @@ if( WIN32 )
|
|||
else( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
|
||||
endif( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||
elseif( APPLE )
|
||||
if( OSX_COCOA_BACKEND )
|
||||
set( SYSTEM_SOURCES_DIR cocoa )
|
||||
set( SYSTEM_SOURCES ${PLAT_COCOA_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} )
|
||||
else( OSX_COCOA_BACKEND )
|
||||
set( SYSTEM_SOURCES_DIR sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
endif( OSX_COCOA_BACKEND )
|
||||
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_MAC_SOURCES} "${FMOD_LIBRARY}" )
|
||||
|
||||
set_source_files_properties( cocoa/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
set_source_files_properties( "${FMOD_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks )
|
||||
else( WIN32 )
|
||||
set( SYSTEM_SOURCES_DIR sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
|
||||
if( APPLE )
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_MAC_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||
else( APPLE )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_MAC_SOURCES} )
|
||||
endif( APPLE )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_MAC_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
endif( WIN32 )
|
||||
|
||||
if( NOT ASM_SOURCES )
|
||||
|
@ -672,11 +669,18 @@ endif( DYN_FLUIDSYNTH )
|
|||
# there's generally a new cpp for every header so this file will get changed
|
||||
if( WIN32 )
|
||||
set( EXTRA_HEADER_DIRS win32/*.h )
|
||||
elseif( APPLE )
|
||||
if( OSX_COCOA_BACKEND )
|
||||
set( EXTRA_HEADER_DIRS cocoa/*.h )
|
||||
else( OSX_COCOA_BACKEND )
|
||||
set( EXTRA_HEADER_DIRS sdl/*.h )
|
||||
endif( OSX_COCOA_BACKEND )
|
||||
else( WIN32 )
|
||||
set( EXTRA_HEADER_DIRS sdl/*.h )
|
||||
endif( WIN32 )
|
||||
file( GLOB HEADER_FILES
|
||||
${EXTRA_HEADER_DIRS}
|
||||
cocoa/*.h
|
||||
fragglescript/*.h
|
||||
g_doom/*.h
|
||||
g_heretic/*.h
|
||||
|
|
62
src/cocoa/critsec.cpp
Normal file
62
src/cocoa/critsec.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
** critsec.cpp
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2014 Alexey Lysiuk
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include "critsec.h"
|
||||
|
||||
// TODO: add error handling
|
||||
|
||||
FCriticalSection::FCriticalSection()
|
||||
{
|
||||
pthread_mutexattr_t attributes;
|
||||
pthread_mutexattr_init(&attributes);
|
||||
pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
||||
pthread_mutex_init(&m_mutex, &attributes);
|
||||
|
||||
pthread_mutexattr_destroy(&attributes);
|
||||
}
|
||||
|
||||
FCriticalSection::~FCriticalSection()
|
||||
{
|
||||
pthread_mutex_destroy(&m_mutex);
|
||||
}
|
||||
|
||||
void FCriticalSection::Enter()
|
||||
{
|
||||
pthread_mutex_lock(&m_mutex);
|
||||
}
|
||||
|
||||
void FCriticalSection::Leave()
|
||||
{
|
||||
pthread_mutex_unlock(&m_mutex);
|
||||
}
|
53
src/cocoa/critsec.h
Normal file
53
src/cocoa/critsec.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
** critsec.h
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2014 Alexey Lysiuk
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef CRITSEC_H
|
||||
#define CRITSEC_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class FCriticalSection
|
||||
{
|
||||
public:
|
||||
FCriticalSection();
|
||||
~FCriticalSection();
|
||||
|
||||
void Enter();
|
||||
void Leave();
|
||||
|
||||
private:
|
||||
pthread_mutex_t m_mutex;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
1
src/cocoa/dikeys.h
Symbolic link
1
src/cocoa/dikeys.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/dikeys.h
|
1
src/cocoa/hardware.h
Symbolic link
1
src/cocoa/hardware.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/hardware.h
|
|
@ -1625,48 +1625,6 @@ const char* I_GetBackEndName()
|
|||
extern "C"
|
||||
{
|
||||
|
||||
struct SDL_mutex
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
|
||||
SDL_mutex* SDL_CreateMutex()
|
||||
{
|
||||
pthread_mutexattr_t attributes;
|
||||
pthread_mutexattr_init(&attributes);
|
||||
pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
||||
SDL_mutex* result = new SDL_mutex;
|
||||
|
||||
if (0 != pthread_mutex_init(&result->mutex, &attributes))
|
||||
{
|
||||
delete result;
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
pthread_mutexattr_destroy(&attributes);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int SDL_mutexP(SDL_mutex* mutex)
|
||||
{
|
||||
return pthread_mutex_lock(&mutex->mutex);
|
||||
}
|
||||
|
||||
int SDL_mutexV(SDL_mutex* mutex)
|
||||
{
|
||||
return pthread_mutex_unlock(&mutex->mutex);
|
||||
}
|
||||
|
||||
void SDL_DestroyMutex(SDL_mutex* mutex)
|
||||
{
|
||||
pthread_mutex_destroy(&mutex->mutex);
|
||||
delete mutex;
|
||||
}
|
||||
|
||||
|
||||
static timeval s_startTicks;
|
||||
|
||||
uint32_t SDL_GetTicks()
|
||||
|
|
1
src/cocoa/i_cd.cpp
Symbolic link
1
src/cocoa/i_cd.cpp
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/i_cd.cpp
|
1
src/cocoa/i_input.h
Symbolic link
1
src/cocoa/i_input.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/i_input.h
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
|
||||
|
||||
#include "HID_Utilities_External.h"
|
||||
#include "hid/HID_Utilities_External.h"
|
||||
|
||||
#include "d_event.h"
|
||||
#include "doomdef.h"
|
||||
|
|
1
src/cocoa/i_movie.cpp
Symbolic link
1
src/cocoa/i_movie.cpp
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/i_movie.cpp
|
1
src/cocoa/i_system.h
Symbolic link
1
src/cocoa/i_system.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/i_system.h
|
1
src/cocoa/st_start.cpp
Symbolic link
1
src/cocoa/st_start.cpp
Symbolic link
|
@ -0,0 +1 @@
|
|||
../sdl/st_start.cpp
|
Loading…
Reference in a new issue