include(Base)

include_directories(include)
foreach(dir gl png zip)
  include_directories(include/${dir})
endforeach()
include_directories(ijg)
include_directories(../../Log/include)

list(APPEND HEADERS ijg/cderror.h)
list(APPEND HEADERS ijg/jmorecfg.h)
list(APPEND HEADERS ijg/jerror.h)
list(APPEND HEADERS ijg/jchuff.h)
list(APPEND HEADERS ijg/jdct.h)
list(APPEND HEADERS ijg/jpegint.h)
list(APPEND HEADERS ijg/jdhuff.h)
list(APPEND HEADERS ijg/transupp.h)
list(APPEND HEADERS ijg/cdjpeg.h)
list(APPEND HEADERS ijg/jpeglib.h)
list(APPEND HEADERS ijg/jinclude.h)
list(APPEND HEADERS ijg/jversion.h)
list(APPEND HEADERS ijg/jconfig.h)
list(APPEND HEADERS ijg/jmemsys.h)
list(APPEND HEADERS include/png/pngconf.h)
list(APPEND HEADERS include/png/png.h)
list(APPEND HEADERS include/g3d/AABox.h)
list(APPEND HEADERS include/g3d/AABSPTree.h)
list(APPEND HEADERS include/g3d/Array.h)
list(APPEND HEADERS include/g3d/BinaryFormat.h)
list(APPEND HEADERS include/g3d/BinaryInput.h)
list(APPEND HEADERS include/g3d/BinaryOutput.h)
list(APPEND HEADERS include/g3d/BoundsTrait.h)
list(APPEND HEADERS include/g3d/Box.h)
list(APPEND HEADERS include/g3d/BumpMapPreprocess.h)
list(APPEND HEADERS include/g3d/Capsule.h)
list(APPEND HEADERS include/g3d/CollisionDetection.h)
list(APPEND HEADERS include/g3d/Color1.h)
list(APPEND HEADERS include/g3d/Color1uint8.h)
list(APPEND HEADERS include/g3d/Color3.h)
list(APPEND HEADERS include/g3d/Color3uint8.h)
list(APPEND HEADERS include/g3d/Color4.h)
list(APPEND HEADERS include/g3d/Color4uint8.h)
list(APPEND HEADERS include/g3d/Cone.h)
list(APPEND HEADERS include/g3d/constants.h)
list(APPEND HEADERS include/g3d/ConvexPolyhedron.h)
list(APPEND HEADERS include/g3d/CoordinateFrame.h)
list(APPEND HEADERS include/g3d/Crypto.h)
list(APPEND HEADERS include/g3d/Cylinder.h)
list(APPEND HEADERS include/g3d/debug.h)
list(APPEND HEADERS include/g3d/debugAssert.h)
list(APPEND HEADERS include/g3d/debugPrintf.h)
list(APPEND HEADERS include/g3d/enumclass.h)
list(APPEND HEADERS include/g3d/EqualsTrait.h)
list(APPEND HEADERS include/g3d/fileutils.h)
list(APPEND HEADERS include/g3d/format.h)
list(APPEND HEADERS include/g3d/g3derror.h)
list(APPEND HEADERS include/g3d/g3dfnmatch.h)
list(APPEND HEADERS include/g3d/G3DGameUnits.h)
list(APPEND HEADERS include/g3d/g3dmath.h)
list(APPEND HEADERS include/g3d/GCamera.h)
list(APPEND HEADERS include/g3d/GImage.h)
list(APPEND HEADERS include/g3d/GLight.h)
list(APPEND HEADERS include/g3d/HashTrait.h)
list(APPEND HEADERS include/g3d/Image1.h)
list(APPEND HEADERS include/g3d/LightingParameters.h)
list(APPEND HEADERS include/g3d/Line.h)
list(APPEND HEADERS include/g3d/LineSegment.h)
list(APPEND HEADERS include/g3d/Map2D.h)
list(APPEND HEADERS include/g3d/Matrix2.h)
list(APPEND HEADERS include/g3d/Matrix3.h)
list(APPEND HEADERS include/g3d/Matrix4.h)
list(APPEND HEADERS include/g3d/MemoryManager.h)
list(APPEND HEADERS include/g3d/MeshAlg.h)
list(APPEND HEADERS include/g3d/MeshBuilder.h)
list(APPEND HEADERS include/g3d/ParseError.h)
list(APPEND HEADERS include/g3d/PhysicsFrame.h)
list(APPEND HEADERS include/g3d/Plane.h)
list(APPEND HEADERS include/g3d/platform.h)
list(APPEND HEADERS include/g3d/PositionTrait.h)
list(APPEND HEADERS include/g3d/Quat.h)
list(APPEND HEADERS include/g3d/Random.h)
list(APPEND HEADERS include/g3d/Ray.h)
list(APPEND HEADERS include/g3d/Rect2D.h)
list(APPEND HEADERS include/g3d/Set.h)
list(APPEND HEADERS include/g3d/SmallArray.h)
list(APPEND HEADERS include/g3d/Sphere.h)
list(APPEND HEADERS include/g3d/spline.h)
list(APPEND HEADERS include/g3d/stringutils.h)
list(APPEND HEADERS include/g3d/System.h)
list(APPEND HEADERS include/g3d/Table.h)
list(APPEND HEADERS include/g3d/Triangle.h)
list(APPEND HEADERS include/g3d/uint128.h)
list(APPEND HEADERS include/g3d/units.h)
list(APPEND HEADERS include/g3d/UprightFrame.h)
list(APPEND HEADERS include/g3d/Vector2.h)
list(APPEND HEADERS include/g3d/Vector2int16.h)
list(APPEND HEADERS include/g3d/Vector3.h)
list(APPEND HEADERS include/g3d/Vector3int16.h)
list(APPEND HEADERS include/g3d/Vector3int32.h)
list(APPEND HEADERS include/g3d/Vector4.h)
list(APPEND HEADERS include/g3d/Vector4int8.h)
list(APPEND HEADERS include/g3d/vectorMath.h)
list(APPEND HEADERS include/g3d/WrapMode.h)


# Add 3rd party code we don't modify.
# Note: CMake will not notice if these files change
# when checking deps, but that should be okay.
file(GLOB SOURCES ijg/*.c;png/*.c;zip/*.c)
# Don't build a few files that cause multiple definitions.
list_filter(SOURCES ijg/jidctred.c)
list_filter(SOURCES ijg/jdphuff.c)
list_filter(SOURCES ijg/jmemansi.c)
list_filter(SOURCES ijg/jcphuff.c)

# g3dcpp sources
list(APPEND SOURCES g3dcpp/AABox.cpp)
list(APPEND SOURCES g3dcpp/BinaryInput.cpp)
list(APPEND SOURCES g3dcpp/BinaryOutput.cpp)
list(APPEND SOURCES g3dcpp/Box.cpp)
list(APPEND SOURCES g3dcpp/Capsule.cpp)
list(APPEND SOURCES g3dcpp/CollisionDetection.cpp)
list(APPEND SOURCES g3dcpp/Color3.cpp)
list(APPEND SOURCES g3dcpp/Color3uint8.cpp)
list(APPEND SOURCES g3dcpp/Color4.cpp)
list(APPEND SOURCES g3dcpp/Color4uint8.cpp)
list(APPEND SOURCES g3dcpp/CoordinateFrame.cpp)
list(APPEND SOURCES g3dcpp/Crypto.cpp)
list(APPEND SOURCES g3dcpp/Cylinder.cpp)
list(APPEND SOURCES g3dcpp/debugAssert.cpp)
list(APPEND SOURCES g3dcpp/fileutils.cpp)
list(APPEND SOURCES g3dcpp/format.cpp)
list(APPEND SOURCES g3dcpp/g3dfnmatch.cpp)
list(APPEND SOURCES g3dcpp/g3dmath.cpp)
list(APPEND SOURCES g3dcpp/GCamera.cpp)
list(APPEND SOURCES g3dcpp/GImage.cpp)
list(APPEND SOURCES g3dcpp/GImage_bayer.cpp)
list(APPEND SOURCES g3dcpp/GImage_bmp.cpp)
list(APPEND SOURCES g3dcpp/GImage_jpeg.cpp)
list(APPEND SOURCES g3dcpp/GImage_png.cpp)
list(APPEND SOURCES g3dcpp/GImage_tga.cpp)
list(APPEND SOURCES g3dcpp/GLight.cpp)
list(APPEND SOURCES g3dcpp/LightingParameters.cpp)
list(APPEND SOURCES g3dcpp/Line.cpp)
list(APPEND SOURCES g3dcpp/LineSegment.cpp)
list(APPEND SOURCES g3dcpp/Matrix3.cpp)
list(APPEND SOURCES g3dcpp/Matrix4.cpp)
list(APPEND SOURCES g3dcpp/MemoryManager.cpp)
list(APPEND SOURCES g3dcpp/PhysicsFrame.cpp)
list(APPEND SOURCES g3dcpp/Plane.cpp)
list(APPEND SOURCES g3dcpp/Quat.cpp)
list(APPEND SOURCES g3dcpp/Random.cpp)
list(APPEND SOURCES g3dcpp/Ray.cpp)
list(APPEND SOURCES g3dcpp/Sphere.cpp)
list(APPEND SOURCES g3dcpp/stringutils.cpp)
list(APPEND SOURCES g3dcpp/System.cpp)
list(APPEND SOURCES g3dcpp/Triangle.cpp)
list(APPEND SOURCES g3dcpp/uint128.cpp)
list(APPEND SOURCES g3dcpp/UprightFrame.cpp)
list(APPEND SOURCES g3dcpp/Vector2.cpp)
list(APPEND SOURCES g3dcpp/Vector2int16.cpp)
list(APPEND SOURCES g3dcpp/Vector3.cpp)
list(APPEND SOURCES g3dcpp/Vector3int16.cpp)
list(APPEND SOURCES g3dcpp/Vector4.cpp)

add_library(G3D OBJECT ${SOURCES} ${HEADERS})
