From d8073423a788b88d3686610cc00aa9e477789700 Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Mon, 25 Sep 2017 14:01:19 -0700 Subject: [PATCH] - Makefile compile steam shim on windows --- source/steamshim_parent/Makefile.win | 36 +++++++++++++ source/steamshim_parent/build.bat | 75 ++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 source/steamshim_parent/Makefile.win create mode 100644 source/steamshim_parent/build.bat diff --git a/source/steamshim_parent/Makefile.win b/source/steamshim_parent/Makefile.win new file mode 100644 index 00000000..aed1cded --- /dev/null +++ b/source/steamshim_parent/Makefile.win @@ -0,0 +1,36 @@ +TARGET = megaglest_shim +GAME_LAUNCH_NAME = megaglest.exe + +!ifndef STEAMWORKS +# STEAMWORKS = /home/softcoder/Code/steamworks_sdk/sdk +!error STEAMWORKS is not set +!endif + +# CXX = cl.exe /O2 /DNDEBUG +# WINDRES = windres +LNK = link.exe +FLAGS = /I $(STEAMWORKS)\public -DGAME_LAUNCH_NAME=\"$(GAME_LAUNCH_NAME)\" +# LIB_PATH = "/LIBPATH:$(STEAMWORKS)\redistributable_bin" /VERBOSE:LIB +LIB_PATH = "/LIBPATH:$(STEAMWORKS)\redistributable_bin" +LIBS = steam_api.lib gdi32.lib user32.lib + +!if "$(DEBUG)" == "1" +FLAGS = $(FLAGS) -DSTEAMSHIM_DEBUG +!else +FLAGS = $(FLAGS) -mwindows +!endif + +SRC = steamshim_parent.cpp + +.PHONY : clean all +all : app + +app: steamshim_parent.obj + $(LNK) $(LIB_PATH) $(LIBS) /machine:X86 /OUT:$(TARGET).exe steamshim_parent.obj + +steamshim_parent.obj: steamshim_parent.cpp + $(CXX) /MT $(CXXFLAGS) $(FLAGS) /c steamshim_parent.cpp /Fosteamshim_parent.obj + +clean: + @-erase $(TARGET).obj + @-erase $(TARGET).exe diff --git a/source/steamshim_parent/build.bat b/source/steamshim_parent/build.bat new file mode 100644 index 00000000..6b8a98d0 --- /dev/null +++ b/source/steamshim_parent/build.bat @@ -0,0 +1,75 @@ +@echo off + +rem change to the directory of this batch file +rem SET VCVARS_PLATFORM=x86_amd64 +SET VCVARS_PLATFORM= + +SET MSBUILD_CONFIG=Release + +ECHO -------------------------------- +ECHO Changing to build folder [%~dp0] p1 ["%1"] p2 ["%2"] +rem pause +cd /d "%~dp0" + +ECHO using msbuild config [%MSBUILD_CONFIG%] +ECHO Checking for windows binary runtime tools... + +rem setup the Visual Studio 2015 environment +ECHO -------------------------------- +ECHO Setting up Visual Studio 2015 environment vars... +REM Ensure ultifds HP doesn't mess the build up +SET Platform= +if "%DevEnvDir%." == "." goto SETVCVARS +GOTO GITSECTION + +:SETVCVARS + +IF EXIST "%VS140COMNTOOLS%..\..\" GOTO VC_Common_15 +IF EXIST "\Program Files\Microsoft Visual Studio 14.0\" GOTO VC_32_15 +IF EXIST "\Program Files (x86)\Microsoft Visual Studio 14.0\" GOTO VC_64_15 +goto GITSECTION + +:VC_Common_15 +call "%VS140COMNTOOLS%..\..\vc\vcvarsall.bat" %VCVARS_PLATFORM% +goto GITSECTION + +:VC_32_15 +ECHO 32 bit Windows detected... +call "\Program Files\Microsoft Visual Studio 14.0\vc\vcvarsall.bat" %VCVARS_PLATFORM% +goto GITSECTION + +:VC_64_15 +ECHO 64 bit Windows detected... +call "\Program Files (x86)\Microsoft Visual Studio 14.0\vc\vcvarsall.bat" %VCVARS_PLATFORM% +goto GITSECTION + +:GITSECTION +rem Update from GIT to latest rev +ECHO -------------------------------- +ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%] + +rem Build Mega-Glest in release mode +ECHO -------------------------------- +Echo Building MegaGlest using Visual Studio 2015... + +set CL=/MP +del steamshim_parent.obj +del megaglest_shim.exe + +rem set VisualStudioVersion=11.0 +set msBuildMaxCPU= +SET BuildInParallel=false +if %NUMBER_OF_PROCESSORS% GTR 2 ( + SET NumberOfProcessesToUseForBuild=2 + SET BuildInParallel=true + SET msBuildMaxCPU=/maxcpucount) + +ECHO Found CPU Count [%NUMBER_OF_PROCESSORS%] +SET MSBUILD_PATH_MG_x64="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140\\" + +echo Doing a FULL REBUILD... +nmake /f Makefile.win STEAMWORKS=c:\Code\steamworks_sdk\sdk + +ECHO ... End. +rem pause execution so we can see the output before the batch file exits +if not "%1" == "nopause" pause