Skip to content

Commit 139dedb

Browse files
committed
release 130.22.4
1 parent 4130337 commit 139dedb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+52625
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM quay.io/pypa/manylinux2014_aarch64
2+
RUN yum update -y
3+
RUN yum install -y libuuid
4+
RUN yum install -y libuuid-devel
5+
RUN yum install -y devtoolset-8-gcc-c++
6+
ENV PATH=/opt/rh/devtoolset-8/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7+
8+
WORKDIR /tmp
9+
RUN curl https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz > openssl-1.0.2u.tar.gz
10+
RUN tar -xzf openssl-1.0.2u.tar.gz
11+
WORKDIR /tmp/openssl-1.0.2u
12+
ENV CFLAGS=-fPIC
13+
RUN ./config shared no-asm --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
14+
RUN make -j
15+
RUN make install
16+
ENV OPENSSL_ROOT_DIR=/usr/local/openssl
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM quay.io/pypa/manylinux2014_x86_64
2+
RUN yum update -y
3+
RUN yum install -y libuuid
4+
RUN yum install -y libuuid-devel
5+
RUN yum install -y devtoolset-8-gcc-c++.x86_64
6+
ENV PATH=/opt/rh/devtoolset-8/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7+
8+
WORKDIR /tmp
9+
RUN curl https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz > openssl-1.0.2u.tar.gz
10+
RUN tar -xzf openssl-1.0.2u.tar.gz
11+
WORKDIR /tmp/openssl-1.0.2u
12+
ENV CFLAGS=-fPIC
13+
RUN ./config shared no-asm --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
14+
RUN make -j
15+
RUN make install
16+
ENV OPENSSL_ROOT_DIR=/usr/local/openssl
17+
18+

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/build/
2+
/builds/
3+
/dist/
4+
/*egg-info/
5+
/wheelhouse/
6+
/.venv*/
7+
/.vscode/
8+
/.python-version
9+
*/__pycache__/*

.gitlab-ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
stages:
2+
- build
3+
4+
build-Linux-x86_64-job:
5+
stage: build
6+
script:
7+
- echo "VARIABLES:"
8+
- echo $CI_CUS_LINUX_X86_PYTHON_PATH
9+
- echo $PATH
10+
- pwd
11+
- echo "COMPILE:"
12+
- $CI_CUS_LINUX_X86_PYTHON_PATH -m pip install cibuildwheel==2.15.0
13+
- $CI_CUS_LINUX_X86_PYTHON_PATH -m cibuildwheel --platform linux --output-dir wheelhouse
14+
artifacts:
15+
name: "$CI_PROJECT_NAME-$CI_JOB_NAME"
16+
paths:
17+
- wheelhouse/
18+
tags:
19+
- Linux-x86_64
20+
rules:
21+
- if: $CI_PIPELINE_TRIGGERED == "true"
22+
allow_failure: false
23+
- when: manual
24+
allow_failure: false
25+
26+
build-Linux-arm64-job:
27+
stage: build
28+
script:
29+
- echo "VARIABLES:"
30+
- echo $CI_CUS_LINUX_ARM_PYTHON_PATH
31+
- echo $PATH
32+
- pwd
33+
- echo "COMPILE:"
34+
- $CI_CUS_LINUX_ARM_PYTHON_PATH -m pip install cibuildwheel==2.15.0
35+
- $CI_CUS_LINUX_ARM_PYTHON_PATH -m cibuildwheel --platform linux --output-dir wheelhouse
36+
artifacts:
37+
name: "$CI_PROJECT_NAME-$CI_JOB_NAME"
38+
paths:
39+
- wheelhouse/
40+
tags:
41+
- Linux-arm64
42+
rules:
43+
- if: $CI_PIPELINE_TRIGGERED == "true"
44+
allow_failure: false
45+
- when: manual
46+
allow_failure: false
47+
48+
build-Windows-amd64-job:
49+
stage: build
50+
script:
51+
- echo "VARIABLES:"
52+
- echo $CI_CUS_WINDOWS_OPENSSL_PATH
53+
- echo $CI_CUS_WINDOWS_PYTHON_PATH
54+
- echo $CI_CUS_WINDOWS_VS_PATH
55+
- echo $CI_CUS_WINDOWS_CMAKE_PATH
56+
- pwd
57+
- echo "PREPARE:"
58+
- $env:path="$CI_CUS_WINDOWS_PYTHON_PATH;$CI_CUS_WINDOWS_PYTHON_PATH/Scripts;$CI_CUS_WINDOWS_CMAKE_PATH;$env:path"
59+
- $env:CIBW_ENVIRONMENT_WINDOWS="OPENSSL_ROOT_DIR=`"$CI_CUS_WINDOWS_OPENSSL_PATH`""
60+
- echo $env:CIBW_ENVIRONMENT_WINDOWS
61+
- echo $env:path
62+
- echo "COMPILE:"
63+
- python -m pip install cibuildwheel==2.15.0
64+
- python -m cibuildwheel --platform windows --output-dir wheelhouse
65+
artifacts:
66+
name: "$CI_PROJECT_NAME-$CI_JOB_NAME"
67+
paths:
68+
- wheelhouse/
69+
tags:
70+
- Windows-amd64
71+
rules:
72+
- if: $CI_PIPELINE_TRIGGERED == "true"
73+
allow_failure: false
74+
- when: manual
75+
allow_failure: false
76+
77+
build-MacOS-universal2-job: # This job runs in the build stage, which runs first.
78+
stage: build
79+
variables:
80+
script:
81+
- echo "VARIABLES:"
82+
- echo $CI_CUS_MACOS_UNIVERSAL2_PYTHON_PATH
83+
- echo $CI_CUS_MACOS_UNIVERSAL2_OPENSSL_PATH
84+
- echo $CI_CUS_MACOS_UNIVERSAL2_UUID_PATH
85+
- echo $PATH
86+
- pwd
87+
- echo "COMPILE:"
88+
- $CI_CUS_MACOS_UNIVERSAL2_PYTHON_PATH -m pip install cibuildwheel==2.15.0
89+
- CIBW_ENVIRONMENT="OPENSSL_ROOT_DIR=$CI_CUS_MACOS_UNIVERSAL2_OPENSSL_PATH UUID_ROOT_DIR=$CI_CUS_MACOS_UNIVERSAL2_UUID_PATH" $CI_CUS_MACOS_UNIVERSAL2_PYTHON_PATH -m cibuildwheel --platform macos --output-dir wheelhouse
90+
artifacts:
91+
name: "$CI_PROJECT_NAME-$CI_JOB_NAME"
92+
paths:
93+
- wheelhouse/
94+
tags:
95+
- MacOS-universal2
96+
rules:
97+
- if: $CI_PIPELINE_TRIGGERED == "true"
98+
allow_failure: false
99+
- when: manual
100+
allow_failure: false

CMakeLists.txt

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
cmake_minimum_required(VERSION 3.15.1) # Cannot be lower than 3.15, otherwise python cannot be found correctly
2+
message("CMAKE VERSION: ${CMAKE_VERSION}")
3+
message("CMAKE PATH: ${CMAKE_COMMAND}")
4+
project(dolphindbcpp)
5+
set(MODULE_NAME _dolphindbcpp)
6+
7+
set(CMAKE_CXX_STANDARD 11)
8+
9+
if(MSVC)
10+
# set(ENV{PATH} "$ENV{VIRTUAL_ENV}/Scripts;$ENV{PATH}")
11+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} /O2 /d2FH4-")
12+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /Od")
13+
else()
14+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
15+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
16+
endif()
17+
18+
# find openssl
19+
if(DEFINED ENV{OPENSSL_ROOT_DIR})
20+
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR})
21+
endif()
22+
file(TO_CMAKE_PATH ${OPENSSL_ROOT_DIR} OPENSSL_ROOT_DIR)
23+
message(STATUS "[OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR}]")
24+
set(OPENSSL_USE_STATIC_LIBS TRUE)
25+
find_package(OpenSSL 1.0.2 REQUIRED)
26+
if(OPENSSL_VERSION VERSION_LESS "1.0.2" OR OPENSSL_VERSION VERSION_GREATER "1.1.1")
27+
message(ERROR "Need OpenSSL [1.0.2 - 1.1.1], ${OPENSSL_VERSION} is unavailable!")
28+
message(ERROR "You can add OPENSSL_ROOT_DIR=<openssl> to environment")
29+
endif()
30+
message(STATUS "[openssl ${OPENSSL_VERSION}]")
31+
32+
# find python3
33+
function(which_python PYCMD PYPATH)
34+
execute_process(COMMAND which ${PYCMD} OUTPUT_VARIABLE P)
35+
string(REGEX MATCH "^(/.*)\n" P "${P}")
36+
file(TO_CMAKE_PATH ${CMAKE_MATCH_1} P)
37+
set(${PYPATH} ${P} PARENT_SCOPE)
38+
endfunction(which_python)
39+
40+
function(python_version PYCMD VA VB VC)
41+
execute_process(COMMAND ${PYCMD} --version OUTPUT_VARIABLE Python_VERSION)
42+
string(REGEX MATCH "^Python ([0-9]+)\\.([0-9]+)\\.([0-9]+)\n$" Python_VERSION ${Python_VERSION})
43+
set(${VA} ${CMAKE_MATCH_1} PARENT_SCOPE)
44+
set(${VB} ${CMAKE_MATCH_2} PARENT_SCOPE)
45+
set(${VC} ${CMAKE_MATCH_3} PARENT_SCOPE)
46+
endfunction(python_version)
47+
48+
set(PYCMD python)
49+
python_version(${PYCMD} VA VB VC)
50+
if(VA STREQUAL "2")
51+
set(PYCMD python3)
52+
python_version(${PYCMD} VA VB VC)
53+
endif()
54+
55+
if(WIN32)
56+
find_package(Python ${VA}.${VB} EXACT REQUIRED COMPONENTS Interpreter Development)
57+
message(STATUS "[python ${Python_VERSION}]")
58+
else()
59+
which_python(${PYCMD} PYPATH)
60+
set(PYTHON_EXECUTABLE ${PYPATH})
61+
message(STATUS "[python executable ${PYPATH}]")
62+
endif()
63+
64+
message(STATUS "[Python Found: ${Python_FOUND}]")
65+
message(STATUS "[Python Include PATH: ${Python_INCLUDE_DIRS}]")
66+
message(STATUS "[Python Executable PATH: ${Python_EXECUTABLE}]")
67+
message(STATUS "[Python Lib PATH: ${Python_LIBRARY}]")
68+
69+
# find pybind11
70+
execute_process(COMMAND pybind11-config --cmakedir OUTPUT_VARIABLE pybind11_DIR)
71+
file(TO_CMAKE_PATH ${pybind11_DIR} pybind11_DIR)
72+
string(REGEX REPLACE "\n$" "" pybind11_DIR ${pybind11_DIR})
73+
find_package(pybind11 CONFIG REQUIRED)
74+
message(STATUS "[pybind11 ${pybind11_VERSION}]")
75+
76+
77+
# add src to pybind11 module
78+
aux_source_directory(core/src SRC)
79+
pybind11_add_module(${MODULE_NAME} ${SRC})
80+
81+
# definitions
82+
target_compile_definitions(${MODULE_NAME}
83+
PUBLIC MODULE_NAME=${MODULE_NAME}
84+
PUBLIC NDEBUG
85+
PUBLIC LOGGING_LEVEL_1
86+
PUBLIC _hypot=hypot
87+
)
88+
89+
# include-dirs
90+
include_directories(
91+
${CMAKE_CURRENT_SOURCE_DIR}/core/include
92+
${OPENSSL_INCLUDE_DIR}
93+
${Python_INCLUDE_DIRS}
94+
)
95+
96+
# lib-dirs
97+
target_link_directories(${MODULE_NAME}
98+
PUBLIC ${Python_LIBRARY_DIRS}
99+
)
100+
101+
# lib-files
102+
target_link_libraries(${MODULE_NAME} PUBLIC
103+
${OPENSSL_LIBRARIES}
104+
)
105+
106+
if(WIN32)
107+
# definitions
108+
target_compile_definitions(${MODULE_NAME}
109+
PUBLIC WINDOWS
110+
PUBLIC MS_WIN64
111+
)
112+
113+
if(MINGW)
114+
# mingw static link "libgcc_s_seh-1.dll" "libstdc++-6.dll" "libwinpthread-1.dll"
115+
set(CMAKE_CXX_STANDARD_LIBRARIES "-static -static-libgcc -static-libstdc++ ${CMAKE_CXX_STANDARD_LIBRARIES}")
116+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
117+
message(STATUS "cxx libraries: " ${CMAKE_CXX_STANDARD_LIBRARIES})
118+
message(STATUS "linker flags: " ${CMAKE_EXE_LINKER_FLAGS})
119+
120+
target_link_libraries(${MODULE_NAME} PUBLIC
121+
C:/Windows/System32/ws2_32.dll
122+
)
123+
124+
elseif(MSVC)
125+
target_compile_definitions(${MODULE_NAME}
126+
PUBLIC WIN32_LEAN_AND_MEAN
127+
PUBLIC _WINSOCK_DEPRECATED_NO_WARNINGS
128+
PUBLIC _CRT_SECURE_NO_WARNINGS
129+
PUBLIC NOMINMAX
130+
PUBLIC _WINDOWS
131+
PUBLIC _USRDLL
132+
)
133+
134+
get_filename_component(OPENSSL_ROOT_DIR ${OPENSSL_INCLUDE_DIR} DIRECTORY)
135+
target_link_directories(${MODULE_NAME}
136+
PUBLIC "${OPENSSL_ROOT_DIR}/lib64"
137+
PUBLIC "${OPENSSL_ROOT_DIR}/lib"
138+
)
139+
140+
target_link_libraries(${MODULE_NAME} PUBLIC
141+
ws2_32
142+
libcryptoMT
143+
libsslMT
144+
advapi32 # needed by openssl static lib
145+
user32 # needed by openssl static lib
146+
crypt32 # needed by openssl static lib
147+
)
148+
149+
else()
150+
message(FATAL_ERROR "Unsupported Compiler")
151+
endif()
152+
153+
elseif(APPLE)
154+
# uuid
155+
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -undefined dynamic_lookup")
156+
if(NOT DEFINED ENV{UUID_ROOT_DIR})
157+
message(SEND_ERROR "NOT DEFINED LIBUUID_PATH")
158+
message(SEND_ERROR "You can brew install util_linux or brew install e2fsprogs")
159+
message(SEND_ERROR "Then add UUID_ROOT_DIR=<util_linux/e2fsprogs> to environment")
160+
message(FATAL_ERROR "NOT DEFINED LIBUUID_PATH")
161+
endif()
162+
target_include_directories(${MODULE_NAME} PUBLIC $ENV{UUID_ROOT_DIR}/include)
163+
target_link_directories(${MODULE_NAME} PUBLIC $ENV{UUID_ROOT_DIR}/lib)
164+
165+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mmacosx-version-min=10.13")
166+
# definitions
167+
target_compile_definitions(${MODULE_NAME}
168+
PUBLIC MAC
169+
)
170+
171+
# lib-files
172+
target_link_libraries(${MODULE_NAME} PUBLIC
173+
uuid
174+
pthread
175+
dl
176+
)
177+
178+
elseif(UNIX)
179+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
180+
# definitions
181+
target_compile_definitions(${MODULE_NAME}
182+
PUBLIC LINUX
183+
PUBLIC GLIBCXX_USE_CXX11_ABI=0
184+
)
185+
186+
# lib-files
187+
target_link_libraries(${MODULE_NAME} PUBLIC
188+
uuid
189+
rt
190+
)
191+
192+
else()
193+
message(FATAL_ERROR "Unsupported Platform")
194+
endif()
195+
196+
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")

LICENSE

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Copyright 2016-2023 DolphinDB, Inc.
2+
3+
14
Apache License
25
Version 2.0, January 2004
36
http://www.apache.org/licenses/
@@ -186,7 +189,7 @@
186189
same "printed page" as the copyright notice for easier
187190
identification within third-party archives.
188191

189-
Copyright [yyyy] [name of copyright owner]
192+
Copyright 2016-2023 DolphinDB, Inc.
190193

191194
Licensed under the Apache License, Version 2.0 (the "License");
192195
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)