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

[WIP] Merging JS and Python binding code - Part 2 #389

Merged
merged 12 commits into from
Jan 23, 2019
Prev Previous commit
Next Next commit
include binding in build behind ifdef
  • Loading branch information
timkpaine committed Jan 20, 2019
commit 6bedba49fa6d41cc9e1d234d6e0c1544748050d4
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ set (SOURCE_FILES
src/cpp/base_impl_osx.cpp
src/cpp/base_impl_wasm.cpp
src/cpp/base_impl_win.cpp
src/cpp/binding.cpp
src/cpp/build_filter.cpp
#src/cpp/calc_agg_dtype.cpp
src/cpp/column.cpp
Expand Down Expand Up @@ -292,21 +293,21 @@ if (PSP_WASM_BUILD)
add_library(psp ${SOURCE_FILES})
set_target_properties(psp PROPERTIES COMPILE_FLAGS "${ASYNC_MODE_FLAGS}")

add_executable(perspective.async src/cpp/binding.cpp src/cpp/emscripten.cpp)
add_executable(perspective.async src/cpp/emscripten.cpp)
target_link_libraries(perspective.async psp "${ASYNC_MODE_FLAGS}")
set_target_properties(perspective.async PROPERTIES COMPILE_FLAGS "${ASYNC_MODE_FLAGS}")
set_target_properties(perspective.async PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
set_target_properties(perspective.async PROPERTIES OUTPUT_NAME "psp.async")

add_executable(perspective.sync src/cpp/binding.cpp src/cpp/emscripten.cpp)
add_executable(perspective.sync src/cpp/emscripten.cpp)
target_link_libraries(perspective.sync psp "${SYNC_MODE_FLAGS}")
set_target_properties(perspective.sync PROPERTIES COMPILE_FLAGS "${SYNC_MODE_FLAGS}")
set_target_properties(perspective.sync PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
set_target_properties(perspective.sync PROPERTIES OUTPUT_NAME "psp.sync")
add_dependencies(perspective.sync perspective.async)

if (NOT CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
add_executable(perspective.asm src/cpp/binding.cpp src/cpp/emscripten.cpp)
add_executable(perspective.asm src/cpp/emscripten.cpp)
target_link_libraries(perspective.asm psp "${ASMJS_MODE_FLAGS}")
set_target_properties(perspective.asm PROPERTIES COMPILE_FLAGS "${ASMJS_MODE_FLAGS}")
set_target_properties(perspective.asm PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
Expand All @@ -324,7 +325,7 @@ else()
target_link_libraries(psp ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
set(CMAKE_SHARED_LIBRARY_SUFFIX .so)

add_library(binding SHARED src/cpp/binding.cpp ${CMAKE_SOURCE_DIR}/python/perspective/src/python.cpp)
add_library(binding SHARED ${CMAKE_SOURCE_DIR}/python/perspective/src/python.cpp)
target_link_libraries(binding psp)
target_link_libraries(binding tbb)
target_link_libraries(binding ${BOOST_PYTHON})
Expand Down
28 changes: 0 additions & 28 deletions src/cpp/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,8 @@
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/

#include <perspective/base.h>
#include <perspective/binding.h>
#include <perspective/gnode.h>
#include <perspective/table.h>
#include <perspective/pool.h>
#include <perspective/context_zero.h>
#include <perspective/context_one.h>
#include <perspective/context_two.h>
#include <random>
#include <cmath>
#include <sstream>
#include <perspective/sym_table.h>
#include <codecvt>
#include <boost/optional.hpp>

#ifdef PSP_ENABLE_WASM
#include <perspective/emscripten.h>
#include <emscripten.h>
#include <emscripten/bind.h>
#include <emscripten/val.h>
using namespace emscripten;
#endif

#ifdef PSP_ENABLE_PYTHON

#endif

using namespace perspective;

namespace perspective {
namespace binding {

Expand Down
4 changes: 4 additions & 0 deletions src/include/perspective/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*/
#pragma once

#if defined(PSP_ENABLE_WASM) || defined(PSP_ENABLE_PYTHON)

#include <perspective/base.h>
#include <perspective/binding.h>
#include <perspective/gnode.h>
Expand Down Expand Up @@ -324,3 +326,5 @@ T get_data_two_skip_headers(std::shared_ptr<t_ctx2> ctx, std::uint32_t depth,

}
}

#endif