Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiemuhuaguo/23.11/cross platform #1191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mars/comm/socket/socket_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include "comm/socket/local_ipstack.h"
#include "unix_socket.h"

#ifdef _WIN32
#include "winsock2.h" // for socket_storage
#endif

class socket_address {
public:
explicit socket_address(const char* _ip, uint16_t _port);
Expand Down
8 changes: 4 additions & 4 deletions mars/comm/verinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#ifndef Mars_verinfo_h
#define Mars_verinfo_h

#define MARS_REVISION "${mars_rev}"
#define MARS_PATH "${mars_branch}"
#define MARS_REVISION "ed9bb06f4"
#define MARS_PATH "tiemuhuaguo/23.11/cross_platform"
#define MARS_URL ""
#define MARS_BUILD_TIME "20230216"
#define MARS_TAG "1.0.0-SNAPSHOT"
#define MARS_BUILD_TIME "2023-12-05 11:43:37"
#define MARS_TAG ""

#endif
189 changes: 0 additions & 189 deletions mars/comm/windows/zlib/adler32.c

This file was deleted.

57 changes: 50 additions & 7 deletions mars/mars_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import shutil
import time
import subprocess
import hashlib
from typing import List
from typing import Dict

COMM_COPY_HEADER_FILES = {
"mars/comm/verinfo.h": "comm",
Expand All @@ -20,6 +22,7 @@
"mars/comm/has_member.h": "comm",
"mars/comm/objc/scope_autoreleasepool.h": "comm",
"mars/comm/objc/ThreadOperationQueue.h": "comm",
"mars/comm/socket/unix_socket.h": "comm/socket",

"mars/comm/xlogger/preprocessor.h": "xlog",
"mars/comm/xlogger/xloggerbase.h": "xlog",
Expand All @@ -29,6 +32,7 @@
"mars/boot/base_manager.h": "boot",

"mars/stn/stn.h": "stn",
"mars/stn/config.h": "stn",
"mars/stn/stn_logic.h": "stn",
"mars/stn/stn_manager.h": "stn",
"mars/stn/task_profile.h": "stn",
Expand Down Expand Up @@ -174,6 +178,15 @@ def remove_cmake_files(path):
os.remove(f)


def remove_if_exist(path: str):
if not os.path.exists(path):
return
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)


def clean_except(path, except_list):
for fpath, dirs, fs in os.walk(path):
in_except = False
Expand Down Expand Up @@ -227,20 +240,49 @@ def copy_windows_pdb(cmake_out, sub_folder, config, dst_folder):
print("%s not exists" % pdb)


def is_different_file(file1: str, file2: str) -> bool:
assert os.path.exists(file1)
if not os.path.exists(file2):
return True
md51: str = hashlib.md5(open(file1, 'rb').read()).hexdigest()
md52: str = hashlib.md5(open(file2, 'rb').read()).hexdigest()
return md51 != md52


# dst是文件的路径,不是文件所在的文件夹的路径
def copy_file(src, dst):
if not os.path.isfile(src):
print('Warning: %s not exist cwd %s' % (src, os.getcwd()))
return
assert os.path.isfile(src), src

if dst.rfind("/") != -1 and not os.path.exists(dst[:dst.rfind("/")]):
os.makedirs(dst[:dst.rfind("/")])
if dst.rfind("\\") != -1 and not os.path.exists(dst[:dst.rfind("\\")]):
os.makedirs(dst[:dst.rfind("\\")])

shutil.copy(src, dst)
if is_different_file(src, dst):
shutil.copy(src, dst)


def copy_file_mapping(header_file_mappings, header_files_src_base, header_files_dst_end):
def copy_file_mapping(header_file_mappings: Dict[str, str], header_files_src_base: str, header_files_dst_end: str):
for (src, dst) in header_file_mappings.items():
copy_file(header_files_src_base + src, header_files_dst_end + "/" + dst + '/' + src[src.rfind("/"):])
copy_file(os.path.join(header_files_src_base, src),
os.path.join(header_files_dst_end, dst, src[src.rfind("/") + 1:]))


# dst为复制后文件夹的路径,而非文件夹的父目录的路径。
# 若复制前dst非空,本函数不会清空dst文件夹中的内容。
def copy_folder(src: str, dst: str):
assert os.path.exists(src), src
assert os.path.isdir(src), src
if not os.path.exists(dst):
os.makedirs(dst)

for name in os.listdir(src):
absolute_src_file: str = os.path.join(src, name)
absolute_dst_file: str = os.path.join(dst, name)
if os.path.isdir(absolute_src_file):
copy_folder(absolute_src_file, absolute_dst_file)
else:
copy_file(absolute_src_file, absolute_dst_file)


def make_static_framework(src_lib, dst_framework, header_file_mappings, header_files_src_base='./'):
Expand All @@ -252,7 +294,8 @@ def make_static_framework(src_lib, dst_framework, header_file_mappings, header_f

framework_path = dst_framework + '/Headers'
for (src, dst) in header_file_mappings.items():
copy_file(header_files_src_base + src, framework_path + "/" + dst + '/' + src[src.rfind("/"):])
copy_file(os.path.join(header_files_src_base, src),
os.path.join(framework_path, dst, src[src.rfind("/") + 1:]))

return True

Expand Down
22 changes: 22 additions & 0 deletions mars/openssl/include/openssl/__DECC_INCLUDE_EPILOGUE.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

/*
* This file is only used by HP C/C++ on VMS, and is included automatically
* after each header file from this directory
*/

/*
* The C++ compiler doesn't understand these pragmas, even though it
* understands the corresponding command line qualifier.
*/
#ifndef __cplusplus
/* restore state. Must correspond to the save in __decc_include_prologue.h */
# pragma names restore
#endif
26 changes: 26 additions & 0 deletions mars/openssl/include/openssl/__DECC_INCLUDE_PROLOGUE.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

/*
* This file is only used by HP C/C++ on VMS, and is included automatically
* after each header file from this directory
*/

/*
* The C++ compiler doesn't understand these pragmas, even though it
* understands the corresponding command line qualifier.
*/
#ifndef __cplusplus
/* save state */
# pragma names save
/* have the compiler shorten symbols larger than 31 chars to 23 chars
* followed by a 8 hex char CRC
*/
# pragma names as_is,shortened
#endif
4 changes: 2 additions & 2 deletions mars/openssl/include/openssl/opensslconf-android.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#elif defined(__aarch64__)
#include <openssl/opensslconf_android-arm64.h>
#elif defined(__i386__)
#include <openssl/opensslconf_android-x86_64.h>
#include <openssl/opensslconf_android-x86.h>
#elif defined(__x86_64__)
#include <openssl/opensslconf_android64-x86_64.h>
#include <openssl/opensslconf_android-x86_64.h>
#else
# error Unable to determine arch not included in OpenSSL build
#endif
Loading