Merge pull request #69 from eldemet/dev-2.1-windsdk
Windows compilation using SDK
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -198,3 +198,7 @@ $RECYCLE.BIN/
|
||||
|
||||
|
||||
*.xcuserstate
|
||||
|
||||
# WindSDK compiled folders
|
||||
build/WinSDK/32bit/
|
||||
build/WinSDK/64bit/
|
||||
|
||||
54
build/WinSDK/Makefile.bat
Normal file
54
build/WinSDK/Makefile.bat
Normal file
@@ -0,0 +1,54 @@
|
||||
rem : set path to Windows SDK
|
||||
Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
|
||||
Set Reg.Val=CurrentInstallFolder
|
||||
Set Build_PATH=%CD%
|
||||
|
||||
rem : set path for source EPANET files
|
||||
cd ..\..\include
|
||||
Set H_PATH=%CD%
|
||||
cd ..\src
|
||||
Set SRC_PATH=%CD%
|
||||
|
||||
rem : set Windows SDK Path from registry
|
||||
For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
|
||||
|
||||
|
||||
rem : 64 bit
|
||||
rem : check pc architecture
|
||||
Set Reg.Qry=HKLM\Hardware\Description\System\CentralProcessor\0
|
||||
REG.exe Query %Reg.Qry% > checkOS.tmp
|
||||
Find /i "x86" < checkOS.tmp > StringCheck.tmp
|
||||
If %ERRORLEVEL% == 1 (
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||
md "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
||||
copy "%H_PATH%"\*.h "%Build_PATH%"\64bit
|
||||
)
|
||||
|
||||
|
||||
rem : 32 bit with DEF
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||
echo "32 bit with epanet2.def mapping"
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL /def:..\build\WinSDK\epanet2.def /MAP
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||
md "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit
|
||||
|
||||
|
||||
rem : a bit of housekeeping and cleaning
|
||||
del "%SRC_PATH%"\*.obj
|
||||
del "%SRC_PATH%"\*.exp
|
||||
del "%SRC_PATH%"\*.lib
|
||||
del "%SRC_PATH%"\*.map
|
||||
del "%SRC_PATH%"\*.tmp
|
||||
|
||||
cd "%Build_PATH%"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
rem : set path to Windows SDK
|
||||
Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
|
||||
Set Reg.Val=CurrentInstallFolder
|
||||
|
||||
For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
|
||||
echo %SDK_PATH%
|
||||
|
||||
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
||||
|
||||
rem : set path for source EPANET files
|
||||
cd ..\..\src
|
||||
set SRC_PATH=%CD%
|
||||
|
||||
del %SRC_PATH%\*.dll
|
||||
del %SRC_PATH%\*.exe
|
||||
|
||||
rem : do the magic ...
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||
|
||||
rem : a bit of housekeeping and cleaning
|
||||
del %SRC_PATH%\*.obj
|
||||
del %SRC_PATH%\*.exp
|
||||
del %SRC_PATH%\*.lib
|
||||
del %SRC_PATH%\*.map
|
||||
@@ -1,29 +0,0 @@
|
||||
rem : set path to Windows SDK
|
||||
Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
|
||||
Set Reg.Val=CurrentInstallFolder
|
||||
|
||||
For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
|
||||
echo %SDK_PATH%
|
||||
|
||||
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||
|
||||
rem : set path for source EPANET files
|
||||
SET SRC_PATH="D:\Projects\EPANET\Open Source\Code\owa\EPANET\src"
|
||||
cd ..\..\src
|
||||
set SRC_PATH=%CD%
|
||||
|
||||
del %SRC_PATH%\*.dll
|
||||
del %SRC_PATH%\*.exe
|
||||
|
||||
rem : do the magic ...
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL /def:..\build\winsdk\epanet2.def /MAP
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||
|
||||
rem : a bit of housekeeping and cleaning
|
||||
del %SRC_PATH%\*.obj
|
||||
del %SRC_PATH%\*.exp
|
||||
del %SRC_PATH%\*.lib
|
||||
del %SRC_PATH%\*.map
|
||||
@@ -1,25 +0,0 @@
|
||||
rem : set path to Windows SDK
|
||||
SET SDK_PATH="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\"
|
||||
|
||||
rem : set path for source EPANET files
|
||||
SET SRC_PATH="D:\Projects\EPANET\Open Source\Code\owa\EPANET\src"
|
||||
|
||||
CALL %SDK_PATH%SetEnv.cmd /x86 /release
|
||||
CHDIR /D %SRC_PATH%
|
||||
del %SRC_PATH%\*.dll
|
||||
del %SRC_PATH%\*.exe
|
||||
|
||||
rem : do the magic ...
|
||||
rem : creat EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL /def:..\build\winsdk\epanet2.def /MAP
|
||||
rem : creat EPANET2.EXE
|
||||
rem : first option is the standalone EXE
|
||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||
rem : second option is a linked EXE (linked to the epanet2.dll)
|
||||
rem cl -o epanet2.exe ..\run\main.c epanet2.lib /I ..\include /I ..\run /I ..\src /link
|
||||
|
||||
rem : a bit of housekeeping and cleaning
|
||||
del %SRC_PATH%\*.obj
|
||||
del %SRC_PATH%\*.exp
|
||||
del %SRC_PATH%\*.lib
|
||||
del %SRC_PATH%\*.map
|
||||
Reference in New Issue
Block a user