2022-07-31 18:55:11 +00:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
## Define project
|
|
|
|
########################################################################################################################
|
|
|
|
project(
|
|
|
|
EnderalSE
|
2024-08-07 18:47:01 +00:00
|
|
|
VERSION 2.1.3
|
2022-07-31 18:55:11 +00:00
|
|
|
DESCRIPTION "Enderal SE DLL"
|
|
|
|
LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.rc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
|
|
|
@ONLY)
|
2024-07-27 14:30:58 +00:00
|
|
|
|
|
|
|
#include(GNUInstallDirs)
|
|
|
|
find_path(SIMPLEINI_INCLUDE_DIRS "ConvertUTF.c")
|
2022-07-31 18:55:11 +00:00
|
|
|
|
2024-07-27 14:30:58 +00:00
|
|
|
file(
|
|
|
|
GLOB_RECURSE
|
|
|
|
sources
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
|
|
|
)
|
2022-07-31 18:55:11 +00:00
|
|
|
|
|
|
|
source_group(
|
|
|
|
TREE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
FILES
|
|
|
|
${headers}
|
|
|
|
${sources})
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
## Configure target DLL
|
|
|
|
########################################################################################################################
|
2024-07-27 14:30:58 +00:00
|
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
|
|
CommonLibNG
|
|
|
|
GIT_REPOSITORY https://github.com/alandtse/CommonLibVR.git
|
2024-07-29 13:27:01 +00:00
|
|
|
GIT_TAG 5e5417e3585c9434295e919bdda27737244e9c5a
|
2024-07-27 14:30:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ENABLE_SKYRIM_SE ON CACHE BOOL " " FORCE)
|
|
|
|
set(ENABLE_SKYRIM_AE ON CACHE BOOL " " FORCE)
|
|
|
|
set(ENABLE_SKYRIM_VR ON CACHE BOOL " " FORCE)
|
|
|
|
set(BUILD_TESTS OFF CACHE BOOL " " FORCE)
|
|
|
|
|
2024-07-29 13:27:01 +00:00
|
|
|
FetchContent_MakeAvailable(CommonLibNG)
|
2024-07-27 14:30:58 +00:00
|
|
|
|
|
|
|
# Use a local copy instead
|
2024-07-29 13:27:01 +00:00
|
|
|
#add_subdirectory("d:/Git/CommonLibVR/" ${CMAKE_BINARY_DIR}/_deps/clib-build)
|
2024-07-27 14:30:58 +00:00
|
|
|
|
|
|
|
#find_package(CommonLibSSE CONFIG REQUIRED)
|
|
|
|
|
|
|
|
get_target_property(COMMONLIB_SRC_DIR CommonLibSSE SOURCE_DIR)
|
|
|
|
|
|
|
|
include(${COMMONLIB_SRC_DIR}/cmake/CommonLibSSE.cmake)
|
2022-07-31 18:55:11 +00:00
|
|
|
|
|
|
|
add_commonlibsse_plugin(${PROJECT_NAME} SOURCES ${headers} ${sources})
|
2024-07-27 14:30:58 +00:00
|
|
|
|
2022-07-31 18:55:11 +00:00
|
|
|
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}")
|
2024-07-27 14:30:58 +00:00
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC CommonLibSSE::CommonLibSSE)
|
|
|
|
|
2022-07-31 18:55:11 +00:00
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PRIVATE
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
|
|
|
|
$<INSTALL_INTERFACE:src>
|
|
|
|
${SIMPLEINI_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
|
|
|
|
2024-07-27 14:30:58 +00:00
|
|
|
find_package(spdlog CONFIG REQUIRED)
|
|
|
|
|
|
|
|
target_link_libraries(
|
|
|
|
"${PROJECT_NAME}"
|
|
|
|
PUBLIC
|
|
|
|
spdlog::spdlog
|
|
|
|
Version.lib
|
|
|
|
)
|
|
|
|
|
2022-07-31 18:55:11 +00:00
|
|
|
target_precompile_headers(${PROJECT_NAME}
|
|
|
|
PRIVATE
|
|
|
|
src/PCH.h)
|
|
|
|
|
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
## Automatic plugin deployment
|
|
|
|
########################################################################################################################
|
|
|
|
|
|
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/../../SKSE/Plugins/")
|
|
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> "${CMAKE_CURRENT_SOURCE_DIR}/../../SKSE/Plugins/")
|
2024-07-27 14:30:58 +00:00
|
|
|
|