Skip to content

Commit

Permalink
Move a few GPL files to separate shogun_gpl folder
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf committed Mar 8, 2017
1 parent 9cbd1a1 commit 5aaad23
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/modular/Minimizer.i
Expand Up @@ -50,6 +50,6 @@
#ifdef USE_GPL_SHOGUN
#ifdef HAVE_NLOPT
%include <shogun/optimization/nloptcommon.h>
%include <shogun/optimization/NLOPTMinimizer.h>
%include <shogun_gpl/optimization/NLOPTMinimizer.h>
#endif //HAVE_NLOPT
#endif //USE_GPL_SHOGUN
2 changes: 1 addition & 1 deletion src/interfaces/modular/Minimizer_includes.i
Expand Up @@ -6,7 +6,7 @@
#ifdef USE_GPL_SHOGUN
#ifdef HAVE_NLOPT
#include <shogun/optimization/nloptcommon.h>
#include <shogun/optimization/NLOPTMinimizer.h>
#include <shogun_gpl/optimization/NLOPTMinimizer.h>
#endif //HAVE_NLOPT
#endif //USE_GPL_SHOGUN
%}
4 changes: 3 additions & 1 deletion src/interfaces/modular/Multiclass.i
Expand Up @@ -53,7 +53,9 @@
%rename(ECOCLLBDecoder) CECOCLLBDecoder;

%rename(MulticlassTreeGuidedLogisticRegression) CMulticlassTreeGuidedLogisticRegression;
#ifdef USE_GPL_SHOGUN
%rename(MulticlassLogisticRegression) CMulticlassLogisticRegression;
#endif //USE_GPL_SHOGUN
%rename(MulticlassLibLinear) CMulticlassLibLinear;
%rename(MulticlassOCAS) CMulticlassOCAS;
%rename(MulticlassSVM) CMulticlassSVM;
Expand Down Expand Up @@ -122,7 +124,7 @@ namespace shogun
%include <shogun/multiclass/ecoc/ECOCStrategy.h>

%include <shogun/multiclass/MulticlassTreeGuidedLogisticRegression.h>
%include <shogun/multiclass/MulticlassLogisticRegression.h>
%include <shogun_gpl/multiclass/MulticlassLogisticRegression.h>
%include <shogun/multiclass/MulticlassLibLinear.h>
%include <shogun/multiclass/MulticlassOCAS.h>
%include <shogun/multiclass/MulticlassSVM.h>
Expand Down
4 changes: 3 additions & 1 deletion src/interfaces/modular/Multiclass_includes.i
Expand Up @@ -47,7 +47,9 @@
#include <shogun/multiclass/ecoc/ECOCLLBDecoder.h>

#include <shogun/multiclass/MulticlassTreeGuidedLogisticRegression.h>
#include <shogun/multiclass/MulticlassLogisticRegression.h>
#ifdef USE_GPL_SHOGUN
#include <shogun_gpl/multiclass/MulticlassLogisticRegression.h>
#endif //USE_GPL_SHOGUN
#include <shogun/multiclass/MulticlassLibLinear.h>
#include <shogun/multiclass/MulticlassOCAS.h>
#include <shogun/multiclass/MulticlassSVM.h>
Expand Down
6 changes: 6 additions & 0 deletions src/shogun/CMakeLists.txt
Expand Up @@ -3,6 +3,12 @@ INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}/src
)

IF(${USE_GPL_SHOGUN} AND EXISTS ${CMAKE_SOURCE_DIR}/src/shogun/gpl)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/shogun/gpl
)
ENDIF()

include(GenerateExportHeader)
include(CMakeDependentOption)
include(CheckIncludeFile)
Expand Down
9 changes: 4 additions & 5 deletions src/shogun/base/class_list.cpp.py
Expand Up @@ -8,6 +8,8 @@
# Written (W) 2008-2009 Soeren Sonnenburg
# Copyright (C) 2008-2009 Fraunhofer Institute FIRST and Max Planck Society

import os.path

class_str = 'class'
types = ["BOOL", "CHAR", "INT8", "UINT8", "INT16", "UINT16", "INT32", "UINT32",
"INT64", "UINT64", "FLOAT32", "FLOAT64", "FLOATMAX", "COMPLEX128"]
Expand Down Expand Up @@ -81,12 +83,11 @@ def extract_class_name(lines, line_nr, line, blacklist):
return c[1:]


def get_includes(classes, basedir="."):
def get_includes(classes, basedir=".", src_dir="shogun"):
class_headers = []
for c, t in classes:
class_headers.append(c+".h")

import os
result = []
for root, dirs, files in os.walk(basedir):
for f in files:
Expand All @@ -96,7 +97,7 @@ def get_includes(classes, basedir="."):
includes = []
result.sort()
for o in result:
includes.append('#include <shogun/%s>' % o.strip().lstrip('./'))
includes.append('#include <%s/%s>' % (src_dir, o.strip().lstrip('./')))
return includes


Expand Down Expand Up @@ -289,7 +290,6 @@ def get_blacklist():


def get_base_src_dir(headers):
import os.path
return os.path.commonprefix(headers)


Expand All @@ -306,7 +306,6 @@ def get_base_src_dir(headers):
HEADERS = sys.argv[2:]

blacklist = get_blacklist()

base_src_dir = get_base_src_dir(HEADERS)
classes = extract_classes(HEADERS, False, blacklist, False)
template_classes = extract_classes(HEADERS, True, blacklist, False)
Expand Down
Expand Up @@ -10,7 +10,6 @@


#include <shogun/multiclass/MulticlassLogisticRegression.h>
#ifdef USE_GPL_SHOGUN
#include <shogun/multiclass/MulticlassOneVsRestStrategy.h>
#include <shogun/io/SGIO.h>
#include <shogun/mathematics/Math.h>
Expand Down Expand Up @@ -101,4 +100,3 @@ bool CMulticlassLogisticRegression::train_machine(CFeatures* data)
}
return true;
}
#endif //USE_GPL_SHOGUN
Expand Up @@ -11,7 +11,6 @@
#ifndef MULTICLASSLOGISTICREGRESSION_H_
#define MULTICLASSLOGISTICREGRESSION_H_
#include <shogun/lib/config.h>
#ifdef USE_GPL_SHOGUN
#include <shogun/lib/common.h>
#include <shogun/features/DotFeatures.h>
#include <shogun/machine/LinearMulticlassMachine.h>
Expand Down Expand Up @@ -111,5 +110,4 @@ class CMulticlassLogisticRegression : public CLinearMulticlassMachine

};
}
#endif //USE_GPL_SHOGUN
#endif
Expand Up @@ -35,7 +35,6 @@
#include <algorithm>

using namespace shogun;
#ifdef USE_GPL_SHOGUN
CNLOPTMinimizer::CNLOPTMinimizer()
:FirstOrderMinimizer()
{
Expand Down Expand Up @@ -284,4 +283,3 @@ void CNLOPTMinimizer::init_minimization()
}
#endif

#endif //USE_GPL_SHOGUN
Expand Up @@ -34,7 +34,6 @@
#define CNLOPTMINIMIZER_H
#include <shogun/optimization/FirstOrderMinimizer.h>

#ifdef USE_GPL_SHOGUN
#ifdef HAVE_NLOPT
#include <shogun/optimization/nloptcommon.h>
#endif
Expand Down Expand Up @@ -136,6 +135,5 @@ class CNLOPTMinimizer: public FirstOrderMinimizer
};

}
#endif //USE_GPL_SHOGUN
#endif /* CNLOPTMINIMIZER_H */

Expand Up @@ -63,7 +63,9 @@
#include <shogun/machine/gp/SoftMaxLikelihood.h>
#include <shogun/optimization/lbfgs/LBFGSMinimizer.h>

#ifdef USE_GPL_SHOGUN
#include <shogun/optimization/NLOPTMinimizer.h>
#endif

using namespace shogun;

Expand Down

0 comments on commit 5aaad23

Please sign in to comment.