build.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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. Windows:
  18. runs-on: windows-2025
  19. env:
  20. VS_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
  21. MSBUILD_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
  22. steps:
  23. - uses: actions/checkout@v4
  24. - name: Install Dependencies
  25. shell: powershell
  26. run: |
  27. Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.32.8-VC.zip" -OutFile "SDL2-devel-2.32.8-VC.zip"
  28. Expand-Archive -Path SDL2-devel-2.32.8-VC.zip
  29. echo "SDL2_DIR=$(pwd)\SDL2-devel-2.32.8-VC\SDL2-2.32.8\" >>${env:GITHUB_ENV}
  30. Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL3-devel-3.2.18-VC.zip" -OutFile "SDL3-devel-3.2.18-VC.zip"
  31. Expand-Archive -Path SDL3-devel-3.2.18-VC.zip
  32. echo "SDL3_DIR=$(pwd)\SDL3-devel-3.2.18-VC\SDL3-3.2.18\" >>${env:GITHUB_ENV}
  33. # VulkanSDK (retrieve minimal bits of the SDK from git)
  34. $vulkanVersion = "1.4.326"
  35. # 1. Get the vulkan headers, we will treat that folder as the sdk folder to avoid having to copy headers around
  36. Invoke-WebRequest -Uri "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v$($vulkanVersion).zip" -OutFile Vulkan-Headers-$($vulkanVersion).zip
  37. Expand-Archive -Path Vulkan-Headers-$($vulkanVersion).zip
  38. echo "VULKAN_SDK=$(pwd)\Vulkan-Headers-$($vulkanVersion)\Vulkan-Headers-$($vulkanVersion)" >>${env:GITHUB_ENV}
  39. # 2. Get and build the vulkan loader source code (UPDATE_DEPS=On will make it automatically fetch its dependencies)
  40. Invoke-WebRequest -Uri "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v$($vulkanVersion).zip" -OutFile Vulkan-Loader-$($vulkanVersion).zip
  41. Expand-Archive -Path Vulkan-Loader-$($vulkanVersion).zip
  42. cmake -S Vulkan-Loader-$($vulkanVersion)\Vulkan-Loader-$($vulkanVersion) -B VulkanLoader-build -D UPDATE_DEPS=On
  43. cmake --build VulkanLoader-build
  44. # 3. Copy the built lib/dll to the expected place
  45. mkdir Vulkan-Headers-$($vulkanVersion)\Vulkan-Headers-$($vulkanVersion)\Lib
  46. copy VulkanLoader-build\loader\Debug\vulkan-1.* Vulkan-Headers-$($vulkanVersion)\Vulkan-Headers-$($vulkanVersion)\Lib\
  47. - name: Fix Projects
  48. shell: powershell
  49. run: |
  50. # CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version.
  51. gci -recurse -filter "*.vcxproj" | ForEach-Object {
  52. (Get-Content $_.FullName) -Replace "<PlatformToolset>v\d{3}</PlatformToolset>","<PlatformToolset>v143</PlatformToolset>" | Set-Content -Path $_.FullName
  53. (Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>[\d\.]+</WindowsTargetPlatformVersion>",'<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>' | Set-Content -Path $_.FullName
  54. }
  55. # 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.
  56. - name: Build example_null (extra warnings, mingw 64-bit)
  57. run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1
  58. - name: Build example_null (mingw 64-bit, as DLL)
  59. shell: bash
  60. run: |
  61. echo '#define IMGUI_API __declspec(dllexport)' > example_single_file.cpp
  62. echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
  63. echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
  64. g++ -I. -Wall -Wformat -shared -o libimgui.dll -Wl,--out-implib,libimgui.a example_single_file.cpp -limm32
  65. g++ -I. -Wall -Wformat -DIMGUI_API='__declspec(dllimport)' -o example_null.exe examples/example_null/main.cpp -L. -limgui
  66. rm -f example_null.exe libimgui.* example_single_file.*
  67. - name: Build example_null (extra warnings, msvc 64-bit)
  68. shell: cmd
  69. run: |
  70. cd examples\example_null
  71. call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
  72. .\build_win32.bat /W4
  73. - name: Build example_null (single file build)
  74. shell: bash
  75. run: |
  76. cat > example_single_file.cpp <<'EOF'
  77. #define IMGUI_IMPLEMENTATION
  78. #include "misc/single_file/imgui_single_file.h"
  79. #include "examples/example_null/main.cpp"
  80. EOF
  81. g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
  82. - name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS)
  83. shell: bash
  84. run: |
  85. cat > example_single_file.cpp <<'EOF'
  86. #define IMGUI_DISABLE_WIN32_FUNCTIONS
  87. #define IMGUI_IMPLEMENTATION
  88. #include "misc/single_file/imgui_single_file.h"
  89. #include "examples/example_null/main.cpp"
  90. EOF
  91. g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
  92. - name: Build example_null (as DLL)
  93. shell: cmd
  94. run: |
  95. call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
  96. echo #define IMGUI_API __declspec(dllexport) > example_single_file.cpp
  97. echo #define IMGUI_IMPLEMENTATION >> example_single_file.cpp
  98. echo #include "misc/single_file/imgui_single_file.h" >> example_single_file.cpp
  99. cl.exe /D_USRDLL /D_WINDLL /I. example_single_file.cpp /LD /FeImGui.dll /link
  100. cl.exe /DIMGUI_API=__declspec(dllimport) /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp
  101. # Win64 examples are more frequently compilted than the Win32 examples.
  102. # More of the Win32 examples requires 'workflow_run' to reduce waste.
  103. - name: Build Win32 example_glfw_opengl2
  104. shell: cmd
  105. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  106. if: github.event_name == 'workflow_run'
  107. - name: Build Win32 example_glfw_opengl3
  108. shell: cmd
  109. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  110. if: github.event_name == 'workflow_run'
  111. - name: Build Win32 example_glfw_vulkan
  112. shell: cmd
  113. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  114. if: github.event_name == 'workflow_run'
  115. - name: Build Win32 example_sdl2_sdlrenderer2
  116. shell: cmd
  117. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  118. if: github.event_name == 'workflow_run'
  119. - name: Build Win32 example_sdl2_vulkan
  120. shell: cmd
  121. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  122. if: github.event_name == 'workflow_run'
  123. - name: Build Win32 example_sdl2_opengl2
  124. shell: cmd
  125. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  126. if: github.event_name == 'workflow_run'
  127. - name: Build Win32 example_sdl2_opengl3
  128. shell: cmd
  129. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  130. - name: Build Win32 example_sdl2_directx11
  131. shell: cmd
  132. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  133. if: github.event_name == 'workflow_run'
  134. - name: Build Win32 example_sdl3_opengl3
  135. shell: cmd
  136. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  137. - name: Build Win32 example_sdl3_sdlgpu3
  138. shell: cmd
  139. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  140. if: github.event_name == 'workflow_run'
  141. - name: Build Win32 example_sdl3_sdlrenderer3
  142. shell: cmd
  143. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  144. if: github.event_name == 'workflow_run'
  145. - name: Build Win32 example_sdl3_vulkan
  146. shell: cmd
  147. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  148. if: github.event_name == 'workflow_run'
  149. - name: Build Win32 example_win32_directx9
  150. shell: cmd
  151. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  152. if: github.event_name == 'workflow_run'
  153. - name: Build Win32 example_win32_directx10
  154. shell: cmd
  155. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  156. if: github.event_name == 'workflow_run'
  157. - name: Build Win32 example_win32_directx11
  158. shell: cmd
  159. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
  160. if: github.event_name == 'workflow_run'
  161. # Windows 64-bits
  162. - name: Build Win64 example_glfw_opengl2
  163. shell: cmd
  164. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  165. if: github.event_name == 'workflow_run'
  166. - name: Build Win64 example_glfw_opengl3
  167. shell: cmd
  168. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  169. - name: Build Win64 example_glfw_vulkan
  170. shell: cmd
  171. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  172. - name: Build Win64 example_sdl2_sdlrenderer2
  173. shell: cmd
  174. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  175. if: github.event_name == 'workflow_run'
  176. - name: Build Win64 example_sdl2_vulkan
  177. shell: cmd
  178. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  179. if: github.event_name == 'workflow_run'
  180. - name: Build Win64 example_sdl2_opengl2
  181. shell: cmd
  182. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
  183. if: github.event_name == 'workflow_run'
  184. - name: Build Win64 example_sdl2_opengl3
  185. shell: cmd
  186. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  187. if: github.event_name == 'workflow_run'
  188. - name: Build Win64 example_sdl2_directx11
  189. shell: cmd
  190. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
  191. - name: Build Win64 example_sdl3_opengl3
  192. shell: cmd
  193. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  194. if: github.event_name == 'workflow_run'
  195. - name: Build Win64 example_sdl3_sdlgpu3
  196. shell: cmd
  197. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  198. - name: Build Win64 example_sdl3_sdlrenderer3
  199. shell: cmd
  200. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=x64 /p:Configuration=Release'
  201. - name: Build Win64 example_sdl3_vulkan
  202. shell: cmd
  203. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
  204. if: github.event_name == 'workflow_run'
  205. - name: Build Win64 example_win32_directx9
  206. shell: cmd
  207. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release'
  208. if: github.event_name == 'workflow_run'
  209. - name: Build Win64 example_win32_directx10
  210. shell: cmd
  211. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release'
  212. if: github.event_name == 'workflow_run'
  213. - name: Build Win64 example_win32_directx11
  214. shell: cmd
  215. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
  216. - name: Build Win64 example_win32_directx12
  217. shell: cmd
  218. run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release'
  219. Linux:
  220. runs-on: ubuntu-latest
  221. steps:
  222. - uses: actions/checkout@v4
  223. - name: Install Dependencies
  224. run: |
  225. sudo apt-get update
  226. sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev
  227. - name: Build example_null (extra warnings, gcc 32-bit)
  228. run: |
  229. make -C examples/example_null clean
  230. CXXFLAGS="$CXXFLAGS -m32 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1
  231. - name: Build example_null (extra warnings, gcc 64-bit)
  232. run: |
  233. make -C examples/example_null clean
  234. CXXFLAGS="$CXXFLAGS -m64 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1
  235. - name: Build example_null (extra warnings, clang 32-bit)
  236. run: |
  237. make -C examples/example_null clean
  238. CXXFLAGS="$CXXFLAGS -m32 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
  239. - name: Build example_null (extra warnings, clang 64-bit)
  240. run: |
  241. make -C examples/example_null clean
  242. CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
  243. - name: Build example_null (extra warnings, empty IM_ASSERT)
  244. run: |
  245. cat > example_single_file.cpp <<'EOF'
  246. #define IM_ASSERT(x)
  247. #define IMGUI_IMPLEMENTATION
  248. #include "misc/single_file/imgui_single_file.h"
  249. #include "examples/example_null/main.cpp"
  250. EOF
  251. 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
  252. - name: Build example_null (freetype)
  253. run: |
  254. make -C examples/example_null clean
  255. make -C examples/example_null WITH_FREETYPE=1
  256. - name: Build example_null (single file build)
  257. run: |
  258. cat > example_single_file.cpp <<'EOF'
  259. #define IMGUI_IMPLEMENTATION
  260. #include "misc/single_file/imgui_single_file.h"
  261. #include "examples/example_null/main.cpp"
  262. EOF
  263. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  264. - name: Build example_null (with ImWchar32)
  265. run: |
  266. cat > example_single_file.cpp <<'EOF'
  267. #define IMGUI_USE_WCHAR32
  268. #define IMGUI_IMPLEMENTATION
  269. #include "misc/single_file/imgui_single_file.h"
  270. #include "examples/example_null/main.cpp"
  271. EOF
  272. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  273. - name: Build example_null (with large ImDrawIdx + pointer ImTextureID)
  274. run: |
  275. cat > example_single_file.cpp <<'EOF'
  276. #define ImTextureID void*
  277. #define ImDrawIdx unsigned int
  278. #define IMGUI_IMPLEMENTATION
  279. #include "misc/single_file/imgui_single_file.h"
  280. #include "examples/example_null/main.cpp"
  281. EOF
  282. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  283. - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS)
  284. run: |
  285. cat > example_single_file.cpp <<'EOF'
  286. #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
  287. #define IMGUI_IMPLEMENTATION
  288. #include "misc/single_file/imgui_single_file.h"
  289. #include "examples/example_null/main.cpp"
  290. EOF
  291. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  292. - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_KEYIO)
  293. run: |
  294. cat > example_single_file.cpp <<'EOF'
  295. #define IMGUI_DISABLE_OBSOLETE_KEYIO
  296. #define IMGUI_IMPLEMENTATION
  297. #include "misc/single_file/imgui_single_file.h"
  298. #include "examples/example_null/main.cpp"
  299. EOF
  300. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  301. - name: Build example_null (with C++20)
  302. run: |
  303. cat > example_single_file.cpp <<'EOF'
  304. #define IMGUI_DISABLE_OBSOLETE_KEYIO
  305. #define IMGUI_IMPLEMENTATION
  306. #include "misc/single_file/imgui_single_file.h"
  307. #include "examples/example_null/main.cpp"
  308. EOF
  309. g++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
  310. - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS)
  311. run: |
  312. cat > example_single_file.cpp <<'EOF'
  313. #define IMGUI_DISABLE_DEMO_WINDOWS
  314. #define IMGUI_DISABLE_DEBUG_TOOLS
  315. #define IMGUI_IMPLEMENTATION
  316. #include "misc/single_file/imgui_single_file.h"
  317. #include "examples/example_null/main.cpp"
  318. EOF
  319. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  320. - name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS)
  321. run: |
  322. cat > example_single_file.cpp <<'EOF'
  323. #define IMGUI_DISABLE_FILE_FUNCTIONS
  324. #define IMGUI_IMPLEMENTATION
  325. #include "misc/single_file/imgui_single_file.h"
  326. #include "examples/example_null/main.cpp"
  327. EOF
  328. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  329. - name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR)
  330. run: |
  331. cat > example_single_file.cpp <<'EOF'
  332. #define IMGUI_USE_BGRA_PACKED_COLOR
  333. #define IMGUI_IMPLEMENTATION
  334. #include "misc/single_file/imgui_single_file.h"
  335. #include "examples/example_null/main.cpp"
  336. EOF
  337. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  338. - name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA)
  339. run: |
  340. cat > example_single_file.cpp <<'EOF'
  341. struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } };
  342. struct MyVec4 { float x; float y; float z; float w;
  343. MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } };
  344. #define IM_VEC2_CLASS_EXTRA \
  345. ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
  346. operator MyVec2() const { return MyVec2(x, y); }
  347. #define IM_VEC4_CLASS_EXTRA \
  348. ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
  349. operator MyVec4() const { return MyVec4(x, y, z, w); }
  350. #define IMGUI_IMPLEMENTATION
  351. #include "misc/single_file/imgui_single_file.h"
  352. #include "examples/example_null/main.cpp"
  353. EOF
  354. g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  355. - name: Build example_null (C++26, Clang)
  356. run: |
  357. cat > example_single_file.cpp <<'EOF'
  358. #define IMGUI_IMPLEMENTATION
  359. #define IMGUI_DISABLE_DEMO_WINDOWS
  360. #include "misc/single_file/imgui_single_file.h"
  361. #include "examples/example_null/main.cpp"
  362. EOF
  363. clang++ -I. -std=c++26 -Wall -Wformat -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
  364. - name: Build example_null (without c++ runtime, Clang)
  365. run: |
  366. cat > example_single_file.cpp <<'EOF'
  367. #define IMGUI_IMPLEMENTATION
  368. #define IMGUI_DISABLE_DEMO_WINDOWS
  369. #include "misc/single_file/imgui_single_file.h"
  370. #include "examples/example_null/main.cpp"
  371. EOF
  372. 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
  373. - name: Build example_glfw_opengl2
  374. run: make -C examples/example_glfw_opengl2
  375. - name: Build example_glfw_opengl3
  376. run: make -C examples/example_glfw_opengl3
  377. if: github.event_name == 'workflow_run'
  378. - name: Build example_sdl2_opengl2
  379. run: make -C examples/example_sdl2_opengl2
  380. if: github.event_name == 'workflow_run'
  381. - name: Build example_sdl2_opengl3
  382. run: make -C examples/example_sdl2_opengl3
  383. - name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES
  384. run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp
  385. MacOS:
  386. runs-on: macos-latest
  387. steps:
  388. - uses: actions/checkout@v4
  389. - name: Install Dependencies
  390. run: |
  391. brew install glfw3 sdl2 sdl3
  392. - name: Build example_null (extra warnings, clang 64-bit)
  393. run: make -C examples/example_null WITH_EXTRA_WARNINGS=1
  394. - name: Build example_null (single file build)
  395. run: |
  396. cat > example_single_file.cpp <<'EOF'
  397. #define IMGUI_IMPLEMENTATION
  398. #include "misc/single_file/imgui_single_file.h"
  399. #include "examples/example_null/main.cpp"
  400. EOF
  401. clang++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
  402. - name: Build example_null (single file build, c++20)
  403. run: |
  404. cat > example_single_file.cpp <<'EOF'
  405. #define IMGUI_IMPLEMENTATION
  406. #include "misc/single_file/imgui_single_file.h"
  407. #include "examples/example_null/main.cpp"
  408. EOF
  409. clang++ -I. -std=c++20 -Wall -Wformat -o example_single_file example_single_file.cpp
  410. - name: Build example_null (without c++ runtime)
  411. run: |
  412. cat > example_single_file.cpp <<'EOF'
  413. #define IMGUI_IMPLEMENTATION
  414. #include "misc/single_file/imgui_single_file.h"
  415. #include "examples/example_null/main.cpp"
  416. EOF
  417. 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
  418. - name: Build example_glfw_opengl2
  419. run: make -C examples/example_glfw_opengl2
  420. - name: Build example_glfw_opengl3
  421. run: make -C examples/example_glfw_opengl3
  422. if: github.event_name == 'workflow_run'
  423. - name: Build example_glfw_metal
  424. run: make -C examples/example_glfw_metal
  425. - name: Build example_sdl2_metal
  426. run: make -C examples/example_sdl2_metal
  427. - name: Build example_sdl2_opengl2
  428. run: make -C examples/example_sdl2_opengl2
  429. if: github.event_name == 'workflow_run'
  430. - name: Build example_sdl2_opengl3
  431. run: make -C examples/example_sdl2_opengl3
  432. - name: Build example_sdl3_opengl3
  433. run: make -C examples/example_sdl3_opengl3
  434. - name: Build example_apple_metal
  435. run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos
  436. - name: Build example_apple_opengl2
  437. run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2
  438. iOS:
  439. runs-on: macos-14
  440. steps:
  441. - uses: actions/checkout@v4
  442. - name: Build example_apple_metal
  443. run: |
  444. # Code signing is required, but we disable it because it is irrelevant for CI builds.
  445. 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
  446. Emscripten:
  447. runs-on: ubuntu-latest
  448. steps:
  449. - uses: actions/checkout@v4
  450. - name: Install Dependencies
  451. run: |
  452. wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  453. tar -xvf master.tar.gz
  454. emsdk-master/emsdk update
  455. emsdk-master/emsdk install latest
  456. emsdk-master/emsdk activate latest
  457. sudo apt-get install build-essential
  458. - name: Build example_sdl2_opengl3 with Emscripten
  459. run: |
  460. pushd emsdk-master
  461. source ./emsdk_env.sh
  462. popd
  463. make -C examples/example_sdl2_opengl3 -f Makefile.emscripten
  464. # This build compiles example_glfw_wgpu using Makefile.emscripten and Emscripten GLFW built-in implementation (-sUSE_GLFW=3)
  465. # This ensures 2 things: the make build works, and the GLFW built-in implementation is tested
  466. - name: Build example_glfw_wgpu with Emscripten/Makefile
  467. run: |
  468. pushd emsdk-master
  469. source ./emsdk_env.sh
  470. popd
  471. make -C examples/example_glfw_wgpu -f Makefile.emscripten
  472. # This build compiles example_glfw_wgpu using CMakeLists.txt and Emscripten GLFW contrib port (--use-port=contrib.glfw3)
  473. # This ensures 2 things: the CMake build works, and the GLFW contrib port is tested
  474. - name: Build example_glfw_wgpu with Emscripten/CMake
  475. run: |
  476. pushd emsdk-master
  477. source ./emsdk_env.sh
  478. popd
  479. emcc -v
  480. emcmake cmake -B build -DCMAKE_BUILD_TYPE=Release examples/example_glfw_wgpu
  481. cmake --build build
  482. Android:
  483. runs-on: ubuntu-latest
  484. steps:
  485. - uses: actions/checkout@v4
  486. - name: Build example_android_opengl3
  487. run: |
  488. cd examples/example_android_opengl3/android
  489. gradle assembleDebug --stacktrace