cmake op for native irrlicht
This commit is contained in:
parent
fb0b8cee79
commit
8e5d81f913
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
option(OP_COMPILE_WITH_IRRLICHT "compile irrnet with native irrlicht datatypes" ON)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
@ -10,7 +12,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lib")
|
||||||
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||||
|
|
||||||
#irrnet stuff
|
#irrnet stuff
|
||||||
add_definitions(-DCOMPILE_WITH_IRRLICHT)
|
|
||||||
set(IRRNET_TARGET irrnet)
|
set(IRRNET_TARGET irrnet)
|
||||||
set(IRRNET_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/source")
|
set(IRRNET_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/source")
|
||||||
set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
|
set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||||
|
@ -27,15 +28,27 @@ set(ZLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
|
||||||
set(ZLIB_INC_DIR ${ZLIB_DIR}/include)
|
set(ZLIB_INC_DIR ${ZLIB_DIR}/include)
|
||||||
add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL)
|
add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
#irrlicht stuff
|
||||||
|
set(IRRLICHT_INC_DIR /usr/include/irrlicht)
|
||||||
|
|
||||||
|
|
||||||
project(irrnet)
|
project(irrnet)
|
||||||
|
|
||||||
include_directories(/usr/include/irrlicht)
|
|
||||||
|
|
||||||
add_library(${IRRNET_TARGET} STATIC
|
add_library(${IRRNET_TARGET} STATIC
|
||||||
|
${IRRNET_INC_DIR}/CEncryption.h
|
||||||
|
${IRRNET_INC_DIR}/CNetManager.h
|
||||||
|
${IRRNET_INC_DIR}/INetManager.h
|
||||||
|
${IRRNET_INC_DIR}/irrNet.h
|
||||||
|
${IRRNET_INC_DIR}/SPacket.h
|
||||||
${IRRNET_SRC_DIR}/CNetManager.cpp
|
${IRRNET_SRC_DIR}/CNetManager.cpp
|
||||||
${IRRNET_SRC_DIR}/SPacket.cpp
|
${IRRNET_SRC_DIR}/SPacket.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (OP_COMPILE_WITH_IRRLICHT)
|
||||||
|
message(STATUS "compile with native irrlicht")
|
||||||
|
add_definitions(-DCOMPILE_WITH_IRRLICHT)
|
||||||
|
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRLICHT_INC_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR})
|
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR})
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,10 @@ class SOutPacket
|
||||||
SOutPacket& operator << (const f64 data);
|
SOutPacket& operator << (const f64 data);
|
||||||
/// Adds data to the packet.
|
/// Adds data to the packet.
|
||||||
SOutPacket& operator << (const core::vector3df& data);
|
SOutPacket& operator << (const core::vector3df& data);
|
||||||
|
#ifdef COMPILE_WITH_IRRLICHT
|
||||||
/// Adds a quaternion to the packet
|
/// Adds a quaternion to the packet
|
||||||
SOutPacket& operator << (const core::quaternion&);
|
SOutPacket& operator << (const core::quaternion&);
|
||||||
|
#endif
|
||||||
/// Adds data to the packet.
|
/// Adds data to the packet.
|
||||||
SOutPacket& operator << (const c8* string);
|
SOutPacket& operator << (const c8* string);
|
||||||
/// Adds data to the packet.
|
/// Adds data to the packet.
|
||||||
|
@ -116,8 +118,10 @@ class SInPacket
|
||||||
void operator >> (f64& data);
|
void operator >> (f64& data);
|
||||||
/// Gets the next item in the packet based on the size of the variable.
|
/// Gets the next item in the packet based on the size of the variable.
|
||||||
void operator >> (core::vector3df& data);
|
void operator >> (core::vector3df& data);
|
||||||
|
#ifdef COMPILE_WITH_IRRLICHT
|
||||||
/// Gets the next item in the packet based on the size of the variable.
|
/// Gets the next item in the packet based on the size of the variable.
|
||||||
void operator >> (core::quaternion& data);
|
void operator >> (core::quaternion& data);
|
||||||
|
#endif
|
||||||
/// Gets the next item in the packet based on the size of the variable.
|
/// Gets the next item in the packet based on the size of the variable.
|
||||||
void operator >> (char* string);
|
void operator >> (char* string);
|
||||||
/// Gets the next item in the packet based on the size of the variable.
|
/// Gets the next item in the packet based on the size of the variable.
|
||||||
|
|
|
@ -106,13 +106,14 @@ SOutPacket& SOutPacket::operator << (const core::vector3df& data)
|
||||||
memcpy(buff.pointer() + buff.size() - 12, &data.X, 12);
|
memcpy(buff.pointer() + buff.size() - 12, &data.X, 12);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#ifdef COMPILE_WITH_IRRLICHT
|
||||||
SOutPacket& SOutPacket::operator << (const core::quaternion& data)
|
SOutPacket& SOutPacket::operator << (const core::quaternion& data)
|
||||||
{
|
{
|
||||||
enlargeBuffer(16);
|
enlargeBuffer(16);
|
||||||
memcpy(buff.pointer() + buff.size() - 16, &data.X, 16);
|
memcpy(buff.pointer() + buff.size() - 16, &data.X, 16);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SOutPacket& SOutPacket::operator << (const c8* string)
|
SOutPacket& SOutPacket::operator << (const c8* string)
|
||||||
{
|
{
|
||||||
|
@ -304,12 +305,13 @@ void SInPacket::operator >> (core::vector3df &data)
|
||||||
memcpy(&data.X,getData()+pos,12);
|
memcpy(&data.X,getData()+pos,12);
|
||||||
pos+=12;
|
pos+=12;
|
||||||
}
|
}
|
||||||
|
#ifdef COMPILE_WITH_IRRLICHT
|
||||||
void SInPacket::operator >> (core::quaternion &data)
|
void SInPacket::operator >> (core::quaternion &data)
|
||||||
{
|
{
|
||||||
memcpy(&data.X,getData()+pos,16);
|
memcpy(&data.X,getData()+pos,16);
|
||||||
pos+=16;
|
pos+=16;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void SInPacket::operator >> (char *string)
|
void SInPacket::operator >> (char *string)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue