From b73fbd591ac1a842cb6193eceeed14c66bb5fe43 Mon Sep 17 00:00:00 2001 From: NancyLi1013 Date: Tue, 6 Aug 2019 02:02:35 -0700 Subject: [PATCH 1/2] [clue] Add new port --- ports/clue/CMakeLists.txt | 23 +++++++++++++++++++++++ ports/clue/CONTROL | 6 ++++++ ports/clue/portfile.cmake | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 ports/clue/CMakeLists.txt create mode 100644 ports/clue/CONTROL create mode 100644 ports/clue/portfile.cmake diff --git a/ports/clue/CMakeLists.txt b/ports/clue/CMakeLists.txt new file mode 100644 index 00000000000000..45ad6f23a39965 --- /dev/null +++ b/ports/clue/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required( VERSION 3.5) + +project(clue VERSION 1.0.0 LANGUAGES CXX ) + +option( CLUE_BUILD_TEST "Build tests for clue" ON ) +option( CLUE_BUILD_EXAMPLE "Build examples" ON ) + +include( GNUInstallDirs ) +include_directories( "${CMAKE_SOURCE_DIR}/clue.hpp" ) + +if ( CLUE_BUILD_TEST ) + enable_testing() + add_subdirectory( tests ) +endif() + +if ( CLUE_BUILD_EXAMPLE ) + enable_testing() + add_subdirectory( examples ) +endif() + +install( FILES ${CMAKE_SOURCE_DIR}/clue.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + +# end of file diff --git a/ports/clue/CONTROL b/ports/clue/CONTROL new file mode 100644 index 00000000000000..6cea179240de0d --- /dev/null +++ b/ports/clue/CONTROL @@ -0,0 +1,6 @@ +Source: clue +Version: 1.0.0-alpha.7 +Homepage: https://github.com/martinmoene/clue +Description: clue is a C++03 header-only library to log messages with a severity and optional module identifier. + + diff --git a/ports/clue/portfile.cmake b/ports/clue/portfile.cmake new file mode 100644 index 00000000000000..d8bd27dedb4f9c --- /dev/null +++ b/ports/clue/portfile.cmake @@ -0,0 +1,28 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO martinmoene/clue + REF v1.0.0-alpha.7 + SHA512 4f0d1115dcf16412239e1ac158be210403f93596b76c91100ae81be3d4f4cb04dda525101850356a7195b219c826305a82cab7a96b1bc1e2cefaa7860a853e73 + HEAD_REF master +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCLUE_BUILD_TEST=OFF + -DCLUE_BUILD_EXAMPLE=OFF +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) + From c295a8605d192f78a5d6709c9020443aa606d637 Mon Sep 17 00:00:00 2001 From: NancyLi1013 Date: Mon, 26 Aug 2019 00:46:43 -0700 Subject: [PATCH 2/2] Add test as feature --- ports/clue/CMakeLists.txt | 32 +++++++++++++++++--------------- ports/clue/CONTROL | 3 ++- ports/clue/portfile.cmake | 11 ++++++----- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ports/clue/CMakeLists.txt b/ports/clue/CMakeLists.txt index 45ad6f23a39965..451d414b8097cf 100644 --- a/ports/clue/CMakeLists.txt +++ b/ports/clue/CMakeLists.txt @@ -1,23 +1,25 @@ -cmake_minimum_required( VERSION 3.5) +cmake_minimum_required(VERSION 3.5) -project(clue VERSION 1.0.0 LANGUAGES CXX ) +project(clue VERSION 1.0.0 LANGUAGES CXX) -option( CLUE_BUILD_TEST "Build tests for clue" ON ) -option( CLUE_BUILD_EXAMPLE "Build examples" ON ) +option(CLUE_BUILD_TEST "Build tests for clue" OFF) +option(CLUE_BUILD_EXAMPLE "Build examples" OFF) -include( GNUInstallDirs ) -include_directories( "${CMAKE_SOURCE_DIR}/clue.hpp" ) +include(GNUInstallDirs) +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/clue.hpp") -if ( CLUE_BUILD_TEST ) - enable_testing() - add_subdirectory( tests ) +if(CLUE_BUILD_TEST) + file(GLOB TEST_SOURCES "tests/*.cpp") + add_executable(test_clue ${TEST_SOURCES}) + target_include_directories(test_clue PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/tests) + install(TARGETS test_clue + RUNTIME DESTINATION tools) endif() -if ( CLUE_BUILD_EXAMPLE ) - enable_testing() - add_subdirectory( examples ) +if(CLUE_BUILD_EXAMPLE) + file(GLOB EXAMPLES "examples/*.cpp") + install(FILES ${EXAMPLES} DESTINATION examples) endif() -install( FILES ${CMAKE_SOURCE_DIR}/clue.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - -# end of file +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/clue.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# end of file \ No newline at end of file diff --git a/ports/clue/CONTROL b/ports/clue/CONTROL index 6cea179240de0d..dcd80809e5d12c 100644 --- a/ports/clue/CONTROL +++ b/ports/clue/CONTROL @@ -3,4 +3,5 @@ Version: 1.0.0-alpha.7 Homepage: https://github.com/martinmoene/clue Description: clue is a C++03 header-only library to log messages with a severity and optional module identifier. - +Feature: test +Description: Build test \ No newline at end of file diff --git a/ports/clue/portfile.cmake b/ports/clue/portfile.cmake index d8bd27dedb4f9c..35fd8228b222ae 100644 --- a/ports/clue/portfile.cmake +++ b/ports/clue/portfile.cmake @@ -10,12 +10,14 @@ vcpkg_from_github( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + test CLUE_BUILD_TEST +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS - -DCLUE_BUILD_TEST=OFF - -DCLUE_BUILD_EXAMPLE=OFF + OPTIONS ${FEATURE_OPTIONS} ) vcpkg_install_cmake() @@ -24,5 +26,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) - +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) \ No newline at end of file