generated from AmethystAPI/Amethyst-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
57 lines (45 loc) · 2.13 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
# Mod Options
project(Join-Latest CXX ASM_NASM)
set(MOD_VERSION "0.1.0")
set(MOD_AUTHOR "Tom16")
# Amethyst Minecraft Folder
set(AmethystFolder "$ENV{localappdata}/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/amethyst/")
# Configure to build within the Amethyst Folder
configure_file(mod.json.in "${AmethystFolder}/mods/${PROJECT_NAME}@${MOD_VERSION}/mod.json" @ONLY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${AmethystFolder}/mods/${PROJECT_NAME}@${MOD_VERSION}")
# Define only RelWithDebInfo as the available build configuration
set(CMAKE_CXX_STANDARD 23)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" CACHE STRING "Build configurations" FORCE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: RelWithDebInfo" FORCE)
# Project Files
file(GLOB_RECURSE ${PROJECT_NAME}_All
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.c
${CMAKE_CURRENT_SOURCE_DIR}/src/*.asm
${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_All})
# Pass mod options to the source code
target_compile_definitions(${PROJECT_NAME} PRIVATE MOD_VERSION="${MOD_VERSION}")
target_compile_definitions(${PROJECT_NAME} PRIVATE MOD_AUTHOR="${MOD_AUTHOR}")
target_compile_definitions(${PROJECT_NAME} PRIVATE MOD_NAME="${PROJECT_NAME}")
# Link libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
AmethystAPI
libhat
$ENV{amethyst_src}/AmethystAPI/lib/fmt.lib
)
# Enable multi processor compilation for C++, to make it go brrrrrr
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:/MP>
)
# EnTT Config Options
target_compile_definitions(${PROJECT_NAME} PUBLIC ENTT_PACKED_PAGE=128)
# Get the AmethystAPI Lib
add_subdirectory("$ENV{amethyst_src}/AmethystAPI" "build")
# Organise files in solution explorer
target_include_directories(${PROJECT_NAME} PRIVATE src)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${${PROJECT_NAME}_All})