Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
feature: to new version v2.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Antares0982 committed Jan 23, 2023
1 parent dae54c9 commit d87d81e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
build/
cmake-build-*/
src/
include/
3rd_include/
.vscode/
.clang-format

Expand Down
30 changes: 17 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif ()
if (MSVC)
message("MSVC detected")
# 以utf8编译, for msvc; EHa参数启用标准 C++ stack unwinding; 启用多线程编译;禁止无返回值的函数;禁用两个与dll export相关的warning
add_compile_options(/W4 /utf-8 /EHa /std:c++17 /MP /we4715 /wd4251 /wd4275 /Zc:__cplusplus)
add_compile_options(/W4 /EHa /std:c++17 /MP /we4715 /wd4251 /wd4275 /Zc:__cplusplus)
else ()
# 禁止无返回值的函数
add_compile_options(-Wall -Werror=return-type)
Expand All @@ -25,23 +25,24 @@ endif ()
add_compile_definitions(JSON_HAS_CPP_17 JSON_MultipleHeaders=ON)

if (MSVC)
add_compile_options(/utf-8 /EHa /MP)
add_compile_options(/EHs /MP)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Debug)
endif ()

set(SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)

file(GLOB MIRAICP_CPP_PATH ${SRC_PATH}/include/*.cpp)
file(GLOB MIRAICP_CPP_PATH ${SRC_PATH}/sdk/*.cpp)
file(GLOB MIRAICP_COMMON_PATH ${SRC_PATH}/common/*.cpp)
file(GLOB LOADER_PATH ${SRC_PATH}/libloader/*.cpp)
file(GLOB_RECURSE PLUGIN_PATH ${SRC_PATH}/plugin/*.cpp)
file(GLOB INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include)
set(
3RD_PATH
${SRC_PATH}/3rd_include/
${SRC_PATH}/3rd_include/json
${SRC_PATH}/3rd_include/json/nlohmann
${SRC_PATH}/3rd_include/utf8
${SRC_PATH}/3rd_include/utf8/utf8
${CMAKE_CURRENT_SOURCE_DIR}/3rd_include/
${CMAKE_CURRENT_SOURCE_DIR}/3rd_include/json
${CMAKE_CURRENT_SOURCE_DIR}/3rd_include/json/nlohmann
${CMAKE_CURRENT_SOURCE_DIR}/3rd_include/utf8
${CMAKE_CURRENT_SOURCE_DIR}/3rd_include/utf8/utf8
)

# -- jni required --
Expand Down Expand Up @@ -75,8 +76,8 @@ set_target_properties(
)
target_include_directories(
MiraiCP_plugin PUBLIC
${SRC_PATH}/include
${SRC_PATH}/common
${INCLUDE_PATH}/sdk
${INCLUDE_PATH}/common
${3RD_PATH}
)
target_compile_definitions(MiraiCP_plugin PUBLIC MIRAICP_LIB_SDK)
Expand All @@ -99,13 +100,16 @@ target_include_directories(
Loader PUBLIC
${JNI_PATH}
${3RD_PATH}
${SRC_PATH}/libloader
${SRC_PATH}/common
${SRC_PATH}
${INCLUDE_PATH}/libloader
${INCLUDE_PATH}/common
)

add_dependencies(Loader MiraiCP_plugin)
target_compile_definitions(Loader PUBLIC MIRAICP_LIB_LOADER)
if (MSVC)
target_compile_options(Loader PUBLIC /utf8 /EHs /MP)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Debug)
endif ()

# 移植性
set_target_properties(Loader PROPERTIES LINK_SEARCH_START_STATIC 1)
Expand Down
13 changes: 10 additions & 3 deletions scripts/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import zipfile
from typing import List

DEFAULT_VERSION_TAG = "v2.13.0-alpha-3"
DEFAULT_VERSION_TAG = "v2.13.1"


def try_remove_file(file: str):
try:
Expand All @@ -34,12 +35,14 @@ def try_remove_tree(tree: str):
except Exception:
...

def try_mkdir(dir:str):

def try_mkdir(dir: str):
try:
os.mkdir(dir)
except Exception:
...


def get_download_version(ver: str) -> str:
return ver if ver[0] == 'v' else 'v'+ver

Expand Down Expand Up @@ -86,7 +89,11 @@ def main():

# copy necessary files
try_remove_tree("src")
shutil.copytree("MiraiCP/cpp/src", f"src")
shutil.copytree("MiraiCP/cpp/src", "src")
try_remove_tree("include")
shutil.copytree("MiraiCP/cpp/include", "include")
try_remove_tree("3rd_include")
shutil.copytree("MiraiCP/cpp/3rd_include", "3rd_include")

# create test cpp
os.mkdir("src/plugin")
Expand Down

0 comments on commit d87d81e

Please sign in to comment.