forked from Kitware/kwiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkwiver-setup-scripts.cmake
125 lines (105 loc) · 6.23 KB
/
kwiver-setup-scripts.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
###
# Configure setup scripts.
# Create initial setup shell script
set(KWIVER_SETUP_SCRIPT_FILE "${KWIVER_BINARY_DIR}/setup_KWIVER.sh" )
# Create initial setup batch script
set(KWIVER_SETUP_BATCH_FILE "${KWIVER_BINARY_DIR}/setup_KWIVER.bat" )
list(APPEND SETUP_BATCH_FILES "${KWIVER_SETUP_BATCH_FILE}")
# Set the bat to use when setting up a test
set(KWIVER_TEST_BATCH_FILE ${KWIVER_SETUP_BATCH_FILE})
set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
if( APPLE )
set(LIBRARY_PATH_VAR "DYLD_FALLBACK_LIBRARY_PATH")
endif()
configure_file(
${KWIVER_CMAKE_DIR}/setup_KWIVER.sh.in
${KWIVER_SETUP_SCRIPT_FILE}
@ONLY
)
if(fletch_BUILT_WITH_CUDA)
list(APPEND EXTRA_WIN32_PATH "${CUDA_TOOLKIT_ROOT_DIR}/bin")
endif()
if(fletch_BUILT_WITH_CUDNN)
list(APPEND EXTRA_WIN32_PATH "${CUDNN_TOOLKIT_ROOT_DIR}/bin")
endif()
configure_file(
${KWIVER_CMAKE_DIR}/setup_KWIVER.bat.in
${KWIVER_SETUP_BATCH_FILE}
@ONLY
)
# install set up script
option( KWIVER_INSTALL_SET_UP_SCRIPT "Creates a setup_KWIVER script (.sh and .bat) that will add properly add kwiver to a shell/cmd prompt" ON )
mark_as_advanced( KWIVER_INSTALL_SET_UP_SCRIPT )
if( KWIVER_INSTALL_SET_UP_SCRIPT )
install( PROGRAMS ${KWIVER_SETUP_SCRIPT_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX} )
if(WIN32)
install( PROGRAMS ${KWIVER_SETUP_BATCH_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
endif()
if ( fletch_FOUND )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PATH=${fletch_ROOT}/bin;%PATH%;\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PATH=${fletch_ROOT}/x64/${_vcVersion}/bin;%PATH%;\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set GDAL_DATA=${GDAL_ROOT}/share/gdal\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PROJ_LIB=${PROJ_ROOT}/share/proj\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export ${LIBRARY_PATH_VAR}=${fletch_ROOT}/lib:$${LIBRARY_PATH_VAR}\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export GDAL_DATA=${GDAL_ROOT}/share/gdal\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export PROJ_LIB=${PROJ_ROOT}/share/proj\n" )
endif()
###
# Install the basic logger properties file.
file( COPY log4cxx.properties DESTINATION "${KWIVER_BINARY_DIR}" )
install( FILES log4cxx.properties DESTINATION ${CMAKE_INSTALL_PREFIX} )
if ( KWIVER_ENABLE_LOG4CXX )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export VITAL_LOGGER_FACTORY=$this_dir/lib/${kwiver_plugin_logger_subdir}/vital_log4cxx_logger\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export LOG4CXX_CONFIGURATION=$this_dir/log4cxx.properties\n" )
if(WIN32)
message(STATUS "Log4CXX is not supported on windows, if no other logger is provided, the default will be used")
endif()
endif()
###
file( COPY log4cplus.properties DESTINATION "${KWIVER_BINARY_DIR}" )
install( FILES log4cplus.properties DESTINATION ${CMAKE_INSTALL_PREFIX} )
if ( KWIVER_ENABLE_LOG4CPLUS )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export VITAL_LOGGER_FACTORY=$this_dir/lib/${kwiver_plugin_logger_subdir}/vital_log4cplus_logger\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export LOG4CPLUS_CONFIGURATION=$this_dir/log4cplus.properties\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set VITAL_LOGGER_FACTORY=vital_log4cplus_logger\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set LOG4CPLUS_CONFIGURATION=%~dp0/log4cplus.properties\n" )
endif()
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export KWIVER_DEFAULT_LOG_LEVEL=WARN\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set KWIVER_DEFAULT_LOG_LEVEL=WARN\n" )
if (KWIVER_ENABLE_PYTHON)
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "# Python environment\n")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export PYTHON_LIBRARY=\"${PYTHON_LIBRARY}\"\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export PYTHONPATH=$this_dir/${python_site_packages}:$PYTHONPATH\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "\n# additional python mudules to load, separated by ':'\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export SPROKIT_PYTHON_MODULES=")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "kwiver.sprokit.processes:")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "kwiver.sprokit.schedulers:")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "kwiver.sprokit.tests.processes:")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "kwiver.vital.tests.alg:")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "kwiver.sprokit.processes.pytorch\n")
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "\n# set to suppress loading python modules/processes\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "# export SPROKIT_NO_PYTHON_MODULES\n\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export KWIVER_PYTHON_DEFAULT_LOG_LEVEL=WARN\n" )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "python${KWIVER_PYTHON_MAJOR_VERSION} -m pip install -r ${KWIVER_BINARY_DIR}/python/requirements.txt\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" ":: Python environment\n")
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PYTHON_LIBRARY=${PYTHON_LIBRARY}\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PYTHONPATH=%~dp0/lib/%config%/python2.7/site-packages\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "\n:: additional python mudules to load, separated by ':'\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set SPROKIT_PYTHON_MODULES=" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "kwiver.sprokit.processes:" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "kwiver.sprokit.schedulers:" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "kwiver.sprokit.tests.processes:")
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "kwiver.vital.tests.alg:" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "kwiver.sprokit.processes.pytorch\n")
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "\n:: set to suppress loading python modules/processes\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "::set SPROKIT_NO_PYTHON_MODULES=false\n\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set KWIVER_PYTHON_DEFAULT_LOG_LEVEL=WARN\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "python${KWIVER_PYTHON_MAJOR_VERSION} -m pip install -r ${KWIVER_BINARY_DIR}/python/requirements.txt\n" )
endif()
if ( KWIVER_ENABLE_MATLAB )
file( APPEND "${KWIVER_SETUP_SCRIPT_FILE}" "export LD_LIBRARY_PATH=${Matlab_LIBRARY_DIR}:$LD_LIBRARY_PATH\n" )
file( APPEND "${KWIVER_SETUP_BATCH_FILE}" "set PATH=${Matlab_LIBRARY_DIR};%PATH%\n" )
endif()