Commit cb7378fd authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

fix CMakeLists for Windows / CLion

parent 1ac216c8
# Folders
Libraries
lib
build
Build
Results
Logs
.idea
Libraries/
lib/
build/
cmake-build-debug/
Build/
Results/
Logs/
.idea/
# CMake
CMakeFiles/
......
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
HINTS
$ENV{SPHINX_DIR}
PATH_SUFFIXES bin
DOC "Sphinx documentation generator"
HINTS
$ENV{SPHINX_DIR}
PATH_SUFFIXES bin
DOC "Sphinx documentation generator"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sphinx DEFAULT_MSG
SPHINX_EXECUTABLE
SPHINX_EXECUTABLE
)
mark_as_advanced(SPHINX_EXECUTABLE)
cmake_minimum_required(VERSION 3.9)
project(DPsim)
cmake_minimum_required(VERSION 3.5)
project(DPsim CXX)
# enable C++11 support
set(CMAKE_CXX_STANDARD 11)
set(PROJECT_AUTHOR "Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
set(PROJECT_COPYRIGHT "2017, Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
......@@ -11,6 +14,15 @@ set(DPSIM_VERSION ${DPSIM_MAJOR_VERSION}.${DPSIM_MINOR_VERSION}.${DPSIM_PATCH_VE
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
# library configuration etc.
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/eigen)
set(EIGEN3_INCLUDE_DIR Libraries/eigen)
else()
find_package(Eigen3 REQUIRED)
endif()
include_directories(${EIGEN3_INCLUDE_DIR})
add_subdirectory(Documentation)
add_subdirectory(Source)
add_subdirectory(Examples/C++)
......@@ -23,3 +35,10 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "3")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
# Show feature summary
include(FeatureSummary)
feature_summary(WHAT ALL
VAR enabledFeaturesText)
message(STATUS "${enabledFeaturesText}")
\ No newline at end of file
......@@ -21,11 +21,11 @@
*********************************************************************************/
#include <iostream>
#include <string>
#include <cstring>
#include "CIMTest.h"
#include "../CIMReader.h"
#include "../Simulation.h"
#include "CIM/CIMReader.h"
#include "Simulation.h"
void readFixedCIMFiles() {
std::list<std::string> filenames;
......
......@@ -21,16 +21,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#ifdef __cim__
#pragma once
#ifndef CIMTEST_H
#define CIMTEST_H
#include "../CIMReader.h"
#include "CIM/CIMReader.h"
void readFixedCIMFiles();
int testCIMReader(std::list<std::string> filenames);
#endif
#endif
cmake_minimum_required(VERSION 3.5)
project(DPsimExample)
# library configuration etc.
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../Libraries/eigen)
set(EIGEN3_INCLUDE_DIR ../Libraries/eigen)
else()
find_package(Eigen3 REQUIRED)
endif()
include_directories(${EIGEN3_INCLUDE_DIR} "../../Source")
if (NOT WIN32)
......@@ -25,7 +18,19 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# add files
file(GLOB SOURCES *.cpp)
set(SOURCES
DPsimExample.cpp
ReferenceCircuits.cpp
SimpleCircuitTest.cpp
SyncGenUnitTestVBR.cpp
SynchronGenUnitTest.cpp
)
if(LINUX)
list(APPEND SOURCES
ShmemTest.cpp
)
endif()
# targets
add_executable(${PROJECT_NAME} ${SOURCES})
......
......@@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
//shmemDistributedRef();
// #### Reference circuits test ################
//simulationExample1();
simulationExample1();
//simulationExample2();
//simulationExample3();
//simulationExampleIdealVS();
......
......@@ -21,19 +21,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#ifdef __python__
#ifndef PYTHONTEST
#define PYTHONTEST
#pragma once
#include <Python.h>
#include "PyComponent.h"
#include "PySimulation.h"
#include "Python/Component.h"
#include "Python/Simulation.h"
namespace DPsim {
void pythonExampleMain()
void pythonExampleMain();
}
#endif
#endif
......@@ -20,12 +20,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#ifdef __linux__
#include "ShmemTest.h"
#include "../Simulation.h"
#include "../ShmemInterface.h"
#include "../Utilities.h"
#include "Simulation.h"
#include "ShmemInterface.h"
#include "Utilities.h"
using namespace DPsim;
......@@ -312,5 +310,3 @@ void DPsim::exampleMainShmem() {
delete intf;
}
}
#endif
......@@ -21,10 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#ifdef __linux__
#ifndef SHMEMTEST_H
#define SHMEMTEST_H
#pragma once
#include "ShmemInterface.h"
......@@ -37,8 +34,4 @@ namespace DPsim {
void shmemDistributedRef();
void exampleMainShmem();
}
#endif
#endif
}
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
if (NOT WIN32)
# needed so CIMParser and arabica (which are first compiled into static libs)
# can be included in the .so
......@@ -9,20 +7,6 @@ if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings")
endif()
# enable C++11 support
set(CMAKE_CXX_STANDARD 11)
# library configuration etc.
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../Libraries/eigen)
set(EIGEN3_INCLUDE_DIR ../Libraries/eigen)
else()
find_package(Eigen3 REQUIRED)
endif()
set(Python_ADDITIONAL_VERSIONS 3.5 3.6 3.7)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
if(WIN32)
set(PYTHON_MODULE_SUFFIX "pyd")
set(ARABICA_XML_BACKEND USE_MSXML)
......@@ -33,16 +17,41 @@ else(APPLE)
set(PYTHON_MODULE_SUFFIX "so")
endif()
include_directories(${EIGEN3_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
file(GLOB SOURCES *.cpp Components/*.cpp)
add_library(dpsim STATIC ${SOURCES})
set(USE_CIM_VERSION "IEC61970_16v29a")
add_subdirectory(CIM-XML-Parser)
target_include_directories(dpsim PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB SOURCES *.cpp Components/*.cpp)
add_library(dpsim SHARED ${SOURCES})
target_link_libraries(dpsim CIMParser ${PYTHON_LIBRARIES} ${LIBS})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE PYTHON_PKGPATH)
# Python module
set(Python_ADDITIONAL_VERSIONS 3.5 3.6 3.7)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
file(GLOB PYTHON_SOURCES Python/*.cpp)
include_directories(${PYTHON_INCLUDE_DIRS})
link_libraries(${PYTHON_LIBRARIES})
ADD_CUSTOM_TARGET(link_dpsim ALL DEPENDS dpsim COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:dpsim> dpsim.${PYTHON_MODULE_SUFFIX})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE PYTHON_PKGPATH)
ADD_CUSTOM_TARGET(link_dpsim ALL DEPENDS dpsim COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:dpsim> dpsim.${PYTHON_MODULE_SUFFIX})
install(FILES $<TARGET_FILE:dpsim> DESTINATION ${PYTHON_PKGPATH} RENAME dpsim.${PYTHON_MODULE_SUFFIX})
endif()
# CIM Parser
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../CIM-XML-Parser)
set(USE_CIM_VERSION "IEC61970_16v29a")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../CIM-XML-Parser)
file(GLOB CIM_SOURCES CIM/*.cpp)
link_libraries(${PYTHON_LIBRARIES})
target_sources(dpsim ${CIM_SOURCES})
endif()
install(FILES $<TARGET_FILE:dpsim> DESTINATION ${PYTHON_PKGPATH} RENAME dpsim.${PYTHON_MODULE_SUFFIX})
#install(TARGETS dpsim
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
#)
\ No newline at end of file
......@@ -42,7 +42,7 @@ std::string BaseComponent::getType()
return ret;
#else
const char *unmangled
const char *unmangled;
unmangled = abi::__cxa_demangle(mangled, NULL, NULL, &status);
......
......@@ -22,6 +22,7 @@
#include "Utilities.h"
#include <cstring>
#include <iostream>
using namespace DPsim;
......@@ -88,7 +89,6 @@ bool DPsim::parseInt(const char *s, int *i) {
return (end != s && !*end);
}
int DPsim::parseArguments(int argc, const char* argv[],
bool &rt, bool &batch, int &split, std::string &interfaceBase, std::string &splitNode) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment