Windows build fixes

This commit is contained in:
Mr-Wiseguy 2023-10-23 17:51:21 -04:00
parent f361fddd3e
commit 1037bb5206
6 changed files with 54 additions and 32 deletions

View File

@ -78,14 +78,14 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<NMakeBuildCommandLine>make TARGET=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)</NMakeBuildCommandLine>
<NMakeCleanCommandLine>make TARGET=$(Configuration) clean</NMakeCleanCommandLine>
<NMakeBuildCommandLine>make CONFIG=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)</NMakeBuildCommandLine>
<NMakeCleanCommandLine>make CONFIG=$(Configuration) clean</NMakeCleanCommandLine>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<NMakeBuildCommandLine>make TARGET=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)</NMakeBuildCommandLine>
<NMakeCleanCommandLine>make TARGET=$(Configuration) clean</NMakeCleanCommandLine>
<NMakeBuildCommandLine>make CONFIG=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)</NMakeBuildCommandLine>
<NMakeCleanCommandLine>make CONFIG=$(Configuration) clean</NMakeCleanCommandLine>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -207,6 +207,7 @@ XCOPY "$(ProjectDir)lib\SDL2-2.24.0\lib\$(Platform)\SDL2.dll" "$(TargetDir)" /S
<ClCompile Include="src\eep.cpp" />
<ClCompile Include="src\euc-jp.cpp" />
<ClCompile Include="src\flash.cpp" />
<ClCompile Include="src\main\main.cpp" />
<ClCompile Include="src\math_routines.cpp" />
<ClCompile Include="src\overlays.cpp" />
<ClCompile Include="src\pak.cpp" />

View File

@ -105,6 +105,9 @@
<ClCompile Include="rsp\aspMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\euc-jp.h">

View File

@ -18,18 +18,18 @@ $(error "Invalid build configuration: $(CONFIG)")
endif
ifeq ($(OS),Windows_NT)
DYN_EXT := .dll
LIB_EXT := .lib
EXE_EXT := .exe
AR := clang++
ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o
# Static C runtime linking
LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt
# Dynamic
# LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -lmsvcrt -lvcruntime -lucrt
LIB_DIR ?= C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64
UCRT_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64;
SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
DYN_EXT := .dll
LIB_EXT := .lib
EXE_EXT := .exe
AR := clang++
ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o
# Static C runtime linking
LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt
# Dynamic
# LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -lmsvcrt -lvcruntime -lucrt
LIB_DIR ?= C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64
UCRT_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64;
SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
define mkdir
mkdir $(subst /,\\,$(1))
endef
@ -37,12 +37,12 @@ SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
rmdir /S /Q $(subst /,\\,$(1))
endef
else
DYN_EXT := .so
LIB_EXT := .a
EXE_EXT :=
LIB_PRE := lib
AR := ar
ARFLAGS := rcs
DYN_EXT := .so
LIB_EXT := .a
EXE_EXT :=
LIB_PRE := lib
AR := ar
ARFLAGS := rcs
define mkdir
mkdir -p $(1)
endef
@ -90,15 +90,6 @@ CFLAGS := -ffunction-sections -fdata-sections -march=nehalem $(OPTFLAGS) $(WA
CXXFLAGS := -ffunction-sections -fdata-sections -march=nehalem $(OPTFLAGS) $(WARNFLAGS) -std=c++20 -c
CPPFLAGS := -Iinclude -Ithirdparty
ifeq ($(OS),Windows_NT)
LDFLAGS := -v -Wl,/OPT:REF $(OPTFLAGS) $(LIBS) -L"$(LIB_DIR:;=)" -L"$(UCRT_DIR:;=)" -L"$(SDK_DIR:;=)" lib/RT64/$(CONFIG)/RT64.lib
else
LDFLAGS := $(OPTFLAGS) -L$(BUILD_DIR) -lRecompiledFuncs -L. -lrt64 -lSDL2 -lX11 -Wl,--gc-sections
FUNC_CFLAGS += -ffunction-sections -fdata-sections
FUNC_CXXFLAGS += -ffunction-sections -fdata-sections
EXTRA_DEPS := librt64.a
endif
ifeq ($(LIB),1)
TARGET := $(BUILD_DIR)/MMRecomp$(DYN_EXT)
LDFLAGS += -shared
@ -106,6 +97,16 @@ else
TARGET := $(BUILD_DIR)/MMRecomp$(EXE_EXT)
endif
ifeq ($(OS),Windows_NT)
LDFLAGS := -v -Wl,/OPT:REF $(OPTFLAGS) $(LIBS) -L"$(LIB_DIR:;=)" -L"$(UCRT_DIR:;=)" -L"$(SDK_DIR:;=)" lib/RT64/$(CONFIG)/mupen64plus-video-rt64.lib lib/SDL2-2.24.0/lib/x64/SDL2.lib
CPPFLAGS += -Ilib/SDL2-2.24.0/include
else
LDFLAGS := $(OPTFLAGS) -L$(BUILD_DIR) -lRecompiledFuncs -L. -lrt64 -lSDL2 -lX11 -Wl,--gc-sections
FUNC_CFLAGS += -ffunction-sections -fdata-sections
FUNC_CXXFLAGS += -ffunction-sections -fdata-sections
EXTRA_DEPS := librt64.a
endif
default: $(TARGET)
clean:

View File

@ -63,11 +63,18 @@ typedef struct {
//DLLEXPORT void (CALL *UpdateScreen)(void) = nullptr;
//DLLEXPORT void (CALL *PumpEvents)(void) = nullptr;
#if defined(_WIN32)
extern "C" int InitiateGFXWindows(GFX_INFO Gfx_Info, HWND hwnd);
#elif defined(__ANDROID__)
static_assert(false && "Unimplemented");
#elif defined(__linux__)
extern "C" int InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display);
#else
static_assert(false && "Unimplemented");
#endif
DLLIMPORT void ProcessRDPList(void);
DLLIMPORT void ProcessDList(void);
DLLIMPORT void UpdateScreen(void);
DLLIMPORT void PumpEvents(void);
DLLIMPORT void ChangeWindow(void);
#endif

View File

@ -9,6 +9,8 @@
#include "ultra64.h"
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <Windows.h>
#elif defined(__ANDROID__)
# include "android/native_window.h"

View File

@ -97,7 +97,15 @@ void RT64Init(uint8_t* rom, uint8_t* rdram, Multilibultra::WindowHandle window_h
gfx_info.SP_STATUS_REG = &SP_STATUS_REG;
gfx_info.RDRAM_SIZE = &RDRAM_SIZE;
#if defined(_WIN32)
InitiateGFXWindows(gfx_info, window_handle);
#elif defined(__ANDROID__)
static_assert(false && "Unimplemented");
#elif defined(__linux__)
InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display);
#else
static_assert(false && "Unimplemented");
#endif
}
void RT64SendDL(uint8_t* rdram, const OSTask* task) {