From f1c76a475d1224deb929c4e8f8f111cebc283cc0 Mon Sep 17 00:00:00 2001 From: Sam Fuller Date: Sun, 27 Jan 2019 21:35:03 -0800 Subject: [PATCH 1/9] Cmake config support --- CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++++++++++- Config.cmake.in | 4 ++++ logvisor | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 Config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 63c2f13..b32b5b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,12 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17 -project(nod) +project(nod VERSION 0.1) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() +include (CMakePackageConfigHelpers) + if (MSVC) # Shaddup MSVC add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 @@ -22,3 +24,41 @@ file(GLOB NOD_HEADERS include/nod/*.h*) add_subdirectory(lib) add_subdirectory(driver) install(DIRECTORY include/nod DESTINATION include/nod) + +set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake") +set(config_file "${PROJECT_BINARY_DIR}/nodConfig.cmake") +set(config_install_dir "lib/cmake/nod") + +# Associate target with export +install( + TARGETS nod + EXPORT nodTargets + ARCHIVE DESTINATION "lib" + INCLUDES DESTINATION "include/nod" # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. +) + +# Install the target config files +install( + EXPORT nodTargets + NAMESPACE "nod::" + DESTINATION "${config_install_dir}" +) + +# Generate version config file +write_basic_package_version_file( + "${version_config_file}" + COMPATIBILITY SameMajorVersion +) + +# Generate config file +configure_package_config_file( + "Config.cmake.in" + "${config_file}" + INSTALL_DESTINATION "lib/cmake/nod" +) + +# Install the config files +install( + FILES "${config_file}" "${version_config_file}" + DESTINATION ${config_install_dir} +) diff --git a/Config.cmake.in b/Config.cmake.in new file mode 100644 index 0000000..7181c15 --- /dev/null +++ b/Config.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/nodTargets.cmake") +check_required_components(nod) diff --git a/logvisor b/logvisor index 01e2918..02cef94 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit 01e291833ba4d7f2a596c32cf6158cb6a9327ad7 +Subproject commit 02cef9479eea2c444715c0a84cb7aa3c8f41c1ee From 2b7ea07caeeea98c02b6784e041cc46ee4ff070d Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 12 May 2019 12:41:14 -1000 Subject: [PATCH 2/9] Remove redundant include path --- .gitmodules | 2 +- CMakeLists.txt | 2 +- logvisor | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 45371bd..10871e6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "logvisor"] path = logvisor - url = ../logvisor.git + url = https://github.com/sfuller/logvisor.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b32b5b4..1e19bb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ file(GLOB NOD_HEADERS include/nod/*.h*) add_subdirectory(lib) add_subdirectory(driver) -install(DIRECTORY include/nod DESTINATION include/nod) +install(DIRECTORY include/nod DESTINATION include) set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake") set(config_file "${PROJECT_BINARY_DIR}/nodConfig.cmake") diff --git a/logvisor b/logvisor index 02cef94..27668b7 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit 02cef9479eea2c444715c0a84cb7aa3c8f41c1ee +Subproject commit 27668b76916d6fcf323f9f66d83d0ab5ab59a2fa From cd782047c8b0f90549bc00cf9d7bee7bbf87ea5f Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 12 May 2019 12:48:02 -1000 Subject: [PATCH 3/9] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 10871e6..7ca2b3a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "logvisor"] path = logvisor - url = https://github.com/sfuller/logvisor.git + url = https://github.com/AxioDL/logvisor.git From ca2aeecc64c6859a9aae172eccf91f2757374f09 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 12 May 2019 13:16:34 -1000 Subject: [PATCH 4/9] Ensure exported include dir is correct --- CMakeLists.txt | 2 +- logvisor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e19bb1..96e1810 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ install( TARGETS nod EXPORT nodTargets ARCHIVE DESTINATION "lib" - INCLUDES DESTINATION "include/nod" # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. + INCLUDES DESTINATION include # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. ) # Install the target config files diff --git a/logvisor b/logvisor index 27668b7..4b4ef03 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit 27668b76916d6fcf323f9f66d83d0ab5ab59a2fa +Subproject commit 4b4ef03a3b6a418e490741a8f5f0d8e1dd700cea From 0ac7140542d1fc2154b3a8c8d8e735185c76e11d Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 22 May 2019 16:04:33 -1000 Subject: [PATCH 5/9] Minor .gitmodules change --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7ca2b3a..45371bd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "logvisor"] path = logvisor - url = https://github.com/AxioDL/logvisor.git + url = ../logvisor.git From d9638cc60d4100308ccd95023af5873d05b27231 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 22 May 2019 17:59:34 -1000 Subject: [PATCH 6/9] Update logvisor --- logvisor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logvisor b/logvisor index a2ffe70..c3f34ae 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit a2ffe70b4e1fa54d7013f327b45970e18e08901a +Subproject commit c3f34aed0b8abdd0616a7a721edbd34d3c4148bb From 01237372e17e4470e002efbe100c81ed804eeea3 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 22 May 2019 18:09:21 -1000 Subject: [PATCH 7/9] Update logvisor --- logvisor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logvisor b/logvisor index c3f34ae..c54e259 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit c3f34aed0b8abdd0616a7a721edbd34d3c4148bb +Subproject commit c54e2596c23d1df93f2a91800a8fc73d22829541 From 4dd0375cae9557a1881d56f722e20557075a9d93 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 23 May 2019 14:17:45 -1000 Subject: [PATCH 8/9] Adjusted install commands for better CMake compatibility --- CMakeLists.txt | 8 -------- lib/CMakeLists.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96e1810..bb82d83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,14 +29,6 @@ set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake") set(config_file "${PROJECT_BINARY_DIR}/nodConfig.cmake") set(config_install_dir "lib/cmake/nod") -# Associate target with export -install( - TARGETS nod - EXPORT nodTargets - ARCHIVE DESTINATION "lib" - INCLUDES DESTINATION include # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. -) - # Install the target config files install( EXPORT nodTargets diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6d4e6b2..63de1c9 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -19,3 +19,11 @@ add_library(nod if(NOT MSVC AND NOT NX) set_source_files_properties(aes.cpp PROPERTIES COMPILE_FLAGS -maes) endif() + +# Associate target with export +install( + TARGETS nod + EXPORT nodTargets + ARCHIVE DESTINATION "lib" + INCLUDES DESTINATION include # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. +) From a1284ae06586b958f36b8ecaba29390835ed2820 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 25 May 2019 00:15:37 -1000 Subject: [PATCH 9/9] Update logvisor --- logvisor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logvisor b/logvisor index c54e259..7672485 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit c54e2596c23d1df93f2a91800a8fc73d22829541 +Subproject commit 7672485d81e9258cc9801238d7f5f1b68e190696