forked from SLikeSoft/SLikeNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
65 lines (53 loc) · 1.87 KB
/
CMakeLists.txt
File metadata and controls
65 lines (53 loc) · 1.87 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# MafiaNet - Cross-platform network engine for multiplayer games
#
# Originally based on RakNet 4.082 and MafiaNet
# Copyright (c) 2024, MafiaHub
# Licensed under MIT-style license
cmake_minimum_required(VERSION 3.21)
project(MafiaNet
VERSION 0.2.0
DESCRIPTION "Cross-platform network engine for multiplayer games"
HOMEPAGE_URL "https://github.com/mafiahub/MafiaNet"
LANGUAGES C CXX
)
# Prevent in-source builds
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed. Create a build directory and run cmake from there.")
endif()
# C++17 standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Use folders in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Options
option(MAFIANET_BUILD_SHARED "Build shared library" ON)
option(MAFIANET_BUILD_STATIC "Build static library" ON)
option(MAFIANET_BUILD_SAMPLES "Build sample applications" OFF)
option(MAFIANET_BUILD_TESTS "Build test suite" OFF)
# Ensure at least one library type is built
if(NOT MAFIANET_BUILD_SHARED AND NOT MAFIANET_BUILD_STATIC)
message(FATAL_ERROR "At least one of MAFIANET_BUILD_SHARED or MAFIANET_BUILD_STATIC must be ON")
endif()
# Dependencies
find_package(OpenSSL 3.0.0 REQUIRED)
find_package(Threads REQUIRED)
# Include helpers
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(MafiaNetHelpers)
# Platform-specific settings
if(WIN32)
add_compile_definitions(
_CRT_SECURE_NO_DEPRECATE
_CRT_NONSTDC_NO_DEPRECATE
)
endif()
# Library subdirectory
add_subdirectory(Source)
# Samples and extensions
if(MAFIANET_BUILD_SAMPLES)
# Fetch dependencies (bzip2, miniupnpc, opus, rnnoise)
include(FetchDependencies)
add_subdirectory(Samples)
add_subdirectory(DependentExtensions)
endif()