import AROS changes

This commit is contained in:
Kalamatee 2015-06-20 20:30:46 +01:00 committed by Daniel Gibson
parent ae17dad2f9
commit 2fb870b13f
6 changed files with 160 additions and 26 deletions

View file

@ -30,6 +30,8 @@ endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sys/cmake")
set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
set(DHEWM3BINARY "dhewm3")
include(CheckCXXCompilerFlag)
include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS)
@ -108,8 +110,10 @@ include_directories(${VORBISFILE_INCLUDE_DIR})
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
if(NOT AROS)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
endif()
if (SDL2)
# skip SDL2main
@ -162,11 +166,13 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-fno-strict-aliasing)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
if(NOT cxx_has_fvisibility)
message(FATAL_ERROR "Compiler does not support -fvisibility")
if(NOT AROS)
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
if(NOT cxx_has_fvisibility)
message(FATAL_ERROR "Compiler does not support -fvisibility")
endif()
add_compile_options(-fvisibility=hidden)
endif()
add_compile_options(-fvisibility=hidden)
# TODO fix these warnings
add_compile_options(-Wno-sign-compare)
@ -178,7 +184,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Woverloaded-virtual)
endif()
if(APPLE)
if(AROS)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".aros-${cpu}")
add_definitions(-DIOAPI_NO_64)
elseif(APPLE)
add_definitions(-DMACOS_X=1)
if(cpu STREQUAL "x86_64")
@ -679,7 +688,31 @@ set(src_core
set(src_stub_openal sys/stub/openal_stub.cpp)
set(src_stub_gl sys/stub/stub_gl.cpp)
if(APPLE)
if(AROS)
set(DHEWM3BINARY "ADoom3")
set(sys_libs ${sys_libs} dll)
set(src_arosdll
sys/aros/dll/dllstartup.c
sys/aros/dll/dll.c
sys/aros/dll/dllimport.c
)
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
sys/events.cpp
sys/sys_local.cpp
sys/aros/aros_net.cpp
sys/aros/aros_signal.cpp
sys/aros/aros_main.cpp
sys/aros/aros_dos.cpp
)
set(src_sys_core
sys/glimp.cpp
)
elseif(APPLE)
set(OSX_RESOURCE_FILES
"${CMAKE_SOURCE_DIR}/sys/osx/Doom3.icns"
"${CMAKE_SOURCE_DIR}/sys/osx/Doom 3.rsrc"
@ -745,27 +778,31 @@ include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
add_library(idlib STATIC ${src_idlib})
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MINGW)
set_target_properties(idlib PROPERTIES COMPILE_FLAGS "-fPIC")
if (AROS)
add_library(dll STATIC ${src_arosdll})
else()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MINGW)
set_target_properties(idlib PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
endif()
if(CORE)
add_executable(dhewm3 WIN32 MACOSX_BUNDLE
add_executable(${DHEWM3BINARY} WIN32 MACOSX_BUNDLE
${src_core}
${src_sys_base}
${src_sys_core}
)
set_target_properties(dhewm3 PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__")
set_target_properties(dhewm3 PROPERTIES LINK_FLAGS "${ldflags}")
set_target_properties(dhewm3 PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist)
set_target_properties(${DHEWM3BINARY} PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__")
set_target_properties(${DHEWM3BINARY} PROPERTIES LINK_FLAGS "${ldflags}")
set_target_properties(${DHEWM3BINARY} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist)
target_link_libraries(dhewm3
target_link_libraries(${DHEWM3BINARY}
idlib
${OPENAL_LIBRARY}
${OGG_LIBRARIES}
${VORBISFILE_LIBRARIES}
${VORBIS_LIBRARIES}
${OGG_LIBRARIES}
${CURL_LIBRARY}
${JPEG_LIBRARY}
${ZLIB_LIBRARY}
@ -774,7 +811,7 @@ if(CORE)
)
if(NOT APPLE AND NOT WIN32)
install(TARGETS dhewm3
install(TARGETS ${DHEWM3BINARY}
RUNTIME DESTINATION "${bindir}"
LIBRARY DESTINATION "${libdir}"
ARCHIVE DESTINATION "${libdir}"
@ -783,19 +820,20 @@ if(CORE)
endif()
if(DEDICATED)
add_executable(dhewm3ded WIN32 MACOSX_BUNDLE
add_executable(${DHEWM3BINARY}ded WIN32 MACOSX_BUNDLE
${src_core}
${src_stub_openal}
${src_stub_gl}
${src_sys_base}
)
set_target_properties(dhewm3ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED;__DOOM_DLL__")
set_target_properties(dhewm3ded PROPERTIES LINK_FLAGS "${ldflags}")
target_link_libraries(dhewm3ded
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED;__DOOM_DLL__")
set_target_properties(${DHEWM3BINARY}ded PROPERTIES LINK_FLAGS "${ldflags}")
target_link_libraries(${DHEWM3BINARY}ded
idlib
${VORBISFILE_LIBRARIES}
${VORBIS_LIBRARIES}
${OGG_LIBRARIES}
${CURL_LIBRARY}
${JPEG_LIBRARY}
${ZLIB_LIBRARY}
@ -804,7 +842,7 @@ if(DEDICATED)
)
if(NOT APPLE AND NOT WIN32)
install(TARGETS dhewm3ded
install(TARGETS ${DHEWM3BINARY}ded
RUNTIME DESTINATION "${bindir}"
LIBRARY DESTINATION "${libdir}"
ARCHIVE DESTINATION "${libdir}"
@ -813,13 +851,22 @@ if(DEDICATED)
endif()
if(BASE)
add_library(base SHARED ${src_game})
if (AROS)
add_executable(base sys/aros/dll/dllglue.c ${src_game})
set_target_properties(base PROPERTIES OUTPUT_NAME "base.aros-${CMAKE_SYSTEM_PROCESSOR}")
else()
add_library(base SHARED ${src_game})
endif()
set_target_properties(base PROPERTIES PREFIX "")
set_target_properties(base PROPERTIES COMPILE_DEFINITIONS "GAME_DLL")
set_target_properties(base PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/game")
set_target_properties(base PROPERTIES LINK_FLAGS "${ldflags}")
set_target_properties(base PROPERTIES INSTALL_NAME_DIR "@executable_path")
target_link_libraries(base idlib)
if (AROS)
target_link_libraries(base idlib dll)
else()
target_link_libraries(base idlib)
endif()
if(NOT APPLE AND NOT WIN32)
install(TARGETS base
@ -831,13 +878,22 @@ if(BASE)
endif()
if(D3XP)
add_library(d3xp SHARED ${src_d3xp})
if (AROS)
add_executable(d3xp sys/aros/dll/dllglue.c ${src_d3xp})
set_target_properties(d3xp PROPERTIES OUTPUT_NAME "d3xp.aros-${CMAKE_SYSTEM_PROCESSOR}")
else()
add_library(d3xp SHARED ${src_d3xp})
endif()
set_target_properties(d3xp PROPERTIES PREFIX "")
set_target_properties(d3xp PROPERTIES COMPILE_DEFINITIONS "GAME_DLL;_D3XP;CTF")
set_target_properties(d3xp PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/d3xp")
set_target_properties(d3xp PROPERTIES LINK_FLAGS "${ldflags}")
set_target_properties(d3xp PROPERTIES INSTALL_NAME_DIR "@executable_path")
target_link_libraries(d3xp idlib)
if (AROS)
target_link_libraries(d3xp idlib dll)
else()
target_link_libraries(d3xp idlib)
endif()
if(NOT APPLE AND NOT WIN32)
install(TARGETS d3xp

View file

@ -34,15 +34,23 @@ If you have questions concerning this license or the applicable additional terms
===============================================================================
*/
#if defined(__AROS__)
#define GAME_NAME "ADoom3" // appears on window titles and errors
#define ENGINE_VERSION "dhewm3 1.4.1" // printed in console
#define CONFIG_FILE "adoom3.cfg"
#else
#define GAME_NAME "dhewm 3" // appears on window titles and errors
#define ENGINE_VERSION "dhewm 3 1.4.1" // printed in console
#endif
// paths
#define BASE_GAMEDIR "base"
// filenames
#ifndef CONFIG_FILE
#define CONFIG_FILE "dhewm.cfg"
#endif
// base folder where the source code lives
#define SOURCE_CODE_BASE_FOLDER "neo"

View file

@ -36,6 +36,8 @@ If you have questions concerning this license or the applicable additional terms
#include "ai/AI.h"
#include <stddef.h>
/*
===============================================================================
@ -604,12 +606,14 @@ pathNode_t *BuildPathTree( const obstacle_t *obstacles, int numObstacles, const
pathNode_t *root, *node, *child;
// gcc 4.0
idQueueTemplate<pathNode_t, offsetof( pathNode_t, next ) > pathNodeQueue, treeQueue;
root = pathNodeAllocator.Alloc();
root->Init();
root->pos = startPos;
root->delta = seekPos - root->pos;
root->numNodes = 0;
pathNodeQueue.Add( root );
for ( node = pathNodeQueue.Get(); node && pathNodeAllocator.GetAllocCount() < MAX_PATH_NODES; node = pathNodeQueue.Get() ) {

View file

@ -817,7 +817,11 @@ idStr::DefaultPath
==================
*/
idStr &idStr::DefaultPath( const char *basepath ) {
#if defined(__AROS__)
if ( ( ( *this )[ 0 ] == '/' ) || ( ( *this )[ 0 ] == '\\' ) || ( ( *this )[ 0 ] == ':' ) ) {
#else
if ( ( ( *this )[ 0 ] == '/' ) || ( ( *this )[ 0 ] == '\\' ) ) {
#endif
// absolute path location
return *this;
}
@ -840,11 +844,19 @@ void idStr::AppendPath( const char *text ) {
EnsureAlloced( len + strlen( text ) + 2 );
if ( pos ) {
#if defined(__AROS__)
if (( data[ pos-1 ] != '/' ) || ( data[ pos-1 ] != ':' )) {
#else
if ( data[ pos-1 ] != '/' ) {
#endif
data[ pos++ ] = '/';
}
}
#if defined(__AROS__)
if (( text[i] == '/' ) || ( text[i] == ':' )) {
#else
if ( text[i] == '/' ) {
#endif
i++;
}
@ -869,7 +881,11 @@ idStr &idStr::StripFilename( void ) {
int pos;
pos = Length() - 1;
#if defined(__AROS__)
while( ( pos > 0 ) && ( ( *this )[ pos ] != '/' ) && ( ( *this )[ pos ] != '\\' ) && ( ( *this )[ pos ] != ':' ) ) {
#else
while( ( pos > 0 ) && ( ( *this )[ pos ] != '/' ) && ( ( *this )[ pos ] != '\\' ) ) {
#endif
pos--;
}
@ -890,7 +906,11 @@ idStr &idStr::StripPath( void ) {
int pos;
pos = Length();
#if defined(__AROS__)
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) && ( ( *this )[ pos - 1 ] != ':' ) ) {
#else
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) ) {
#endif
pos--;
}
@ -910,7 +930,11 @@ void idStr::ExtractFilePath( idStr &dest ) const {
// back up until a \ or the start
//
pos = Length();
#if defined(__AROS__)
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) && ( ( *this )[ pos - 1 ] != ':' ) ) {
#else
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) ) {
#endif
pos--;
}
@ -929,7 +953,11 @@ void idStr::ExtractFileName( idStr &dest ) const {
// back up until a \ or the start
//
pos = Length() - 1;
#if defined(__AROS__)
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) && ( ( *this )[ pos - 1 ] != ':' ) ) {
#else
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) ) {
#endif
pos--;
}
@ -949,7 +977,11 @@ void idStr::ExtractFileBase( idStr &dest ) const {
// back up until a \ or the start
//
pos = Length() - 1;
#if defined(__AROS__)
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) && ( ( *this )[ pos - 1 ] != ':' ) ) {
#else
while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '/' ) && ( ( *this )[ pos - 1 ] != '\\' ) ) {
#endif
pos--;
}

View file

@ -64,12 +64,18 @@ If you have questions concerning this license or the applicable additional terms
#endif
#define StrCmpNI use_idStr_Icmpn
#if defined( stricmp )
#undef stricmp
#endif
#define stricmp idStr::Icmp // use_idStr_Icmp
#define _stricmp use_idStr_Icmp
#if defined( strcasecmp )
#undef strcasecmp
#endif
#define strcasecmp use_idStr_Icmp
#if defined( strnicmp )
#undef strnicmp
#endif
#define strnicmp use_idStr_Icmpn
#define _strnicmp use_idStr_Icmpn
#define _memicmp use_idStr_Icmpn

View file

@ -40,6 +40,34 @@ If you have questions concerning this license or the applicable additional terms
===============================================================================
*/
// Win32
#if defined(__AROS__)
#define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
#ifdef GAME_DLL
#define ID_GAME_API __attribute__((visibility ("default")))
#else
#define ID_GAME_API
#endif
#define ALIGN16( x ) x __attribute__ ((aligned (16)))
#define PACKED __attribute__((packed))
#define PATHSEPERATOR_STR "/"
#define PATHSEPERATOR_CHAR '/'
#define __cdecl
#define ASSERT assert
#define ID_INLINE inline
#define ID_STATIC_TEMPLATE
#define assertmem( x, y )
#endif
// Win32
#if defined(WIN32) || defined(_WIN32)