Skip to content

Commit

Permalink
Merge pull request #20 from th1000s/cmake_unix
Browse files Browse the repository at this point in the history
Set C++ to 17, and a few CMake fixes for Linux
  • Loading branch information
Lgt2x committed Apr 17, 2024
2 parents bff9cc8 + 26266d6 commit 4d181c8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@ PROJECT(Descent3)
IF (UNIX)
SET (D3_GAMEDIR "~/Descent3/")

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)

IF (APPLE)
SET(EXTRA_CXX_FLAGS "-Wno-address-of-temporary")
ELSE()
SET(EXTRA_CXX_FLAGS "-fpermissive")
ENDIF()

SET(CMAKE_CXX_COMPILER "g++")
SET(CMAKE_CXX_FLAGS "-O0 -g -Wno-write-strings -Wno-multichar -Wno-address-of-temporary")
SET(CMAKE_C_FLAGS "-O0 -g")
SET(CMAKE_CXX_FLAGS "-O0 -g -Wno-write-strings -Wno-multichar ${BITS} ${EXTRA_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-O0 -g ${BITS}")
SET(CMAKE_C_COMPILER "gcc")
IF (NOT APPLE)
LIST(APPEND CMAKE_CXX_FLAGS "-m32")
LIST(APPEND CMAKE_C_FLAGS "-m32")
ENDIF()

FIND_PACKAGE( SDL REQUIRED )
IF (APPLE)
# Provide FIND_PACKAGE( SDL_image ) below with an include dir and library that work with brew-installed sdl2_image
Expand Down
2 changes: 2 additions & 0 deletions Descent3/cinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "renderer.h"
#include "bitmap.h"

#include <cstdint>

// Movie Cinematic
typedef struct tCinematic {
intptr_t mvehandle;
Expand Down
2 changes: 1 addition & 1 deletion lib/findintersection.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ extern bool FVI_always_check_ceiling;
inline bool FastVectorBBox(const float *min, const float *max, const float *origin, const float *dir) {
bool f_inside = true;
char quad[3];
register int i;
int i;
float max_t[3];
float can_plane[3];
int which_plane;
Expand Down
2 changes: 2 additions & 0 deletions lib/movie.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "renderer.h"

#include <cstdint>

#define MVELIB_NOERROR 0
#define MVELIB_FILE_ERROR -1
#define MVELIB_NOTINIT_ERROR -2
Expand Down
2 changes: 1 addition & 1 deletion md5/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void MD5::MD5Final(unsigned char digest[16]) {
* the data and converts bytes into longwords for this routine.
*/
void MD5::MD5Transform(uint32_t buf[4], uint32_t const in[16]) {
register uint32_t a, b, c, d;
uint32_t a, b, c, d;

a = buf[0];
b = buf[1];
Expand Down
16 changes: 8 additions & 8 deletions misc/psglob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

// Returns 1 if string contains globbing characters in it
int PSGlobHasPattern(char *string) {
register char *p = string;
register char c;
char *p = string;
char c;
int open = 0;

while ((c = *p++) != '\0') {
Expand Down Expand Up @@ -70,8 +70,8 @@ int PSGlobHasPattern(char *string) {
// 8) If dot_special is not zero, '*' and '?' do not match '.' at the beginning of text
// 9) If case_sensitive is 0, than case does not matter for the non-pattern characters
int PSGlobMatch(char *pattern, char *text, int case_sensitive, int dot_special) {
register char *p = pattern, *t = text;
register char c;
char *p = pattern, *t = text;
char c;

while ((c = *p++) != '\0') {
switch (c) {
Expand All @@ -90,7 +90,7 @@ int PSGlobMatch(char *pattern, char *text, int case_sensitive, int dot_special)
return 0;
return PSGlobMatchAfterStar(p, case_sensitive, t);
case '[': {
register char c1 = *t++;
char c1 = *t++;
int invert;

if (!c1)
Expand All @@ -102,7 +102,7 @@ int PSGlobMatch(char *pattern, char *text, int case_sensitive, int dot_special)
c = *p++;

while (1) {
register char cstart = c, cend = c;
char cstart = c, cend = c;
if (c == '\\') {
cstart = *p++;
cend = cstart;
Expand Down Expand Up @@ -162,8 +162,8 @@ int PSGlobMatch(char *pattern, char *text, int case_sensitive, int dot_special)

// Like PSGlobMatch, but match pattern against any final segment of text
int PSGlobMatchAfterStar(char *pattern, int case_sensitive, char *text) {
register char *p = pattern, *t = text;
register char c, c1;
char *p = pattern, *t = text;
char c, c1;

while ((c = *p++) == '?' || c == '*') {
if (c == '?' && *t++ == '\0')
Expand Down
2 changes: 1 addition & 1 deletion scripts/osiris_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#ifdef __LINUX__
#ifndef MACOSX
typedef unsigned int size_t;
// typedef unsigned int size_t;
#endif
#include <stdarg.h>
void _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext);
Expand Down

0 comments on commit 4d181c8

Please sign in to comment.