diff --git a/CMakeLists.txt b/CMakeLists.txt index 6da8ed8..393a160 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,71 +61,11 @@ if (NOT HAVE_CLOCK_GETTIME) endif() endif() -add_library(ovni SHARED - ovni.c - parson.c -) +add_subdirectory(src) -target_include_directories(ovni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable(ovniemu - chan.c - emu.c - emu_nosv.c - emu_openmp.c - emu_ovni.c - emu_tampi.c - emu_nodes.c - emu_kernel.c - emu_nanos6.c - emu_task.c - trace.c - ovni.c - parson.c - pcf.c - prv.c -) - -add_executable(ovnidump - dump.c - ovni.c - trace.c - parson.c -) - -add_executable(ovni2prv - ovni2prv.c - ovni.c - trace.c - parson.c -) - -add_executable(ovnisort - sort.c - ovni.c - trace.c - parson.c -) - -# Use _ROOT variables if available, commonly used by MPI -# installations -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) +include(CTest) +if(BUILD_TESTING) + add_subdirectory(test) endif() -find_package(MPI REQUIRED) -add_executable(ovnisync ovnisync.c) -target_link_libraries(ovnisync m MPI::MPI_C) - -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - include(CTest) - - if(BUILD_TESTING) - add_subdirectory(test) - endif() -endif() - -install(TARGETS ovni LIBRARY DESTINATION lib) -install(TARGETS ovniemu ovnidump ovni2prv ovnisync ovnisort RUNTIME DESTINATION bin) -install(FILES ovni.h DESTINATION include) install(DIRECTORY cfg/ DESTINATION share/ovni) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0737c4e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) +# SPDX-License-Identifier: GPL-3.0-or-later + +add_library(ovni SHARED + ovni.c + parson.c +) + +target_include_directories(ovni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +add_executable(ovniemu + chan.c + emu.c + emu_nosv.c + emu_openmp.c + emu_ovni.c + emu_tampi.c + emu_nodes.c + emu_kernel.c + emu_nanos6.c + emu_task.c + trace.c + ovni.c + parson.c + pcf.c + prv.c +) + +add_executable(ovnidump + dump.c + ovni.c + trace.c + parson.c +) + +add_executable(ovni2prv + ovni2prv.c + ovni.c + trace.c + parson.c +) + +add_executable(ovnisort + sort.c + ovni.c + trace.c + parson.c +) + +# Use _ROOT variables if available, commonly used by MPI +# installations +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + +find_package(MPI REQUIRED) +add_executable(ovnisync ovnisync.c) +target_link_libraries(ovnisync m MPI::MPI_C) + +install(TARGETS ovni LIBRARY DESTINATION lib) +install(TARGETS ovniemu ovnidump ovni2prv ovnisync ovnisort RUNTIME DESTINATION bin) +install(FILES ovni.h DESTINATION include) diff --git a/chan.c b/src/chan.c similarity index 100% rename from chan.c rename to src/chan.c diff --git a/chan.h b/src/chan.h similarity index 100% rename from chan.h rename to src/chan.h diff --git a/common.h b/src/common.h similarity index 100% rename from common.h rename to src/common.h diff --git a/compat.h b/src/compat.h similarity index 100% rename from compat.h rename to src/compat.h diff --git a/dump.c b/src/dump.c similarity index 100% rename from dump.c rename to src/dump.c diff --git a/emu.c b/src/emu.c similarity index 100% rename from emu.c rename to src/emu.c diff --git a/emu.h b/src/emu.h similarity index 100% rename from emu.h rename to src/emu.h diff --git a/emu_kernel.c b/src/emu_kernel.c similarity index 100% rename from emu_kernel.c rename to src/emu_kernel.c diff --git a/emu_nanos6.c b/src/emu_nanos6.c similarity index 100% rename from emu_nanos6.c rename to src/emu_nanos6.c diff --git a/emu_nodes.c b/src/emu_nodes.c similarity index 100% rename from emu_nodes.c rename to src/emu_nodes.c diff --git a/emu_nosv.c b/src/emu_nosv.c similarity index 100% rename from emu_nosv.c rename to src/emu_nosv.c diff --git a/emu_openmp.c b/src/emu_openmp.c similarity index 100% rename from emu_openmp.c rename to src/emu_openmp.c diff --git a/emu_ovni.c b/src/emu_ovni.c similarity index 100% rename from emu_ovni.c rename to src/emu_ovni.c diff --git a/emu_tampi.c b/src/emu_tampi.c similarity index 100% rename from emu_tampi.c rename to src/emu_tampi.c diff --git a/emu_task.c b/src/emu_task.c similarity index 100% rename from emu_task.c rename to src/emu_task.c diff --git a/emu_task.h b/src/emu_task.h similarity index 100% rename from emu_task.h rename to src/emu_task.h diff --git a/heap.h b/src/heap.h similarity index 100% rename from heap.h rename to src/heap.h diff --git a/ovni.c b/src/ovni.c similarity index 100% rename from ovni.c rename to src/ovni.c diff --git a/ovni.h b/src/ovni.h similarity index 100% rename from ovni.h rename to src/ovni.h diff --git a/ovni2prv.c b/src/ovni2prv.c similarity index 100% rename from ovni2prv.c rename to src/ovni2prv.c diff --git a/ovnisync.c b/src/ovnisync.c similarity index 100% rename from ovnisync.c rename to src/ovnisync.c diff --git a/parson.c b/src/parson.c similarity index 100% rename from parson.c rename to src/parson.c diff --git a/parson.h b/src/parson.h similarity index 100% rename from parson.h rename to src/parson.h diff --git a/pcf.c b/src/pcf.c similarity index 100% rename from pcf.c rename to src/pcf.c diff --git a/pcf.h b/src/pcf.h similarity index 100% rename from pcf.h rename to src/pcf.h diff --git a/prv.c b/src/prv.c similarity index 100% rename from prv.c rename to src/prv.c diff --git a/prv.h b/src/prv.h similarity index 100% rename from prv.h rename to src/prv.h diff --git a/sort.c b/src/sort.c similarity index 100% rename from sort.c rename to src/sort.c diff --git a/trace.c b/src/trace.c similarity index 100% rename from trace.c rename to src/trace.c diff --git a/trace.h b/src/trace.h similarity index 100% rename from trace.h rename to src/trace.h diff --git a/uthash.h b/src/uthash.h similarity index 100% rename from uthash.h rename to src/uthash.h diff --git a/utlist.h b/src/utlist.h similarity index 100% rename from utlist.h rename to src/utlist.h diff --git a/test/macros.cmake b/test/macros.cmake index 6469b88..09676f9 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -41,7 +41,7 @@ function(ovni_test source) "OVNI_NPROCS=${OVNI_TEST_NPROC}") list(APPEND OVNI_TEST_ENV - "OVNI_BUILD_DIR=${CMAKE_BINARY_DIR}") + "OVNI_BUILD_DIR=${CMAKE_BINARY_DIR}/src") list(APPEND OVNI_TEST_ENV "OVNI_CURRENT_DIR=${CMAKE_CURRENT_BINARY_DIR}")