Code quality: Fixed compilation issues on Windows MSVC

This commit is contained in:
Philippe Tillet
2015-07-28 15:13:43 -07:00
parent 48ee0b548c
commit a94b0f3596
6 changed files with 198 additions and 176 deletions

View File

@@ -19,7 +19,7 @@ endif()
#Compiler flags #Compiler flags
add_definitions(${BACKEND_DEFINES}) add_definitions(${BACKEND_DEFINES})
if(WIN32) if(WIN32)
add_definitions("-DNOMINMAX -DISAAC_DLL") add_definitions("-DNOMINMAX")
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic")

View File

@@ -3,12 +3,13 @@
#include <string> #include <string>
#include <exception> #include <exception>
#include "isaac/defines.h"
namespace isaac namespace isaac
{ {
/** @brief Exception for the case the generator is unable to deal with the operation */ /** @brief Exception for the case the generator is unable to deal with the operation */
class unknown_datatype : public std::exception class ISAACAPI unknown_datatype : public std::exception
{ {
public: public:
unknown_datatype(int); unknown_datatype(int);

View File

@@ -1,10 +1,11 @@
if(ANDROID) if(ANDROID)
add_library(isaac STATIC ${LIBISAAC_SRC}) add_library(isaac STATIC ${LIBISAAC_SRC})
else() else()
if(MSVC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/wrap/clBLAS.def")
endif()
add_library(isaac SHARED ${LIBISAAC_SRC}) add_library(isaac SHARED ${LIBISAAC_SRC})
if(MSVC)
set_target_properties(isaac PROPERTIES COMPILE_FLAGS "-DISAAC_DLL")
set_target_properties(isaac PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/wrap/clBLAS.def")
endif()
endif() endif()
if(OPENCL_FOUND) if(OPENCL_FOUND)

View File

@@ -173,6 +173,11 @@ array& array::operator=(controller<TYPE> const & c)
return *this; return *this;
} }
#define INSTANTIATE(TYPE) template ISAACAPI array& array::operator=<TYPE>(controller<TYPE> const &)
INSTANTIATE(array);
INSTANTIATE(array_expression);
#undef INSTANTIATE
template<class DT> template<class DT>
array & array::operator=(std::vector<DT> const & rhs) array & array::operator=(std::vector<DT> const & rhs)
{ {
@@ -181,6 +186,21 @@ array & array::operator=(std::vector<DT> const & rhs)
return *this; return *this;
} }
#define INSTANTIATE(TYPE) template ISAACAPI array& array::operator=<TYPE>(std::vector<TYPE> const &)
INSTANTIATE(char);
INSTANTIATE(unsigned char);
INSTANTIATE(short);
INSTANTIATE(unsigned short);
INSTANTIATE(int);
INSTANTIATE(unsigned int);
INSTANTIATE(long);
INSTANTIATE(unsigned long);
INSTANTIATE(long long);
INSTANTIATE(unsigned long long);
INSTANTIATE(float);
INSTANTIATE(double);
#undef INSTANTIATE
array & array::operator=(value_scalar const & rhs) array & array::operator=(value_scalar const & rhs)
{ return *this = controller<value_scalar>(rhs); } { return *this = controller<value_scalar>(rhs); }

View File

@@ -14,7 +14,7 @@
; * limitations under the License. ; * limitations under the License.
; * ************************************************************************/ ; * ************************************************************************/
LIBRARY clBLAS LIBRARY isaac
EXPORTS EXPORTS
clblasSetup clblasSetup

2
python/setup.py Normal file → Executable file
View File

@@ -115,7 +115,7 @@ def main():
include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")] include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")]
#Source files #Source files
src = 'src/lib/value_scalar.cpp src/lib/array.cpp src/lib/wrap/clBLAS.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/io.cpp src/lib/model/model.cpp src/lib/model/predictors/random_forest.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/command_queue.cpp src/lib/driver/handle.cpp src/lib/driver/event.cpp src/lib/driver/program.cpp src/lib/driver/kernel.cpp src/lib/driver/device.cpp src/lib/driver/backend.cpp src/lib/driver/platform.cpp src/lib/driver/ndrange.cpp src/lib/driver/context.cpp src/lib/driver/buffer.cpp src/lib/driver/check.cpp src/lib/backend/parse.cpp src/lib/backend/stream.cpp src/lib/backend/mapped_object.cpp src/lib/backend/keywords.cpp src/lib/backend/binder.cpp src/lib/backend/templates/ger.cpp src/lib/backend/templates/gemv.cpp src/lib/backend/templates/gemm.cpp src/lib/backend/templates/dot.cpp src/lib/backend/templates/axpy.cpp src/lib/backend/templates/base.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']] src = 'src/lib/wrap/clBLAS.cpp src/lib/value_scalar.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/io.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/model/predictors/random_forest.cpp src/lib/model/model.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/program.cpp src/lib/driver/platform.cpp src/lib/driver/ndrange.cpp src/lib/driver/kernel.cpp src/lib/driver/handle.cpp src/lib/driver/event.cpp src/lib/driver/device.cpp src/lib/driver/context.cpp src/lib/driver/command_queue.cpp src/lib/driver/check.cpp src/lib/driver/buffer.cpp src/lib/driver/backend.cpp src/lib/backend/templates/ger.cpp src/lib/backend/templates/gemv.cpp src/lib/backend/templates/gemm.cpp src/lib/backend/templates/dot.cpp src/lib/backend/templates/base.cpp src/lib/backend/templates/axpy.cpp src/lib/backend/stream.cpp src/lib/backend/parse.cpp src/lib/backend/mapped_object.cpp src/lib/backend/keywords.cpp src/lib/backend/binder.cpp src/lib/array.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']]
boostsrc = 'external/boost/libs/' boostsrc = 'external/boost/libs/'
for s in ['numpy','python','smart_ptr','system','thread']: for s in ['numpy','python','smart_ptr','system','thread']:
src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x] src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x]