Integral Method
Given a volume of material with constant or varying density, the mass is defined by the volume integral
$$ m = \int \rho \,{\rm d}V \tag{1}$$
The center of mass is given by the integral
$$ \vec{c} = \frac{1}{m} \int \,\vec{r}\, \rho\, {\rm d} V \tag{2}$$
where $\vec{r} = \pmatrix{x \\ y \\ z}$ is the position of each particle in the object, and center of mass $\vec{c} = \pmatrix{c_x \\ c_y \\ c_z}$
Finally, the mass moment of inertia tensor about the origin is found by the integral
$$ \mathbf{I}_0 = \int \begin{bmatrix} y^2+z^2 & -x y & -x z \\ -x y & x^2+z^2 & -y z\\ -x z & -y z & x^2+y^2 \end{bmatrix} \rho \, {\rm d} V \tag{3} $$
If the MMOI about the center of mass is required, then use the parallel axis theorem in vector form"
$$ \mathbf{I}_C = \mathbf{I}_0 - m \begin{bmatrix} c_y^2+c_z^2 & -c_x c_y & -c_x c_z \\ -c_x c_y & c_x^2+c_z^2 & -c_y c_z\\ -c_x c_z & -c_y c_z & c_x^2+c_y^2 \end{bmatrix} \tag{4} $$
Example
Consider an upside-down cone with the coordinate system centered on the tip and uniform density $\rho$
Each particle location in the object is defined by cylindrical coordinates
$$ \vec{r} = \pmatrix{r \cos \theta \\ r \sin \theta \\ z} $$ with $z = 0 \ldots h$, $\theta = 0 \ldots 2\pi$, and $r = 0 \ldots \tfrac{z}{h} R$
The differential volume in cylindrical coordinates is
$$ {\rm d}V = r\, {\rm d} r\, {\rm d}\theta\, {\rm d} z $$
So according to the procedure above we have
$$ m = \int_0^h \int_0^{2\pi} \int_0^{\tfrac{z R}{h}} \rho\, r\, {\rm d} r\, {\rm d}\theta\, {\rm d} z = \rho \frac{\pi h R^2}{3}$$
$$ \vec{c} = \frac{1}{ \rho \tfrac{\pi h R^2}{3} } \int_0^h \int_0^{2\pi} \int_0^{\tfrac{z R}{h}} \rho\, \pmatrix{r \cos \theta \\ r \sin \theta \\ z}\, r\, {\rm d} r\, {\rm d}\theta\, {\rm d} z = \pmatrix{0 \\ 0 \\ \tfrac{3}{4} h } $$
$$ \mathbf{I}_0 = \int_0^h \int_0^{2\pi} \int_0^{\tfrac{z R}{h}} \rho\, \begin{bmatrix}
z^2+r^2 \sin^2 \theta & -r^2 \sin\theta\cos\theta & -r z \cos\theta \\
-r^2 \sin\theta \cos\theta & z^2 + r^2 \cos^2 \theta & -r z \sin\theta \\
-r z \cos\theta & - r z \sin \theta & r^2
\end{bmatrix} r\, {\rm d} r\, {\rm d}\theta\, {\rm d} z $$
$$ \mathbf{I}_0 = \begin{bmatrix} \rho \tfrac{\pi R^2 h (R^2+4h^2)}{20} & & \\
& \rho \tfrac{\pi R^2 h (R^2 +4 h^2)}{20} & \\ & & \rho \tfrac{\pi R^4 h}{10} \end{bmatrix} = \begin{bmatrix} m \tfrac{3 (R^2+4 h^2)}{20} & & \\
& m \tfrac{3 (R^2+4 h^2)}{20} & \\ & & m \tfrac{3 R^2}{10} \end{bmatrix} $$
$$ \mathbf{I}_C = \mathbf{I}_0 - m \begin{bmatrix} \tfrac{9 h^2}{16} & & \\ & \tfrac{9 h^2}{16} & \\ & & 0 \end{bmatrix} = \begin{bmatrix} m \left( \tfrac{3 R^2}{20} + \frac{3 h^2}{80} \right) & & \\
& m \left( \tfrac{3 R^2}{20} + \frac{3 h^2}{80} \right) & \\ & & m \tfrac{3 R^2}{10} \end{bmatrix} $$
which matches the published values in
https://en.wikipedia.org/wiki/List_of_moments_of_inertia