build.yml 25 KB

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