My modifications made in
moduleconfig.h:
PHP Code:
#define MODULE_NAME "TestName"
#define MODULE_VERSION "0.0.1"
#define MODULE_AUTHOR "TestAAuthor"
#define MODULE_URL "TestUrl"
#define MODULE_LOGTAG "TestLogTag"
#define MODULE_LIBRARY "testlib"
#define MODULE_LIBCLASS ""
#define USE_METAMOD
#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
My file
main.cpp
PHP Code:
#include "sdk/amxxmodule.h"
void OnPluginsLoaded()
{
MF_Log("Hello World");
}
My file
CMakeLists.txt
PHP Code:
cmake_minimum_required(VERSION 3.18)
project(mylib)
set(TARGET_NAME ${PROJECT_NAME})
add_library(${TARGET_NAME} SHARED main.cpp sdk/amxxmodule.cpp)
set(DEP_DIR c:/msdk)
target_include_directories(${TARGET_NAME} PRIVATE
# https://github.com/alliedmodders/amxmodx.git
${DEP_DIR}/amxmodx/public
# https://github.com/alliedmodders/hlsdk.git
${DEP_DIR}/hlsdk/dlls
${DEP_DIR}/hlsdk/public
${DEP_DIR}/hlsdk/common
${DEP_DIR}/hlsdk/engine
# https://github.com/alliedmodders/metamod-hl1.git
${DEP_DIR}/metamod-hl1/metamod
sdk
)
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX "_amxx.dll")
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/lib)
I'm trying to compile on windows and it gives me this error when compiling:
Code:
[build] In file included from C:/cpp_proyects/cmakemodule/sdk/amxxmodule.cpp:2953:
[build] c:/msdk/hlsdk/dlls/cbase.h:57:34: error: expected constructor, destructor, or type conversion before '(' token
[build] 57 | #define CBASE_DLLEXPORT _declspec( dllexport )
[build] | ^
[build] c:/msdk/hlsdk/dlls/cbase.h:65:12: note: in expansion of macro 'CBASE_DLLEXPORT'
[build] 65 | extern "C" CBASE_DLLEXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
[build] | ^~~~~~~~~~~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:57:34: error: expected constructor, destructor, or type conversion before '(' token
[build] 57 | #define CBASE_DLLEXPORT _declspec( dllexport )
[build] | ^
[build] c:/msdk/hlsdk/dlls/cbase.h:66:12: note: in expansion of macro 'CBASE_DLLEXPORT'
[build] 66 | extern "C" CBASE_DLLEXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
[build] | ^~~~~~~~~~~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:57:36: error: 'dllexport' has not been declared
[build] 57 | #define CBASE_DLLEXPORT _declspec( dllexport )
[build] | ^~~~~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:63:16: note: in expansion of macro 'CBASE_DLLEXPORT'
[build] 63 | #define EXPORT CBASE_DLLEXPORT
[build] | ^~~~~~~~~~~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:241:14: note: in expansion of macro 'EXPORT'
[build] 241 | void EXPORT SUB_Remove( void );
[build] | ^~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:57:46: error: expected ';' at end of member declaration
[build] 57 | #define CBASE_DLLEXPORT _declspec( dllexport )
[build] | ^
[build] c:/msdk/hlsdk/dlls/cbase.h:63:16: note: in expansion of macro 'CBASE_DLLEXPORT'
[build] 63 | #define EXPORT CBASE_DLLEXPORT
[build] | ^~~~~~~~~~~~~~~
[build] c:/msdk/hlsdk/dlls/cbase.h:241:14: note: in expansion of macro 'EXPORT'
[build] 241 | void EXPORT SUB_Remove( void );
[build] | ^~~~~~
All the mistakes
https://pastebin.com/mpU31bah
For more details I have all the files here
https://github.com/Ndrs24/amxx-module-cmake