aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/FindJson.cmake
blob: 26339a2959d09819c051ce1d3c261d392e8b3041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Look for JSONCPP if asked to.
# We use a bundled version by default because some distros ship versions of
# JSONCPP that cause segfaults and other memory errors when we link with them.
# See https://github.com/minetest/minetest/issues/1793

mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR)
option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP.  May cause segfaults and other memory errors!" FALSE)

if(ENABLE_SYSTEM_JSONCPP)
	find_library(JSON_LIBRARY NAMES jsoncpp)
	find_path(JSON_INCLUDE_DIR json/features.h PATH_SUFFIXES jsoncpp)

	include(FindPackageHandleStandardArgs)
	find_package_handle_standard_args(JSONCPP DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)

	if(JSONCPP_FOUND)
		message(STATUS "Using system JSONCPP library.")
	endif()
endif()

if(NOT JSONCPP_FOUND)
	message(STATUS "Using bundled JSONCPP library.")
	set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp)
	set(JSON_LIBRARY jsoncpp)
	add_subdirectory(lib/jsoncpp)
endif()
l com">with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef SHADER_HEADER #define SHADER_HEADER #include "irrlichttypes_extrabloated.h" #include "threads.h" #include <string> class IGameDef; /* shader.{h,cpp}: Shader handling stuff. */ /* Gets the path to a shader by first checking if the file name_of_shader/filename exists in shader_path and if not, using the data path. If not found, returns "". Utilizes a thread-safe cache. */ std::string getShaderPath(const std::string &name_of_shader, const std::string &filename); struct ShaderInfo { std::string name; video::E_MATERIAL_TYPE material; ShaderInfo(): name(""), material(video::EMT_SOLID) {} }; /* Setter of constants for shaders */ namespace irr { namespace video { class IMaterialRendererServices; } } class IShaderConstantSetter { public: virtual ~IShaderConstantSetter(){}; virtual void onSetConstants(video::IMaterialRendererServices *services, bool is_highlevel) = 0; }; /* ShaderSource creates and caches shaders. */ class IShaderSource { public: IShaderSource(){} virtual ~IShaderSource(){} virtual u32 getShaderId(const std::string &name){return 0;} virtual u32 getShaderIdDirect(const std::string &name){return 0;} virtual std::string getShaderName(u32 id){return "";} virtual ShaderInfo getShader(u32 id){return ShaderInfo();} virtual ShaderInfo getShader(const std::string &name){return ShaderInfo();} }; class IWritableShaderSource : public IShaderSource { public: IWritableShaderSource(){} virtual ~IWritableShaderSource(){} virtual u32 getShaderId(const std::string &name){return 0;} virtual u32 getShaderIdDirect(const std::string &name){return 0;} virtual std::string getShaderName(u32 id){return "";} virtual ShaderInfo getShader(u32 id){return ShaderInfo();} virtual ShaderInfo getShader(const std::string &name){return ShaderInfo();} virtual void processQueue()=0; virtual void insertSourceShader(const std::string &name_of_shader, const std::string &filename, const std::string &program)=0; virtual void rebuildShaders()=0; virtual void addGlobalConstantSetter(IShaderConstantSetter *setter)=0; }; IWritableShaderSource* createShaderSource(IrrlichtDevice *device); #endif