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

Add minimal emscripten build support #7954

Merged
merged 2 commits into from May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions python-package/xgboost/libpath.py
Expand Up @@ -43,8 +43,7 @@ def find_lib_path() -> List[str]:
# directory here
dll_path.append(os.path.join(curr_path, './windows/Release/'))
dll_path = [os.path.join(p, 'xgboost.dll') for p in dll_path]
elif sys.platform.startswith('linux') or sys.platform.startswith(
'freebsd'):
elif sys.platform.startswith(('linux', 'freebsd', 'emscripten')):
dll_path = [os.path.join(p, 'libxgboost.so') for p in dll_path]
elif sys.platform == 'darwin':
dll_path = [os.path.join(p, 'libxgboost.dylib') for p in dll_path]
Expand Down
5 changes: 4 additions & 1 deletion src/common/host_device_vector.cc
Expand Up @@ -180,13 +180,16 @@ template class HostDeviceVector<uint64_t>; // bst_row_t
template class HostDeviceVector<uint32_t>; // bst_feature_t
template class HostDeviceVector<RegTree::Segment>;

#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
/*
* On OSX:
*
* typedef unsigned int uint32_t;
* typedef unsigned long long uint64_t;
* typedef unsigned long __darwin_size_t;
*
* On Emscripten:
* typedef unsigned long size_t;
*/
template class HostDeviceVector<std::size_t>;
#endif // defined(__APPLE__)
Expand Down