HΦ  3.2.0
Add new source-file, executable, scripts (handle CMake)

To build HPhi, CMake is required. We have to modify the CMake configuration file when we add new sources, executables, scripts.

New source code

When we add a new source code, we have to add the file-name into the following part of src/CMakeLists.txt.

set(SOURCES source1.c source2.c ...)

New executable

When we add a new executable ("myprog" in this case), we have to add following command in src/CMakeLists.txt.

set(SOURCES_MYPROG source1.c source2.c ...)
add_executable(myprog ${SOURCES_MYPROG})
target_link_libraries(myprog ${LAPACK_LIBRARIES} m)
if(MPI_FOUND)
target_link_libraries(myprog ${MPI_C_LIBRARIES})
endif(MPI_FOUND)
install(TARGETS myprog RUNTIME DESTINATION bin)

New script

When we add a new script written in python, sh, etc. ("myscript.sh" in this case) into tool/, we have to add the following command in tool/CMakeLists.txt.

configure_file(myscript.sh myscript.sh COPYONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/myscript.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)