Skip to content

Commit 381605f

Browse files
committed
Initial commit
1 parent 94a1654 commit 381605f

File tree

8 files changed

+176
-2
lines changed

8 files changed

+176
-2
lines changed

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
35+
# Others
36+
.vs
37+
build

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "intercept"]
2+
path = intercept
3+
url = https://github.com/intercept/intercept.git

CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
cmake_minimum_required (VERSION 3.6)
2+
3+
#----Make changes here
4+
5+
#This is your project name. And also the filename of the resulting plugin.
6+
project (template-plugin)
7+
8+
#This setting enables the use of the engine string type instead of converting to std::string.
9+
#Enabling this results in better performance when handling strings to SQF commands.
10+
option(USE_ENGINE_TYPES "USE_ENGINE_TYPES" OFF)
11+
12+
#----Don't change anything below this line
13+
14+
option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF)
15+
set(INTERCEPT_LINK_TYPE "static")
16+
17+
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
18+
set( USE_64BIT_BUILD ON)
19+
endif()
20+
21+
message("GENERATOR USED: '${CMAKE_GENERATOR}'")
22+
message("COMPILER USED: '${CMAKE_CXX_COMPILER_ID}'")
23+
24+
set(CMAKE_CL_64 ${USE_64BIT_BUILD})
25+
26+
if(USE_64BIT_BUILD)
27+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win64/")
28+
else()
29+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/win32/")
30+
endif()
31+
32+
set(CMAKE_CXX_STANDARD 17)
33+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
34+
set(CMAKE_CXX_EXTENSIONS OFF)
35+
36+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
37+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
38+
39+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
40+
41+
add_subdirectory(src)

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# intercept-plugin-template
2-
A template plugin for Intercept
1+
This is the Intercept plugin template project.

addons/main/config.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class CfgPatches {
2+
class intercept_template_plugin { //Change this
3+
name = "Intercept Template Plugin"; //Change this
4+
units[] = {};
5+
weapons[] = {};
6+
requiredVersion = 1.82;
7+
requiredAddons[] = {"intercept_core"};
8+
author = "Dedmen"; //Change this
9+
authors[] = {"Dedmen"}; //Change this
10+
url = "https://github.com/intercept/intercept-plugin-template"; //Change this
11+
version = "1.0";
12+
versionStr = "1.0";
13+
versionAr[] = {1,0};
14+
};
15+
};
16+
class Intercept {
17+
class Dedmen { //Change this. It's either the name of your project if you have more than one plugin. Or just your name.
18+
class template_plugin { //Change this.
19+
pluginName = "Intercept Template Plugin"; //Change this.
20+
};
21+
};
22+
};

intercept

Submodule intercept added at f283e2f

src/CMakeLists.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
cmake_minimum_required (VERSION 3.0)
2+
3+
4+
file(GLOB_RECURSE INTERCEPT_PLUGIN_SOURCES *.h *.hpp *.c *.cpp)
5+
SOURCE_GROUP("src" FILES ${INTERCEPT_PLUGIN_SOURCES})
6+
7+
#If you want to split your source files into different directories you can do so here
8+
9+
#The SOURCE_GROUP string is the directory it will display as inside your visual studio.
10+
#Here is a example of a "utilities" subdirectory.
11+
12+
#file(GLOB INTERCEPT_plugin_utilities_SOURCES "utilities/*.cpp" "utilities/*.hpp" "utilities/*.h")
13+
#SOURCE_GROUP("src/utilities" FILES ${INTERCEPT_plugin_utilities_SOURCES})
14+
15+
#----Don't change anything below this line
16+
17+
18+
#include the Intercept headers from the submodule
19+
set(INTERCEPT_CLIENT_PATH "${CMAKE_SOURCE_DIR}/intercept/src/client")
20+
21+
set(INTERCEPT_INCLUDE_PATH "${INTERCEPT_CLIENT_PATH}/headers" "${INTERCEPT_CLIENT_PATH}/headers/shared" "${INTERCEPT_CLIENT_PATH}/headers/client/" "${INTERCEPT_CLIENT_PATH}/headers/client/sqf")
22+
23+
if(USE_64BIT_BUILD)
24+
set(INTERCEPT_PLUGIN_NAME "${CMAKE_PROJECT_NAME}_x64")
25+
else()
26+
set(INTERCEPT_PLUGIN_NAME "${CMAKE_PROJECT_NAME}")
27+
endif()
28+
29+
add_definitions(/DINTERCEPT_NO_THREAD_SAFETY)
30+
31+
if(USE_ENGINE_TYPES)
32+
add_definitions(/DINTERCEPT_SQF_STRTYPE_RSTRING)
33+
endif()
34+
35+
file(GLOB INTERCEPT_HOST_SOURCES "${INTERCEPT_CLIENT_PATH}/intercept/client/*.cpp" "${INTERCEPT_CLIENT_PATH}/intercept/client/sqf/*.cpp" "${INTERCEPT_CLIENT_PATH}/intercept/shared/*.cpp")
36+
SOURCE_GROUP("intercept" FILES ${INTERCEPT_HOST_SOURCES})
37+
38+
add_library( ${INTERCEPT_PLUGIN_NAME} SHARED ${INTERCEPT_PLUGIN_SOURCES} ${INTERCEPT_HOST_SOURCES})
39+
40+
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${INTERCEPT_INCLUDE_PATH})
41+
42+
set_target_properties(${INTERCEPT_PLUGIN_NAME} PROPERTIES PREFIX "")
43+
set_target_properties(${INTERCEPT_PLUGIN_NAME} PROPERTIES FOLDER "${CMAKE_PROJECT_NAME}")
44+
45+
if(CMAKE_COMPILER_IS_GNUCXX)
46+
set(CMAKE_CXX_FLAGS "-std=c++1z -O2 -s -fPIC -fpermissive -static-libgcc -static-libstdc++")#-march=i686 -m32
47+
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
48+
set(CMAKE_SHARED_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
49+
else()
50+
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 /MP /EHsc")
51+
set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob1 /EHsc /MP") #with debug info
52+
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/OPT:REF /DEBUG:FULL")
53+
endif()

src/main.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <intercept.hpp>
2+
3+
4+
int intercept::api_version() { //This is required for the plugin to work.
5+
return 1;
6+
}
7+
8+
void intercept::register_interfaces() {
9+
10+
}
11+
12+
void intercept::pre_start() {
13+
14+
}
15+
16+
void intercept::pre_init() {
17+
intercept::sqf::system_chat("The Intercept template plugin is running!");
18+
}

0 commit comments

Comments
 (0)