diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..02a9dbc --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + + +# Others +.vs +build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..02d091d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "intercept"] + path = intercept + url = https://github.com/intercept/intercept.git \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..960d5cb --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required (VERSION 3.6) + +#----Make changes here + +#This is your project name. And also the filename of the resulting plugin. +project (template-plugin) + +#This setting enables the use of the engine string type instead of converting to std::string. +#Enabling this results in better performance when handling strings to SQF commands. +option(USE_ENGINE_TYPES "USE_ENGINE_TYPES" OFF) + +#----Don't change anything below this line + +option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) +set(INTERCEPT_LINK_TYPE "static") + +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") + set( USE_64BIT_BUILD ON) +endif() + +message("GENERATOR USED: '${CMAKE_GENERATOR}'") +message("COMPILER USED: '${CMAKE_CXX_COMPILER_ID}'") + +set(CMAKE_CL_64 ${USE_64BIT_BUILD}) + +if(USE_64BIT_BUILD) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win64/") +else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win32/") +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) + +add_subdirectory(src) \ No newline at end of file diff --git a/README.md b/README.md index 0623aa7..4bb2985 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# intercept-plugin-template -A template plugin for Intercept +This is the Intercept plugin template project. diff --git a/addons/main/config.cpp b/addons/main/config.cpp new file mode 100644 index 0000000..6e46b7d --- /dev/null +++ b/addons/main/config.cpp @@ -0,0 +1,22 @@ +class CfgPatches { + class intercept_template_plugin { //Change this + name = "Intercept Template Plugin"; //Change this + units[] = {}; + weapons[] = {}; + requiredVersion = 1.82; + requiredAddons[] = {"intercept_core"}; + author = "Dedmen"; //Change this + authors[] = {"Dedmen"}; //Change this + url = "https://github.com/intercept/intercept-plugin-template"; //Change this + version = "1.0"; + versionStr = "1.0"; + versionAr[] = {1,0}; + }; +}; +class Intercept { + class Dedmen { //Change this. It's either the name of your project if you have more than one plugin. Or just your name. + class template_plugin { //Change this. + pluginName = "Intercept Template Plugin"; //Change this. + }; + }; +}; \ No newline at end of file diff --git a/intercept b/intercept new file mode 160000 index 0000000..f283e2f --- /dev/null +++ b/intercept @@ -0,0 +1 @@ +Subproject commit f283e2fd3ce1024e496c6c17eb27f81693f05ca8 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..f686ce7 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required (VERSION 3.0) + + +file(GLOB_RECURSE INTERCEPT_PLUGIN_SOURCES *.h *.hpp *.c *.cpp) +SOURCE_GROUP("src" FILES ${INTERCEPT_PLUGIN_SOURCES}) + +#If you want to split your source files into different directories you can do so here + +#The SOURCE_GROUP string is the directory it will display as inside your visual studio. +#Here is a example of a "utilities" subdirectory. + +#file(GLOB INTERCEPT_plugin_utilities_SOURCES "utilities/*.cpp" "utilities/*.hpp" "utilities/*.h") +#SOURCE_GROUP("src/utilities" FILES ${INTERCEPT_plugin_utilities_SOURCES}) + +#----Don't change anything below this line + + +#include the Intercept headers from the submodule +set(INTERCEPT_CLIENT_PATH "${CMAKE_SOURCE_DIR}/intercept/src/client") + +set(INTERCEPT_INCLUDE_PATH "${INTERCEPT_CLIENT_PATH}/headers" "${INTERCEPT_CLIENT_PATH}/headers/shared" "${INTERCEPT_CLIENT_PATH}/headers/client/" "${INTERCEPT_CLIENT_PATH}/headers/client/sqf") + +if(USE_64BIT_BUILD) + set(INTERCEPT_PLUGIN_NAME "${CMAKE_PROJECT_NAME}_x64") +else() + set(INTERCEPT_PLUGIN_NAME "${CMAKE_PROJECT_NAME}") +endif() + +add_definitions(/DINTERCEPT_NO_THREAD_SAFETY) + +if(USE_ENGINE_TYPES) + add_definitions(/DINTERCEPT_SQF_STRTYPE_RSTRING) +endif() + +file(GLOB INTERCEPT_HOST_SOURCES "${INTERCEPT_CLIENT_PATH}/intercept/client/*.cpp" "${INTERCEPT_CLIENT_PATH}/intercept/client/sqf/*.cpp" "${INTERCEPT_CLIENT_PATH}/intercept/shared/*.cpp") +SOURCE_GROUP("intercept" FILES ${INTERCEPT_HOST_SOURCES}) + +add_library( ${INTERCEPT_PLUGIN_NAME} SHARED ${INTERCEPT_PLUGIN_SOURCES} ${INTERCEPT_HOST_SOURCES}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${INTERCEPT_INCLUDE_PATH}) + +set_target_properties(${INTERCEPT_PLUGIN_NAME} PROPERTIES PREFIX "") +set_target_properties(${INTERCEPT_PLUGIN_NAME} PROPERTIES FOLDER "${CMAKE_PROJECT_NAME}") + +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "-std=c++1z -O2 -s -fPIC -fpermissive -static-libgcc -static-libstdc++")#-march=i686 -m32 + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_SHARED_LINKER_FLAGS "-static -static-libgcc -static-libstdc++") +else() + set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 /MP /EHsc") + set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob1 /EHsc /MP") #with debug info + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/OPT:REF /DEBUG:FULL") +endif() \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..2ed7a0e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,18 @@ +#include + + +int intercept::api_version() { //This is required for the plugin to work. + return 1; +} + +void intercept::register_interfaces() { + +} + +void intercept::pre_start() { + +} + +void intercept::pre_init() { + intercept::sqf::system_chat("The Intercept template plugin is running!"); +} \ No newline at end of file