forked from nbcraft-org/nbcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
64 lines (53 loc) · 1.54 KB
/
CMakeLists.txt
File metadata and controls
64 lines (53 loc) · 1.54 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
cmake_minimum_required(VERSION 3.16.0)
project(reminecraftpe)
# Store Output In Top-Level Build Directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# WASM
if(EMSCRIPTEN)
function(add_compile_and_link_options)
add_compile_options(${ARGV})
add_link_options(${ARGV})
endfunction()
set(CMAKE_EXECUTABLE_SUFFIX ".js")
add_link_options("$<$<CONFIG:DEBUG>:-gsource-map>")
add_link_options(-Wno-pthreads-mem-growth -sALLOW_MEMORY_GROWTH=1)
endif()
# Clang
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-inconsistent-missing-override -Wno-enum-compare-switch -Wno-register)
endif()
# Windows Linking
if(WIN32)
add_link_options(
-static-libgcc
-static-libstdc++
)
endif()
# HaikuOS Network Library
if(HAIKU)
link_libraries(network)
endif()
# Threading
if(EMSCRIPTEN)
add_compile_and_link_options(-pthread)
else()
find_package(Threads)
link_libraries(Threads::Threads)
endif()
# Android Logging
if(ANDROID)
link_libraries(log)
endif()
# stb_image And Other Libraries
add_subdirectory(thirdparty/stb_image EXCLUDE_FROM_ALL)
# Load Common Code
add_subdirectory(source)
# Load Platform-Specific Code
add_subdirectory(platforms)
# Assets
if(EMSCRIPTEN)
target_link_options(reminecraftpe PRIVATE --use-preload-plugins --preload-file "${CMAKE_CURRENT_SOURCE_DIR}/game@/")
else()
file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/game/assets" "${CMAKE_CURRENT_BINARY_DIR}/assets" SYMBOLIC)
endif()