Commit 943f49e6 authored by Markus Mirz's avatar Markus Mirz
Browse files

remove submodules and use cmake fetch_content

parent 05ce8a6a
[submodule "Examples/CIM/grid-data"]
path = Examples/CIM/grid-data
url = https://git.rwth-aachen.de/acs/public/grid-data/cim-grid-data.git
[submodule "Dependencies/eigen"]
path = Dependencies/eigen
url = https://github.com/eigenteam/eigen-git-mirror.git
[submodule "Dependencies/libcimpp"]
path = Dependencies/libcimpp
url = https://github.com/cim-iec/libcimpp.git
[submodule "Dependencies/spdlog"]
path = Dependencies/spdlog
url = https://github.com/gabime/spdlog.git
set(CIMPP_DIR Dependencies/libcimpp)
option(WITH_CIM_SUBMODULE "Build with CIMpp as submodule" OFF)
set(CIM_VERSION "16v29a")
set(USE_CIM_VERSION "IEC61970_16v29a")
include(FindPackageHandleStandardArgs)
if(WIN32 AND NOT WITH_CIM_SUBMODULE)
set(CIMPP_INCLUDE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/${CIMPP_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/${CIMPP_DIR}/${CIM_VERSION}
)
find_library(CIMPP_LIBRARY
NAMES libcimpp.lib
PATH_SUFFIXES
Debug
Release
PATHS
${CMAKE_CURRENT_BINARY_DIR}/${CIMPP_DIR}
)
set(ARABICA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${CIMPP_DIR}/thirdparty/arabica/include)
find_library(ARABICA_LIBRARY
NAMES arabica.lib
PATH_SUFFIXES
Debug
Release
PATHS
${CMAKE_CURRENT_BINARY_DIR}/${CIMPP_DIR}/thirdparty/arabica
)
find_package_handle_standard_args(CIMpp DEFAULT_MSG CIMPP_LIBRARY CIMPP_INCLUDE_DIR)
mark_as_advanced(CIMPP_INCLUDE_DIR)
if(CIMPP_LIBRARY AND ARABICA_LIBRARY)
set(WITH_CIM_SUBMODULE OFF)
else()
set(WITH_CIM_SUBMODULE ON)
set(CIMPP_INCLUDE_DIR "")
set(CIMPP_LIBRARY "")
set(ARABICA_INCLUDE_DIR "")
set(ARABICA_LIBRARY "")
endif()
endif()
if (WITH_CIM_SUBMODULE)
# When adding CIMpp via a subdirectory, all the neccessary
# details about include directories, library name and path
# are associated with the CIMpp target 'libcimpp'
# We therefore do not need to keep track of CIMPP_INCLUDE_DIR
# seperately
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
add_subdirectory(Dependencies/libcimpp)
set(CIMPP_LIBRARY libcimpp)
set(CIMPP_LIBRARIES ${CIMPP_LIBRARY})
set(CIMPP_INCLUDE_DIR "")
find_package_handle_standard_args(CIMpp DEFAULT_MSG CIMPP_LIBRARY)
elseif(NOT WIN32)
find_path(CIMPP_INCLUDE_DIR
NAMES CIMModel.hpp
PATH_SUFFIXES
cimpp/${CIM_VERSION}
${CIM_VERSION}
include/src
)
find_library(CIMPP_LIBRARY
NAMES cimpp${CIM_VERSION}
PATH_SUFFIXES
lib/static
)
# handle the QUIETLY and REQUIRED arguments and set CIMPP_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(CIMpp DEFAULT_MSG CIMPP_LIBRARY CIMPP_INCLUDE_DIR)
mark_as_advanced(CIMPP_INCLUDE_DIR)
endif()
mark_as_advanced(CIMPP_LIBRARY)
set(CIMPP_LIBRARIES ${CIMPP_LIBRARY} ${ARABICA_LIBRARY})
set(CIMPP_INCLUDE_DIRS ${CIMPP_INCLUDE_DIR} ${ARABICA_INCLUDE_DIR})
option(WITH_EIGEN_SUBMODULE "Build with Eigen as submodule" OFF)
if (WITH_EIGEN_SUBMODULE OR WIN32)
# This could be used when an optimized version of eigen is required
# add_subdirectory(Dependencies/eigen)
find_path(EIGEN3_INCLUDE_DIR
NAMES signature_of_eigen3_matrix_library
PATHS
Dependencies/eigen
)
else()
set(TEMP_PATH ${CMAKE_MODULE_PATH})
# We temporarily clear the module path to avoid recursion
set(CMAKE_MODULE_PATH "")
find_package(Eigen3 REQUIRED)
set(CMAKE_MODULE_PATH ${TEMP_PATH})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 REQUIRED_VARS EIGEN3_INCLUDE_DIR)
......@@ -5,7 +5,7 @@ set(PROJECT_AUTHOR "Institute for Automation of Complex Power Systems, RWTH Aach
set(PROJECT_COPYRIGHT "2017-2020, Institute for Automation of Complex Power Systems, RWTH Aachen University")
set(PROJECT_DESCRIPTION "C++ Power System Simulation Library")
set(PROJECT_HOMEPAGE_URL "https://dpsim.fein-aachen.org/")
set(PROJECT_VCS_URL "https://git.rwth-aachen.org/acs/public/simulation/dpsim")
set(PROJECT_VCS_URL "https://github.com/dpsim-simulator/dpsim.git")
# Required for dpsim_python
if(POLICY CMP0076)
......@@ -28,17 +28,19 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL Intel)
# needed by icc, but for some reason not added by CMake
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
add_definitions(-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING)
if(NOT WIN32)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake;${PROJECT_SOURCE_DIR}/models/CMake")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(CheckCXXCompilerFlag)
if(MSVC)
# Silence Visual Studio deprecation warnings
add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
add_definitions(-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING)
# Set exception handling for portability
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
......@@ -63,34 +65,41 @@ check_symbol_exists(getopt_long getopt.h HAVE_GETOPT)
include(GetVersion)
GetVersion(${PROJECT_SOURCE_DIR} "DPSIM")
find_package(Eigen3 3.0 REQUIRED)
option(WITH_EIGEN_SUBMODULE "Build with Eigen as submodule" OFF)
option(WITH_SPDLOG_SUBMODULE "Build with Spdlog as submodule" OFF)
option(WITH_CIM_SUBMODULE "Build with CIMpp as submodule" OFF)
# Workaround for spdlog in Windows
# A custom FindSpdlog does not work currently
option(SPDLOG_BUILD_TESTING "Build spdlog tests" OFF)
option(SPDLOG_BUILD_BENCH "Build spdlog benchmarks" OFF)
option(SPDLOG_BUILD_EXAMPLES "Build spdlog examples" OFF)
find_package(Threads REQUIRED)
if (WITH_EIGEN_SUBMODULE OR WIN32)
include(cmake/GetEigenSubmodule.cmake)
else()
find_package(Eigen3 3.0 REQUIRED)
endif()
option(WITH_SPDLOG_SUBMODULE "Build with Spdlog as submodule" OFF)
if (WITH_SPDLOG_SUBMODULE OR WIN32)
set(SPDLOG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/spdlog/include)
include(cmake/GetSpdlogSubmodule.cmake)
else()
find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)
endif()
find_package(Threads REQUIRED)
find_package(CIMpp)
if (WITH_CIM_SUBMODULE OR WIN32)
include(cmake/GetCIMppSubmodule.cmake)
else()
find_package(CIMpp)
endif()
find_package(Sundials)
find_package(OpenMP)
find_package(CUDA)
find_package(GSL)
find_package(Graphviz)
find_package(PythonInterp 3.6)
find_package(PythonLibs 3.6)
find_package(NumPy)
find_package(VILLASnode)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
......@@ -103,11 +112,11 @@ elseif("${CMAKE_SYSTEM}" MATCHES "Darwin")
set(MacOS_FOUND ON)
endif()
include(CMakeDependentOption)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build C++ examples" ON )
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build C++ examples" ON)
option(GET_GRID_DATA "Download grid data" ON)
include(CMakeDependentOption)
cmake_dependent_option(WITH_GSL "Enable GSL" ON "GSL_FOUND" OFF)
cmake_dependent_option(WITH_SUNDIALS "Enable sundials solver suite" ON "Sundials_FOUND" OFF)
cmake_dependent_option(WITH_SHMEM "Enable shared memory interface" ON "VILLASnode_FOUND" OFF)
......@@ -160,17 +169,18 @@ set(DPSIM_INCLUDE_DIRS
)
add_subdirectory(models)
add_subdirectory(Tests)
add_subdirectory(Source)
add_subdirectory(docs)
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif(BUILD_EXAMPLES)
#add_subdirectory(Dependencies/pybind11)
#pybind11_add_module(dpsimpy Source/pybind/main.cpp)
#target_link_libraries(dpsimpy PRIVATE dpsim)
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif(BUILD_EXAMPLES)
include(cmake/GetGridData.cmake)
message(VERBOSE "Compiler Release Flags: " ${CMAKE_CXX_FLAGS_RELEASE})
message(VERBOSE "Compiler Debug Flags: " ${CMAKE_CXX_FLAGS_DEBUG})
......
Subproject commit 22cb9414cb0c65b042717c5ccc5aee4c0cdf95c6
Subproject commit a00d674b04d3b67e5fec1da2730ff42b345f6d6b
Subproject commit 1aa9ea92e20142a1ce2f2e1ac40ed1fa781fac19
Subproject commit 5c73ab36eb46d9410da36a9048a4a5061057f4dd
......@@ -36,7 +36,7 @@ int main(int argc, char** argv){
"Rootnet_FULL_NE_06J16h_EQ.xml",
"Rootnet_FULL_NE_06J16h_SV.xml",
"Rootnet_FULL_NE_06J16h_TP.xml"
}, "Examples/CIM/grid-data/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results", "CIMPATH");
}, "build/_deps/cim-data-src/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -63,7 +63,7 @@ int main(int argc, char** argv){
"Rootnet_FULL_NE_06J16h_EQ.xml",
"Rootnet_FULL_NE_06J16h_SV.xml",
"Rootnet_FULL_NE_06J16h_TP.xml"
}, "Examples/CIM/grid-data/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results", "CIMPATH");
}, "build/_deps/cim-data-src/CIGRE_MV/NEPLAN/CIGRE_MV_no_tapchanger_With_LoadFlow_Results", "CIMPATH");
String simName = "CIGRE-MV-NoTap-LoadProfiles";
CPS::Real system_freq = 50;
......
......@@ -36,7 +36,7 @@ int main(int argc, char** argv){
"Rootnet_FULL_NE_13J16h_EQ.xml",
"Rootnet_FULL_NE_13J16h_SV.xml",
"Rootnet_FULL_NE_13J16h_TP.xml"
}, "Examples/CIM/grid-data/IEEE_EU_LV/IEEE_EU_LV_reduced", "CIMPATH");
}, "build/_deps/cim-data-src/IEEE_EU_LV/IEEE_EU_LV_reduced", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -44,7 +44,7 @@ int main(int argc, char** argv){
"Rootnet_FULL_NE_06J16h_EQ.xml",
"Rootnet_FULL_NE_06J16h_SV.xml",
"Rootnet_FULL_NE_06J16h_TP.xml"
}, "Examples/CIM/grid-data/IEEE_EU_LV/IEEE_EU_LV_reduced", "CIMPATH");
}, "build/_deps/cim-data-src/IEEE_EU_LV/IEEE_EU_LV_reduced", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX_Dyn", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX_Dyn", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX_Dyn", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX_Dyn", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX", "CIMPATH");
//for (Int copies = 0; copies < 20; copies++) {
// for (Int threads = 0; threads <= 12; threads = threads+2)
......
......@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX", "CIMPATH");
//for (Int copies = 0; copies < 10; copies++) {
// for (Int threads = 0; threads <= 12; threads = threads+2)
......
......@@ -119,7 +119,7 @@ int main(int argc, char *argv[]) {
"WSCC-09_RX_EQ.xml",
"WSCC-09_RX_SV.xml",
"WSCC-09_RX_TP.xml"
}, "Examples/CIM/grid-data/WSCC-09/WSCC-09_RX", "CIMPATH");
}, "build/_deps/cim-data-src/WSCC-09/WSCC-09_RX", "CIMPATH");
//for (Int copies = 0; copies < 10; copies++) {
// for (Int threads = 0; threads <= 12; threads = threads+2) {
......
......@@ -33,7 +33,7 @@ int main(int argc, char** argv){
if (argc <= 1) {
filenames = DPsim::Utils::findFiles({
"case14Both.xml"
}, "Examples/CIM/grid-data/Matpower_cases", "CIMPATH");
}, "build/_deps/cim-data-src/Matpower_cases", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
......@@ -33,7 +33,7 @@ int main(int argc, char** argv){
if (argc <= 1) {
filenames = DPsim::Utils::findFiles({
"case145.xml"
}, "Examples/CIM/grid-data/Matpower_cases", "CIMPATH");
}, "build/_deps/cim-data-src/Matpower_cases", "CIMPATH");
}
else {
filenames = std::list<fs::path>(argv + 1, argv + argc);
......
Markdown is supported
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