Skip to content

Commit

Permalink
feat: add endstone_ prefix to compiled lib
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jul 28, 2024
1 parent 29e2042 commit 7a7600c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
with:
name: example-plugin-windows
path: |
./build/*_plugin.dll
./build/*_plugin.pdb
./build/endstone_*.dll
./build/endstone_*.pdb
build_linux:
name: Build on Ubuntu
Expand Down Expand Up @@ -74,4 +74,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: example-plugin-linux
path: ./build/*_plugin.so
path: ./build/endstone_*.so
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(endstone_cpp_example CXX)
project(cpp_example CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -16,10 +16,9 @@ FetchContent_MakeAvailable(endstone)
add_library(${PROJECT_NAME} SHARED src/example_plugin.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_link_libraries(${PROJECT_NAME} PRIVATE endstone::headers)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "endstone_")

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(${PROJECT_NAME} PRIVATE _ITERATOR_DEBUG_LEVEL=0)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${PROJECT_NAME} PRIVATE -stdlib=libc++ -fPIC)
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++ libc++.a libc++abi.a)
endif ()
2 changes: 1 addition & 1 deletion src/example_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "example_plugin.h"

// The ENDSTONE_PLUGIN macro defines the metadata for the plugin.
ENDSTONE_PLUGIN(/*name=*/"endstone_cpp_example", /*version=*/"0.4.0", /*main_class=*/ExamplePlugin)
ENDSTONE_PLUGIN(/*name=*/"cpp_example", /*version=*/"0.4.0", /*main_class=*/ExamplePlugin)
{
prefix = "CppExamplePlugin";
description = "C++ example plugin for Endstone servers";
Expand Down

0 comments on commit 7a7600c

Please sign in to comment.