build.yml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. name: build
  2. on:
  3. push:
  4. pull_request:
  5. workflow_run:
  6. # Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling
  7. # "scheduled" workflow, while maintaining ability to perform local CI builds.
  8. workflows:
  9. - scheduled
  10. - manual
  11. branches:
  12. - master
  13. - docking
  14. types:
  15. - requested
  16. jobs:
  17. Build-Windows:
  18. runs-on: windows-2025
  19. name: Build - Windows
  20. defaults:
  21. run:
  22. working-directory: ${{ github.workspace }}/imgui
  23. env:
  24. VS_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
  25. MSBUILD_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
  26. steps:
  27. - uses: actions/checkout@v5
  28. with:
  29. path: ${{ github.workspace }}/imgui
  30. # The VulkanSDK libs for Windows is manually generated using build_windows_vulkan_libs.ps1 + attached to issue #8925.
  31. # (we have a .yml workflow in commit history if it becomes ever useful to create this on CI too)
  32. - name: Install Dependencies
  33. shell: powershell
  34. run: |
  35. Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.32.8-VC.zip" -OutFile "SDL2-devel-2.32.8-VC.zip"
  36. Expand-Archive -Path SDL2-devel-2.32.8-VC.zip
  37. echo "SDL2_DIR=$(pwd)\SDL2-devel-2.32.8-VC\SDL2-2.32.8\" >>${env:GITHUB_ENV}
  38. Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL3-devel-3.2.18-VC.zip" -OutFile "SDL3-devel-3.2.18-VC.zip"
  39. Expand-Archive -Path SDL3-devel-3.2.18-VC.zip
  40. echo "SDL3_DIR=$(pwd)\SDL3-devel-3.2.18-VC\SDL3-3.2.18\" >>${env:GITHUB_ENV}
  41. Invoke-WebRequest -Uri "https://github.com/user-attachments/files/22464296/vulkan_windows_libs_1.4.326.zip" -OutFile vulkan_windows_libs_1.4.326.zip
  42. Expand-Archive -Path vulkan_windows_libs_1.4.326.zip
  43. echo "VULKAN_SDK=$(pwd)\vulkan_windows_libs_1.4.326\" >>${env:GITHUB_ENV}
  44. - name: Fix Projects
  45. shell: powershell
  46. run: |
  47. # CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version.
  48. gci -recurse -filter "*.vcxproj" | ForEach-Object {
  49. (Get-Content $_.FullName) -Replace "<PlatformToolset>v\d{3}</PlatformToolset>","<PlatformToolset>v143</PlatformToolset>" | Set-Content -Path $_.FullName
  50. (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>[\d\.]+</WindowsTargetPlatformVersion>",'<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>' | Set-Content -Path $_.FullName
  51. }
  52. # Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long.
  53. - name: Build example_null (extra warnings, mingw 64-bit)
  54. run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1
  55. - name: Build example_null (mingw 64-bit, as DLL)
  56. shell: bash
  57. run: |
  58. echo '#define IMGUI_API __declspec(dllexport)' > example_single_file.cpp
  59. echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
  60. echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
  61. g++ -I. -Wall -Wformat -shared -o libimgui.dll -Wl,--out-implib,libimgui.a example_single_file.cpp -limm32
  62. g++ -I. -Wall -Wformat -DIMGUI_API='__declspec(dllimport)' -DIMGUI_IMPL_API= -o example_null.exe examples/example_null/main.cpp -L. -limgui
  63. rm -f example_null.exe libimgui.* example_single_file.*
  64. - name: Build example_null (extra warnings, msvc 64-bit)
  65. shell: cmd
  66. run: |
  67. cd examples\example_null
  68. call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
  69. .\build_win32.bat /W4
  70. - name: Build example_null (single file build)
  71. shell: bash
  72. run: |
  73. cat > example_single_file.cpp <<'EOF'
  74. #define IMGUI_IMPLEMENTATION
  75. #include "misc/single_file/imgui_single_file.h"
  76. #include "examples/example_null/main.cpp"
  77. EOF
  78. g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
  79. - name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS)
  80. shell: bash
  81. run: |
  82. cat > example_single_file.cpp <<'EOF'
  83. #define IMGUI_DISABLE_WIN32_FUNCTIONS
  84. #define IMGUI_IMPLEMENTATION
  85. #include "misc/single_file/imgui_single_file.h"
  86. #include "examples/example_null/main.cpp"
  87. EOF
  88. g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
  89. - name: Build example_null (as DLL)
  90. shell: cmd
  91. run: |
  92. call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
  93. echo #define IMGUI_API __declspec(dllexport) > example_single_file.cpp
  94. echo #define IMGUI_IMPLEMENTATION >> example_single_file.cpp
  95. echo #include "misc/single_file/imgui_single_file.h" >> example_single_file.cpp
  96. cl.exe /D_USRDLL /D_WINDLL /I. example_single_file.cpp /LD /FeImGui.dll /link
  97. cl.exe /DIMGUI_API=__declspec(dllimport) -DIMGUI_IMPL_API= /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp
  98. # Win64 examples are more frequently compilted than the Win32 examples.
  99. # More of the Win32 examples requires 'workflow_run' to reduce waste.
  100. - name: Build Win32 example_glfw_opengl2
  101. shell: cmd
  102. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  103. if: github.event_name == 'workflow_run'
  104. - name: Build Win32 example_glfw_opengl3
  105. shell: cmd
  106. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  107. if: github.event_name == 'workflow_run'
  108. - name: Build Win32 example_glfw_vulkan
  109. shell: cmd
  110. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  111. if: github.event_name == 'workflow_run'
  112. - name: Build Win32 example_sdl2_sdlrenderer2
  113. shell: cmd
  114. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  115. if: github.event_name == 'workflow_run'
  116. - name: Build Win32 example_sdl2_vulkan
  117. shell: cmd
  118. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  119. if: github.event_name == 'workflow_run'
  120. - name: Build Win32 example_sdl2_opengl2
  121. shell: cmd
  122. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  123. if: github.event_name == 'workflow_run'
  124. - name: Build Win32 example_sdl2_opengl3
  125. shell: cmd
  126. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  127. - name: Build Win32 example_sdl2_directx11
  128. shell: cmd
  129. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  130. if: github.event_name == 'workflow_run'
  131. - name: Build Win32 example_sdl3_opengl3
  132. shell: cmd
  133. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  134. - name: Build Win32 example_sdl3_sdlgpu3
  135. shell: cmd
  136. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  137. if: github.event_name == 'workflow_run'
  138. - name: Build Win32 example_sdl3_sdlrenderer3
  139. shell: cmd
  140. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  141. if: github.event_name == 'workflow_run'
  142. - name: Build Win32 example_sdl3_vulkan
  143. shell: cmd
  144. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  145. if: github.event_name == 'workflow_run'
  146. - name: Build Win32 example_win32_directx9
  147. shell: cmd
  148. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  149. if: github.event_name == 'workflow_run'
  150. - name: Build Win32 example_win32_directx10
  151. shell: cmd
  152. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  153. if: github.event_name == 'workflow_run'
  154. - name: Build Win32 example_win32_directx11
  155. shell: cmd
  156. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  157. if: github.event_name == 'workflow_run'
  158. # Windows 64-bits
  159. - name: Build Win64 example_glfw_opengl2
  160. shell: cmd
  161. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  162. if: github.event_name == 'workflow_run'
  163. - name: Build Win64 example_glfw_opengl3
  164. shell: cmd
  165. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  166. - name: Build Win64 example_glfw_vulkan
  167. shell: cmd
  168. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  169. - name: Build Win64 example_sdl2_sdlrenderer2
  170. shell: cmd
  171. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  172. if: github.event_name == 'workflow_run'
  173. - name: Build Win64 example_sdl2_vulkan
  174. shell: cmd
  175. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  176. if: github.event_name == 'workflow_run'
  177. - name: Build Win64 example_sdl2_opengl2
  178. shell: cmd
  179. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  180. if: github.event_name == 'workflow_run'
  181. - name: Build Win64 example_sdl2_opengl3
  182. shell: cmd
  183. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  184. if: github.event_name == 'workflow_run'
  185. - name: Build Win64 example_sdl2_directx11
  186. shell: cmd
  187. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
  188. - name: Build Win64 example_sdl3_opengl3
  189. shell: cmd
  190. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  191. if: github.event_name == 'workflow_run'
  192. - name: Build Win64 example_sdl3_sdlgpu3
  193. shell: cmd
  194. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  195. - name: Build Win64 example_sdl3_sdlrenderer3
  196. shell: cmd
  197. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  198. - name: Build Win64 example_sdl3_vulkan
  199. shell: cmd
  200. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  201. if: github.event_name == 'workflow_run'
  202. - name: Build Win64 example_win32_directx9
  203. shell: cmd
  204. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release'
  205. if: github.event_name == 'workflow_run'
  206. - name: Build Win64 example_win32_directx10
  207. shell: cmd
  208. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release'
  209. if: github.event_name == 'workflow_run'
  210. - name: Build Win64 example_win32_directx11
  211. shell: cmd
  212. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
  213. - name: Build Win64 example_win32_directx12
  214. shell: cmd
  215. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release'
  216. Build-Linux:
  217. runs-on: ubuntu-latest
  218. name: Build - Linux
  219. defaults:
  220. run:
  221. working-directory: ${{ github.workspace }}/imgui
  222. steps:
  223. - uses: actions/checkout@v5
  224. with:
  225. path: ${{ github.workspace }}/imgui
  226. - name: Install Dependencies
  227. run: |
  228. sudo apt-get update
  229. sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev
  230. - name: Build example_null (extra warnings, gcc 32-bit)
  231. run: |
  232. make -C examples/example_null clean
  233. CXXFLAGS="$CXXFLAGS -m32 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1
  234. - name: Build example_null (extra warnings, gcc 64-bit)
  235. run: |
  236. make -C examples/example_null clean
  237. CXXFLAGS="$CXXFLAGS -m64 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1
  238. - name: Build example_null (extra warnings, clang 32-bit)
  239. run: |
  240. make -C examples/example_null clean
  241. CXXFLAGS="$CXXFLAGS -m32 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
  242. - name: Build example_null (extra warnings, clang 64-bit)
  243. run: |
  244. make -C examples/example_null clean
  245. CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
  246. - name: Build example_null (extra warnings, empty IM_ASSERT)
  247. run: |
  248. cat > example_single_file.cpp <<'EOF'
  249. #define IM_ASSERT(x)
  250. #define IMGUI_IMPLEMENTATION
  251. #include "misc/single_file/imgui_single_file.h"
  252. #include "examples/example_null/main.cpp"
  253. EOF
  254. g++ -I. -std=c++11 -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp
  255. - name: Build example_null (freetype)
  256. run: |
  257. make -C examples/example_null clean
  258. make -C examples/example_null WITH_FREETYPE=1
  259. - name: Build example_null (single file build)
  260. run: |
  261. cat > example_single_file.cpp <<'EOF'
  262. #define IMGUI_IMPLEMENTATION
  263. #include "misc/single_file/imgui_single_file.h"
  264. #include "examples/example_null/main.cpp"
  265. EOF
  266. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  267. - name: Build example_null (with ImWchar32)
  268. run: |
  269. cat > example_single_file.cpp <<'EOF'
  270. #define IMGUI_USE_WCHAR32
  271. #define IMGUI_IMPLEMENTATION
  272. #include "misc/single_file/imgui_single_file.h"
  273. #include "examples/example_null/main.cpp"
  274. EOF
  275. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  276. - name: Build example_null (with large ImDrawIdx + pointer ImTextureID)
  277. run: |
  278. cat > example_single_file.cpp <<'EOF'
  279. #define ImTextureID void*
  280. #define ImDrawIdx unsigned int
  281. #define IMGUI_IMPLEMENTATION
  282. #include "misc/single_file/imgui_single_file.h"
  283. #include "examples/example_null/main.cpp"
  284. EOF
  285. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  286. - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS)
  287. run: |
  288. cat > example_single_file.cpp <<'EOF'
  289. #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
  290. #define IMGUI_IMPLEMENTATION
  291. #include "misc/single_file/imgui_single_file.h"
  292. #include "examples/example_null/main.cpp"
  293. EOF
  294. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  295. - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_KEYIO)
  296. run: |
  297. cat > example_single_file.cpp <<'EOF'
  298. #define IMGUI_DISABLE_OBSOLETE_KEYIO
  299. #define IMGUI_IMPLEMENTATION
  300. #include "misc/single_file/imgui_single_file.h"
  301. #include "examples/example_null/main.cpp"
  302. EOF
  303. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  304. - name: Build example_null (with C++20)
  305. run: |
  306. cat > example_single_file.cpp <<'EOF'
  307. #define IMGUI_DISABLE_OBSOLETE_KEYIO
  308. #define IMGUI_IMPLEMENTATION
  309. #include "misc/single_file/imgui_single_file.h"
  310. #include "examples/example_null/main.cpp"
  311. EOF
  312. g++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
  313. - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS)
  314. run: |
  315. cat > example_single_file.cpp <<'EOF'
  316. #define IMGUI_DISABLE_DEMO_WINDOWS
  317. #define IMGUI_DISABLE_DEBUG_TOOLS
  318. #define IMGUI_IMPLEMENTATION
  319. #include "misc/single_file/imgui_single_file.h"
  320. #include "examples/example_null/main.cpp"
  321. EOF
  322. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  323. - name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS)
  324. run: |
  325. cat > example_single_file.cpp <<'EOF'
  326. #define IMGUI_DISABLE_FILE_FUNCTIONS
  327. #define IMGUI_IMPLEMENTATION
  328. #include "misc/single_file/imgui_single_file.h"
  329. #include "examples/example_null/main.cpp"
  330. EOF
  331. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  332. - name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR)
  333. run: |
  334. cat > example_single_file.cpp <<'EOF'
  335. #define IMGUI_USE_BGRA_PACKED_COLOR
  336. #define IMGUI_IMPLEMENTATION
  337. #include "misc/single_file/imgui_single_file.h"
  338. #include "examples/example_null/main.cpp"
  339. EOF
  340. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  341. - name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA)
  342. run: |
  343. cat > example_single_file.cpp <<'EOF'
  344. struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } };
  345. struct MyVec4 { float x; float y; float z; float w;
  346. MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } };
  347. #define IM_VEC2_CLASS_EXTRA \
  348. ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
  349. operator MyVec2() const { return MyVec2(x, y); }
  350. #define IM_VEC4_CLASS_EXTRA \
  351. ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
  352. operator MyVec4() const { return MyVec4(x, y, z, w); }
  353. #define IMGUI_IMPLEMENTATION
  354. #include "misc/single_file/imgui_single_file.h"
  355. #include "examples/example_null/main.cpp"
  356. EOF
  357. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  358. - name: Build example_null (C++26, Clang)
  359. run: |
  360. cat > example_single_file.cpp <<'EOF'
  361. #define IMGUI_IMPLEMENTATION
  362. #define IMGUI_DISABLE_DEMO_WINDOWS
  363. #include "misc/single_file/imgui_single_file.h"
  364. #include "examples/example_null/main.cpp"
  365. EOF
  366. clang++ -I. -std=c++26 -Wall -Wformat -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
  367. - name: Build example_null (without c++ runtime, Clang)
  368. run: |
  369. cat > example_single_file.cpp <<'EOF'
  370. #define IMGUI_IMPLEMENTATION
  371. #define IMGUI_DISABLE_DEMO_WINDOWS
  372. #include "misc/single_file/imgui_single_file.h"
  373. #include "examples/example_null/main.cpp"
  374. EOF
  375. clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
  376. - name: Build example_glfw_opengl2
  377. run: make -C examples/example_glfw_opengl2
  378. - name: Build example_glfw_opengl3
  379. run: make -C examples/example_glfw_opengl3
  380. if: github.event_name == 'workflow_run'
  381. - name: Build example_sdl2_opengl2
  382. run: make -C examples/example_sdl2_opengl2
  383. if: github.event_name == 'workflow_run'
  384. - name: Build example_sdl2_opengl3
  385. run: make -C examples/example_sdl2_opengl3
  386. - name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES
  387. run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp
  388. Build-MacOS:
  389. runs-on: macos-latest
  390. name: Build - MacOS
  391. defaults:
  392. run:
  393. working-directory: ${{ github.workspace }}/imgui
  394. steps:
  395. - uses: actions/checkout@v5
  396. with:
  397. path: ${{ github.workspace }}/imgui
  398. - name: Install Dependencies
  399. run: |
  400. brew install glfw3 sdl2 sdl3
  401. - name: Build example_null (extra warnings, clang 64-bit)
  402. run: make -C examples/example_null WITH_EXTRA_WARNINGS=1
  403. - name: Build example_null (single file build)
  404. run: |
  405. cat > example_single_file.cpp <<'EOF'
  406. #define IMGUI_IMPLEMENTATION
  407. #include "misc/single_file/imgui_single_file.h"
  408. #include "examples/example_null/main.cpp"
  409. EOF
  410. clang++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  411. - name: Build example_null (single file build, c++20)
  412. run: |
  413. cat > example_single_file.cpp <<'EOF'
  414. #define IMGUI_IMPLEMENTATION
  415. #include "misc/single_file/imgui_single_file.h"
  416. #include "examples/example_null/main.cpp"
  417. EOF
  418. clang++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
  419. - name: Build example_null (without c++ runtime)
  420. run: |
  421. cat > example_single_file.cpp <<'EOF'
  422. #define IMGUI_IMPLEMENTATION
  423. #include "misc/single_file/imgui_single_file.h"
  424. #include "examples/example_null/main.cpp"
  425. EOF
  426. clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
  427. - name: Build example_glfw_opengl2
  428. run: make -C examples/example_glfw_opengl2
  429. - name: Build example_glfw_opengl3
  430. run: make -C examples/example_glfw_opengl3
  431. if: github.event_name == 'workflow_run'
  432. - name: Build example_glfw_metal
  433. run: make -C examples/example_glfw_metal
  434. - name: Build example_sdl2_metal
  435. run: make -C examples/example_sdl2_metal
  436. - name: Build example_sdl2_opengl2
  437. run: make -C examples/example_sdl2_opengl2
  438. if: github.event_name == 'workflow_run'
  439. - name: Build example_sdl2_opengl3
  440. run: make -C examples/example_sdl2_opengl3
  441. - name: Build example_sdl3_opengl3
  442. run: make -C examples/example_sdl3_opengl3
  443. - name: Build example_apple_metal
  444. run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos
  445. - name: Build example_apple_opengl2
  446. run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2
  447. Build-iOS:
  448. runs-on: macos-14
  449. name: Build - iOS
  450. steps:
  451. - uses: actions/checkout@v5
  452. - name: Build example_apple_metal
  453. run: |
  454. # Code signing is required, but we disable it because it is irrelevant for CI builds.
  455. xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  456. Build-Emscripten:
  457. runs-on: ubuntu-latest
  458. name: Build - Emscripten
  459. steps:
  460. - uses: actions/checkout@v5
  461. - name: Install Dependencies
  462. run: |
  463. wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  464. tar -xvf master.tar.gz
  465. emsdk-master/emsdk update
  466. emsdk-master/emsdk install latest
  467. emsdk-master/emsdk activate latest
  468. sudo apt-get install build-essential
  469. - name: Build example_sdl2_opengl3 with Emscripten
  470. run: |
  471. pushd emsdk-master
  472. source ./emsdk_env.sh
  473. popd
  474. make -C examples/example_sdl2_opengl3 -f Makefile.emscripten
  475. # This build compiles example_glfw_wgpu using Makefile.emscripten and Emscripten GLFW built-in implementation (-sUSE_GLFW=3)
  476. # This ensures 2 things: the make build works, and the GLFW built-in implementation is tested
  477. - name: Build example_glfw_wgpu with Emscripten/Makefile
  478. run: |
  479. pushd emsdk-master
  480. source ./emsdk_env.sh
  481. popd
  482. make -C examples/example_glfw_wgpu -f Makefile.emscripten
  483. # This build compiles example_glfw_wgpu using CMakeLists.txt and Emscripten GLFW contrib port (--use-port=contrib.glfw3)
  484. # This ensures 2 things: the CMake build works, and the GLFW contrib port is tested
  485. - name: Build example_glfw_wgpu with Emscripten/CMake
  486. run: |
  487. pushd emsdk-master
  488. source ./emsdk_env.sh
  489. popd
  490. emcc -v
  491. emcmake cmake -B build -DCMAKE_BUILD_TYPE=Release examples/example_glfw_wgpu
  492. cmake --build build
  493. Build-Android:
  494. runs-on: ubuntu-latest
  495. name: Build - Android
  496. steps:
  497. - uses: actions/checkout@v5
  498. - name: Build example_android_opengl3
  499. run: |
  500. cd examples/example_android_opengl3/android
  501. gradle assembleDebug --stacktrace
  502. Test-Windows:
  503. runs-on: windows-2025
  504. name: Test - Windows
  505. defaults:
  506. run:
  507. working-directory: ${{ github.workspace }}/imgui
  508. env:
  509. MSBUILD_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
  510. steps:
  511. - uses: actions/checkout@v5
  512. with:
  513. path: ${{ github.workspace }}/imgui
  514. - uses: actions/checkout@v5
  515. continue-on-error: true
  516. with:
  517. fetch-depth: 1
  518. repository: ocornut/imgui_test_engine
  519. path: ${{ github.workspace }}/imgui_test_engine
  520. submodules: true
  521. - name: Fix Tests Projects
  522. shell: powershell
  523. working-directory: ${{ github.workspace }}/imgui_test_engine
  524. run: |
  525. # WARNING: This will need updating if toolset/sdk change in project files!
  526. gci -recurse -filter "*.vcxproj" | ForEach-Object {
  527. # Fix SDK and toolset for most samples.
  528. (Get-Content $_.FullName) -Replace "<PlatformToolset>v110</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
  529. (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
  530. # Fix SDK and toolset for samples that require newer SDK/toolset. At the moment it is only dx12.
  531. (Get-Content $_.FullName) -Replace "<PlatformToolset>v140</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
  532. (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
  533. }
  534. - name: Build Tests
  535. shell: cmd
  536. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  537. run: '"%MSBUILD_PATH%\MSBuild.exe" imgui_test_suite.vcxproj /p:Platform=x64 /p:Configuration=Release /p:ClFlags=/WX -maxcpucount:%NUMBER_OF_PROCESSORS%'
  538. - name: Run Tests
  539. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  540. run: Release/imgui_test_suite.exe -nogui -nopause -v2 -ve4 tests
  541. - name: Check for Docking
  542. id: check_docking
  543. shell: bash
  544. working-directory: ${{ github.workspace }}/imgui
  545. run: echo "has_dock=$(grep -q "#define IMGUI_HAS_DOCK" imgui.h && echo true || echo false)" >> $GITHUB_OUTPUT
  546. - name: Run Viewport Tests
  547. if: steps.check_docking.outputs.has_dock == 'true'
  548. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  549. run: Release/imgui_test_suite.exe -nogui -nopause -v2 -ve4 -viewport-mock viewport
  550. Test-Linux:
  551. runs-on: ubuntu-latest
  552. name: Test - Linux
  553. defaults:
  554. run:
  555. working-directory: ${{ github.workspace }}/imgui
  556. steps:
  557. - uses: actions/checkout@v5
  558. with:
  559. path: ${{ github.workspace }}/imgui
  560. - uses: actions/checkout@v5
  561. with:
  562. fetch-depth: 1
  563. repository: ocornut/imgui_test_engine
  564. path: ${{ github.workspace }}/imgui_test_engine
  565. submodules: true
  566. - name: Build Tests
  567. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  568. run: make -j$(nproc)
  569. - name: Run Tests
  570. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  571. run: ./imgui_test_suite -nogui -nopause -v2 -ve4 tests
  572. - name: Check for Docking
  573. id: check_docking
  574. working-directory: ${{ github.workspace }}/imgui
  575. run: echo "has_dock=$(grep -q "#define IMGUI_HAS_DOCK" imgui.h && echo true || echo false)" >> $GITHUB_OUTPUT
  576. - name: Run Viewport Tests
  577. if: steps.check_docking.outputs.has_dock == 'true'
  578. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  579. run: ./imgui_test_suite -nogui -nopause -v2 -ve4 -viewport-mock viewport
  580. Test-MacOS:
  581. runs-on: macos-latest
  582. name: Test - MacOS
  583. defaults:
  584. run:
  585. working-directory: ${{ github.workspace }}/imgui
  586. steps:
  587. - uses: actions/checkout@v5
  588. with:
  589. path: ${{ github.workspace }}/imgui
  590. - uses: actions/checkout@v5
  591. with:
  592. fetch-depth: 1
  593. repository: ocornut/imgui_test_engine
  594. path: ${{ github.workspace }}/imgui_test_engine
  595. submodules: true
  596. - name: Build Tests
  597. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  598. run: make -j$(nproc)
  599. - name: Run Tests
  600. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  601. run: ./imgui_test_suite -nogui -nopause -v2 -ve4 tests
  602. - name: Check for Docking
  603. id: check_docking
  604. working-directory: ${{ github.workspace }}/imgui
  605. run: echo "has_dock=$(grep -q "#define IMGUI_HAS_DOCK" imgui.h && echo true || echo false)" >> $GITHUB_OUTPUT
  606. - name: Run Viewport Tests
  607. if: steps.check_docking.outputs.has_dock == 'true'
  608. working-directory: ${{ github.workspace }}/imgui_test_engine/imgui_test_suite
  609. run: ./imgui_test_suite -nogui -nopause -v2 -ve4 -viewport-mock viewport