From efbcb8f65d35736cb7ecf6977237b47c07ae3292 Mon Sep 17 00:00:00 2001 From: Barbz Date: Sat, 23 Sep 2017 11:30:22 +0200 Subject: [PATCH] Fix CMake custom script (#658) * CMake - CMake now detects custom scripts in the Custom directory * CMake - CMake now detects the custom script headers * CMake - Added an example in the README on how to make a CMakeLists.txt for a custom script --- src/scripts/CMakeLists.txt | 2 +- src/scripts/Custom/README.md | 16 ++++++++++++++++ src/scripts/ScriptLoader.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 769bf26c5..27945f839 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -51,7 +51,7 @@ if(SCRIPTS) include(Pet/CMakeLists.txt) endif() -if(EXISTS "Custom/CMakeLists.txt") +if(EXISTS "${AC_SCRIPTS_DIR}/Custom/CMakeLists.txt") include(Custom/CMakeLists.txt) endif() diff --git a/src/scripts/Custom/README.md b/src/scripts/Custom/README.md index 8473a630f..7b9e83d4e 100644 --- a/src/scripts/Custom/README.md +++ b/src/scripts/Custom/README.md @@ -8,3 +8,19 @@ add scripts to project solution. BTW, **We strongly suggest you** to use our module system to create your custom powerful module instead of simple scripts. + + + + +----------------- +CMakeLists.txt example: + +set(scripts_STAT_SRCS + ${scripts_STAT_SRCS} + ${AC_SCRIPTS_DIR}/Custom/your_script.cpp + ${AC_SCRIPTS_DIR}/Custom/your_script.h +) + +AC_ADD_SCRIPT_LOADER("Custom" "ScriptLoader.h") + +message(" -> Prepared: My custom scripts") diff --git a/src/scripts/ScriptLoader.h b/src/scripts/ScriptLoader.h index b9a86d308..6ac5ef0fe 100644 --- a/src/scripts/ScriptLoader.h +++ b/src/scripts/ScriptLoader.h @@ -7,6 +7,7 @@ #ifndef SC_SCRIPTLOADER_H #define SC_SCRIPTLOADER_H +void AddCustomScripts(); void AddScripts(); void AddSpellScripts(); void AddCommandScripts();