Skip to content

Commit

Permalink
move pyd files into nuwe_pyeccodes to install by pip.
Browse files Browse the repository at this point in the history
  • Loading branch information
perillaroc committed Aug 12, 2018
1 parent 92266ea commit 7ef33a8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
8 changes: 4 additions & 4 deletions example/message_handler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
project(example_message_handler)
#project(example_message_handler)

set(TEST_DATA_ROOT ${NUWE_DATA_ROOT})

configure_file (
"${PROJECT_SOURCE_DIR}/example_config.h.in"
"${PROJECT_BINARY_DIR}/example_config.h"
"${CMAKE_CURRENT_SOURCE_DIR}/example_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/example_config.h"
)

add_executable(example_message_handler main.cpp)
Expand All @@ -14,5 +14,5 @@ target_link_libraries(example_message_handler PUBLIC
)

target_include_directories(example_message_handler PUBLIC
${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
4 changes: 2 additions & 2 deletions src/grib_message_handler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(grib_message_handler)
#project(grib_message_handler)

set(SOURCE_FILES
src/grib_message_handler.cpp
Expand All @@ -10,7 +10,7 @@ add_library(grib_message_handler STATIC ${SOURCE_FILES})

target_include_directories(grib_message_handler
INTERFACE
${PROJECT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_link_libraries(grib_message_handler PUBLIC
Expand Down
26 changes: 16 additions & 10 deletions src/pyeccodes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
project(pyeccodes)
#project(pyeccodes)

find_package(pybind11 REQUIRED)

pybind11_add_module(nuwe_pyeccodes nuwe_pyeccodes.cpp)
pybind11_add_module(_pyeccodes nuwe_pyeccodes.cpp)

set(PYECCODES_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/nuwe_pyeccodes)

configure_file (
"${PROJECT_SOURCE_DIR}/setup.py.in"
"${PROJECT_BINARY_DIR}/setup.py"
"${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/setup.py"
)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/nuwe_pyeccodes DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries(nuwe_pyeccodes PUBLIC
target_link_libraries(_pyeccodes PUBLIC
NuwePyeccodes::grib_message_handler
)

set_target_properties(nuwe_pyeccodes PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_target_properties(_pyeccodes PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PYECCODES_OUTPUT_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY_Release ${PYECCODES_OUTPUT_DIRECTORY}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PYECCODES_OUTPUT_DIRECTORY}
LIBRARY_OUTPUT_DIRECTORY_Release ${PYECCODES_OUTPUT_DIRECTORY}
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PYECCODES_OUTPUT_DIRECTORY}
ARCHIVE_OUTPUT_DIRECTORY_Release ${PYECCODES_OUTPUT_DIRECTORY}
)
2 changes: 1 addition & 1 deletion src/pyeccodes/nuwe_pyeccodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace py = pybind11;
using namespace pyeccodes;

PYBIND11_MODULE(nuwe_pyeccodes, m) {
PYBIND11_MODULE(_pyeccodes, m) {
py::class_<GribMessageHandler>(m, "GribMessageHandler")
.def(py::init<>())
.def("getSize", &GribMessageHandler::getSize)
Expand Down
2 changes: 2 additions & 0 deletions src/pyeccodes/nuwe_pyeccodes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# coding: utf-8
from ._pyeccodes import *
9 changes: 5 additions & 4 deletions src/pyeccodes/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ from setuptools import setup, find_packages
setup(
name="nuwe_pyeccodes",
version="0.1.0",
packages=['nuwe_eccodes'],
install_requires=['numpy'],
include_package_data=True,
packages=["nuwe_pyeccodes"],
package_data={
'nuwe_eccodes': [
'@PROJECT_BINARY_DIR@/*.lib',
'@PROJECT_BINARY_DIR@/*.pyd',
'': [
'*.lib',
'*.pyd',
]
}
)

0 comments on commit 7ef33a8

Please sign in to comment.