set(INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/dep/include ${PROJECT_SOURCE_DIR}/src/dep/include/irrlicht ${PROJECT_SOURCE_DIR}/src/dep/include/zlib ${PROJECT_SOURCE_DIR}/src/Client/GUI/)
if(WIN32)
  set(LIBTYPE SHARED)
  set(INCLUDE_DIRS ${INCLUDE_DIRS} ${DirectX_D3D9_INCLUDE_DIR} ${DirectX_D3DX9_INCLUDE_DIR})
else()
  set(LIBTYPE STATIC)
endif()
include_directories(${INCLUDE_DIRS})

add_library(irrlicht ${LIBTYPE} # this may be considered a hack.

aesGladman/aescrypt.cpp
aesGladman/aeskey.cpp
aesGladman/aestab.cpp
aesGladman/fileenc.cpp
aesGladman/hmac.cpp
aesGladman/prng.cpp
aesGladman/pwd2key.cpp
aesGladman/sha1.cpp
aesGladman/sha2.cpp

bzip2/blocksort.c
bzip2/bzlib.c
bzip2/crctable.c
bzip2/decompress.c
bzip2/bzcompress.c
bzip2/huffman.c
bzip2/randtable.c


zlib/adler32.c
zlib/compress.c
zlib/crc32.c
zlib/deflate.c
zlib/gzio.c
zlib/infback.c
zlib/inffast.c
zlib/inflate.c
zlib/inftrees.c
zlib/trees.c
zlib/uncompr.c
zlib/zutil.c

lzma/LzmaDec.c

libpng/example.c
libpng/png.c
libpng/pngerror.c
libpng/pnggccrd.c
libpng/pngget.c
libpng/pngmem.c
libpng/pngpread.c
libpng/pngread.c
libpng/pngrio.c
libpng/pngrtran.c
libpng/pngrutil.c
libpng/pngset.c
libpng/pngtest.c
libpng/pngtrans.c
libpng/pngvcrd.c
libpng/pngwio.c
libpng/pngwrite.c
libpng/pngwtran.c
libpng/pngwutil.c

jpeglib/jaricom.c
jpeglib/jcapimin.c
jpeglib/jcapistd.c
jpeglib/jcarith.c
jpeglib/jccoefct.c
jpeglib/jccolor.c
jpeglib/jcdctmgr.c
jpeglib/jchuff.c
jpeglib/jcinit.c
jpeglib/jcmainct.c
jpeglib/jcmarker.c
jpeglib/jcmaster.c
jpeglib/jcomapi.c
jpeglib/jcparam.c
jpeglib/jcprepct.c
jpeglib/jcsample.c
jpeglib/jctrans.c
jpeglib/jdapimin.c
jpeglib/jdapistd.c
jpeglib/jdarith.c
jpeglib/jdatadst.c
jpeglib/jdatasrc.c
jpeglib/jdcoefct.c
jpeglib/jdcolor.c
jpeglib/jddctmgr.c
jpeglib/jdhuff.c
jpeglib/jdinput.c
jpeglib/jdmainct.c
jpeglib/jdmarker.c
jpeglib/jdmaster.c
jpeglib/jdmerge.c
jpeglib/jdpostct.c
jpeglib/jdsample.c
jpeglib/jdtrans.c
jpeglib/jerror.c
jpeglib/jfdctflt.c
jpeglib/jfdctfst.c
jpeglib/jfdctint.c
jpeglib/jidctflt.c
jpeglib/jidctfst.c
jpeglib/jidctint.c
jpeglib/jmemmgr.c
jpeglib/jmemnobs.c
jpeglib/jquant1.c
jpeglib/jquant2.c
jpeglib/jutils.c

C3DSMeshFileLoader.cpp
CAnimatedMeshMD2.cpp
CAnimatedMeshMD3.cpp
CAnimatedMeshSceneNode.cpp
CAttributes.cpp
CB3DMeshFileLoader.cpp
CBillboardSceneNode.cpp
CBoneSceneNode.cpp
CBSPMeshFileLoader.cpp
CBurningShader_Raster_Reference.cpp
CCameraSceneNode.cpp
CColladaFileLoader.cpp
CColladaMeshWriter.cpp
CColorConverter.cpp
CCSMLoader.cpp
CCubeSceneNode.cpp
# CD3D8Driver.cpp
# CD3D8NormalMapRenderer.cpp
# CD3D8ParallaxMapRenderer.cpp
# CD3D8ShaderMaterialRenderer.cpp
# CD3D8Texture.cpp
CD3D9Driver.cpp
CD3D9HLSLMaterialRenderer.cpp
CD3D9NormalMapRenderer.cpp
CD3D9ParallaxMapRenderer.cpp
CD3D9ShaderMaterialRenderer.cpp
CD3D9Texture.cpp
CDefaultGUIElementFactory.cpp
CDefaultSceneNodeAnimatorFactory.cpp
CDefaultSceneNodeFactory.cpp
CDepthBuffer.cpp
CDMFLoader.cpp
CDummyTransformationSceneNode.cpp
CEmptySceneNode.cpp
CFileList.cpp
CFileSystem.cpp
CFPSCounter.cpp
CGeometryCreator.cpp
CGUIButton.cpp
CGUICheckBox.cpp
CGUIColorSelectDialog.cpp
CGUIComboBox.cpp
CGUIContextMenu.cpp
CGUIEditBox.cpp
CGUIEnvironment.cpp
CGUIFileOpenDialog.cpp
CGUIFont.cpp
CGUIImage.cpp
CGUIImageList.cpp
CGUIInOutFader.cpp
CGUIListBox.cpp
CGUIMenu.cpp
CGUIMeshViewer.cpp
CGUIMessageBox.cpp
CGUIModalScreen.cpp
CGUIScrollBar.cpp
CGUISkin.cpp
CGUISpinBox.cpp
CGUISpriteBank.cpp
CGUIStaticText.cpp
CGUITabControl.cpp
CGUITable.cpp
CGUIToolBar.cpp
CGUITreeView.cpp
CGUIWindow.cpp
CImage.cpp
CImageLoaderBMP.cpp
CImageLoaderJPG.cpp
CImageLoaderPCX.cpp
CImageLoaderPNG.cpp
CImageLoaderPPM.cpp
CImageLoaderPSD.cpp
CImageLoaderRGB.cpp
CImageLoaderTGA.cpp
CImageLoaderWAL.cpp
CImageWriterBMP.cpp
CImageWriterJPG.cpp
CImageWriterPCX.cpp
CImageWriterPNG.cpp
CImageWriterPPM.cpp
CImageWriterPSD.cpp
CImageWriterTGA.cpp
CIrrDeviceConsole.cpp
CIrrDeviceFB.cpp
CIrrDeviceLinux.cpp
CIrrDeviceSDL.cpp
CIrrDeviceStub.cpp
CIrrDeviceWin32.cpp
CIrrDeviceWinCE.cpp
CIrrMeshFileLoader.cpp
CIrrMeshWriter.cpp
CLightSceneNode.cpp
CLimitReadFile.cpp
CLMTSMeshFileLoader.cpp
CLogger.cpp
CLWOMeshFileLoader.cpp
CMD2MeshFileLoader.cpp
CMD3MeshFileLoader.cpp
CMemoryFile.cpp
CMeshCache.cpp
CMeshManipulator.cpp
CMeshSceneNode.cpp
CMetaTriangleSelector.cpp
CMountPointReader.cpp
CMS3DMeshFileLoader.cpp
CMY3DMeshFileLoader.cpp
CNPKReader.cpp
CNullDriver.cpp
COBJMeshFileLoader.cpp
COBJMeshWriter.cpp
COCTLoader.cpp
COctreeSceneNode.cpp
COctreeTriangleSelector.cpp
COgreMeshFileLoader.cpp
COpenGLDriver.cpp
COpenGLExtensionHandler.cpp
COpenGLNormalMapRenderer.cpp
COpenGLParallaxMapRenderer.cpp
COpenGLShaderMaterialRenderer.cpp
COpenGLSLMaterialRenderer.cpp
COpenGLTexture.cpp
COSOperator.cpp
CPakReader.cpp
CParticleAnimatedMeshSceneNodeEmitter.cpp
CParticleAttractionAffector.cpp
CParticleBoxEmitter.cpp
CParticleCylinderEmitter.cpp
CParticleFadeOutAffector.cpp
CParticleGravityAffector.cpp
CParticleMeshEmitter.cpp
CParticlePointEmitter.cpp
CParticleRingEmitter.cpp
CParticleRotationAffector.cpp
CParticleScaleAffector.cpp
CParticleSphereEmitter.cpp
CParticleSystemSceneNode.cpp
CPLYMeshFileLoader.cpp
CPLYMeshWriter.cpp
CQ3LevelMesh.cpp
CQuake3ShaderSceneNode.cpp
CReadFile.cpp
CSceneCollisionManager.cpp
CSceneManager.cpp
CSceneNodeAnimatorCameraFPS.cpp
CSceneNodeAnimatorCameraMaya.cpp
CSceneNodeAnimatorCollisionResponse.cpp
CSceneNodeAnimatorDelete.cpp
CSceneNodeAnimatorFlyCircle.cpp
CSceneNodeAnimatorFlyStraight.cpp
CSceneNodeAnimatorFollowSpline.cpp
CSceneNodeAnimatorRotation.cpp
CSceneNodeAnimatorTexture.cpp
CShadowVolumeSceneNode.cpp
CSkinnedMesh.cpp
CSkyBoxSceneNode.cpp
CSkyDomeSceneNode.cpp
CSoftwareDriver.cpp
CSoftwareDriver2.cpp
CSoftwareTexture.cpp
CSoftwareTexture2.cpp
CSphereSceneNode.cpp
CSTLMeshFileLoader.cpp
CSTLMeshWriter.cpp
CTarReader.cpp
CTerrainSceneNode.cpp
CTerrainTriangleSelector.cpp
CTextSceneNode.cpp
CTRFlat.cpp
CTRFlatWire.cpp
CTRGouraud.cpp
CTRGouraud2.cpp
CTRGouraudAlpha2.cpp
CTRGouraudAlphaNoZ2.cpp
CTRGouraudWire.cpp
CTriangleBBSelector.cpp
CTriangleSelector.cpp
CTRTextureBlend.cpp
CTRTextureDetailMap2.cpp
CTRTextureFlat.cpp
CTRTextureFlatWire.cpp
CTRTextureGouraud.cpp
CTRTextureGouraud2.cpp
CTRTextureGouraudAdd.cpp
CTRTextureGouraudAdd2.cpp
CTRTextureGouraudAddNoZ2.cpp
CTRTextureGouraudAlpha.cpp
CTRTextureGouraudAlphaNoZ.cpp
CTRTextureGouraudNoZ.cpp
CTRTextureGouraudNoZ2.cpp
CTRTextureGouraudVertexAlpha2.cpp
CTRTextureGouraudWire.cpp
CTRTextureLightMap2_Add.cpp
CTRTextureLightMap2_M1.cpp
CTRTextureLightMap2_M2.cpp
CTRTextureLightMap2_M4.cpp
CTRTextureLightMapGouraud2_M4.cpp
CTRTextureWire2.cpp
CVideoModeList.cpp
CVolumeLightSceneNode.cpp
CWaterSurfaceSceneNode.cpp
CWriteFile.cpp
CXMeshFileLoader.cpp
CXMLReader.cpp
CXMLWriter.cpp
CZBuffer.cpp
CZipReader.cpp
IBurningShader.cpp
Irrlicht-gcc.cbp
Irrlicht.cpp
irrXML.cpp
os.cpp

additions/CImageLoaderBLP.cpp

${PROJECT_SOURCE_DIR}/src/Client/GUI/CM2Mesh.cpp
)
if(WIN32)
  SET_TARGET_PROPERTIES (irrlicht PROPERTIES DEFINE_SYMBOL 
  "IRRLICHT_EXPORTS"
  RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_INSTALL_PREFIX}/bin"
  RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_INSTALL_PREFIX}/bin")
  target_link_libraries (irrlicht ${DirectX_D3D9_LIBRARY} ${DirectX_D3DX9_LIBRARY} Winmm)
  install(TARGETS irrlicht DESTINATION ${CMAKE_INSTALL_PREFIX}) # irrlicht needs to go to the install dir on windows as it's a dll
endif()
