ENABLE_TESTING()
SET(BUILD_SHARED_LIBS TRUE)
+IF(WIN32)
+ SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ENDIF(WIN32)
+
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
IF(EXISTS ${CONFIGURATION_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
INCLUDE(SalomeSetupPlatform) # From CONFIGURATION
# Always build libraries as shared objects:
SET(BUILD_SHARED_LIBS TRUE)
-
OPTION(YDEFX_BUILD_GUI "Generate widgets" ON)
-
-FIND_PACKAGE(Py2cpp REQUIRED)
+IF(WIN32)
+ SET(PY2CPP_ROOT_DIR $ENV{PY2CPP_ROOT_DIR})
+ELSE(WIN32)
+ FIND_PACKAGE(Py2cpp REQUIRED)
+ENDIF(WIN32)
IF(NOT SalomeKERNEL_FOUND)
MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used")
Launcher.hxx
PyStudyJob.hxx
TPyStudyJob.hxx
- ydefxExports.hxx
)
-SET(ydefx_LINK
- py2cpp
- ${PYTHON_LIBRARIES}
-)
+IF(WIN32)
+ SET(ydefx_LINK
+ ${PY2CPP_ROOT_DIR}/lib/py2cpp.lib
+ ${PYTHON_LIBRARIES}
+ ${PLATFORM_LIBS}
+ )
+ELSE(WIN32)
+ SET(ydefx_LINK
+ py2cpp
+ ${PYTHON_LIBRARIES}
+ )
+ENDIF(WIN32)
ADD_LIBRARY(ydefx ${ydefx_SOURCES})
TARGET_LINK_LIBRARIES(ydefx ${ydefx_LINK})
-TARGET_INCLUDE_DIRECTORIES(ydefx PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cpp>
- $<INSTALL_INTERFACE:${SALOME_INSTALL_HEADERS}>)
-
+IF(WIN32)
+ TARGET_INCLUDE_DIRECTORIES(ydefx PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cpp>
+ $<INSTALL_INTERFACE:${SALOME_INSTALL_HEADERS}>
+ ${PY2CPP_ROOT_DIR}/include)
+ELSE(WIN32)
+ TARGET_INCLUDE_DIRECTORIES(ydefx PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cpp>
+ $<INSTALL_INTERFACE:${SALOME_INSTALL_HEADERS}>)
+ENDIF(WIN32)
INSTALL(TARGETS ydefx DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(TARGETS ydefx EXPORT ydefxCfg_cmake LIBRARY DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${ydefx_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}/ydefx)
//
#ifndef YDEFX_EXCEPTIONS_HXX
#define YDEFX_EXCEPTIONS_HXX
-#include "ydefxExports.hxx"
#include <string>
namespace ydefx
{
-class YDEFX_EXPORT Exception:public std::exception
+class Exception:public std::exception
{
public:
Exception(const std::string& message);
//
#ifndef YDEFX_JOB_H
#define YDEFX_JOB_H
-#include "ydefxExports.hxx"
#include <string>
namespace ydefx
{
-class YDEFX_EXPORT Job
+class Job
{
public:
virtual ~Job(){}
//
#ifndef YDEFX_JOBPARAMETERSPROXY_H
#define YDEFX_JOBPARAMETERSPROXY_H
-#include "ydefxExports.hxx"
#include <string>
#include <list>
#include <map>
namespace ydefx
{
-class YDEFX_EXPORT JobParametersProxy
+class JobParametersProxy
{
public:
JobParametersProxy();
#ifndef YDEFX_LAUNCHER_H
#define YDEFX_LAUNCHER_H
-#include "ydefxExports.hxx"
#include "TMonoPyJob.hxx"
#include "TPyStudyJob.hxx"
namespace ydefx
{
class Job;
-class YDEFX_EXPORT Launcher
+class Launcher
{
public:
Launcher():_lastError(){}
//
#ifndef YDEFX_MONOPYJOB_HXX
#define YDEFX_MONOPYJOB_HXX
-#include "ydefxExports.hxx"
#include "Job.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
{
-class YDEFX_EXPORT MonoPyJob : public Job
+class MonoPyJob : public Job
{
public:
MonoPyJob();
//
#ifndef YDEFX_PYCONVERSIONS_HXX
#define YDEFX_PYCONVERSIONS_HXX
-#include "ydefxExports.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
}
namespace py2cpp
{
-YDEFX_EXPORT PyObject * toPy(const ydefx::JobParametersProxy& jp);
-YDEFX_EXPORT PyObject * toPy(const ydefx::PyStudyFunction& jp);
+PyObject * toPy(const ydefx::JobParametersProxy& jp);
+PyObject * toPy(const ydefx::PyStudyFunction& jp);
}
#include <py2cpp/py2cpp.hxx>
//
#ifndef YDEFX_PYSTUDYFUNCTION_H
#define YDEFX_PYSTUDYFUNCTION_H
-#include "ydefxExports.hxx"
#include "StudyFunction.hxx"
#include "PyConversions.hxx"
namespace ydefx
{
-class YDEFX_EXPORT PyStudyFunction : StudyFunction
+class PyStudyFunction : StudyFunction
{
public:
PyStudyFunction();
//
#ifndef YDEFX_PYSTUDYJOB_HXX
#define YDEFX_PYSTUDYJOB_HXX
-#include "ydefxExports.hxx"
#include "Job.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
{
-class YDEFX_EXPORT PyStudyJob : public Job
+class PyStudyJob : public Job
{
public:
PyStudyJob(const std::string& pymodule_name, const std::string& pyclass_name);
#ifndef YDEFX_SAMPLE_H\r
#define YDEFX_SAMPLE_H\r
\r
-#include "ydefxExports.hxx"\r
#include <vector>\r
#include <string>\r
#include <list>\r
{\r
\r
template <class T>\r
-class YDEFX_EXPORT VariablesGroup\r
+class VariablesGroup\r
{\r
public:\r
VariablesGroup();\r
T _defaultValue;\r
};\r
\r
-enum class YDEFX_EXPORT ExecutionState {NOTEXECUTED, DONE, ERROR};\r
+enum class ExecutionState {NOTEXECUTED, DONE, ERROR};\r
\r
template <class T>\r
-class YDEFX_EXPORT OneTypeSample\r
+class OneTypeSample\r
{\r
public:\r
const VariablesGroup<T>& inputs()const;\r
\r
// no type sample\r
template <>\r
-class YDEFX_EXPORT Sample<>\r
+class Sample<>\r
{\r
public:\r
const std::vector<std::string>& errors()const{return _errors;}\r
\r
// multi type sample\r
template <class T, class... Ts>\r
-class YDEFX_EXPORT Sample<T, Ts...> : public OneTypeSample<T>, public Sample<Ts...>\r
+class Sample<T, Ts...> : public OneTypeSample<T>, public Sample<Ts...>\r
{\r
public:\r
virtual ExecutionState pointState(int index);\r
#ifndef YDEFX_SAMPLEPYCONVERSIONS_HXX
#define YDEFX_SAMPLEPYCONVERSIONS_HXX
-#include "ydefxExports.hxx"
#include <py2cpp/py2cpp.hxx>
#include "Sample.hxx"
#include "Exceptions.hxx"
* list of sample types.
*/
template <class S, class... Ts>
-YDEFX_EXPORT class SamplePyConverter;
+class SamplePyConverter;
/*!
* Convert input variables of a sample to a python dictionary.
* The returned value is NULL in case of error.
*/
template <class ...Ts>
-YDEFX_EXPORT PyObject* inputToPy(const Sample<Ts...>& sample);
+PyObject* inputToPy(const Sample<Ts...>& sample);
/*!
* Fill the input values of the sample from a python dictionary.
* Keys from the python dictionary that do not exist in the sample are ignored.
*/
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample);
+py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* Convert output variables of a sample to a python dictionary.
* The returned value is NULL in case of error.
*/
template <class ...Ts>
-YDEFX_EXPORT PyObject* outputToPy(const Sample<Ts...>& sample);
+PyObject* outputToPy(const Sample<Ts...>& sample);
/*!
* Fill the output values of a sample from a python dictionary.
* ignored.
*/
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample);
+py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* Fill the error values of a sample from a python list of strings.
* strings.
*/
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
+py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* Fetch output values and errors from the python objet.
* function is called.
*/
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(PyObject* obj, Sample<Ts...>& sample);
+py2cpp::ConversionCheck fetchResults(PyObject* obj, Sample<Ts...>& sample);
////////////////////////////////////////////////////////////////////////////////
// Template implementations
////////////////////////////////////////////////////////////////////////////////
template <class S>
-class YDEFX_EXPORT SamplePyConverter<S>
+class SamplePyConverter<S>
{
public:
bool inputToPy(const S& sample, PyObject* result){return true;}
};
template <class S, class T, class... Ts>
-class YDEFX_EXPORT SamplePyConverter<S,T, Ts...> : public SamplePyConverter<S, Ts...>
+class SamplePyConverter<S,T, Ts...> : public SamplePyConverter<S, Ts...>
{
public:
/*! Add sample.inputs<T> to result.
return ok;
}
- YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, S& sample)
+ py2cpp::ConversionCheck inputFromPy(PyObject* obj, S& sample)
{
py2cpp::ConversionCheck check;
std::list<std::string> names = sample.OneTypeSample<T>::inputs().names();
return check;
}
- YDEFX_EXPORT bool outputToPy(const S& sample, PyObject* result)
+ bool outputToPy(const S& sample, PyObject* result)
{
bool ok = true;
std::size_t maxsize = sample.maxSize();
return ok;
}
- YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, S& sample)
+ py2cpp::ConversionCheck outputFromPy(PyObject* obj, S& sample)
{
py2cpp::ConversionCheck check;
std::list<std::string> names = sample.OneTypeSample<T>::outputs().names();
};
template <class ...Ts>
-YDEFX_EXPORT PyObject* inputToPy(const Sample<Ts...>& sample)
+PyObject* inputToPy(const Sample<Ts...>& sample)
{
PyObject * result = PyDict_New();
if(result)
}
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample)
+py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyDict_Check(obj))
}
template <class ...Ts>
-YDEFX_EXPORT PyObject* outputToPy(const Sample<Ts...>& sample)
+PyObject* outputToPy(const Sample<Ts...>& sample)
{
PyObject * result = PyDict_New();
if(result)
}
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample)
+py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyDict_Check(obj))
}
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample)
+py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyList_Check(obj))
}
template <class ...Ts>
-YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
+py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
check.addError(outputFromPy(obj.getAttr("_output").get(), sample));
//
#ifndef YDEFX_STUDYFUNCTION_H
#define YDEFX_STUDYFUNCTION_H
-#include "ydefxExports.hxx"
#include <string>
#include <list>
namespace ydefx
{
-class YDEFX_EXPORT StudyFunction
+class StudyFunction
{
public:
virtual ~StudyFunction(){}
//
#ifndef YDEFX_TMONOPYJOB_HXX
#define YDEFX_TMONOPYJOB_HXX
-#include "ydefxExports.hxx"
#include "JobParametersProxy.hxx"
#include "MonoPyJob.hxx"
#include "SamplePyConversions.hxx"
namespace ydefx
{
template <class ...Ts>
-class YDEFX_EXPORT TMonoPyJob : public MonoPyJob
+class TMonoPyJob : public MonoPyJob
{
public:
//! Create a new job.
//
#ifndef YDEFX_TPYSTUDYJOB_HXX
#define YDEFX_TPYSTUDYJOB_HXX
-#include "ydefxExports.hxx"
#include "JobParametersProxy.hxx"
#include "PyStudyJob.hxx"
#include "SamplePyConversions.hxx"
namespace ydefx
{
template <class ...Ts>
-class YDEFX_EXPORT TPyStudyJob : public PyStudyJob
+class TPyStudyJob : public PyStudyJob
{
public:
//! Create a new job using the default pystudy class.
FIND_PACKAGE(SalomeCppUnit REQUIRED)
# additional include directories
-INCLUDE_DIRECTORIES(
- ${CPPUNIT_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/..
-)
+SET(_include_DIRECTORIES
+ ${CPPUNIT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
+ )
+IF(WIN32)
+ LIST(APPEND _include_DIRECTORIES ${PY2CPP_ROOT_DIR}/include)
+ENDIF(WIN32)
+
+INCLUDE_DIRECTORIES(${_include_DIRECTORIES})
+IF(WIN32)
+ SET(py2cpp_lib ${PY2CPP_ROOT_DIR}/lib/py2cpp.lib)
+ELSE(WIN32)
+ SET(py2cpp_lib py2cpp)
+ENDIF(WIN32)
# libraries to link to
SET(_link_LIBRARIES
${CPPUNIT_LIBRARIES}
- py2cpp
+ ${py2cpp_lib}
ydefx
)
//
#ifndef YDEFX_YACSSTUDYFUNCTION_H
#define YDEFX_YACSSTUDYFUNCTION_H
-#include "ydefxExports.hxx"
#include "StudyFunction.hxx"
namespace ydefx
{
//TODO not implemented!
-class YDEFX_EXPORT YacsStudyFunction : StudyFunction
+class YacsStudyFunction : StudyFunction
{
public:
YacsStudyFunction();
+++ /dev/null
-// Copyright (C) 2021 EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#pragma once
-
-#ifdef WIN32
-# if defined(ydefx_EXPORTS) || defined(ydefx_EXPORTS)
-# define YDEFX_EXPORT __declspec( dllexport )
-# else
-# define YDEFX_EXPORT __declspec( dllimport )
-# endif
-#else
-# define YDEFX_EXPORT
-#endif
SET(YDEFXGUI_HEADERS
ResourceWidget.hxx
- ydefxguiExports.hxx
)
SET(YDEFXGUI_link_LIBRARIES
//
#ifndef IDEFX_ParamsConfigWidget_HXX
#define IDEFX_ParamsConfigWidget_HXX
-#include "ydefxguiExports.hxx"
#include "JobParametersProxy.hxx"
#include <QtWidgets>
namespace ydefx
{
-class YDEFXGUI_EXPORT ParamsConfigWidget: public QScrollArea
+class ParamsConfigWidget: public QScrollArea
{
Q_OBJECT
public:
//
#ifndef IDEFX_PathsConfigWidget_HXX
#define IDEFX_PathsConfigWidget_HXX
-#include "ydefxguiExports.hxx"
#include "JobParametersProxy.hxx"
#include <QtWidgets>
namespace ydefx
{
-class YDEFXGUI_EXPORT PathsConfigWidget: public QScrollArea
+class PathsConfigWidget: public QScrollArea
{
Q_OBJECT
public:
//
#ifndef IDEFX_QuickConfigWidget_HXX
#define IDEFX_QuickConfigWidget_HXX
-#include "ydefxguiExports.hxx"
#include "JobParametersProxy.hxx"
#include <QtWidgets>
namespace ydefx
{
-class YDEFXGUI_EXPORT QuickConfigWidget: public QScrollArea
+class QuickConfigWidget: public QScrollArea
{
Q_OBJECT
public:
//
#ifndef IDEFX_RESOURCEWIDGET_HXX
#define IDEFX_RESOURCEWIDGET_HXX
-#include "ydefxguiExports.hxx"
#include "JobParametersProxy.hxx"
#include <QtWidgets>
namespace ydefx
{
-class YDEFXGUI_EXPORT ResourceWidget: public QTabWidget
+class ResourceWidget: public QTabWidget
{
Q_OBJECT
public: