build.yml 25 KB

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