Skip to content

Commit

Permalink
Add flag to disable MT flag usage.
Browse files Browse the repository at this point in the history
Signed-off-by: Bertrand Rix <bertrand.rix@artelys.com>
  • Loading branch information
obrix committed Jul 23, 2024
1 parent 6f1edca commit 4362f74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cpp/powsybl-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ project(powsybl-cpp)

# Enable static linkage to prevent any future runtime binary compatibility issue
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
if(USE_MSVC_MT_FLAG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

Expand Down
6 changes: 4 additions & 2 deletions cpp/pypowsybl-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ project(pypowsybl-cpp)

# Enable static linkage to prevent any future runtime binary compatibility issue
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
if(USE_MSVC_MT_FLAG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
endif()

set(POWSYBL_CPP_SOURCE_DIR "../powsybl-cpp")
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def build_extension(self, ext):
if not extdir.endswith(os.path.sep):
extdir += os.path.sep
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
'-DPYTHON_EXECUTABLE=' + sys.executable]
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DUSE_MSVC_MT_FLAG=True']

cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
Expand Down

0 comments on commit 4362f74

Please sign in to comment.