-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added makefile for multi-core compiling if make is available, happy n…
…ew year!
- Loading branch information
1 parent
1bd1fad
commit 7fa4ea2
Showing
6 changed files
with
72 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
bin/ | ||
temp/ | ||
stl/ | ||
.vs/ | ||
FluidX3D.vcxproj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
# command line argument(s): device ID(s); if empty, FluidX3D will automatically choose the fastest available device(s) | ||
|
||
mkdir -p bin # create directory for executable | ||
rm -f ./bin/FluidX3D # prevent execution of old version if compiling fails | ||
#TARGET=Linux-X11 # compile on Linux with X11 graphics | ||
TARGET=Linux # compile on Linux (without X11) | ||
#TARGET=macOS # compile on macOS (without X11) | ||
#TARGET=Android # compile on Android (without X11) | ||
|
||
#g++ ./src/*.cpp -o ./bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lX11 # compile on Linux with X11 | ||
if command -v make &>/dev/null; then # if make is available, compile FluidX3D with multiple CPU cores | ||
make $TARGET | ||
else # else (make is not installed), compile FluidX3D with a single CPU core | ||
mkdir -p bin # create directory for executable | ||
rm -rf temp bin/FluidX3D # prevent execution of old executable if compiling fails | ||
if [ $TARGET == Linux-X11 ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lX11; fi | ||
if [ $TARGET == Linux ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL; fi | ||
if [ $TARGET == macOS ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL; fi | ||
if [ $TARGET == Android ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL; fi | ||
fi | ||
|
||
g++ ./src/*.cpp -o ./bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL # compile on Linux (without X11) | ||
#g++ ./src/*.cpp -o ./bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL # compile on macOS (without X11) | ||
#g++ ./src/*.cpp -o ./bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL # compile on Android (without X11) | ||
|
||
./bin/FluidX3D "$@" # run FluidX3D | ||
bin/FluidX3D "$@" # run FluidX3D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
MAKEFLAGS = -j$(nproc) | ||
CC = g++ | ||
CFLAGS = -std=c++17 -pthread | ||
|
||
Linux-X11 Linux: LDFLAGS_OPENCL = -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL | ||
macOS: LDFLAGS_OPENCL = -I./src/OpenCL/include -framework OpenCL | ||
Android: LDFLAGS_OPENCL = -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL | ||
|
||
Linux-X11: LDFLAGS_X11 = -I./src/X11/include -L./src/X11/lib -lX11 | ||
Linux macOS Android: LDFLAGS_X11 = | ||
|
||
Linux-X11 Linux macOS Android: bin/FluidX3D | ||
|
||
bin/FluidX3D: temp/graphics.o temp/info.o temp/kernel.o temp/lbm.o temp/lodepng.o temp/main.o temp/setup.o temp/shapes.o make.sh | ||
@mkdir -p bin | ||
$(CC) temp/*.o -o bin/FluidX3D $(CFLAGS) $(LDFLAGS_OPENCL) $(LDFLAGS_X11) | ||
|
||
temp/graphics.o: src/graphics.cpp src/defines.hpp src/graphics.hpp src/lodepng.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/graphics.cpp -o temp/graphics.o $(CFLAGS) $(LDFLAGS_X11) | ||
|
||
temp/info.o: src/info.cpp src/defines.hpp src/graphics.hpp src/info.hpp src/lbm.hpp src/lodepng.hpp src/opencl.hpp src/units.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/info.cpp -o temp/info.o $(CFLAGS) $(LDFLAGS_OPENCL) | ||
|
||
temp/kernel.o: src/kernel.cpp src/kernel.hpp src/lodepng.hpp src/utilities.hpp | ||
@mkdir -p temp | ||
$(CC) -c src/kernel.cpp -o temp/kernel.o $(CFLAGS) | ||
|
||
temp/lbm.o: src/lbm.cpp src/defines.hpp src/graphics.hpp src/info.hpp src/lbm.hpp src/lodepng.hpp src/opencl.hpp src/units.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/lbm.cpp -o temp/lbm.o $(CFLAGS) $(LDFLAGS_OPENCL) | ||
|
||
temp/lodepng.o: src/lodepng.cpp src/lodepng.hpp | ||
@mkdir -p temp | ||
$(CC) -c src/lodepng.cpp -o temp/lodepng.o $(CFLAGS) | ||
|
||
temp/main.o: src/main.cpp src/defines.hpp src/graphics.hpp src/info.hpp src/lbm.hpp src/lodepng.hpp src/opencl.hpp src/setup.hpp src/shapes.hpp src/units.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/main.cpp -o temp/main.o $(CFLAGS) $(LDFLAGS_OPENCL) | ||
|
||
temp/setup.o: src/setup.cpp src/defines.hpp src/graphics.hpp src/info.hpp src/lbm.hpp src/lodepng.hpp src/opencl.hpp src/setup.hpp src/shapes.hpp src/units.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/setup.cpp -o temp/setup.o $(CFLAGS) $(LDFLAGS_OPENCL) | ||
|
||
temp/shapes.o: src/shapes.cpp src/defines.hpp src/graphics.hpp src/info.hpp src/lbm.hpp src/lodepng.hpp src/opencl.hpp src/shapes.hpp src/units.hpp src/utilities.hpp make.sh | ||
@mkdir -p temp | ||
$(CC) -c src/shapes.cpp -o temp/shapes.o $(CFLAGS) $(LDFLAGS_OPENCL) | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf temp bin/FluidX3D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters