forked from https://github.com/rna88/irrnet which lacked a proper cmake config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

62 lines
1.9 KiB

# cmake for irrnet, ottona, 2022-04-27
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_REQUIRED ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lib")
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
#irrnet stuff
set(IRRNET_TARGET irrnet)
set(IRRNET_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/source")
set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
#enet stuff
set(ENET_TARGET enet)
set(ENET_DIR "${CMAKE_CURRENT_LIST_DIR}/enet")
set(ENET_INC_DIR ${ENET_DIR}/include)
add_subdirectory(${ENET_DIR} EXCLUDE_FROM_ALL)
#zlib stuff
set(ZLIB_TARGET zlibstatic)
set(ZLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
set(ZLIB_INC_DIR ${ZLIB_DIR})
set(ZLIB_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR}/zlib)
add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL)
#irrlicht stuff
if (NOT IRRLICHT_INC_DIR)
set(IRRLICHT_INC_DIR /usr/include/irrlicht)
endif()
project(irrnet)
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}/SPacket.cpp
)
if (OP_COMPILE_WITH_IRRLICHT)
message(STATUS "compile with native irrlicht")
add_definitions(-DCOMPILE_WITH_IRRLICHT)
message(STATUS "irrlicht dir: " ${IRRLICHT_INC_DIR})
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRLICHT_INC_DIR})
endif()
target_link_libraries(${IRRNET_TARGET} ${ZLIB_TARGET} ${ENET_TARGET})
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR})
message(STATUS "conf dir" ${ZLIB_CONF_DIR})
target_include_directories(${IRRNET_TARGET} PRIVATE ${ZLIB_CONF_DIR})