integrate fluid lib build into main build
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
5174572fb8
commit
f41b0fb0f4
21
.vscode/c_cpp_properties.json
vendored
Normal file
21
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"C:/Program Files/Eclipse Adoptium/jdk-21.0.5.11-hotspot/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"compilerPath": "C:\\ProgramData\\mingw64\\mingw64\\bin\\gcc.exe",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "windows-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -6,5 +6,10 @@
|
||||
},
|
||||
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable",
|
||||
"javascript.preferences.importModuleSpecifier": "non-relative",
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative"
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||
"files.associations": {
|
||||
"electrosphere_fluidsim.h": "c",
|
||||
"jni.h": "c",
|
||||
"electrosphere_server_fluid_simulator_fluidacceleratedsimulator.h": "c"
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Fri Nov 29 20:08:47 EST 2024
|
||||
buildNumber=406
|
||||
#Sat Nov 30 14:46:42 EST 2024
|
||||
buildNumber=408
|
||||
|
||||
29
pom.xml
29
pom.xml
@ -513,6 +513,18 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Generate JNI Headers -->
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<compilerArgs>
|
||||
<arg>-h</arg>
|
||||
<arg>src/fluid/includes</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!--Exec build tools-->
|
||||
<plugin>
|
||||
@ -536,6 +548,23 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- Build Fluid Lib -->
|
||||
<execution>
|
||||
<id>build-fluid-lib</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>bash</executable>
|
||||
<environmentVariables>
|
||||
<SAVE_STEPS>0</SAVE_STEPS>
|
||||
</environmentVariables>
|
||||
<arguments>
|
||||
<argument>./src/fluid/compile.sh</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
86
src/fluid/compile.sh
Normal file
86
src/fluid/compile.sh
Normal file
@ -0,0 +1,86 @@
|
||||
cd ./src/fluid
|
||||
|
||||
echo "SAVE STEPS $SAVE_STEPS"
|
||||
|
||||
LIB_ENDING=".so"
|
||||
BASE_INCLUDE_DIR=""
|
||||
OS_INCLUDE_DIR=""
|
||||
|
||||
#determine os
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
#linux
|
||||
LIB_ENDING=".so"
|
||||
BASE_INCLUDE_DIR="${JAVA_HOME}/include"
|
||||
OS_INCLUDE_DIR="${JAVA_HOME}/include/linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# Mac OSX
|
||||
LIB_ENDING=".so"
|
||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
# POSIX compatibility layer and Linux environment emulation for Windows
|
||||
LIB_ENDING=".dll"
|
||||
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
|
||||
LIB_ENDING=".dll"
|
||||
BASE_INCLUDE_DIR="${JAVA_HOME}/include"
|
||||
OS_INCLUDE_DIR="${JAVA_HOME}/include/win32"
|
||||
elif [[ "$OSTYPE" == "win32" ]]; then
|
||||
# I'm not sure this can happen.
|
||||
LIB_ENDING=".dll"
|
||||
elif [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||
# ...
|
||||
LIB_ENDING=".so"
|
||||
else
|
||||
# Unknown.
|
||||
LIB_ENDING=".so"
|
||||
fi
|
||||
|
||||
# echo $PWD
|
||||
|
||||
#clean compile dir
|
||||
rm -f ./*.o
|
||||
rm -f ./*.so
|
||||
rm -f ./*.dll
|
||||
|
||||
|
||||
#compile object files
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/densitystep.c"
|
||||
# OUTPUT_FILE="./densitystep.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/velocitystep.c"
|
||||
# OUTPUT_FILE="./velocitystep.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/chunkmask.c"
|
||||
# OUTPUT_FILE="./chunkmask.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -DSAVE_STEPS=$SAVE_STEPS"
|
||||
INPUT_FILES="./src/javainterface.c"
|
||||
OUTPUT_FILE="./javainterface.o"
|
||||
gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -DSAVE_STEPS=$SAVE_STEPS"
|
||||
INPUT_FILES="./src/fluidsim.c"
|
||||
OUTPUT_FILE="./fluidsim.o"
|
||||
gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
|
||||
|
||||
#compile shared object file
|
||||
OUTPUT_FILE="libfluidsim$LIB_ENDING"
|
||||
COMPILE_FLAGS="-shared"
|
||||
INPUT_FILES="fluidsim.o javainterface.o"
|
||||
gcc $COMPILE_FLAGS $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
#move to resources
|
||||
mkdir -p ../../shared-folder
|
||||
mv "./libfluidsim$LIB_ENDING" "../../shared-folder/"
|
||||
|
||||
#clean compile dir
|
||||
rm -f ./*.o
|
||||
rm -f ./*.so
|
||||
rm -f ./*.dll
|
||||
@ -1,31 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class electrosphere_FluidSim */
|
||||
|
||||
#ifndef _Included_electrosphere_FluidSim
|
||||
#define _Included_electrosphere_FluidSim
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef electrosphere_FluidSim_DIM
|
||||
#define electrosphere_FluidSim_DIM 18L
|
||||
#undef electrosphere_FluidSim_DIFFUSION_CONSTANT
|
||||
#define electrosphere_FluidSim_DIFFUSION_CONSTANT 1.0E-5f
|
||||
#undef electrosphere_FluidSim_VISCOSITY_CONSTANT
|
||||
#define electrosphere_FluidSim_VISCOSITY_CONSTANT 1.0E-5f
|
||||
#undef electrosphere_FluidSim_LINEARSOLVERTIMES
|
||||
#define electrosphere_FluidSim_LINEARSOLVERTIMES 20L
|
||||
#undef electrosphere_FluidSim_GRAVITY
|
||||
#define electrosphere_FluidSim_GRAVITY -1000.0f
|
||||
/*
|
||||
* Class: electrosphere_FluidSim
|
||||
* Method: simulate
|
||||
* Signature: (Ljava/util/List;F)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_electrosphere_FluidSim_simulate
|
||||
(JNIEnv *, jclass, jobject, jfloat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,21 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class electrosphere_server_fluid_simulator_FluidAcceleratedSimulator */
|
||||
|
||||
#ifndef _Included_electrosphere_server_fluid_simulator_FluidAcceleratedSimulator
|
||||
#define _Included_electrosphere_server_fluid_simulator_FluidAcceleratedSimulator
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: electrosphere_server_fluid_simulator_FluidAcceleratedSimulator
|
||||
* Method: simulate
|
||||
* Signature: (Ljava/util/List;F)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAcceleratedSimulator_simulate
|
||||
(JNIEnv *, jclass, jobject, jfloat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include "../includes/utilities.h"
|
||||
#include "../includes/chunkmask.h"
|
||||
#include "../includes/electrosphere_FluidSim.h"
|
||||
#include "../includes/electrosphere_server_fluid_simulator_FluidAcceleratedSimulator.h"
|
||||
#include "../includes/mainFunctions.h"
|
||||
#include "../includes/chunk.h"
|
||||
#include "../includes/simulation.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user