Merge branch 'travis-ci' into 'master'

Travis-CI builds

Merge support to build SRB2 for Linux system via Travis-Ci
This will build SRB2 with GCC and Clang to make sure we do not break Linux/GNU builds

See merge request !41
This commit is contained in:
Alam Ed Arias 2016-02-07 21:57:26 -05:00
commit 985b9a11cc
12 changed files with 54 additions and 20 deletions

33
.travis.yml Normal file
View file

@ -0,0 +1,33 @@
language: c
sudo: required
dist: trusty
env:
- CFLAGS=-Wno-absolute-value -Werror
compiler:
- gcc
- clang
cache:
directories:
- $HOME/srb2_cache
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- p7zip-full
before_script:
- mkdir $HOME/srb2_cache
- wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O $HOME/srb2_cache/SRB2-v2114-Installer.exe
- 7z x $HOME/srb2_cache/SRB2-v2114-Installer.exe -oassets
- mkdir build
- cd build
- cmake ..
script: make

View file

@ -80,9 +80,6 @@ endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
add_definitions(-DMACOSX)
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang")
set(CLANG ON)
endif()
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

View file

@ -166,7 +166,7 @@ set(SRB2_CORE_GAME_SOURCES
p_tick.h
)
if(NOT CLANG)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
@ -404,10 +404,14 @@ endif()
# Compatibility flag with later versions of GCC
# We should really fix our code to not need this
if(NOT CLANG AND NOT MSVC)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif()
add_definitions(-DCMAKECONFIG)
#add_library(SRB2Core STATIC
@ -429,4 +433,4 @@ endif()
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
endif()
endif()

View file

@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
cmd->forwardmove = sonic->player->cmd.forwardmove;
cmd->angleturn = abs(tails->angle - sonic->angle)>>16;
cmd->angleturn = abs((tails->angle - sonic->angle))>>16;
if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))

View file

@ -603,7 +603,7 @@ static void F_IntroDrawScene(void)
if (finalecount-84 < 58) { // Pure Fat is driving up!
int ftime = (finalecount-84);
x = (-189<<FRACBITS) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
// Draw the body
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);

View file

@ -4225,7 +4225,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MT_GOOP, // painchance
sfx_dmpain, // painsound
S_EGGMOBILE2_PAIN2, // meleestate
MT_EGGMOBILE2_POGO, // missilestate
(statenum_t)MT_EGGMOBILE2_POGO, // missilestate
S_EGGMOBILE2_DIE1, // deathstate
S_EGGMOBILE2_FLEE1,// xdeathstate
sfx_cybdth, // deathsound

View file

@ -6071,7 +6071,7 @@ static void M_RoomMenu(INT32 choice)
for (i = 0; room_list[i].header.buffer[0]; i++)
{
if(room_list[i].name != '\0')
if(*room_list[i].name != '\0')
{
MP_RoomMenu[i+1].text = room_list[i].name;
roomIds[i] = room_list[i].id;

View file

@ -677,7 +677,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
else
snprintf(maptext, 8, "Unknown");
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl)
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0')
snprintf(lvlttltext, 48, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",

View file

@ -6352,7 +6352,7 @@ void A_Boss2PogoTarget(mobj_t *actor)
if (actor->info->missilestate) // spawn the pogo stick collision box
{
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, actor->info->missilestate);
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, (mobjtype_t)actor->info->missilestate);
pogo->target = actor;
}

View file

@ -2507,8 +2507,8 @@ isblocking:
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
if (((!slidemo->player->climbing && abs(slidemo->angle - ANGLE_90 - climbline) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs(slidemo->angle - climbline) < ANGLE_135))
if (((!slidemo->player->climbing && abs((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs((slidemo->angle - climbline)) < ANGLE_135))
&& P_IsClimbingValid(slidemo->player, climbangle))
{
slidemo->angle = climbangle;

View file

@ -7899,9 +7899,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (player == &players[consoleplayer])
{
if (focusangle >= localangle)
localangle += abs(focusangle - localangle)>>5;
localangle += abs((focusangle - localangle))>>5;
else
localangle -= abs(focusangle - localangle)>>5;
localangle -= abs((focusangle - localangle))>>5;
}
}
else if (P_AnalogMove(player)) // Analog

View file

@ -117,7 +117,7 @@ if(${SDL2_FOUND})
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
if(CLANG)
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
add_framework(CoreFoundation SRB2SDL2)
add_framework(SDL2 SRB2SDL2)
add_framework(SDL2_mixer SRB2SDL2)
@ -224,7 +224,7 @@ if(${SDL2_FOUND})
endif()
#### Installation ####
if (CLANG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(TARGETS SRB2SDL2
BUNDLE DESTINATION .
)
@ -265,7 +265,7 @@ if(${SDL2_FOUND})
# Mac bundle fixup
if(CLANG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
@ -279,4 +279,4 @@ if(${SDL2_FOUND})
else()
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
endif()
endif()