Skip to content

Commit

Permalink
Update openssl build script to support debug | release
Browse files Browse the repository at this point in the history
  • Loading branch information
gorlak committed Feb 19, 2021
1 parent 62eae34 commit 5602ed5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Dependencies/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openssl-install/
openssl-*/
26 changes: 6 additions & 20 deletions Dependencies/openssl-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,32 @@ if "%RUNTIME%" equ "d" copy /y ms\nt.mak ms\nt.mak.orig
:: Release
::

if defined BUILD_RELEASE perl Configure %CONFIGURE% no-asm --prefix=%~dp0\%PLATFORM%-m%RUNTIME%
if defined BUILD_RELEASE rmdir /s /q %~dp0\openssl-%PLATFORM%-m%RUNTIME%
if defined BUILD_RELEASE perl Configure %CONFIGURE% no-asm --prefix=%~dp0\openssl-%PLATFORM%-m%RUNTIME%
if defined BUILD_RELEASE call %SETUP%

if defined BUILD_RELEASE if "%RUNTIME%" equ "d" copy /y ms\nt.mak ms\nt.mak.unhacked
if defined BUILD_RELEASE if "%RUNTIME%" equ "d" perl -p -e "s/\/MT/\/MD/g" ms\nt.mak.unhacked > ms\nt.mak

if defined BUILD_RELEASE nmake -f ms\nt.mak
if defined BUILD_RELEASE nmake -f ms\nt.mak install
if defined BUILD_RELEASE copy /y tmp32\lib.pdb %~dp0\%PLATFORM%-m%RUNTIME%\lib\
if defined BUILD_RELEASE copy /y tmp32\lib.pdb %~dp0\openssl-%PLATFORM%-m%RUNTIME%\lib\
if defined BUILD_RELEASE nmake -f ms\nt.mak clean

::
:: Debug
::

if defined BUILD_DEBUG perl Configure debug-%CONFIGURE% no-asm --prefix=%~dp0\%PLATFORM%-m%RUNTIME%d
if defined BUILD_DEBUG rmdir /s /q %~dp0\openssl-%PLATFORM%-m%RUNTIME%d
if defined BUILD_DEBUG perl Configure debug-%CONFIGURE% no-asm --prefix=%~dp0\openssl-%PLATFORM%-m%RUNTIME%d
if defined BUILD_DEBUG call %SETUP%

if defined BUILD_DEBUG if "%RUNTIME%" equ "d" copy /y ms\nt.mak ms\nt.mak.unhacked
if defined BUILD_DEBUG if "%RUNTIME%" equ "d" perl -p -e "s/\/MT/\/MD/g" ms\nt.mak.unhacked > ms\nt.mak

if defined BUILD_DEBUG nmake -f ms\nt.mak
if defined BUILD_DEBUG nmake -f ms\nt.mak install
if defined BUILD_DEBUG copy /y tmp32.dbg\lib.pdb %~dp0\%PLATFORM%-m%RUNTIME%d\lib\
if defined BUILD_DEBUG copy /y tmp32.dbg\lib.pdb %~dp0\openssl-%PLATFORM%-m%RUNTIME%d\lib\
if defined BUILD_DEBUG nmake -f ms\nt.mak clean

::
Expand All @@ -78,20 +80,4 @@ git clean -fdx

popd

pushd %~dp0

if exist openssl-install attrib -r openssl-install\*.* /s
if exist openssl-install rmdir /s /q openssl-install

ren %PLATFORM%-m%RUNTIME%\lib m%RUNTIME%
ren %PLATFORM%-m%RUNTIME%d\lib m%RUNTIME%d

ren %PLATFORM%-m%RUNTIME% openssl-install
mkdir openssl-install\lib\vstudio-%VisualStudioVersion%\%PLATFORM%
move openssl-install\m%RUNTIME% openssl-install\lib\vstudio-%VisualStudioVersion%\%PLATFORM%\
move %PLATFORM%-m%RUNTIME%d\m%RUNTIME%d openssl-install\lib\vstudio-%VisualStudioVersion%\%PLATFORM%\
rmdir /s /q %PLATFORM%-m%RUNTIME%d

popd

endlocal
84 changes: 45 additions & 39 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ newoption

architecture( _OPTIONS[ "architecture" ] )

local platform = "x64"
if _OPTIONS[ "architecture" ] == "x86" then
platform = "Win32"
end

flags
{
"FatalWarnings",
Expand Down Expand Up @@ -50,11 +55,6 @@ defines
"Z_PREFIX",
}

includedirs
{
"Dependencies/openssl-install/include",
}

buildoptions
{
"/MP",
Expand Down Expand Up @@ -112,6 +112,46 @@ configuration "Release"
"/Oi",
}

configuration {"Debug", "x86"}
includedirs
{
"Dependencies/openssl-Win32-mdd/include",
}
libdirs
{
"Dependencies/openssl-Win32-mdd/lib"
}

configuration {"not Debug", "x86"}
includedirs
{
"Dependencies/openssl-Win32-md/include",
}
libdirs
{
"Dependencies/openssl-Win32-md/lib"
}

configuration {"Debug", "x86_64"}
includedirs
{
"Dependencies/openssl-x64-mdd/include",
}
libdirs
{
"Dependencies/openssl-x64-mdd/lib"
}

configuration {"not Debug", "x86_64"}
includedirs
{
"Dependencies/openssl-x64-md/include",
}
libdirs
{
"Dependencies/openssl-x64-md/lib"
}

configuration {}

-- workspace
Expand Down Expand Up @@ -426,11 +466,6 @@ project "p4"
"Dependencies/p4/zlib",
}

local platform = "x64"
if _OPTIONS[ "architecture" ] == "x86" then
platform = "Win32"
end

files
{
"Dependencies/p4/client/clientmain.*",
Expand All @@ -453,18 +488,6 @@ project "p4"
"setargv.obj",
}

configuration "Debug"
libdirs
{
"Dependencies/openssl-install/lib/vstudio-$(VisualStudioVersion)/" .. platform .. "/mdd"
}

configuration "not Debug"
libdirs
{
"Dependencies/openssl-install/lib/vstudio-$(VisualStudioVersion)/" .. platform .. "/md"
}

project "P4Win"

kind "WindowedApp"
Expand Down Expand Up @@ -507,11 +530,6 @@ project "P4Win"
"Source/gui/OptionsDlg",
}

local platform = "x64"
if _OPTIONS[ "architecture" ] == "x86" then
platform = "Win32"
end

files
{
"Source/common/**.cpp",
Expand Down Expand Up @@ -556,15 +574,3 @@ project "P4Win"
"wininet",
"winmm",
}

configuration "Debug"
libdirs
{
"Dependencies/openssl-install/lib/vstudio-$(VisualStudioVersion)/" .. platform .. "/mdd"
}

configuration "not Debug"
libdirs
{
"Dependencies/openssl-install/lib/vstudio-$(VisualStudioVersion)/" .. platform .. "/md"
}

0 comments on commit 5602ed5

Please sign in to comment.