77 lines
2.6 KiB
CMake
77 lines
2.6 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
|
|
|
|
########################################################################################################################
|
|
## Define project
|
|
########################################################################################################################
|
|
project(
|
|
EnderalSE
|
|
VERSION 2.1.0
|
|
DESCRIPTION "Enderal SE DLL"
|
|
LANGUAGES CXX)
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
find_path(SIMPLEINI_INCLUDE_DIRS "ConvertUTF.c")
|
|
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.rc.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
|
@ONLY)
|
|
|
|
set(sources
|
|
src/Main.cpp
|
|
src/EventListener.cpp
|
|
src/Papyrus.cpp
|
|
src/Patches/TweenMenuPatch.cpp
|
|
src/Patches/HeroMenuPatch.cpp
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
|
|
|
source_group(
|
|
TREE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
FILES
|
|
${headers}
|
|
${sources})
|
|
|
|
########################################################################################################################
|
|
## Configure target DLL
|
|
########################################################################################################################
|
|
find_package(CommonLibSSE CONFIG REQUIRED)
|
|
|
|
add_commonlibsse_plugin(${PROJECT_NAME} SOURCES ${headers} ${sources})
|
|
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}")
|
|
|
|
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}>)
|
|
|
|
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/")
|