2020-05-23 20:58:42 +00:00
|
|
|
HAVE_DYNARMIC = 0
|
2024-01-24 14:47:54 +00:00
|
|
|
HAVE_FFMPEG = 0
|
|
|
|
HAVE_FFMPEG_STATIC = 0
|
2020-05-23 20:58:42 +00:00
|
|
|
HAVE_GLAD = 1
|
|
|
|
HAVE_SSE = 0
|
2022-01-30 15:44:33 +00:00
|
|
|
HAVE_RGLGEN = 0
|
2020-05-23 20:58:42 +00:00
|
|
|
HAVE_RPC = 1
|
2024-01-24 14:47:54 +00:00
|
|
|
FFMPEG_DISABLE_VDPAU ?= 0
|
|
|
|
HAVE_FFMPEG_CROSSCOMPILE ?= 0
|
|
|
|
FFMPEG_XC_CPU ?=
|
|
|
|
FFMPEG_XC_ARCH ?=
|
|
|
|
FFMPEG_XC_PREFIX ?=
|
|
|
|
FFMPEG_XC_SYSROOT ?=
|
|
|
|
FFMPEG_XC_NM ?=
|
|
|
|
FFMPEG_XC_AR ?=
|
|
|
|
FFMPEG_XC_AS ?=
|
|
|
|
FFMPEG_XC_CC ?=
|
|
|
|
FFMPEG_XC_LD ?=
|
2020-05-23 20:58:42 +00:00
|
|
|
|
|
|
|
TARGET_NAME := citra
|
|
|
|
EXTERNALS_DIR += ./externals
|
|
|
|
SRC_DIR += ./src
|
2021-09-26 15:29:34 +00:00
|
|
|
LIBS = -lm
|
2023-12-07 17:04:27 +00:00
|
|
|
DEFINES := -DHAVE_LIBRETRO
|
2020-05-23 20:58:42 +00:00
|
|
|
|
|
|
|
STATIC_LINKING := 0
|
|
|
|
AR := ar
|
|
|
|
|
|
|
|
SPACE :=
|
|
|
|
SPACE := $(SPACE) $(SPACE)
|
|
|
|
BACKSLASH :=
|
|
|
|
BACKSLASH := \$(BACKSLASH)
|
|
|
|
filter_out1 = $(filter-out $(firstword $1),$1)
|
|
|
|
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
|
|
|
|
|
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (,$(ARCH))
|
|
|
|
ARCH = $(shell uname -m)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# system platform
|
|
|
|
system_platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
EXE_EXT = .exe
|
|
|
|
system_platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
system_platform = osx
|
|
|
|
arch = intel
|
|
|
|
ifeq ($(shell uname -p),powerpc)
|
|
|
|
arch = ppc
|
|
|
|
endif
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
system_platform = win
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCHFLAGS),)
|
|
|
|
ifeq ($(archs),ppc)
|
|
|
|
ARCHFLAGS = -arch ppc -arch ppc64
|
|
|
|
else
|
|
|
|
ARCHFLAGS = -arch i386 -arch x86_64
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(platform), osx)
|
|
|
|
ifndef ($(NOUNIVERSAL))
|
|
|
|
CXXFLAGS += $(ARCHFLAGS)
|
|
|
|
LFLAGS += $(ARCHFLAGS)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
|
|
EXT := a
|
|
|
|
endif
|
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
GIT_REV := "$(shell git rev-parse HEAD || echo unknown)"
|
|
|
|
GIT_BRANCH := "$(shell git rev-parse --abbrev-ref HEAD || echo unknown)"
|
|
|
|
GIT_DESC := "$(shell git describe --always --long --dirty || echo unknown)"
|
|
|
|
BUILD_DATE := "$(shell date +'%d/%m/%Y_%H:%M')"
|
|
|
|
|
|
|
|
DEFINES += -DGIT_REV=\"$(GIT_REV)\" \
|
|
|
|
-DGIT_BRANCH=\"$(GIT_BRANCH)\" \
|
|
|
|
-DGIT_DESC=\"$(GIT_DESC)\" \
|
|
|
|
-DBUILD_NAME=\"citra-libretro\" \
|
|
|
|
-DBUILD_DATE=\"$(BUILD_DATE)\" \
|
|
|
|
-DBUILD_VERSION=\"$(GIT_BRANCH)-$(GIT_DESC)\" \
|
|
|
|
-DBUILD_FULLNAME=\"\" \
|
|
|
|
-DSHADER_CACHE_VERSION=\"0\"
|
|
|
|
|
2020-05-23 20:58:42 +00:00
|
|
|
ifeq ($(platform), unix)
|
|
|
|
EXT ?= so
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=$(SRC_DIR)/citra_libretro/link.T -Wl,--no-undefined
|
2022-02-24 12:12:18 +00:00
|
|
|
LIBS +=-lpthread -lGL -ldl
|
2024-01-24 14:47:54 +00:00
|
|
|
HAVE_FFMPEG = 1
|
|
|
|
HAVE_FFMPEG_STATIC = 1
|
|
|
|
ifeq ($(HAVE_FFMPEG_STATIC), 1)
|
|
|
|
LIBS += $(EXTERNALS_DIR)/ffmpeg/libavcodec/libavcodec.a $(EXTERNALS_DIR)/ffmpeg/libavutil/libavutil.a
|
|
|
|
else
|
|
|
|
LIBS += -lavcodec -lavutil
|
|
|
|
endif
|
2020-05-23 20:58:42 +00:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# Nintendo Switch (libnx)
|
|
|
|
else ifeq ($(platform), libnx)
|
|
|
|
include $(DEVKITPRO)/libnx/switch_rules
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_$(platform).a
|
|
|
|
DEFINES += -DSWITCH=1 -D__SWITCH__=1 -DHAVE_LIBNX=1 \
|
|
|
|
-D__LINUX_ERRNO_EXTENSIONS__ -DBOOST_ASIO_DISABLE_SIGACTION -DOS_RNG_AVAILABLE
|
|
|
|
|
|
|
|
fpic := -fPIE
|
|
|
|
CFLAGS = $(DEFINES) -I$(LIBNX)/include/ -I$(PORTLIBS)/include/ -specs=$(LIBNX)/switch.specs
|
|
|
|
CFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -ffast-math
|
|
|
|
CXXFLAGS = $(ASFLAGS) $(CFLAGS)
|
|
|
|
ARCH = aarch64
|
|
|
|
STATIC_LINKING = 1
|
|
|
|
HAVE_GLAD = 0
|
2022-01-30 15:44:33 +00:00
|
|
|
HAVE_RGLGEN = 1
|
2020-05-23 20:58:42 +00:00
|
|
|
HAVE_RPC = 0
|
|
|
|
DEBUG = 0
|
2022-01-30 15:44:33 +00:00
|
|
|
else ifneq (,$(findstring windows_msvc2019,$(platform)))
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
PlatformSuffix = $(subst windows_msvc2019_,,$(platform))
|
|
|
|
ifneq (,$(findstring desktop,$(PlatformSuffix)))
|
|
|
|
WinPartition = desktop
|
|
|
|
MSVC2019CompileFlags = -D_UNICODE -DUNICODE -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
|
|
|
|
LDFLAGS += -MANIFEST -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
|
|
|
|
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
|
|
|
|
WinPartition = uwp
|
|
|
|
MSVC2019CompileFlags = -DWINDLL -D_UNICODE -DUNICODE -DWRL_NO_DEFAULT_LIB
|
|
|
|
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
MSVC2019CompileFlags += -DEBUG
|
|
|
|
|
|
|
|
else
|
|
|
|
MSVC2019CompileFlags += -O2 -GS"-" -MD
|
|
|
|
endif
|
|
|
|
|
|
|
|
MSVC2019CompileFlags += -D_WIN32=1 -DNOMINMAX -DBOOST_ALL_NO_LIB
|
|
|
|
|
|
|
|
CFLAGS += $(MSVC2019CompileFlags) -nologo
|
|
|
|
CXXFLAGS += $(MSVC2019CompileFlags) -nologo -EHsc -Zc:throwingNew,inline
|
|
|
|
|
|
|
|
TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
|
|
|
|
|
|
|
|
CC = cl.exe
|
|
|
|
CXX = cl.exe
|
|
|
|
|
|
|
|
SPACE :=
|
|
|
|
SPACE := $(SPACE) $(SPACE)
|
|
|
|
BACKSLASH :=
|
|
|
|
BACKSLASH := \$(BACKSLASH)
|
|
|
|
filter_out1 = $(filter-out $(firstword $1),$1)
|
|
|
|
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
|
|
|
|
|
|
|
|
reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>/dev/null)))
|
|
|
|
fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
|
|
|
|
|
|
|
|
b1 := (
|
|
|
|
b2 := )
|
|
|
|
ProgramFiles86w := $(ProgramFiles$(b1)x86$(b2))
|
|
|
|
ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
|
|
|
|
|
|
|
|
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
|
|
|
|
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
|
|
|
|
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
|
|
|
|
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
|
|
|
|
WindowsSdkDir := $(WindowsSdkDir)
|
|
|
|
|
|
|
|
WindowsSDKVersion ?= $(firstword $(foreach folder,$(subst $(subst \,/,$(WindowsSdkDir)Include/),,$(wildcard $(call fix_path,$(WindowsSdkDir)Include\*))),$(if $(wildcard $(call fix_path,$(WindowsSdkDir)Include/$(folder)/um/Windows.h)),$(folder),)))$(BACKSLASH)
|
|
|
|
WindowsSDKVersion := $(WindowsSDKVersion)
|
|
|
|
|
|
|
|
VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2019/BuildTools
|
|
|
|
VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2019/Enterprise
|
|
|
|
VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2019/Professional
|
|
|
|
VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2019/Community
|
|
|
|
|
|
|
|
VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
|
|
|
|
ifeq ($(VsInstallRoot), )
|
|
|
|
VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
|
|
|
|
endif
|
|
|
|
ifeq ($(VsInstallRoot), )
|
|
|
|
VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
|
|
|
|
endif
|
|
|
|
ifeq ($(VsInstallRoot), )
|
|
|
|
VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
|
|
|
|
endif
|
|
|
|
VsInstallRoot := $(VsInstallRoot)
|
|
|
|
|
|
|
|
VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
|
|
|
|
VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
|
|
|
|
VcCompilerLibDir := $(VcCompilerToolsDir)/lib/$(TargetArchMoniker)
|
|
|
|
|
|
|
|
WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
|
|
|
|
WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
|
|
|
|
WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
|
|
|
|
WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
|
|
|
|
WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
|
|
|
|
|
|
|
|
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerLibDir)")
|
|
|
|
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
|
|
|
|
|
|
|
|
# For some reason the HostX86 compiler doesn't like compiling for x64
|
|
|
|
# ("no such file" opening a shared library), and vice-versa.
|
|
|
|
# Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
|
|
|
|
# NOTE: What about ARM?
|
|
|
|
ifneq (,$(findstring x64,$(TargetArchMoniker)))
|
|
|
|
override TARGET_ARCH = x86_64
|
|
|
|
VCCompilerToolsBinDir := $(VcCompilerToolsDir)/bin/HostX64/$(TargetArchMoniker)
|
|
|
|
LIB := $(LIB);$(CORE_DIR)/dx9sdk/Lib/x64
|
|
|
|
else
|
|
|
|
override TARGET_ARCH = x86
|
|
|
|
VCCompilerToolsBinDir := $(VcCompilerToolsDir)/bin/HostX86/$(TargetArchMoniker)
|
|
|
|
LIB := $(LIB);$(CORE_DIR)/dx9sdk/Lib/x86
|
|
|
|
endif
|
|
|
|
|
|
|
|
PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)"):$(PATH)
|
|
|
|
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
|
|
|
|
|
|
|
|
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
|
2024-01-24 14:47:54 +00:00
|
|
|
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir);$(FFMPEGDIR)/Windows/$(TARGET_ARCH)/lib
|
2022-01-30 15:44:33 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
|
|
|
PSS_STYLE :=2
|
|
|
|
LDFLAGS += -DLL
|
|
|
|
PLATFORM_EXT = win32
|
|
|
|
LDFLAGS += ws2_32.lib user32.lib shell32.lib winmm.lib gdi32.lib opengl32.lib imm32.lib ole32.lib oleaut32.lib version.lib uuid.lib mfuuid.lib
|
|
|
|
HAVE_MF = 1
|
2022-01-31 17:14:20 +00:00
|
|
|
# RPC crashes, TODO: Figure out why
|
|
|
|
HAVE_RPC = 0
|
2020-11-12 15:22:02 +00:00
|
|
|
else
|
|
|
|
CC ?= gcc
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
2020-11-12 15:25:58 +00:00
|
|
|
DEFINES += -D_WIN32_WINNT=0x0600 -DWINVER=0x0600
|
2020-11-12 15:48:38 +00:00
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(SRC_DIR)/citra_libretro/link.T -Wl,--no-undefined
|
2020-11-12 16:01:06 +00:00
|
|
|
LDFLAGS += -static -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
|
2020-11-12 15:22:02 +00:00
|
|
|
|
|
|
|
ifeq ($(MSYSTEM),MINGW64)
|
2021-01-06 22:13:26 +00:00
|
|
|
CC ?= x86_64-w64-mingw32-gcc
|
|
|
|
CXX ?= x86_64-w64-mingw32-g++
|
2020-11-12 16:14:12 +00:00
|
|
|
LDFLAGS += -lopengl32 -lmfuuid
|
2020-11-12 15:22:02 +00:00
|
|
|
ASFLAGS += -DWIN64
|
2020-11-12 16:14:12 +00:00
|
|
|
HAVE_MF = 1
|
2020-11-12 15:22:02 +00:00
|
|
|
endif
|
2020-05-23 20:58:42 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(findstring msvc,$(platform)))
|
|
|
|
CFLAGS += -D_CRT_SECURE_NO_WARNINGS
|
|
|
|
CXXFLAGS += -D_CRT_SECURE_NO_WARNINGS
|
|
|
|
endif
|
|
|
|
|
|
|
|
# x86_64 is expected to support both SSE and Dynarmic
|
|
|
|
ifeq ($(ARCH), x86_64)
|
|
|
|
DEFINES += -DARCHITECTURE_x86_64
|
|
|
|
HAVE_DYNARMIC = 1
|
|
|
|
HAVE_SSE = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CXXFLAGS += -O0 -g
|
|
|
|
else
|
2022-01-30 15:44:33 +00:00
|
|
|
# Add Unix optimization flags
|
|
|
|
ifeq (,$(findstring msvc,$(platform)))
|
|
|
|
CXXFLAGS += -O3 -ffast-math -ftree-vectorize -DNDEBUG
|
|
|
|
endif
|
2020-05-23 20:58:42 +00:00
|
|
|
endif
|
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
# Set ffmpeg configure options
|
|
|
|
ifeq ($(HAVE_FFMPEG_STATIC), 1)
|
|
|
|
FFMPEG_CONF_OPTS =--disable-encoders --disable-decoders --enable-decoder=aac --enable-decoder=aac_fixed --enable-decoder=aac_latm --disable-programs
|
|
|
|
ifeq ($(FFMPEG_DISABLE_VDPAU), 1)
|
|
|
|
FFMPEG_CONF_OPTS += --disable-vdpau
|
|
|
|
endif
|
|
|
|
ifeq ($(HAVE_FFMPEG_CROSSCOMPILE), 1)
|
|
|
|
FFMPEG_CONF_OPTS+= --enable-cross-compile --target-os="linux"
|
|
|
|
ifeq ($(FFMPEG_XC_CPU),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_CPU provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --cpu="$(FFMPEG_XC_CPU)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_ARCH),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_ARCH provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --arch="$(FFMPEG_XC_ARCH)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_PREFIX),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_PREFIX provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --cross-prefix="$(FFMPEG_XC_PREFIX)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_SYSROOT),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_SYSROOT provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --sysroot="$(FFMPEG_XC_SYSROOT)" --sysinclude="$(FFMPEG_XC_SYSROOT)/usr/include"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_NM),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_NM provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --nm="$(FFMPEG_XC_NM)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_AR),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_AR provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --ar="$(FFMPEG_XC_AR)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_AS),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_AS provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --as="$(FFMPEG_XC_AS)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_CC),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_CC provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --cc="$(FFMPEG_XC_CC)"
|
|
|
|
endif
|
|
|
|
ifeq ($(FFMPEG_XC_LD),)
|
|
|
|
$(error HAVE_FFMPEG_CROSSCOMPILE set, but no FFMPEG_XC_LD provided)
|
|
|
|
else
|
|
|
|
FFMPEG_CONF_OPTS += --ld="$(FFMPEG_XC_LD)"
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-05-23 20:58:42 +00:00
|
|
|
include Makefile.common
|
|
|
|
|
2022-02-25 10:46:29 +00:00
|
|
|
SOURCES_CXX += $(DYNARMICSOURCES_CXX)
|
|
|
|
|
2020-05-23 20:58:42 +00:00
|
|
|
CPPFILES = $(filter %.cpp,$(SOURCES_CXX))
|
|
|
|
CCFILES = $(filter %.cc,$(SOURCES_CXX))
|
|
|
|
|
|
|
|
OBJECTS := $(SOURCES_C:.c=.o) $(CPPFILES:.cpp=.o) $(CCFILES:.cc=.o)
|
|
|
|
|
2022-01-30 15:44:33 +00:00
|
|
|
ifeq (,$(findstring msvc,$(platform)))
|
2024-01-24 14:47:54 +00:00
|
|
|
CXXFLAGS += -std=c++17
|
2022-01-30 15:44:33 +00:00
|
|
|
else
|
|
|
|
CXXFLAGS += -std:c++latest
|
|
|
|
endif
|
2020-05-23 20:58:42 +00:00
|
|
|
|
2022-01-30 15:44:33 +00:00
|
|
|
|
|
|
|
CFLAGS += -D__LIBRETRO__ $(fpic) $(DEFINES) $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
|
|
|
DYNARMICFLAGS += -D__LIBRETRO__ $(fpic) $(DEFINES) $(DYNARMICINCFLAGS) $(INCFLAGS_PLATFORM) $(CXXFLAGS)
|
|
|
|
CXXFLAGS += -D__LIBRETRO__ $(fpic) $(DEFINES) $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
2020-05-23 20:58:42 +00:00
|
|
|
|
|
|
|
OBJOUT = -o
|
2024-01-24 14:47:54 +00:00
|
|
|
LINKOUT = -o
|
2020-05-23 20:58:42 +00:00
|
|
|
|
|
|
|
ifneq (,$(findstring msvc,$(platform)))
|
|
|
|
OBJOUT = -Fo
|
|
|
|
LINKOUT = -out:
|
|
|
|
ifeq ($(STATIC_LINKING),1)
|
|
|
|
LD ?= lib.exe
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -MTd
|
|
|
|
CXXFLAGS += -MTd
|
|
|
|
else
|
|
|
|
CFLAGS += -MT
|
|
|
|
CXXFLAGS += -MT
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
LD = link.exe
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -MDd
|
|
|
|
CXXFLAGS += -MDd
|
|
|
|
else
|
|
|
|
CFLAGS += -MD
|
|
|
|
CXXFLAGS += -MD
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
LD = $(CXX)
|
|
|
|
endif
|
|
|
|
|
2020-10-06 13:38:03 +00:00
|
|
|
all: shaders $(TARGET)
|
2020-05-23 20:58:42 +00:00
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
ffmpeg_configure:
|
|
|
|
ifeq ($(HAVE_FFMPEG_STATIC), 1)
|
|
|
|
cd $(EXTERNALS_DIR)/ffmpeg && ./configure $(FFMPEG_CONF_OPTS)
|
|
|
|
endif
|
|
|
|
ffmpeg_static: ffmpeg_configure
|
|
|
|
ifeq ($(HAVE_FFMPEG_STATIC), 1)
|
|
|
|
cd $(EXTERNALS_DIR)/ffmpeg && $(MAKE) -j$(NUMPROC)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(TARGET): ffmpeg_static $(OBJECTS)
|
2020-05-23 20:58:42 +00:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
|
|
$(AR) rcs $@ $(OBJECTS)
|
|
|
|
else
|
|
|
|
$(LD) $(fpic) $(SHARED) $(INCLUDES) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
|
|
|
|
endif
|
|
|
|
|
2023-12-08 05:59:09 +00:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(fpic) -c $(OBJOUT)$@ $<
|
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
$(foreach p,$(OBJECTS),$(if $(findstring $(EXTERNALS_DIR)/dynarmic/src,$p),$p,)):
|
|
|
|
$(CXX) $(DYNARMICFLAGS) $(fpic) -c $(OBJOUT)$@ $(@:.o=.cpp)
|
|
|
|
|
2022-01-30 15:44:33 +00:00
|
|
|
%.o: %.cc
|
|
|
|
$(CXX) $(CXXFLAGS) $(fpic) -c $(OBJOUT)$@ $<
|
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
%.o: %.cpp
|
2020-05-23 20:58:42 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(fpic) -c $(OBJOUT)$@ $<
|
|
|
|
|
|
|
|
clean:
|
2024-01-24 14:47:54 +00:00
|
|
|
rm -f $(OBJECTS) $(TARGET)
|
|
|
|
ifeq ($(HAVE_FFMPEG_STATIC), 1)
|
|
|
|
cd $(EXTERNALS_DIR)/ffmpeg && $(MAKE) clean
|
2023-12-07 10:39:27 +00:00
|
|
|
endif
|
|
|
|
|
2020-05-23 20:58:42 +00:00
|
|
|
shaders: $(SHADER_FILES)
|
2024-01-24 14:47:54 +00:00
|
|
|
mkdir -p $(SRC_DIR)/video_core/shaders
|
2020-05-23 20:58:42 +00:00
|
|
|
for SHADER_FILE in $^; do \
|
|
|
|
FILENAME=$$(basename "$$SHADER_FILE"); \
|
2024-01-24 14:47:54 +00:00
|
|
|
SHADER_NAME=$$(echo "$$FILENAME" | sed -e "s/\./_/g"); \
|
|
|
|
rm -f $(SRC_DIR)/video_core/shaders/$$FILENAME; \
|
|
|
|
echo "#pragma once" >> $(SRC_DIR)/video_core/shaders/$$FILENAME; \
|
|
|
|
echo "constexpr std::string_view $$SHADER_NAME = R\"(" >> $(SRC_DIR)/video_core/shaders/$$FILENAME; \
|
|
|
|
cat $$SHADER_FILE >> $(SRC_DIR)/video_core/shaders/$$FILENAME; \
|
|
|
|
echo ")\";" >> $(SRC_DIR)/video_core/shaders/$$FILENAME; \
|
2020-05-23 20:58:42 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|
2024-01-24 14:47:54 +00:00
|
|
|
.PHONY: clean ffmpeg_static
|