Browse Source

CI: Add unity builds test. (#2893)

Rokas Kupstys 5 years ago
parent
commit
1742ca45c5

+ 9 - 0
.github/workflows/build.yml

@@ -44,6 +44,9 @@ jobs:
       - name: Build example_null (extra warnings)
       - name: Build example_null (extra warnings)
         run: mingw32-make -C examples/example_null EXTRA_WARNINGS=1
         run: mingw32-make -C examples/example_null EXTRA_WARNINGS=1
 
 
+      - name: Build example_null (unity build)
+        run: mingw32-make -C examples/example_null UNITY_BUILD=1
+
       - name: Build Win32 example_glfw_opengl2
       - name: Build Win32 example_glfw_opengl2
         shell: cmd
         shell: cmd
         run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
         run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
@@ -156,6 +159,9 @@ jobs:
     - name: Build example_null (extra warnings)
     - name: Build example_null (extra warnings)
       run: make -C examples/example_null EXTRA_WARNINGS=1
       run: make -C examples/example_null EXTRA_WARNINGS=1
 
 
+    - name: Build example_null (unity build)
+      run: make -C examples/example_null UNITY_BUILD=1
+
     - name: Build example_glfw_opengl2
     - name: Build example_glfw_opengl2
       run: make -C examples/example_glfw_opengl2
       run: make -C examples/example_glfw_opengl2
 
 
@@ -185,6 +191,9 @@ jobs:
     - name: Build example_null (extra warnings)
     - name: Build example_null (extra warnings)
       run: make -C examples/example_null EXTRA_WARNINGS=1
       run: make -C examples/example_null EXTRA_WARNINGS=1
 
 
+    - name: Build example_null (unity build)
+      run: make -C examples/example_null UNITY_BUILD=1
+
     - name: Build example_glfw_opengl2
     - name: Build example_glfw_opengl2
       run: make -C examples/example_glfw_opengl2
       run: make -C examples/example_glfw_opengl2
 
 

+ 8 - 3
examples/example_null/Makefile

@@ -4,11 +4,16 @@
 #
 #
 
 
 EXE = example_null
 EXE = example_null
-SOURCES = main.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
+EXTRA_WARNINGS ?= 0
+UNITY_BUILD ?= 0
+ifeq ($(UNITY_BUILD), 1)
+	SOURCES = unity_build.cpp
+else
+	SOURCES = main.cpp
+	SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
+endif
 OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
 OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
 UNAME_S := $(shell uname -s)
 UNAME_S := $(shell uname -s)
-EXTRA_WARNINGS ?= 0
 
 
 CXXFLAGS = -I../ -I../../
 CXXFLAGS = -I../ -I../../
 CXXFLAGS += -g -Wall -Wformat
 CXXFLAGS += -g -Wall -Wformat

+ 6 - 0
examples/example_null/unity_build.cpp

@@ -0,0 +1,6 @@
+// Unity build test - build this example as a single compilation unit.
+#include "main.cpp"
+#include "../../imgui.cpp"
+#include "../../imgui_demo.cpp"
+#include "../../imgui_draw.cpp"
+#include "../../imgui_widgets.cpp"