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
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,27 @@ IF(PYTHON_FOUND)
elseif(Python_SITELIB)
INSTALL(TARGETS LeptonInjector LIBRARY DESTINATION ${Python_SITELIB})
endif()

LIST( APPEND python_earth_private
${CMAKE_SOURCE_DIR}/private/pybindings/earthmodel-service.cxx
)

add_library( EarthModelService SHARED ${python_earth_private})
set_target_properties( EarthModelService PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME "EarthModelService" PREFIX "" SUFFIX ".so")
target_include_directories( EarthModelService PRIVATE ${PYTHON_INCLUDE_DIR})
target_link_libraries(EarthModelService PRIVATE lepton_injector ${Boost_LIBRARIES} ${Python_LIBRARIES})
include_directories(${Boost_INCLUDE_DIRS})

EXECUTE_PROCESS( COMMAND ${PYTHON_EXECUTABLE} -c
"from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=''))"
OUTPUT_VARIABLE PYTHON_MODULE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(PYTHON_MODULE_DIR)
INSTALL(TARGETS EarthModelService LIBRARY DESTINATION ${PYTHON_MODULE_DIR})
elseif(Python_SITELIB)
INSTALL(TARGETS EarthModelService LIBRARY DESTINATION ${Python_SITELIB})
endif()

ELSE(NOT PYTHON FOUND)
MESSAGE("-- no python. skipping")
ENDIF(PYTHON_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion private/pybindings/LeptonInjector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ BOOST_PYTHON_MODULE(LeptonInjector){
(args("injectors"),args("minimum energy"),args("maximum energy"),args("spectral index"),args("minimum azimuth"),args("maximum azimuth"),args("minimum zenith"),args("maximum zenith"),args("injection radius")=1200., args("endcap length")=1200., args("cylinder radius")=1200., args("cylinder height")=1200.))
)
.def("Execute",&Controller::Execute)
.def("SetEarthModel",&Controller::setEarthModel)
.def("SetEarthModel",&Controller::SetEarthModel)
.def("AddInjector",&Controller::AddInjector)
.def("NameOutfile",&Controller::NameOutfile)
.def("NameLicFile",&Controller::NameLicFile)
Expand Down