CMAKE_MINIMUM_REQUIRED(VERSION 3.2)

SET(common_sources
	base_packet.cpp
	classes.cpp
	cli/eqemu_command_handler.cpp
	compression.cpp
	condition.cpp
	crash.cpp
	crc16.cpp
	crc32.cpp
	database.cpp
	database_conversions.cpp
	database_instances.cpp
	dbcore.cpp
	deity.cpp
	emu_constants.cpp
	emu_limits.cpp
	emu_opcodes.cpp
	emu_versions.cpp
	eqdb.cpp
	eqdb_res.cpp
	eqemu_exception.cpp
	eqemu_config.cpp
	eqemu_logsys.cpp
	eq_limits.cpp
	eq_packet.cpp
	eq_stream_ident.cpp
	eq_stream_proxy.cpp
	eqtime.cpp
	event_sub.cpp
	extprofile.cpp
	faction.cpp
	guild_base.cpp
	guilds.cpp
	inventory_profile.cpp
	inventory_slot.cpp
	ipc_mutex.cpp
	ip_util.cpp
	item_data.cpp
	item_instance.cpp
	json_config.cpp
	light_source.cpp
	md5.cpp
	memory_buffer.cpp
	memory_mapped_file.cpp
	misc.cpp
	misc_functions.cpp
	mutex.cpp
	mysql_request_result.cpp
	mysql_request_row.cpp
	opcode_map.cpp
	opcodemgr.cpp
	packet_dump.cpp
	packet_dump_file.cpp
	packet_functions.cpp
	perl_eqdb.cpp
	perl_eqdb_res.cpp
	proc_launcher.cpp
	profanity_manager.cpp
	ptimer.cpp
	races.cpp
	rdtsc.cpp
	rulesys.cpp
	say_link.cpp
	serialize_buffer.cpp
	serverinfo.cpp
	shareddb.cpp
	skills.cpp
	spdat.cpp
	string_util.cpp
	struct_strategy.cpp
	textures.cpp
	timer.cpp
	unix.cpp
	platform.cpp
	json/jsoncpp.cpp
	net/console_server.cpp
	net/console_server_connection.cpp
	net/crc32.cpp
	net/daybreak_connection.cpp
	net/eqstream.cpp
	net/packet.cpp
	net/servertalk_client_connection.cpp
	net/servertalk_legacy_client_connection.cpp
	net/servertalk_server.cpp
	net/servertalk_server_connection.cpp
	net/tcp_connection.cpp
	net/tcp_server.cpp
	net/websocket_server.cpp
	net/websocket_server_connection.cpp
	patches/patches.cpp
	patches/sod.cpp
	patches/sod_limits.cpp
	patches/sof.cpp
	patches/sof_limits.cpp
	patches/rof.cpp
	patches/rof_limits.cpp
	patches/rof2.cpp
	patches/rof2_limits.cpp
	patches/titanium.cpp
	patches/titanium_limits.cpp
	patches/uf.cpp
	patches/uf_limits.cpp
	StackWalker/StackWalker.cpp
	util/directory.cpp
	util/uuid.cpp)

SET(common_headers
	any.h
	base_packet.h
	base_data.h
	bodytypes.h
	classes.h
	compression.h
	condition.h
	crash.h
	crc16.h
	crc32.h
	cli/argh.h
	cli/eqemu_command_handler.h
	cli/terminal_color.hpp
	data_verification.h
	database.h
	dbcore.h
	deity.h
	emu_constants.h
	emu_limits.h
	emu_opcodes.h
	emu_oplist.h
	emu_versions.h
	eq_constants.h
	eq_packet_structs.h
	eqdb.h
	eqdb_res.h
	eqemu_exception.h
	eqemu_config.h
	eqemu_config_elements.h
	eqemu_logsys.h
	eqemu_logsys_log_aliases.h
	eq_limits.h
	eq_packet.h
	eq_stream_ident.h
	eq_stream_intf.h
	eq_stream_locator.h
	eq_stream_proxy.h
	eqtime.h
	errmsg.h
	event_sub.h
	extprofile.h
	faction.h
	features.h
	fixed_memory_hash_set.h
	fixed_memory_variable_hash_set.h
	global_define.h
	guild_base.h
	guilds.h
	http/httplib.h
	inventory_profile.h
	inventory_slot.h
	ipc_mutex.h
	ip_util.h
	item_data.h
	item_fieldlist.h
	item_instance.h
	json_config.h
	languages.h
	light_source.h
	linked_list.h
	loottable.h
	mail_oplist.h
	md5.h
	memory_buffer.h
	memory_mapped_file.h
	misc.h
	misc_functions.h
	mutex.h
	mysql_request_result.h
	mysql_request_row.h
	op_codes.h
	opcode_dispatch.h
	opcodemgr.h
	packet_dump.h
	packet_dump_file.h
	packet_functions.h
	platform.h
	proc_launcher.h
	profanity_manager.h
	profiler.h
	ptimer.h
	queue.h
	races.h
	random.h
	rdtsc.h
	rulesys.h
	ruletypes.h
	say_link.h
	seperator.h
	serialize_buffer.h
	serverinfo.h
	servertalk.h
	shareddb.h
	skills.h
	spdat.h
    string_util.h
	struct_strategy.h
	textures.h
	timer.h
	types.h
	unix.h
	useperl.h
	version.h
	zone_numbers.h
	event/event_loop.h
	event/task.h
	event/timer.h
	json/json.h
	json/json-forwards.h
	net/console_server.h
	net/console_server_connection.h
	net/crc32.h
	net/daybreak_connection.h
	net/daybreak_structs.h
	net/dns.h
	net/endian.h
	net/eqstream.h
	net/packet.h
	net/servertalk_client_connection.h
	net/servertalk_legacy_client_connection.h
	net/servertalk_common.h
	net/servertalk_server.h
	net/servertalk_server_connection.h
	net/tcp_connection.h
	net/tcp_server.h
	net/websocket_server.h
	net/websocket_server_connection.h
	patches/patches.h
	patches/sod.h
	patches/sod_limits.h
	patches/sod_ops.h
	patches/sod_structs.h
	patches/sof.h
	patches/sof_limits.h
	patches/sof_ops.h
	patches/sof_structs.h
	patches/ss_declare.h
	patches/ss_define.h
	patches/ss_register.h
	patches/rof.h
	patches/rof_limits.h
	patches/rof_ops.h
	patches/rof_structs.h
	patches/rof2.h
	patches/rof2_limits.h
	patches/rof2_ops.h
	patches/rof2_structs.h
	patches/titanium.h
	patches/titanium_limits.h
	patches/titanium_ops.h
	patches/titanium_structs.h
	patches/uf.h
	patches/uf_limits.h
	patches/uf_ops.h
	patches/uf_structs.h
	StackWalker/StackWalker.h
	util/memory_stream.h
	util/directory.h
	util/uuid.h)

SOURCE_GROUP(Event FILES
	event/event_loop.h
	event/timer.h
	event/task.h
)

SOURCE_GROUP(Json FILES
	json/json.h
	json/jsoncpp.cpp
	json/json-forwards.h
)

SOURCE_GROUP(Net FILES
	net/console_server.cpp
	net/console_server.h
	net/console_server_connection.cpp
	net/console_server_connection.h
	net/crc32.cpp
	net/crc32.h
	net/daybreak_connection.cpp
	net/daybreak_connection.h
	net/daybreak_structs.h
	net/dns.h
	net/endian.h
	net/eqmq.cpp
	net/eqmq.h
	net/eqstream.cpp
	net/eqstream.h
	net/packet.cpp
	net/packet.h
	net/servertalk_client_connection.cpp
	net/servertalk_client_connection.h
	net/servertalk_legacy_client_connection.cpp
	net/servertalk_legacy_client_connection.h
	net/servertalk_common.h
	net/servertalk_server.cpp
	net/servertalk_server.h
	net/servertalk_server_connection.cpp
	net/servertalk_server_connection.h
	net/tcp_connection.cpp
	net/tcp_connection.h
	net/tcp_server.cpp
	net/tcp_server.h
	net/websocket_server.cpp
	net/websocket_server.h
	net/websocket_server_connection.cpp
	net/websocket_server_connection.h
)

SOURCE_GROUP(Patches FILES
	patches/patches.h
	patches/sod.h
	patches/sod_limits.h
	patches/sod_ops.h
	patches/sod_structs.h
	patches/sof.h
	patches/sof_limits.h
	patches/sof_ops.h
	patches/sof_structs.h
	patches/ss_declare.h
	patches/ss_define.h
	patches/ss_register.h
	patches/rof.h
	patches/rof_limits.h
	patches/rof_ops.h
	patches/rof_structs.h
	patches/rof2.h
	patches/rof2_limits.h
	patches/rof2_ops.h
	patches/rof2_structs.h
	patches/titanium.h
	patches/titanium_limits.h
	patches/titanium_ops.h
	patches/titanium_structs.h
	patches/uf.h
	patches/uf_limits.h
	patches/uf_ops.h
	patches/uf_structs.h
	patches/patches.cpp
	patches/sod.cpp
	patches/sod_limits.cpp
	patches/sof.cpp
	patches/sof_limits.cpp
	patches/rof.cpp
	patches/rof_limits.cpp
	patches/rof2.cpp
	patches/rof2_limits.cpp
	patches/titanium.cpp
	patches/titanium_limits.cpp
	patches/uf.cpp
	patches/uf_limits.cpp
)

SOURCE_GROUP(StackWalker FILES
	StackWalker/StackWalker.h
	StackWalker/StackWalker.cpp
)

SOURCE_GROUP(Util FILES
	util/memory_stream.h
	util/directory.cpp
	util/directory.h
	util/uuid.cpp
	util/uuid.h
)

INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)

ADD_LIBRARY(common ${common_sources} ${common_headers})

IF(UNIX)
	SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
	SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp"  "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
ENDIF(UNIX)


SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
