Skip to content

Commit

Permalink
Auto-detect size_t size on platform to set SWIG switches appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
tseip committed Oct 24, 2024
1 parent 6eb6870 commit 4c36faa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ SET_SOURCE_FILES_PROPERTIES(fourbynine.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_LIBRARY(swig_fourbynine TYPE SHARED LANGUAGE python OUTPUT_DIR "../model_fitting" OUTFILE_DIR "./" SOURCES fourbynine.i)
set_property(TARGET swig_fourbynine PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE)

include(CheckTypeSize)

check_type_size("size_t" SIZE_T_SIZE)
IF (NOT SIZE_T_SIZE EQUAL 8)
target_compile_definitions(swig_fourbynine PRIVATE SWIGWORDSIZE64)
ENDIF()

IF (NOT WIN32)
set_target_properties(swig_fourbynine PROPERTIES SUFFIX ".so")
ENDIF()
Expand Down

0 comments on commit 4c36faa

Please sign in to comment.