@@ -173,6 +173,11 @@ list(LENGTH LIBINT2_LIBRARY_CXX_SRC _source_count)
173173message(STATUS "Loading ${_source_count} library source files from LIBINT2_LIBRARY_CXX_SRC")
174174message(DEBUG "LIBINT2_LIBRARY_CXX_SRC=${LIBINT2_LIBRARY_CXX_SRC}")
175175
176+ # Notes
177+ # * __COMPILING_LIBINT2 is needed whenever using libint targets in the build tree
178+ # * MSVC does not include <cmath> constants, unless _USE_MATH_DEFINES is defined
179+ # * /EHsc sets the exception handling model (allows "throw")
180+
176181add_library(
177182 int-obj
178183 OBJECT
@@ -193,8 +198,7 @@ target_compile_features(
193198set_target_properties(
194199 int-obj
195200 PROPERTIES
196- UNITY_BUILD TRUE
197- # always use unity build for int-obj
201+ UNITY_BUILD TRUE # always use unity build for int-obj
198202 )
199203target_include_directories(
200204 int-obj
@@ -205,6 +209,16 @@ target_include_directories(
205209 ${PROJECT_SOURCE_DIR}/include/libint2/
206210 )
207211
212+ if (MSVC)
213+ set_target_properties(
214+ int-obj
215+ PROPERTIES
216+ LINK_FLAGS "/STACK:4194304"
217+ # Increase stack size from 1 MB to 4 MB
218+ )
219+ endif()
220+
221+
208222if (BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS)
209223 set(BUILD_SHARED_LIBS 1)
210224 set_target_properties(
@@ -233,13 +247,13 @@ if (BUILD_SHARED_LIBS)
233247 int-shared
234248 INTERFACE
235249 $<BUILD_INTERFACE:__COMPILING_LIBINT2=1>
236- # need __COMPILING_LIBINT2 whenever using libint targets in the build tree
250+ PUBLIC
251+ $<$<BOOL:${MSVC}>:_USE_MATH_DEFINES>
237252 )
238-
239- set_target_properties(
253+ target_compile_options(
240254 int-shared
241- PROPERTIES
242- OUTPUT_NAME "int2"
255+ PUBLIC
256+ $<$<BOOL:${MSVC}>:/EHsc>
243257 )
244258 target_include_directories(
245259 int-shared
@@ -249,7 +263,11 @@ if (BUILD_SHARED_LIBS)
249263 $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
250264 $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/libint2>
251265 )
252-
266+ set_target_properties(
267+ int-shared
268+ PROPERTIES
269+ OUTPUT_NAME "int2"
270+ )
253271endif()
254272
255273if (BUILD_STATIC_LIBS)
@@ -269,13 +287,11 @@ if (BUILD_STATIC_LIBS)
269287 INTERFACE
270288 $<BUILD_INTERFACE:__COMPILING_LIBINT2=1>
271289 PUBLIC
272- # MSVC does not include <cmath> constants, unless _USE_MATH_DEFINES is defined.
273290 $<$<BOOL:${MSVC}>:_USE_MATH_DEFINES>
274291 )
275292 target_compile_options(
276293 int-static
277294 PUBLIC
278- # Set the exception handling model (allows "throw")
279295 $<$<BOOL:${MSVC}>:/EHsc>
280296 )
281297 target_include_directories(
@@ -291,9 +307,6 @@ if (BUILD_STATIC_LIBS)
291307 PROPERTIES
292308 OUTPUT_NAME "int2"
293309 )
294-
295-
296- # target_compile_definitions(int-static PUBLIC _USE_MATH_DEFINES)
297310endif()
298311
299312# Permanent aliases =============================================================
0 commit comments