Skip to content

Commit

Permalink
add /bigobj flag to SWIG wrappers for MSVC
Browse files Browse the repository at this point in the history
we get an error `C1128: number of sections exceeded object file format limit: compile with /bigobj`
so add that flag
  • Loading branch information
KrisThielemans committed Sep 16, 2023
1 parent 7d88f5c commit 792cc37
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/swig/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2012 Kris Thielemans
# Copyright 2014, 2018, 2020, 2022 University College London
# Copyright 2014, 2018, 2020, 2022, 2023 University College London
# This file is part of STIR.
#
# SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -151,6 +151,9 @@ if(BUILD_SWIG_PYTHON)
SWIG_ADD_MODULE(stir python stir.i $<TARGET_OBJECTS:stir_registries>)
else()
SWIG_ADD_LIBRARY(stir LANGUAGE python TYPE MODULE SOURCES stir.i $<TARGET_OBJECTS:stir_registries>)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
set_property(TARGET ${SWIG_MODULE_stir_REAL_NAME} PROPERTY SWIG_GENERATED_COMPILE_OPTIONS /bigobj)
endif()
endif()
SWIG_WORKAROUND(${SWIG_MODULE_stir_REAL_NAME})
SWIG_LINK_LIBRARIES(stir ${STIR_LIBRARIES} ${STIR_Python_dependency})
Expand Down Expand Up @@ -198,6 +201,9 @@ if (BUILD_SWIG_OCTAVE)
SWIG_ADD_MODULE(stiroct octave stir.i $<TARGET_OBJECTS:stir_registries>)
else()
SWIG_ADD_LIBRARY(stiroct LANGUAGE octave TYPE MODULE SOURCES stir.i $<TARGET_OBJECTS:stir_registries>)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
set_property(TARGET ${SWIG_MODULE_stiroct_REAL_NAME} PROPERTY SWIG_GENERATED_COMPILE_OPTIONS /bigobj)
endif()
endif()
SET_TARGET_PROPERTIES(${SWIG_MODULE_stiroct_REAL_NAME} PROPERTIES SUFFIX ${OCTAVE_SUFFIX} PREFIX "${OCTAVE_PREFIX}")
SWIG_WORKAROUND(${SWIG_MODULE_stiroct_REAL_NAME})
Expand All @@ -224,6 +230,9 @@ if (BUILD_SWIG_MATLAB)
SWIG_ADD_MODULE(stirMATLAB matlab stir.i $<TARGET_OBJECTS:stir_registries>)
else()
SWIG_ADD_LIBRARY(stirMATLAB LANGUAGE matlab TYPE MODULE SOURCES stir.i $<TARGET_OBJECTS:stir_registries>)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
set_property(TARGET ${SWIG_MODULE_stirMATLAB_REAL_NAME} PROPERTY SWIG_GENERATED_COMPILE_OPTIONS /bigobj)
endif()
endif()
if (WIN32)
set (Matlab_CXXLINKER_FLAGS "/EXPORT:mexFunction")
Expand Down

0 comments on commit 792cc37

Please sign in to comment.