Skip to content

Commit 39aa8c3

Browse files
author
Darth Vader
committed
Merge commit 'd8147392218c9a0a40f25e39d47d0360b6b4500b'
2 parents 36baede + d814739 commit 39aa8c3

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

src/phast/PhreeqcRM/CMakeLists.txt

+4-29
Original file line numberDiff line numberDiff line change
@@ -577,41 +577,16 @@ else()
577577
endif()
578578
endif()
579579

580-
if(STANDALONE_BUILD EQUAL 1 AND MSVC)
580+
if(WIN32)
581581
# PHREEQCRM_STATIC_RUNTIME (VCOMP???.dll) cannot be made static
582-
option(PHREEQCRM_STATIC_RUNTIME "Build with a static runtime (excluding VCOMP???.DLL)" OFF)
582+
option(PHREEQCRM_STATIC_RUNTIME "Build with a static runtime (excluding OpenMP dlls)" OFF)
583583
if(PHREEQCRM_STATIC_RUNTIME)
584584
# compile with static runtime
585-
586-
set(CompilerFlags
587-
CMAKE_CXX_FLAGS
588-
CMAKE_CXX_FLAGS_DEBUG
589-
CMAKE_CXX_FLAGS_RELEASE
590-
CMAKE_CXX_FLAGS_MINSIZEREL
591-
CMAKE_CXX_FLAGS_RELWITHDEBINFO
592-
CMAKE_C_FLAGS
593-
CMAKE_C_FLAGS_DEBUG
594-
CMAKE_C_FLAGS_RELEASE
595-
CMAKE_C_FLAGS_MINSIZEREL
596-
CMAKE_C_FLAGS_RELWITHDEBINFO
597-
)
598-
599-
foreach(CompilerFlag ${CompilerFlags})
600-
if(${CompilerFlag} MATCHES "/MD")
601-
string(REGEX REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
602-
endif()
603-
endforeach()
604-
605-
set(FortranCompilerFlags CMAKE_Fortran_FLAGS)
606-
607-
foreach(FortranCompilerFlags ${FortranCompilerFlags})
608-
if(${FortranCompilerFlags} MATCHES "/libs:dll")
609-
string(REGEX REPLACE "/libs:dll" "/libs:static" ${FortranCompilerFlags} "${${FortranCompilerFlags}}")
610-
endif()
611-
endforeach()
585+
set_property(TARGET PhreeqcRM PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
612586
endif()
613587
endif()
614588

589+
# TODO PHREEQCRM_ENABLE_TESTING
615590
if(STANDALONE_BUILD EQUAL 1)
616591
# tests
617592
enable_testing()

src/phast/PhreeqcRM/Tests/CMakeLists.txt

+26
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ if(PHREEQCRM_FORTRAN_TESTING)
6262
source_group("Source Files" FILES "../src/BMI_not_implemented.inc")
6363
source_group("Source Files" FILES "../src/IPhreeqcPhast/IPhreeqc/IPhreeqc_interface.F90")
6464
source_group("Source Files" FILES "../src/RM_interface.F90")
65+
66+
if(PHREEQCRM_STATIC_RUNTIME)
67+
set_property(TARGET FortranAdvect PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
68+
endif()
6569
endif()
6670

6771

@@ -163,6 +167,10 @@ if(PHREEQCRM_FORTRAN_TESTING)
163167
target_link_libraries(TestRM FortranAdvect)
164168
endif()
165169

170+
if(PHREEQCRM_STATIC_RUNTIME)
171+
set_property(TARGET TestRM PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
172+
endif()
173+
166174
#-----------------------------------------------------------------------------#
167175

168176
# test PhreeqcRM dtor
@@ -181,6 +189,10 @@ target_link_libraries(TestRMdtor PhreeqcRM::PhreeqcRM)
181189

182190
add_test(TestRMdtor TestRMdtor)
183191

192+
if(PHREEQCRM_STATIC_RUNTIME)
193+
set_property(TARGET TestRMdtor PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
194+
endif()
195+
184196
#-----------------------------------------------------------------------------#
185197

186198
# test BMIPhreeqcRM dtor
@@ -201,6 +213,10 @@ target_link_libraries(TestBMIdtor PhreeqcRM::PhreeqcRM)
201213

202214
add_test(TestBMIdtor TestBMIdtor)
203215

216+
if(PHREEQCRM_STATIC_RUNTIME)
217+
set_property(TARGET TestBMIdtor PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
218+
endif()
219+
204220
#-----------------------------------------------------------------------------#
205221

206222
# test compile and run
@@ -274,6 +290,16 @@ set_property(TARGET TestRM APPEND
274290
TestAllMethods_py.log.txt
275291
)
276292

293+
if(WIN32 AND PHREEQCRM_FORTRAN_TESTING)
294+
# this attempts to find the location of libiomp5md.dll to add it to the path
295+
# this should work for the most recent versions of oneAPI (ifort and ifx)
296+
get_filename_component(FORTRAN_COMPILER_DIR ${CMAKE_Fortran_COMPILER} DIRECTORY)
297+
file(TO_NATIVE_PATH "${FORTRAN_COMPILER_DIR}" FORTRAN_COMPILER_DIR_NATIVE)
298+
set_tests_properties(TestRM PROPERTIES
299+
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${FORTRAN_COMPILER_DIR_NATIVE}"
300+
)
301+
endif()
302+
277303
if(MSVC AND BUILD_SHARED_LIBS)
278304
# copy PhreeqcRM dll
279305
add_custom_command(TARGET TestRM POST_BUILD

0 commit comments

Comments
 (0)