Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,18 @@ if(NOT DEFINED MCPL_NOTOUCH_CMAKE_BUILD_TYPE)
endif()
endif()

option( BUILD_EXAMPLES "Whether to build examples." OFF )
option( BUILD_WITHZLIB "Whether to link with zlib if available." ON )
option( BUILD_WITHSSW "Whether to build the MCPL-SSW converters (for MCNP)." ON )
option( BUILD_WITHPTRAC "Whether to build the MCPL-PTRAC converters (for MCNP)." ON )
option( BUILD_WITHPHITS "Whether to build the MCPL-PHITS converters." ON )
option( BUILD_WITHT4 "Whether to build the TRIPOLI-4 converters." ON )
option( BUILD_WITHSSV "Whether to build the ASCII-SSV converters." ON )
option( BUILD_WITHG4 "Whether to build Geant4 plugins." OFF )
option( BUILD_FAT "Whether to also build the fat binaries." OFF )
option( INSTALL_PY "Whether to also install mcpl python files." ON )
option( MODIFY_RPATH "Whether to try to set RPATH in installed binaries (if disabled all special RPATH handling is skipped)." ON )
option( BUILD_EXAMPLES "Whether to build examples." OFF )
option( BUILD_WITHZLIB "Whether to link with zlib if available." ON )
option( BUILD_WITHSSW "Whether to build the MCPL-SSW converters (for MCNP)." ON )
option( BUILD_WITHPTRAC "Whether to build the MCPL-PTRAC converters (for MCNP)." ON )
option( BUILD_WITHPHITS "Whether to build the MCPL-PHITS converters." ON )
option( BUILD_WITHT4 "Whether to build the TRIPOLI-4 converters." ON )
option( BUILD_WITHSSV "Whether to build the ASCII-SSV converters." ON )
option( BUILD_WITHG4 "Whether to build Geant4 plugins." OFF )
option( BUILD_FAT "Whether to also build the fat binaries." OFF )
option( INSTALL_PY "Whether to also install mcpl python files." ON )
option( MODIFY_RPATH "Whether to try to set RPATH in installed binaries (if disabled all special RPATH handling is skipped)." ON )
option( BUILD_SHARED_LIBS "Whether to build shared libraries." ON )

if ( DEFINED MCPL_FORCE_GEANT4_SUPPORT AND MCPL_FORCE_GEANT4_SUPPORT )
set( BUILD_WITHG4 ON )
Expand Down Expand Up @@ -173,9 +174,9 @@ else ()
endif()
endif ()

add_library(mcpl SHARED "${SRC}/mcpl/mcpl.c")
add_library(mcpl "${SRC}/mcpl/mcpl.c")
set(MCPL_LIBNAME "${CMAKE_SHARED_LIBRARY_PREFIX}mcpl${CMAKE_SHARED_LIBRARY_SUFFIX}")
target_link_libraries( mcpl PRIVATE common )
target_link_libraries( mcpl PRIVATE $<BUILD_INTERFACE:common> )

target_include_directories(mcpl
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/mcpl>
Expand Down Expand Up @@ -208,7 +209,7 @@ install( FILES "${PROJECT_BINARY_DIR}/MCPLConfigVersion.cmake" "${PROJECT_BINARY
install(FILES "${SRC}/mcpl/mcpl.h" DESTINATION ${MCPL_INCDIR})

if (BUILD_WITHSSW)
add_library(sswmcpl SHARED "${SRC}/mcnpssw/sswmcpl.c" "${SRC}/mcnpssw/sswread.c")
add_library(sswmcpl "${SRC}/mcnpssw/sswmcpl.c" "${SRC}/mcnpssw/sswread.c")
target_include_directories(sswmcpl PUBLIC "${SRC}/mcnpssw")
target_link_libraries(sswmcpl mcpl common)
if (MATH_NEEDS_LIBM)
Expand All @@ -227,7 +228,7 @@ if (BUILD_WITHSSW)
endif()

if (BUILD_WITHPTRAC)
add_library(ptracmcpl SHARED "${SRC}/mcnpptrac/ptracmcpl.c" "${SRC}/mcnpptrac/ptracread.c")
add_library(ptracmcpl "${SRC}/mcnpptrac/ptracmcpl.c" "${SRC}/mcnpptrac/ptracread.c")
target_include_directories(ptracmcpl PUBLIC "${SRC}/mcnpptrac")
target_link_libraries(ptracmcpl mcpl common)
if (MATH_NEEDS_LIBM)
Expand All @@ -246,7 +247,7 @@ if (BUILD_WITHPTRAC)
endif()

if (BUILD_WITHPHITS)
add_library(phitsmcpl SHARED "${SRC}/phits/phitsmcpl.c" "${SRC}/phits/phitsread.c")
add_library(phitsmcpl "${SRC}/phits/phitsmcpl.c" "${SRC}/phits/phitsread.c")
target_include_directories(phitsmcpl PUBLIC "${SRC}/phits")
target_link_libraries(phitsmcpl mcpl common)
add_executable(phits2mcpl "${SRC}/phits/phits2mcpl_app.c")
Expand All @@ -262,7 +263,7 @@ if (BUILD_WITHPHITS)
endif()

if (BUILD_WITHT4)
add_library(stockmcpl SHARED "${SRC}/tripolistock/stockmcpl.c" "${SRC}/tripolistock/stockread.c")
add_library(stockmcpl "${SRC}/tripolistock/stockmcpl.c" "${SRC}/tripolistock/stockread.c")
target_include_directories(stockmcpl PUBLIC "${SRC}/tripolistock")
target_link_libraries(stockmcpl mcpl common)
if (MATH_NEEDS_LIBM)
Expand All @@ -281,7 +282,7 @@ if (BUILD_WITHT4)
endif()

if (BUILD_WITHSSV)
add_library(ssvmcpl SHARED "${SRC}/ssv/ssvmcpl.c" "${SRC}/ssv/ssvread.c")
add_library(ssvmcpl "${SRC}/ssv/ssvmcpl.c" "${SRC}/ssv/ssvread.c")
target_include_directories(ssvmcpl PUBLIC "${SRC}/ssv")
target_link_libraries(ssvmcpl mcpl common)
if (MATH_NEEDS_LIBM)
Expand Down Expand Up @@ -329,7 +330,7 @@ if (BUILD_EXAMPLES)
endif()

if (BUILD_FAT)
add_library(mcpl_fat SHARED "${SRCFAT}/mcpl_fat.c")
add_library(mcpl_fat "${SRCFAT}/mcpl_fat.c")
target_include_directories(mcpl_fat PUBLIC "${SRC}/mcpl")
add_executable(mcpltool_fat "${SRCFAT}/mcpltool_app_fat.c")
install(TARGETS mcpl_fat mcpltool_fat ${INSTDEST})
Expand Down Expand Up @@ -395,7 +396,7 @@ else()
endif()

if (Geant4_FOUND)
add_library(g4mcpl SHARED "${SRC}/geant4/G4MCPLGenerator.cc" "${SRC}/geant4/G4MCPLWriter.cc")
add_library(g4mcpl "${SRC}/geant4/G4MCPLGenerator.cc" "${SRC}/geant4/G4MCPLWriter.cc")
set(G4MCPL_LIBNAME "${CMAKE_SHARED_LIBRARY_PREFIX}g4mcpl${CMAKE_SHARED_LIBRARY_SUFFIX}")
target_link_libraries( g4mcpl PUBLIC mcpl ${Geant4_LIBRARIES} PRIVATE common )
target_include_directories(g4mcpl
Expand Down
6 changes: 5 additions & 1 deletion src/mcpl/mcpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@
#include <string.h>
#include <assert.h>
#include <math.h>
#include <unistd.h>
#include <limits.h>
#ifdef MCPL_THIS_IS_MS
# include <fcntl.h>
# include <io.h>
# define F_OK 0
# define STDOUT_FILENO 1
# define access(name,type) _access(name,type)
#else
#include <unistd.h>
#endif

#define MCPLIMP_NPARTICLES_POS 8
Expand Down