Skip to content

Commit

Permalink
Add ispc compiling to Linux builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Jan 14, 2025
1 parent 147959b commit 3ebe666
Show file tree
Hide file tree
Showing 8 changed files with 625 additions and 561 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ xLights/xLights_l4cpp.log
.objs
wxWidgets*
log4cpp*
ispc*
xLights/xLights.VC.db
lib/linux/libliquidfun.a
*.opensdf
Expand Down
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ SUDO = `which sudo`
SUBDIRS = xLights xSchedule xCapture xFade xScanner xSchedule/xSMSDaemon xSchedule/RemoteFalcon

WXWIDGETS_TAG=xlights_2024.20
ISPC_VERSION=1.25.3
ISPC_ARCH=$(shell uname -m)

ifeq '$(ISPC_ARCH)' 'aarch64'
ISPC_URL=https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}/ispc-v${ISPC_VERSION}-linux.aarch64.tar.gz
ISPC_DIR=ispc-v${ISPC_VERSION}-linux.aarch64
else
ISPC_URL=https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}/ispc-v${ISPC_VERSION}-linux.tar.gz
ISPC_DIR=ispc-v${ISPC_VERSION}-linux
endif

.NOTPARALLEL:

all: wxwidgets33 log4cpp cbp2make linkliquid libxlsxwriter makefile subdirs
all: wxwidgets33 log4cpp cbp2make linkliquid libxlsxwriter ispc makefile subdirs

#############################################################################

Expand Down Expand Up @@ -90,6 +100,16 @@ wxwidgets33: FORCE
echo Completed build/install of wxwidgets; \
fi

ispc: FORCE
@printf "Checking ispc\n"
@if test "`./ispc --version`" != "$(ISPC_VERSION)"; \
then if test ! -f ispc-$(ISPC_VERSION).tar.gz; \
then echo Downloading iscp $(ISPC_URL); curl -L -o ispc-$(ISPC_VERSION).tar.gz $(ISPC_URL) ; \
fi; \
tar -xzf ispc-$(ISPC_VERSION).tar.gz; \
ln -s -f $(ISPC_DIR)/bin/ispc ispc; \
fi


#############################################################################

Expand Down Expand Up @@ -175,6 +195,7 @@ xLights/xLights.cbp.mak: xLights/xLights.cbp
| sed \
-e "s/CFLAGS_LINUX_RELEASE = \(.*\)/CFLAGS_LINUX_RELEASE = \1 $(IGNORE_WARNINGS)/" \
-e "s/OBJDIR_LINUX_DEBUG = \(.*\)/OBJDIR_LINUX_DEBUG = .objs_debug/" \
-e "s#all: linux_debug linux_release#include ../build_scripts/linux/*.mak\n\nall: linux_debug linux_release#" \
> xLights/xLights.cbp.mak

xSchedule/xSchedule.cbp.mak: xSchedule/xSchedule.cbp
Expand Down
17 changes: 17 additions & 0 deletions build_scripts/linux/ispc.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

ISPC_ARCH=$(shell uname -m)

ifeq '$(ISPC_ARCH)' 'aarch64'
ISPC_FLAGS=--target-os=linux --target=neon-i32x8 --arch=aarch64
else
ISPC_FLAGS=--target-os=linux --target=sse2-i32x8 --target=avx2-i32x8 --target=avx2-i32x16 --target=avx512icl-x32 --arch=x86_64
endif

$(OBJDIR_LINUX_DEBUG)/%.o: %.ispc
../ispc -g $(ISPC_FLAGS) -o $@ $<

$(OBJDIR_LINUX_RELEASE)/%.o: %.ispc
../ispc --math-lib=fast $(ISPC_FLAGS) -o $@ $<

OBJ_LINUX_DEBUG += $(OBJDIR_LINUX_DEBUG)/effects/ispc/LayerBlendingFunctions.o
OBJ_LINUX_RELEASE += $(OBJDIR_LINUX_RELEASE)/effects/ispc/LayerBlendingFunctions.o
4 changes: 4 additions & 0 deletions xLights/effects/ispc/ISPCComputeUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

ISPCComputeUtilities ISPCComputeUtilities::INSTANCE;

#ifndef __WXMSW__
// #define HASISPC
#endif


#ifdef HASISPC
#include "LayerBlendingFunctions.ispc.h"
Expand Down
5 changes: 4 additions & 1 deletion xLights/xLights.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,10 @@
<Unit filename="effects/assist/xlGridCanvasPictures.h" />
<Unit filename="effects/ispc/ISPCComputeUtilities.cpp" />
<Unit filename="effects/ispc/ISPCComputeUtilities.h" />
<Unit filename="effects/ispc/LayerBlendingFunctions.ispc" />
<Unit filename="effects/ispc/LayerBlendingFunctions.ispc">
<Option link="1" />
<Option compiler="gcc" use="0" buildCommand="../ispc-v1.25.3-linux.aarch64/bin/ispc -o $object $file" />
</Unit>
<Unit filename="effects/ispc/LayerBlendingFunctions.ispc.h" />
<Unit filename="graphics/opengl/DrawGLUtils.cpp" />
<Unit filename="graphics/opengl/DrawGLUtils.h" />
Expand Down
1,130 changes: 575 additions & 555 deletions xLights/xLights.cbp.mak

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions xLights/xlPrefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#ifdef __WXMAC__
#include "OpenGL/gl3.h"
#define __gl_h_

#define HASISPC 1
#endif


Expand Down
4 changes: 2 additions & 2 deletions xSchedule/xSchedule.cbp.mak
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LIB =
LDFLAGS =

INC_LINUX_DEBUG = $(INC) -Iinclude -I../xSchedule -I../include -I../xLights
CFLAGS_LINUX_DEBUG = $(CFLAGS) -Wall -g -std=c++1z `wx-config --version=3.3 --cflags` `pkg-config --cflags libavformat libavcodec libavutil libswresample libswscale` `pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0` -Winvalid-pch -DWX_PRECOMP -DLINUX -D__WXDEBUG__ -D__cdecl=""
CFLAGS_LINUX_DEBUG = $(CFLAGS) -Wall -g -std=gnu++20 `wx-config --version=3.3 --cflags` `pkg-config --cflags libavformat libavcodec libavutil libswresample libswscale` `pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0` -Winvalid-pch -DWX_PRECOMP -DLINUX -D__WXDEBUG__ -D__cdecl=""
RESINC_LINUX_DEBUG = $(RESINC)
RCFLAGS_LINUX_DEBUG = $(RCFLAGS)
LIBDIR_LINUX_DEBUG = $(LIBDIR)
Expand All @@ -30,7 +30,7 @@ DEP_LINUX_DEBUG =
OUT_LINUX_DEBUG = ../bin/xSchedule

INC_LINUX_RELEASE = $(INC) -Iinclude -I../xSchedule -I../include -I../xLights
CFLAGS_LINUX_RELEASE = $(CFLAGS) -O2 -Wall -std=c++1z `wx-config --version=3.3 --cflags` `pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0` `pkg-config --cflags libavformat libavcodec libavutil libswresample libswscale` -Winvalid-pch -DWX_PRECOMP -DLINUX -DNDEBUG -D__cdecl='' -Wno-reorder -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-unknown-pragmas
CFLAGS_LINUX_RELEASE = $(CFLAGS) -O2 -Wall -std=gnu++20 `wx-config --version=3.3 --cflags` `pkg-config --cflags gstreamer-1.0 gstreamer-video-1.0` `pkg-config --cflags libavformat libavcodec libavutil libswresample libswscale` -Winvalid-pch -DWX_PRECOMP -DLINUX -DNDEBUG -D__cdecl='' -Wno-reorder -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-unknown-pragmas
RESINC_LINUX_RELEASE = $(RESINC)
RCFLAGS_LINUX_RELEASE = $(RCFLAGS) -Wno-reorder -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-unknown-pragmas
LIBDIR_LINUX_RELEASE = $(LIBDIR)
Expand Down

0 comments on commit 3ebe666

Please sign in to comment.