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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <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> <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 TARGET=$(Configuration) clean</NMakeCleanCommandLine> <NMakeCleanCommandLine>make CONFIG=$(Configuration) clean</NMakeCleanCommandLine>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <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> <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 TARGET=$(Configuration) clean</NMakeCleanCommandLine> <NMakeCleanCommandLine>make CONFIG=$(Configuration) clean</NMakeCleanCommandLine>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <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\eep.cpp" />
<ClCompile Include="src\euc-jp.cpp" /> <ClCompile Include="src\euc-jp.cpp" />
<ClCompile Include="src\flash.cpp" /> <ClCompile Include="src\flash.cpp" />
<ClCompile Include="src\main\main.cpp" />
<ClCompile Include="src\math_routines.cpp" /> <ClCompile Include="src\math_routines.cpp" />
<ClCompile Include="src\overlays.cpp" /> <ClCompile Include="src\overlays.cpp" />
<ClCompile Include="src\pak.cpp" /> <ClCompile Include="src\pak.cpp" />

View File

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

View File

@ -18,18 +18,18 @@ $(error "Invalid build configuration: $(CONFIG)")
endif endif
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
DYN_EXT := .dll DYN_EXT := .dll
LIB_EXT := .lib LIB_EXT := .lib
EXE_EXT := .exe EXE_EXT := .exe
AR := clang++ AR := clang++
ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o
# Static C runtime linking # Static C runtime linking
LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt
# Dynamic # Dynamic
# LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -lmsvcrt -lvcruntime -lucrt # 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 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; 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 SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
define mkdir define mkdir
mkdir $(subst /,\\,$(1)) mkdir $(subst /,\\,$(1))
endef 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)) rmdir /S /Q $(subst /,\\,$(1))
endef endef
else else
DYN_EXT := .so DYN_EXT := .so
LIB_EXT := .a LIB_EXT := .a
EXE_EXT := EXE_EXT :=
LIB_PRE := lib LIB_PRE := lib
AR := ar AR := ar
ARFLAGS := rcs ARFLAGS := rcs
define mkdir define mkdir
mkdir -p $(1) mkdir -p $(1)
endef 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 CXXFLAGS := -ffunction-sections -fdata-sections -march=nehalem $(OPTFLAGS) $(WARNFLAGS) -std=c++20 -c
CPPFLAGS := -Iinclude -Ithirdparty 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) ifeq ($(LIB),1)
TARGET := $(BUILD_DIR)/MMRecomp$(DYN_EXT) TARGET := $(BUILD_DIR)/MMRecomp$(DYN_EXT)
LDFLAGS += -shared LDFLAGS += -shared
@ -106,6 +97,16 @@ else
TARGET := $(BUILD_DIR)/MMRecomp$(EXE_EXT) TARGET := $(BUILD_DIR)/MMRecomp$(EXE_EXT)
endif 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) default: $(TARGET)
clean: clean:

View File

@ -63,11 +63,18 @@ typedef struct {
//DLLEXPORT void (CALL *UpdateScreen)(void) = nullptr; //DLLEXPORT void (CALL *UpdateScreen)(void) = nullptr;
//DLLEXPORT void (CALL *PumpEvents)(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); extern "C" int InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display);
#else
static_assert(false && "Unimplemented");
#endif
DLLIMPORT void ProcessRDPList(void); DLLIMPORT void ProcessRDPList(void);
DLLIMPORT void ProcessDList(void); DLLIMPORT void ProcessDList(void);
DLLIMPORT void UpdateScreen(void); DLLIMPORT void UpdateScreen(void);
DLLIMPORT void PumpEvents(void);
DLLIMPORT void ChangeWindow(void); DLLIMPORT void ChangeWindow(void);
#endif #endif

View File

@ -9,6 +9,8 @@
#include "ultra64.h" #include "ultra64.h"
#if defined(_WIN32) #if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# include <Windows.h> # include <Windows.h>
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
# include "android/native_window.h" # 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.SP_STATUS_REG = &SP_STATUS_REG;
gfx_info.RDRAM_SIZE = &RDRAM_SIZE; 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); InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display);
#else
static_assert(false && "Unimplemented");
#endif
} }
void RT64SendDL(uint8_t* rdram, const OSTask* task) { void RT64SendDL(uint8_t* rdram, const OSTask* task) {