Skip to content

Commit 8a47341

Browse files
committed
Add files for supporting Windows
1 parent 73e9b39 commit 8a47341

2 files changed

Lines changed: 125 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(griddb_python)
4+
5+
set(C_LIB E:/c_client-master/c_client-master/bin/x64/Release)
6+
set(C_HEADER E:/c_client-master/c_client-master/client/c/include)
7+
set(SOURCE_HEADER E:/cmake-fun/SourceCode/src)
8+
set(PYTHON_RESOURCE C:/Users/griddb/AppData/Local/Programs/Python/Python36/)
9+
set(SWIG_RESOURCE E:/swigwin-3.0.12)
10+
11+
set(PYTHON_LIBRARIES ${PYTHON_RESOURCE}/libs)
12+
set(PYTHON_INCLUDE_DIRS ${PYTHON_RESOURCE}/include)
13+
set(PYTHON_LIBRARY ${PYTHON_RESOURCE}/libs)
14+
set(PYTHON_INCLUDE_DIR ${PYTHON_RESOURCE}/include)
15+
find_package(PythonLibs 3 REQUIRED)
16+
find_package(PythonInterp 3 REQUIRED)
17+
18+
set(SWIG_DIR ${SWIG_RESOURCE}/Lib)
19+
set(SWIG_EXECUTABLE ${SWIG_RESOURCE}/swig.exe)
20+
find_package(SWIG REQUIRED)
21+
include(${SWIG_USE_FILE})
22+
23+
set(CMAKE_SWIG_FLAGS -c++)
24+
set(CMAKE_CXX_FLAGS "/DLL /LD /D_USRDLL /D_WINDLL /MT /MD")
25+
26+
include_directories(${C_HEADER} ${PYTHON_RESOURCE}/include ${SOURCE_HEADER})
27+
link_directories(${PYTHON_RESOURCE}/libs ${C_LIB})
28+
29+
set_property(SOURCE ${SOURCE_HEADER}/griddb.i PROPERTY CPLUSPLUS ON)
30+
swig_add_library(griddb_python TYPE SHARED LANGUAGE python SOURCES ${SOURCE_HEADER}/griddb.i
31+
${SOURCE_HEADER}/TimeSeriesProperties.cpp
32+
${SOURCE_HEADER}/ContainerInfo.cpp
33+
${SOURCE_HEADER}/AggregationResult.cpp
34+
${SOURCE_HEADER}/Container.cpp
35+
${SOURCE_HEADER}/Store.cpp
36+
${SOURCE_HEADER}/StoreFactory.cpp
37+
${SOURCE_HEADER}/PartitionController.cpp
38+
${SOURCE_HEADER}/Query.cpp
39+
${SOURCE_HEADER}/QueryAnalysisEntry.cpp
40+
${SOURCE_HEADER}/RowKeyPredicate.cpp
41+
${SOURCE_HEADER}/RowSet.cpp
42+
${SOURCE_HEADER}/TimestampUtils.cpp
43+
${SOURCE_HEADER}/Field.cpp
44+
${SOURCE_HEADER}/Util.cpp)
45+
46+
target_link_libraries(griddb_python gridstore_c)

cmake_build_guide.org

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#+TITLE: Cmake Build Guide For GridDB Python Client
2+
3+
#+STARTUP: showall
4+
#+STARTUP: logdone
5+
#+STARTUP: hidestars
6+
7+
#+OPTIONS: author:nil timestamp:nil creator:nil
8+
#+OPTIONS: ^:nil _:nil
9+
10+
#+DRAWERS: NOTE
11+
12+
[TABLE-OF-CONTENTS]
13+
14+
#+STYLE: <STYLE type="text/css">
15+
#+STYLE: <!-
16+
#+STYLE: .break { page-break-before: always; }
17+
#+STYLE: -->
18+
#+STYLE: </STYLE>
19+
20+
#+HTML: <DIV class="break"></DIV><BR>
21+
22+
* Building the GridDB python client
23+
24+
This section shows how to build the GridDB python client on a single machine.
25+
26+
** Confirming the environment
27+
28+
Confirm that OS is Windows 10 64 bit
29+
30+
** Required software to build GridDB python client
31+
- cmake: version 3.14.5
32+
- python: version 3.6.4
33+
- swig: version 3.0.12
34+
- GridDB C client: version 4.2.0
35+
In order to build, we also need to install Visual Studio 2017
36+
37+
** Installing required software
38+
*** Install cmake
39+
- Download zip package from https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-win64-x64.zip
40+
- Extract the zip package and get resource of cmake tool
41+
*** Install python
42+
- Download and install python 3.6.4 from https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe
43+
- Set path for PYTHON_RESOURCE in *CmakeList.txt*
44+
#+BEGIN_EXAMPLE
45+
set(PYTHON_RESOURCE C:/Users/username/AppData/Local/Programs/Python/Python36)
46+
#+END_EXAMPLE
47+
*** Install swig
48+
- Download zip package from https://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.12/swigwin-3.0.12.zip/download
49+
- Extract the zip package then set path for SWIG_RESOURCE in *CmakeList.txt*
50+
#+BEGIN_EXAMPLE
51+
set(SWIG_RESOURCE E:/swigwin-3.0.12)
52+
#+END_EXAMPLE
53+
*** Install GridDB C client
54+
- Please refer to https://github.com/griddb/c_client to install GridDB C client.
55+
- After installing GridDB C client, set path for C_LIB (path for gridstore_c.lib) and C_HEADER (path for gridstore.h) in *CmakeList.txt*
56+
#+BEGIN_EXAMPLE
57+
set(C_LIB E:/c_client-master/bin/x64/Release)
58+
set(C_HEADER E:/c_client-master/client/c/include)
59+
#+END_EXAMPLE
60+
** Building GridDB python client
61+
Before building Griddb python client, please set link for SOURCE_HEADER (link to folder store cpp headers) in *CmakeList.txt*
62+
#+BEGIN_EXAMPLE
63+
set(SOURCE_HEADER E:/SourceCode/src)
64+
#+END_EXAMPLE
65+
*** Generate standard build files from cmake
66+
- Open <PATH_TO_CMAKE>/cmake-3.14.5-win64-x64/bin/cmake-gui.exe
67+
- Set link for *source code* in cmake gui: link to folder store *CmakeList.txt*
68+
- Set link for *the binaries* in cmake gui: link to folder which generated files are store (sln file, py file)
69+
- Run *Configure* with set *Specify the generator for this project* is *Visual Studio 15 2017*, and for *Optional toolset to use* is *x64*
70+
- Run *Generate* to get standard build files
71+
*** Build python client
72+
- Open <PATH_TO_OUTPUT_CMAKE>/griddb_python.sln by Visual Studio 2017
73+
- Build *griddb_python* project to get *_griddb_python.pyd* library and *griddb_python.py* interface
74+
** Run sample to check for building Python client
75+
- Put *_griddb_python.pyd*, *gridstore_c.dll* libraries and *griddb_python.py* interface into folder store *sample1.py*
76+
#+BEGIN_EXAMPLE
77+
<PATH_TO>/python.exe sample1.py 239.0.0.1 <port> <cluster> <username> <password>
78+
#+END_EXAMPLE
79+

0 commit comments

Comments
 (0)