Skip to content

Commit

Permalink
enable msvc win32 project
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Apr 26, 2015
1 parent 5e63b5d commit 6c83a94
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ How to Build Windows Version
=====
* Open the solution file with Visual Studio
* Select x64 and Release in build
- For 32bit windows or python, try win32 and Release (not fully tested)
* Rebuild all

This should give you xgboost.exe for CLI version and xgboost_wrapper.dll for python
Expand Down
3 changes: 3 additions & 0 deletions windows/xgboost/xgboost.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OpenMPSupport>true</OpenMPSupport>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>$(OutDir)\rabit.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down
2 changes: 2 additions & 0 deletions windows/xgboost_wrapper/xgboost_wrapper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OpenMPSupport>true</OpenMPSupport>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>$(OutDir)\rabit.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down
7 changes: 5 additions & 2 deletions wrapper/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os

import platform
from setuptools import setup


Expand All @@ -11,7 +11,10 @@ class XGBoostLibraryNotFound(Exception):
dll_path = [curr_dir]

if os.name == 'nt':
dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/'))
if platform.architecture()[0] == '64bit':
dll_path.append(os.path.join(curr_dir, '../windows/Release/'))
else:
dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/'))

if os.name == 'nt':
dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path]
Expand Down
7 changes: 6 additions & 1 deletion wrapper/xgboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sys
import re
import ctypes
import platform
import collections

import numpy as np
Expand Down Expand Up @@ -40,7 +41,11 @@ class XGBoostLibraryNotFound(Exception):
def load_xglib():
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
dll_path = [curr_path]
dll_path.append(os.path.join(curr_path, '../windows/x64/Release/'))
if os.name == 'nt':
if platform.architecture()[0] == '64bit':
dll_path.append(os.path.join(curr_dir, '../windows/Release/'))
else:
dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/'))

if os.name == 'nt':
dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path]
Expand Down
2 changes: 1 addition & 1 deletion wrapper/xgboost_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ extern "C"{
pmat->info.group_ptr.resize(len + 1);
pmat->info.group_ptr[0] = 0;
for (uint64_t i = 0; i < len; ++i) {
pmat->info.group_ptr[i+1] = pmat->info.group_ptr[i]+group[i];
pmat->info.group_ptr[i+1] = pmat->info.group_ptr[i] + group[i];
}
}
const float* XGDMatrixGetFloatInfo(const void *handle, const char *field, bst_ulong* len) {
Expand Down

0 comments on commit 6c83a94

Please sign in to comment.