Skip to content

Commit a089fec

Browse files
authored
Changes to compile with MSVC (#130)
1 parent 82ce05e commit a089fec

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ set(PACKAGE_VERSION_PATCH "0")
2121
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
2222

2323
set(CMAKE_CXX_STANDARD 17)
24-
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wconversion -Wpedantic")
24+
25+
if (MSVC)
26+
set(CMAKE_CXX_FLAGS "/Wall")
27+
else()
28+
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wconversion -Wpedantic")
29+
endif()
2530

2631
# Ipopt support is disabled by default
2732
option(GRIDKIT_ENABLE_IPOPT "Enable Ipopt support" OFF)

src/Model/PhasorDynamics/SynchronousMachine/GenClassical/GenClassical.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
*
77
*
88
*/
9-
9+
#define _USE_MATH_DEFINES
1010
#include "GenClassical.hpp"
1111

1212
#include <cmath>
1313
#include <iostream>
1414

1515
#include <Model/PhasorDynamics/Bus/Bus.hpp>
1616

17-
#define _USE_MATH_DEFINES
18-
1917
namespace GridKit
2018
{
2119
namespace PhasorDynamics

tests/UnitTests/PhasorDynamics/GenClassicalTests.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @brief Tests for classical generator model.
66
*
77
*/
8+
#define _USE_MATH_DEFINES /* need this since directly including GenClassical.cpp for MSVC compiler */
89
#include <iomanip>
910
#include <iostream>
1011
#include <limits>

0 commit comments

Comments
 (0)