Skip to content

Commit

Permalink
Merge pull request onitama#20 from gzaffin/master
Browse files Browse the repository at this point in the history
Fix compilation on linux onitama#18 - pull request from gzaffin
  • Loading branch information
onitama committed Dec 17, 2020
2 parents 7fc50ff + 48f7b57 commit cf4e650
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
21 changes: 15 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CC = gcc
CFLAGS =
CXXFLAGS =
# CXXFLAGS += -Wno-write-strings
COMMON_FLAGS =
COMMON_FLAGS = -Wall -O3
# COMMON_FLAGS += -Wall -Werror
LDFLAGS =
DEFINES =
Expand All @@ -37,8 +37,8 @@ TARGET_PCMTOOL = pcmtool$(EXE_SUFFIX)

ifeq ($(DEBUG),1)
TARGET = $(TARGET_NAME)_d$(EXE_SUFFIX)
LDFLAGS += -g
COMMON_FLAGS += -O0 -g
LDFLAGS = -g
COMMON_FLAGS = -O0 -g -Wall
OBJS_DIR = objs_d
endif

Expand Down Expand Up @@ -115,13 +115,22 @@ DEP_SRCS += sdl/osdep_sdl.cpp
DEP_SRCS += sdl/audiobuffer.cpp
DEP_SRCS += sdl/audiotime.cpp

SDL_CFLAGS = $(shell sdl-config --cflags) -DUSE_SDL
SDL_CFLAGS = `sdl-config --cflags` -DUSE_SDL
COMMON_FLAGS += $(SDL_CFLAGS)

ifeq ($(STATIC),1)
SDL_LIBS = $(shell sdl-config --static-libs)
ifeq ($(OS_LINUX),1)
SDL_LIBS = `sdl-config --static-libs` -static-libgcc -static-libstdc++
LDFLAGS += -Wl,-rpath,/usr/local/lib,-rpath,/usr/lib/x86_64-linux-gnu,-rpath,/usr/lib/gcc/x86_64-linux-gnu
else
SDL_LIBS = $(shell sdl-config --libs)
SDL_LIBS = `sdl-config --static-libs`
endif
else
ifeq ($(OS_LINUX),1)
SDL_LIBS = `sdl-config --libs` -lX11
else
SDL_LIBS = `sdl-config --libs`
endif
endif

ifeq ($(SDL_WIN32),1)
Expand Down
8 changes: 8 additions & 0 deletions src/Makefile.setting
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ endif
endif

# static
ifeq ($(WIN32),1)
STATIC = 1
endif
ifeq ($(OS_OSX),1)
STATIC = 1
endif
ifeq ($(OS_LINUX),1)
STATIC = 0
endif
5 changes: 5 additions & 0 deletions src/adpcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ typedef unsigned long DWORD;
typedef unsigned short WORD;
#endif

#ifndef _WIN32
typedef unsigned long ULONG_PTR;
typedef ULONG_PTR DWORD_PTR;
#endif

typedef struct {
BYTE bID[4]; // ヘッダ
DWORD dSize; // サイズ
Expand Down
2 changes: 1 addition & 1 deletion src/sdl/osdep_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ bool OsDependentSdl::InitTimer() {
}

void OsDependentSdl::FreeTimer() {
SDL_RemoveTimer((SDL_TimerID)TimerId);
SDL_RemoveTimer(TimerId);
}

// オーディオ更新用タイマー
Expand Down
4 changes: 2 additions & 2 deletions src/sdl/osdep_sdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef _OS_DEP_SDL_H_
#define _OS_DEP_SDL_H_


#include <SDL.h>
#include <stdint.h>
#include "../osdep.h"
#include "audiotime.h"
Expand Down Expand Up @@ -69,7 +69,7 @@ class OsDependentSdl : public OsDependent {
bool AudioOpenFlag;

private:
void *TimerId;
SDL_TimerID TimerId;
};

#endif

0 comments on commit cf4e650

Please sign in to comment.