Skip to content

Commit

Permalink
Added variations for runtime library between matrix combination for m…
Browse files Browse the repository at this point in the history
…svc runtime configurations. #81
  • Loading branch information
kekyo committed Sep 17, 2019
1 parent 57dde7c commit 0f4e86e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 16 deletions.
8 changes: 5 additions & 3 deletions IL2C.Runtime/build/IL2C.Runtime.msvc.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IL2CRuntimeMSVCTargetPlatform Condition="'%(Link.SubSystem)'=='EFI Application'">uefi</IL2CRuntimeMSVCTargetPlatform>
<IL2CRuntimeMSVCTargetPlatform Condition="'%(Link.SubSystem)'==''">win</IL2CRuntimeMSVCTargetPlatform>
<IL2CRuntimeMSVCTargetPlatform Condition="'$(IL2CRuntimeMSVCTargetPlatform)'==''">win</IL2CRuntimeMSVCTargetPlatform>
<IL2CRuntimeMSVCTargetRuntime Condition="'%(ClCompile.RuntimeLibrary)'=='MultiThreadedDebugDLL'">rtd</IL2CRuntimeMSVCTargetRuntime>
<IL2CRuntimeMSVCTargetRuntime Condition="'%(ClCompile.RuntimeLibrary)'=='MultiThreadedDLL'">rtd</IL2CRuntimeMSVCTargetRuntime>
<IL2CRuntimeMSVCTargetRuntime Condition="'$(IL2CRuntimeMSVCTargetRuntime)'==''">rts</IL2CRuntimeMSVCTargetRuntime>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(IL2CRuntimeBasePath)\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(IL2CRuntimeMSVCBasePath)\lib\$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libil2c-msvc-$(IL2CRuntimeMSVCTargetPlatform)-$(Platform).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libil2c-msvc-$(IL2CRuntimeMSVCTargetPlatform)-$(Platform)-$(IL2CRuntimeMSVCTargetRuntime).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
12 changes: 9 additions & 3 deletions IL2C.Runtime/cmake/msvc-win.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ ProcessorCount(pc)
math(EXPR pc2 "${pc}*2")

set(CMAKE_C_FLAGS "/EHa /GF /Gy /Zi /utf-8 /W4 /WX /wd4100 /wd4197 /wd4206 /wd4127 /MP${pc2}")
set(CMAKE_C_FLAGS_DEBUG "/Od /Ob0 /Oi /RTC1 /GR /sdl /MTd -D_DEBUG")
set(CMAKE_C_FLAGS_RELEASE "/Ox /Ot /Ob2 /Oi /Oy /GL /GS /sdl- /MT -DNDEBUG")

if("${RUNTIMELIB}" STREQUAL "rts")
set(CMAKE_C_FLAGS_DEBUG "/Od /Ob0 /Oi /RTC1 /GR /sdl /MTd -D_DEBUG") # MTd - Multi threaded debug (static)
set(CMAKE_C_FLAGS_RELEASE "/Ox /Ot /Ob2 /Oi /Oy /GL /GS /sdl- /MT -DNDEBUG") # MT - Multi threaded (static)
else()
set(CMAKE_C_FLAGS_DEBUG "/Od /Ob0 /Oi /RTC1 /GR /sdl /MDd -D_DEBUG") # MDd - Multi threaded debug DLL
set(CMAKE_C_FLAGS_RELEASE "/Ox /Ot /Ob2 /Oi /Oy /GL /GS /sdl- /MD -DNDEBUG") # MD - Multi threaded DLL
endif()

set(CMAKE_STATIC_LINKER_FLAGS "/ignore:4221")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
Expand All @@ -31,7 +37,7 @@ if("${PLATFORM}" STREQUAL "Win32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH")
endif()

set(IL2C_LIBRARY_NAME_BASE "il2c-msvc-win-${PLATFORM}")
set(IL2C_LIBRARY_NAME_BASE "il2c-msvc-win-${PLATFORM}-${RUNTIMELIB}")
set(IL2C_LIBRARY_NAME "lib${IL2C_LIBRARY_NAME_BASE}.lib")

set(TARGET_LIBRARY_NAME "lib${IL2C_LIBRARY_NAME_BASE}")
Expand Down
66 changes: 56 additions & 10 deletions build-runtime.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ cd build.cmake

rem ================================================================================

:msvc-win-win32
:msvc-win-win32-rts

echo.
echo ///////////////////////////////////////////////
echo // Build IL2C.Runtime (msvc-win-win32-%Configuration%)
echo // Build IL2C.Runtime (msvc-win-win32-rts-%Configuration%)
echo.

mkdir msvc-win-win32-%Configuration%
cd msvc-win-win32-%Configuration%
mkdir msvc-win-win32-rts-%Configuration%
cd msvc-win-win32-rts-%Configuration%

cmake -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=Win32 -DCONFIGURATION=%Configuration% ../..
cmake -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=Win32 -DRUNTIMELIB=rts -DCONFIGURATION=%Configuration% ../..
if errorlevel 1 (
exit /b %errorlevel%
)
Expand All @@ -63,17 +63,63 @@ cd ..

rem ================================================================================

:msvc-win-x64
:msvc-win-x64-rts

echo.
echo ///////////////////////////////////////////////
echo // Build IL2C.Runtime (msvc-win-x64-%Configuration%)
echo // Build IL2C.Runtime (msvc-win-x64-rts-%Configuration%)
echo.

mkdir msvc-win-x64-%Configuration%
cd msvc-win-x64-%Configuration%
mkdir msvc-win-x64-rts-%Configuration%
cd msvc-win-x64-rts-%Configuration%

cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=x64 -DCONFIGURATION=%Configuration% ../..
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=x64 -DRUNTIMELIB=rts -DCONFIGURATION=%Configuration% ../..
if errorlevel 1 (
exit /b %errorlevel%
)
cmake --build . -j --config %Configuration%
if errorlevel 1 (
exit /b %errorlevel%
)

cd ..

rem ================================================================================

:msvc-win-win32-rtd

echo.
echo ///////////////////////////////////////////////
echo // Build IL2C.Runtime (msvc-win-win32-rtd-%Configuration%)
echo.

mkdir msvc-win-win32-rtd-%Configuration%
cd msvc-win-win32-rtd-%Configuration%

cmake -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=Win32 -DRUNTIMELIB=rtd -DCONFIGURATION=%Configuration% ../..
if errorlevel 1 (
exit /b %errorlevel%
)
cmake --build . -j --config %Configuration%
if errorlevel 1 (
exit /b %errorlevel%
)

cd ..

rem ================================================================================

:msvc-win-x64-rtd

echo.
echo ///////////////////////////////////////////////
echo // Build IL2C.Runtime (msvc-win-x64-rtd-%Configuration%)
echo.

mkdir msvc-win-x64-rtd-%Configuration%
cd msvc-win-x64-rtd-%Configuration%

cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=../../cmake/msvc-win.cmake -DPLATFORM=x64 -DRUNTIMELIB=rtd -DCONFIGURATION=%Configuration% ../..
if errorlevel 1 (
exit /b %errorlevel%
)
Expand Down

0 comments on commit 0f4e86e

Please sign in to comment.