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
|
FetchContent_Declare(
elements
GIT_REPOSITORY https://github.com/cycfi/elements.git
)
FetchContent_Declare(
nfd
GIT_REPOSITORY https://github.com/btzy/nativefiledialog-extended.git
)
FetchContent_MakeAvailable(elements CLI11 nfd)
# set the path to the elements root & module path
set(ELEMENTS_ROOT "${elements_SOURCE_DIR}")
set(ELEMENTS_BUILD_EXAMPLES OFF)
get_filename_component(ELEMENTS_ROOT "${ELEMENTS_ROOT}" ABSOLUTE)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ELEMENTS_ROOT}/cmake")
# target for ensuring plotting is possible for the gui executables
add_custom_target(plotter)
if (${BUILD_PLOT_EXE})
find_package(Python3 COMPONENTS Interpreter)
if (Python3_FOUND)
execute_process(
COMMAND pip show pyinstaller matplotlib numpy
RESULT_VARIABLE EXIT_CODE
OUTPUT_QUIET
)
if (${EXIT_CODE} EQUAL 0)
add_custom_command(TARGET plotter POST_BUILD
COMMAND ${Python3_EXECUTABLE} -c "import PyInstaller.__main__; PyInstaller.__main__.run(['${CMAKE_SOURCE_DIR}/scripts/plot.py', '--onefile', '--distpath', '${CMAKE_RUNTIME_OUTPUT_DIRECTORY}'])"
VERBATIM
)
elseif(${GUI})
message(FATAL_ERROR "GUI executables requested, but Python is not installed. The plotting script is unusable. Compile using GUI=FALSE to avoid this error.")
else()
message(WARNING "The plotting utility cannot be built. The GUI executables will only be able to use the raw Python scripts.")
endif()
endif()
endif()
# gui executables
add_subdirectory(saxs_fitter_gui)
add_subdirectory(em_fitter_gui)
|