Skip to content

Commit

Permalink
Improvement tied to #11
Browse files Browse the repository at this point in the history
No longuer bundle previous version of Dear Imgui inside this depot. Now optionally fetch them from GitHub instead.
Moved around some generated folders
  • Loading branch information
sammyfreg committed Feb 13, 2021
1 parent b85b951 commit 5f128f3
Show file tree
Hide file tree
Showing 96 changed files with 463 additions and 197,379 deletions.
100 changes: 100 additions & 0 deletions Build/GenerateCompatibilityTest.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@echo off
setlocal enabledelayedexpansion
cls

::-----------------------------------------------------------------------------------
:: SETTINGS
::-----------------------------------------------------------------------------------
:: List of offical Dear ImGui (from official depot)
set VERSIONS=(v1.74 v1.75 v1.76 v1.77 v1.78 v1.79)
:: List of custom Dear ImGui releases (from own depot)
set EXTRA_VERSIONS=(dock-1-76)

:: Output directory
set IMGUI_DIR=%~dp0..\_generated\imgui

:: Destination of Compatibility project config file
set COMPAT_FILE=%IMGUI_DIR%\compatibility.sharpmake.cs

:: goto SkipDownload

:GetAllImgui
echo ================================================================================
echo Download multiple versions of Dear Imgui.
echo Unpack them and generates netImgui projects for each.
echo Used to test compatibility against multiple version of Dear ImGui
echo ================================================================================
echo.

if not exist %IMGUI_DIR% goto SkipDelete
echo.
echo --------------------------------------------------------------------------------
echo Clearing Releases
echo --------------------------------------------------------------------------------
echo Removing: %IMGUI_DIR%
rmdir /s /q %IMGUI_DIR%


:SkipDelete
mkdir %IMGUI_DIR%
echo.
echo --------------------------------------------------------------------------------
echo Downloading and extracting Dear ImGui Releases
echo --------------------------------------------------------------------------------
pushd %IMGUI_DIR%
for %%v in %VERSIONS% do (
set IMGUI_FILE=%%v.tar.gz
set IMGUI_FILEPATH="https://github.com/ocornut/imgui/archive/!IMGUI_FILE!"
echo !IMGUI_FILEPATH!
curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
tar -xzf !IMGUI_FILE!
del !IMGUI_FILE!
echo.
)
for %%v in %EXTRA_VERSIONS% do (
set IMGUI_FILE=%%v.zip
set IMGUI_FILEPATH="https://raw.githubusercontent.com/wiki/sammyfreg/netImgui/ImguiVersions/!IMGUI_FILE!"
echo !IMGUI_FILE!
curl -LJ !IMGUI_FILEPATH! --output !IMGUI_FILE!
tar -xzf !IMGUI_FILE!
del !IMGUI_FILE!
echo.
)
popd

:SkipDownload
echo --------------------------------------------------------------------------------
echo Generating Sharpmake config for compatibility projects
echo --------------------------------------------------------------------------------
type compatibility.sharpmake.cs.1 > %COMPAT_FILE%
:: Declare each compatibility project (1 per Imgui version)
for /D %%d IN (%IMGUI_DIR%\*) DO (
call :GenerateProjectName %%d
echo [Sharpmake.Generate] public class !NetImguiName! : ProjectNetImgui { public !NetImguiName!^(^): base^(@"%%d"^){} } >> %COMPAT_FILE%
)

type compatibility.sharpmake.cs.2 >> %COMPAT_FILE%
:: Create function adding each project
for /D %%d IN (%IMGUI_DIR%\*) DO (
call :GenerateProjectName %%d
echo conf.AddProject^<!NetImguiName!^>^(target, false, SolutionFolder^); >> %COMPAT_FILE%
echo !NetImguiName! added
)
type compatibility.sharpmake.cs.3 >> %COMPAT_FILE%

echo.
echo --------------------------------------------------------------------------------
echo Dear ImGui Older versions fetched
echo Please regenerate the projects to have them included in compiling tests
echo --------------------------------------------------------------------------------
pause
exit /b %errorlevel%

:: Take a Imgui install path, and make it into a NetImgui project name
:: By keeping only the last direcotory name and removing '-' and '.'
:GenerateProjectName
set NetImguiName=%~nx1
set NetImguiName=%NetImguiName:-=_%
set NetImguiName=%NetImguiName:.=_%
set NetImguiName=ProjectNetImgui_%NetImguiName%
exit /b 0
7 changes: 7 additions & 0 deletions Build/GenerateDebug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
echo ================================================================
echo Generate a sharpmake debug project.
echo (Helps debugging problem with netImgui project generation)
echo ================================================================
Sharpmake\Sharpmake.Application.exe /sources("shared.sharpmake.cs", "netImgui.sharpmake.cs") /verbose /generateDebugSolution
pause
4 changes: 0 additions & 4 deletions Build/GenerateProjects.bat

This file was deleted.

Binary file modified Build/Sharpmake/Sharpmake.Application.exe
Binary file not shown.
Binary file modified Build/Sharpmake/Sharpmake.CommonPlatforms.dll
Binary file not shown.
Binary file modified Build/Sharpmake/Sharpmake.Generators.dll
Binary file not shown.
Binary file modified Build/Sharpmake/Sharpmake.dll
Binary file not shown.
42 changes: 40 additions & 2 deletions Build/Sharpmake/Sharpmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Build/compatibility.sharpmake.cs.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Note:
// The files 'Build\compatibility.sharpmake.cs.1 [2,3]'
// are used by 'Build\GenerateCompatibilityTest.bat'
// while generating '_generated\imgui\compatibility.sharpmake.cs'

namespace NetImgui
{
6 changes: 6 additions & 0 deletions Build/compatibility.sharpmake.cs.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

public class Utility
{
public static void AddCompatibilityProjects(Sharpmake.Solution.Configuration conf, NetImguiTarget target)
{
string SolutionFolder = "CompatibilityTest";
3 changes: 3 additions & 0 deletions Build/compatibility.sharpmake.cs.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
}
}
}
Loading

0 comments on commit 5f128f3

Please sign in to comment.