Updated setup.py to build base python setup
This commit is contained in:
parent
816c5c7f5d
commit
f86e5b1341
4 changed files with 13 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.4.1)
|
||||
project(kompute VERSION 0.3.0)
|
||||
project(kompute VERSION 0.4.2)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
|
|
@ -13,6 +13,7 @@ option(KOMPUTE_OPT_BUILD_SHADERS "Enable if you want to re-build all shader file
|
|||
option(KOMPUTE_OPT_BUILD_SINGLE_HEADER "Enable if you want to build the single header file" 0)
|
||||
option(KOMPUTE_OPT_INSTALL "Enable if you want to enable installation" 0)
|
||||
# Build options
|
||||
option(KOMPUTE_OPT_BUILD_PYTHON "Enable if you want to build python bindings" 0)
|
||||
option(KOMPUTE_OPT_ENABLE_SPDLOG "Extra compile flags for Kompute, see docs for full list" 0)
|
||||
option(KOMPUTE_OPT_REPO_SUBMODULE_BUILD, "Use the submodule repos instead of external package manager" 0)
|
||||
option(KOMPUTE_OPT_ANDOID_BUILD "Enable android compilation flags required" 0)
|
||||
|
|
@ -43,12 +44,16 @@ endfunction()
|
|||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_DOCS)
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config" ${CMAKE_MODULE_PATH})
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
if(KOMPUTE_OPT_BUILD_PYTHON)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
project(cmake_example)
|
||||
|
||||
add_subdirectory(pybind11)
|
||||
pybind11_add_module(cmake_example src/main.cpp)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,9 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
|
||||
int add(int i, int j) {
|
||||
return i + j;
|
||||
}
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(cmake_example, m) {
|
||||
m.doc() = R"pbdoc(
|
||||
Pybind11 example plugin
|
||||
-----------------------
|
||||
|
||||
.. currentmodule:: cmake_example
|
||||
|
||||
.. autosummary::
|
||||
:toctree: _generate
|
||||
|
||||
add
|
||||
subtract
|
||||
)pbdoc";
|
||||
|
||||
m.def("add", &add, R"pbdoc(
|
||||
Add two numbers
|
||||
|
||||
Some other explanation about the add function.
|
||||
)pbdoc");
|
||||
|
||||
m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc(
|
||||
Subtract two numbers
|
||||
|
||||
Some other explanation about the subtract function.
|
||||
)pbdoc");
|
||||
|
||||
#ifdef VERSION_INFO
|
||||
m.attr("__version__") = VERSION_INFO;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ class CMakeBuild(build_ext):
|
|||
extdir += os.path.sep
|
||||
|
||||
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
|
||||
'-DKOMPUTE_OPT_BUILD_PYTHON=1',
|
||||
'-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1',
|
||||
'-DPYTHON_EXECUTABLE=' + sys.executable]
|
||||
|
||||
cfg = 'Debug' if self.debug else 'Release'
|
||||
|
|
@ -57,6 +59,7 @@ class CMakeBuild(build_ext):
|
|||
self.distribution.get_version())
|
||||
if not os.path.exists(self.build_temp):
|
||||
os.makedirs(self.build_temp)
|
||||
|
||||
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
|
||||
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue