Use pkg-config to find nOS-V
This commit is contained in:
		
							parent
							
								
									4b4f1bd218
								
							
						
					
					
						commit
						eda93acc49
					
				| @ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||||||
| 
 | 
 | ||||||
| - Don't modify nOS-V subsystem state on task pause. The "Task: Running" | - Don't modify nOS-V subsystem state on task pause. The "Task: Running" | ||||||
|   state is now renamed to "Task: In body" to reflect the change. |   state is now renamed to "Task: In body" to reflect the change. | ||||||
|  | - Use pkg-config to locate the nOS-V library and get the version. Use | ||||||
|  |   `PKG_CONFIG_LIBDIR=/path/to/nosv/install/lib/pkgconfig` to use a custom | ||||||
|  |   installation path. | ||||||
| 
 | 
 | ||||||
| ## [1.3.0] - 2023-09-07 | ## [1.3.0] - 2023-09-07 | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								cmake/FindNosv.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								cmake/FindNosv.cmake
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | # Copyright (c) 2023 Barcelona Supercomputing Center (BSC) | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  | 
 | ||||||
|  | find_package(PkgConfig) | ||||||
|  | 
 | ||||||
|  | if(NOT PKG_CONFIG_FOUND) | ||||||
|  |   message(STATUS "pkg-config not found, required to locate nOSV-V") | ||||||
|  |   return() | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
|  | # Use PKG_CONFIG_LIBDIR=/path/to/nosv/install/lib/pkgconfig to use a custom | ||||||
|  | # installation. | ||||||
|  | pkg_search_module(NOSV IMPORTED_TARGET nos-v) | ||||||
|  | 
 | ||||||
|  | if(NOT NOSV_FOUND) | ||||||
|  |   message(STATUS "nOS-V not found") | ||||||
|  | else() | ||||||
|  |   message(STATUS "Found nOS-V ${NOSV_VERSION} at ${NOSV_LINK_LIBRARIES}") | ||||||
|  | endif() | ||||||
| @ -67,7 +67,7 @@ | |||||||
|         # We need to be able to exit the chroot to run Nanos6 tests, as they |         # We need to be able to exit the chroot to run Nanos6 tests, as they | ||||||
|         # require access to /sys for hwloc |         # require access to /sys for hwloc | ||||||
|         __noChroot = true; |         __noChroot = true; | ||||||
|         buildInputs = old.buildInputs ++ (with pkgs; [ nosv nanos6 nodes ]); |         buildInputs = old.buildInputs ++ (with pkgs; [ pkg-config nosv nanos6 nodes ]); | ||||||
|         cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_ALL_TESTS=ON" ]; |         cmakeFlags = old.cmakeFlags ++ [ "-DENABLE_ALL_TESTS=ON" ]; | ||||||
|         preConfigure = old.preConfigure or "" + '' |         preConfigure = old.preConfigure or "" + '' | ||||||
|           export NODES_HOME="${pkgs.nodes}" |           export NODES_HOME="${pkgs.nodes}" | ||||||
|  | |||||||
| @ -1,16 +1,13 @@ | |||||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | # Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) | ||||||
| # SPDX-License-Identifier: GPL-3.0-or-later | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
| 
 | 
 | ||||||
| find_library(nosv libnosv) | find_package(Nosv) | ||||||
| find_path(NOSV_INCLUDE_DIR nosv.h) |  | ||||||
| 
 | 
 | ||||||
| check_library_exists(nosv nosv_init "nosv.h" HAVE_NOSV) | if(NOT NOSV_FOUND) | ||||||
| 
 |  | ||||||
| if(NOT HAVE_NOSV) |  | ||||||
|   if(ENABLE_ALL_TESTS) |   if(ENABLE_ALL_TESTS) | ||||||
|     message(FATAL_ERROR "nOS-V library not found, cannot enable nOS-V RT tests") |     message(FATAL_ERROR "nOS-V not found, cannot enable nOS-V RT tests") | ||||||
|   else() |   else() | ||||||
|     message(STATUS "nOS-V library not found, disabling nOS-V RT tests") |     message(STATUS "nOS-V not found, disabling nOS-V RT tests") | ||||||
|   endif() |   endif() | ||||||
|   return() |   return() | ||||||
| else() | else() | ||||||
| @ -19,9 +16,7 @@ endif() | |||||||
| 
 | 
 | ||||||
| function(nosv_test) | function(nosv_test) | ||||||
|   ovni_test(${ARGN}) |   ovni_test(${ARGN}) | ||||||
|   target_link_libraries("${OVNI_TEST_NAME}" PRIVATE nosv) |   target_link_libraries("${OVNI_TEST_NAME}" PRIVATE PkgConfig::NOSV) | ||||||
|   target_include_directories("${OVNI_TEST_NAME}" |  | ||||||
|     PUBLIC ${NOSV_INCLUDE_DIR}) |  | ||||||
|   set_property(TEST "${OVNI_TEST_NAME}" APPEND |   set_property(TEST "${OVNI_TEST_NAME}" APPEND | ||||||
|     PROPERTY |     PROPERTY | ||||||
|       ENVIRONMENT "NOSV_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nosv/nosv.toml") |       ENVIRONMENT "NOSV_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nosv/nosv.toml") | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user