# https://codeload.github.com/mikke89/RmlUi/zip/master 

### DEPENDS ###
DKDEPEND(freetype)
#DKDEPEND(glew)
#DKDEPEND(sdl2)
#DKDEPEND(sdl2_image)
#DKDEPEND(sfml)



### VERSION ###
DKSET(RMLUI_VERSION master)
DKSET(RMLUI_NAME RmlUi-${RMLUI_VERSION})
DKSET(RMLUI_DL https://codeload.github.com/mikke89/RmlUi/zip/${RMLUI_VERSION})
DKSET(RMLUI ${3RDPARTY}/${RMLUI_NAME})



### INSTALL ###
DKINSTALL(${RMLUI_DL} rmlui ${RMLUI})



### LINK ###
DKDEFINE(RMLUI_STATIC_LIB)
DKINCLUDE(${RMLUI}/Include)

#if(rmlui_core)
	WIN_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/RmlCore.lib)
	WIN_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/RmlCore.lib)
	MAC_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlCore.a)
	MAC_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlCore.a)
	IOSSIM_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlCore_d.a)
	IOSSIM_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlCore.a)
	LINUX_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlCore.a)
	LINUX_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlCore.a)
	RASPBERRY_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlCore.a)
	RASPBERRY_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlCore.a)
	##ANDROID_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libRmlCore.a)
	##ANDROID_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libRmlCore.a)
	ANDROID_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlCore.a)
	ANDROID_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlCore.a)
#endif()

if(rmlui_debugger)
	WIN_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/RmlDebugger.lib)
	WIN_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/RmlDebugger.lib)
	WIN_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/RmlDebugger.lib)
	MAC_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlDebugger.a)
	MAC_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlDebugger.a)
	IOSSIM_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlDebugger_d.a)
	IOSSIM_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlDebugger.a)
	LINUX_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlDebugger.a)
	LINUX_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlDebugger.a)
	RASPBERRY_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlDebugger.a)
	RASPBERRY_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlDebugger.a)
	##ANDROID_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libRmlDebugger.a)
	##ANDROID_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libRmlDebugger.a)
	ANDROID_DEBUG_LIB(${RMLUI}/${OS}/${DEBUG_DIR}/libRmlDebugger.a)
	ANDROID_RELEASE_LIB(${RMLUI}/${OS}/${RELEASE_DIR}/libRmlDebugger.a)
endif()

### The RmlUi SDL example needs these libraries
#${GLEW}\${OS}\lib\Debug\glew32d.lib
#${JPEG}\${OS}\Debug\turbojpeg-static.lib
#${PNG}\${OS}\Debug\libpng17_staticd.lib
#${TIFF}\${OS}\Debug\tiff-static.lib
#${ZLIB}\${OS}\Debug\zlibstaticd.lib
#winmm.lib
#Setupapi.lib
#version.lib
#imm32.lib





#### RML minimal #####
WIN_PATH(${RMLUI}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} 
"-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /nologo /GR /EHsc -DRMLUI_STATIC_LIB -DGLEW_STATIC /I${RMLUI}/Include /I${SDL}/include /I${GLEW}/include" -DBUILD_SHARED_LIBS=OFF
-DBUILD_SAMPLES=OFF -DBUILD_TESTING=OFF -DENABLE_SVG_PLUGIN=OFF -DENABLE_LOTTIE_PLUGIN=OFF -DBUILD_LUA_BINDINGS=OFF ${FREETYPE_WIN} ${RMLUI})


#### RML + ALL Extras #####
#WIN_PATH(${RMLUI}/${OS})
#WIN32_COMMAND(${DKCMAKE_WIN32} 
#"-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /nologo /GR /EHsc -DRMLUI_STATIC_LIB -DGLEW_STATIC /I${RMLUI}/Include /I${SDL}/include /I${GLEW}/include" 
#-DBUILD_SAMPLES=ON -DBUILD_TESTING=ON -DENABLE_SVG_PLUGIN=OFF -DENABLE_LOTTIE_PLUGIN=OFF -DBUILD_LUA_BINDINGS=OFF ${FREETYPE_WIN} ${SDL2IMAGE_WIN} ${GLEW_WIN32} ${SDL2_WIN} ${SFML_WIN} 
#${RMLUI})







WIN64_COMMAND(${DKCMAKE_WIN64} "-DCMAKE_CXX_FLAGS=/DWIN64 /D_WINDOWS /W3 /nologo /GR /EHsc -DRMLUI_STATIC_LIB /I${RMLUI}/Include /I${SDL}/include /I${GLEW}/include" -DBUILD_SAMPLES=ON 
-DBUILD_TESTING=ON -DENABLE_LOTTIE_PLUGIN=OFF -DBUILD_LUA_BINDINGS=OFF -DENABLE_SVG_PLUGIN=OFF ${FREETYPE_WIN} ${SDL2IMAGE_WIN} ${GLEW64} ${SDL2_WIN} 
#${SFML_WIN} 
${RMLUI})
WIN_VS(${RMLUI_NAME} RmlUi.sln RmlCore)
if(rmlui_debugger)
	WIN_VS(${RMLUI_NAME} RmlUi.sln RmlDebugger)
endif()

##WIN32_COMMAND(${CMAKE_EXE} -G "Visual Studio 16 2019" -A Win32 "-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /nologo /GR /EHsc -DRMLUI_STATIC_LIB /I${3RDPARTY}/${RMLUI_NAME}/Include /I${SDL}/include /I${GLEW}/include" "-DCMAKE_CXX_FLAGS_DEBUG=/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG" "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Ob2 /DNDEBUG" -DBUILD_SHARED_LIBS=OFF -DBUILD_SAMPLES=ON ${FREETYPE_WIN} ${SDL2_WIN} -DSDL2_IMAGE_LIBRARY_TEMP=${SDLIMAGE}/${OS}/lib/${RELEASE_DIR}/SDL_image.lib -DSDL2_IMAGE_INCLUDE_DIR=${SDLIMAGE} -DGLEW_DIR=${GLEW}/build/cmake -DGLEW_INCLUDE_DIR=${GLEW} -DGLEW_SHARED_LIBRARY_DEBUG=${GLEW}/${OS}/lib/${DEBUG_DIR}/libglew32d.lib -DGLEW_SHARED_LIBRARY_RELEASE=${GLEW}/${OS}/lib/${RELEASE_DIR}/libglew32.lib -DGLEW_STATIC_LIBRARY_DEBUG=${GLEW}/${OS}/lib/${DEBUG_DIR}/glew32d.lib -DGLEW_STATIC_LIBRARY_RELEASE=${GLEW}/${OS}/lib/${RELEASE_DIR}/glew32.lib -DCMAKE_PREFIX_PATH=${GLEW} -DSFML_INCLUDE_DIR=${SFML}/include -DSFML_MAIN_LIBRARY_DEBUG=${SFML}/${OS}/lib/${DEBUG_DIR}/sfml-main-d.lib -DSFML_MAIN_LIBRARY_RELEASE=${SFML}/${OS}/lib/${RELEASE_DIR}/sfml-main.lib -DSFML_SYSTEM_LIBRARY_DEBUG=${SFML}/${OS}/lib/${DEBUG_DIR}/sfml-system-s-d.lib -DSFML_SYSTEM_LIBRARY_RELEASE=${SFML}/${OS}/lib/${DEBUG_DIR}/sfml-system-s.lib -DSFML_WINDOW_LIBRARY_DEBUG=${SFML}/${OS}/lib/${DEBUG_DIR}/sfml-window-s-d.lib -DSFML_WINDOW_LIBRARY_RELEASE=${SFML}/${OS}/lib/${RELEASE_DIR}/sfml-window-s.lib -DSFML_GRAPHICS_LIBRARY_DEBUG=${SFML}/${OS}/lib/${DEBUG_DIR}/sfml-graphics-s-d.lib -DSFML_GRAPHICS_LIBRARY_RELEASE=${SFML}/${OS}/lib/${RELEASE_DIR}/sfml-graphics-s.lib ${RMLUI})


### COMPILE ###
#WIN_PATH(${RMLUI}/${OS})
#WIN32_COMMAND(${CMAKE_EXE} -G ${GENERATOR} -A Win32 "-DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /W3 /nologo /GR /EHsc /I${RMLUI}/Include /I${SDL}/include" "-DCMAKE_CXX_FLAGS_DEBUG=/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG" "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Ob2 /DNDEBUG" -DBUILD_SHARED_LIBS=OFF -DBUILD_SAMPLES=ON -DFREETYPE_INCLUDE_DIR_freetype2=${FREETYPE}/include -DFREETYPE_INCLUDE_DIR_ft2build=${FREETYPE}/include -DFREETYPE_LIBRARY=${FREETYPE}/${OS}/${RELEASE_DIR}/freetype.lib -DFREETYPE_LIBRARY_DEBUG=${FREETYPE}/${OS}/${DEBUG_DIR}/freetype.lib -DFREETYPE_LIBRARY_RELEASE=${FREETYPE}/${OS}/${RELEASE_DIR}/freetype.lib -DSDL2_INCLUDE_DIR=${SDL} -DSDL2_LIBRARY=${SDL}/${OS}/${RELEASE_DIR}/SDL2.lib -DSDL2_LIBRARY_TEMP=${SDL}/${OS}/${RELEASE_DIR}/SDL2.lib -DSDL2_IMAGE_INCLUDE_DIR=${SDLIMAGE} -DSDL2_IMAGE_LIBRARY_TEMP=${SDLIMAGE}/${OS}/lib/${RELEASE_DIR}/SDL_image.lib -DGLEW_INCLUDE_DIR=${GLEW} -DGLEW_STATIC_LIBRARY_DEBUG=${GLEW}/${OS}/lib/${DEBUG_DIR}/glew32d.lib -DGLEW_STATIC_LIBRARY_RELEASE=${GLEW}/${OS}/lib/${RELEASE_DIR}/glew32.lib ${RMLUI})
#WIN_VS(${RMLUI_NAME} RmlUi.sln)

## Test Building with Msys/Mingw
##WIN32_COMMAND(${CMAKE_EXE} -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=${MSYS}/bin/make.exe -DENABLE_PRECOMPILED_HEADERS=OFF -DDISABLE_RTTI_AND_EXCEPTIONS=ON -DBUILD_SHARED_LIBS=OFF -DFREETYPE_INCLUDE_DIR_freetype2=${FREETYPE}/include -DFREETYPE_INCLUDE_DIR_ft2build=${FREETYPE}/include -DFREETYPE_LIBRARY_DEBUG=${FREETYPE}/${OS}/${DEBUG_DIR}/freetype.lib -DFREETYPE_LIBRARY_RELEASE=${FREETYPE}/${OS}/${RELEASE_DIR}/freetype.lib ${RMLUI})
##WIN32_BASH("#!/bin/bash\;
##cd /${RMLUI}/${OS}\;
##export PATH=/c/mingw32/bin:$PATH\;
##export PATH=/c/msys/bin:$PATH\;
##make\;
##exit\;")


MAC_PATH(${RMLUI}/${OS})
MAC64_COMMAND(${DKCMAKE_MAC64} ${FREETYPE_APPLE} ${RMLUI})
MAC_XCODE(${RMLUI_NAME})


IOS_COMMAND(${RMLUI}/${OS})
IOS64_COMMAND(${DKCMAKE_IOS64} ${FREETYPE_APPLE} ${RMLUI})
IOS_XCODE(${RMLUI_NAME})


IOSSIM_PATH(${RMLUI}/${OS})
IOSSIM64_COMMAND(${DKCMAKE_IOSSIM64} ${FREETYPE_APPLE} ${RMLUI})
IOSSIM_XCODE(${RMLUI_NAME})


LINUX_DEBUG_PATH(${RMLUI}/${OS}/${DEBUG_DIR})
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} ${FREETYPE_LINUX} ${RMLUI})
LINUX_DEBUG_COMMAND(make)

LINUX_RELEASE_PATH(${RMLUI}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} ${FREETYPE_LINUX} ${RMLUI})
LINUX_RELEASE_COMMAND(make)


RASPBERRY_DEBUG_PATH(${RMLUI}/${OS}/${DEBUG_DIR})
RASPBERRY_DEBUG_COMMAND(${DKCMAKE_RASPBERRY_DEBUG} ${FREETYPE_RASPBERRY} ${RMLUI})
RASPBERRY_DEBUG_COMMAND(make)

RASPBERRY_RELEASE_PATH(${RMLUI}/${OS}/${RELEASE_DIR})
RASPBERRY_RELEASE_COMMAND(${DKCMAKE_RASPBERRY_RELEASE} ${FREETYPE_RASPBERRY} ${RMLUI})
RASPBERRY_RELEASE_COMMAND(make)


##ANDROID_NDK(${RMLUI_NAME})
ANDROID_PATH(${RMLUI}/${OS})
ANDROID32_COMMAND(${DKCMAKE_ANDROID32} "-DANDROID_COMPILER_FLAGS=-DRMLUI_STATIC_LIB -I${RMLUI}/Include" -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_SAMPLES=OFF ${FREETYPE_ANDROID} ${RMLUI})
ANDROID64_COMMAND(${DKCMAKE_ANDROID64} "-DANDROID_COMPILER_FLAGS=-DRMLUI_STATIC_LIB -I${RMLUI}/Include" -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_SAMPLES=OFF ${FREETYPE_ANDROID} ${RMLUI})
ANDROID_VS(${RMLUI_NAME} RmlUi.sln)
