From e40db0834b49954deb2dd9b4cf64be8c51bc438f Mon Sep 17 00:00:00 2001 From: Matthew A Johnson Date: Tue, 25 May 2021 11:05:01 +0100 Subject: [PATCH] Making CMake integration easier (#22) --- CHANGELOG.md | 5 +++++ CMakeLists.txt | 14 ++++++-------- RELEASE_NOTES | 5 +---- VERSION | 2 +- doc/CMakeLists.txt | 2 +- samples/CMakeLists.txt | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b00b7e6..6e6d464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2021-05-21 - Version 1.3.1](https://github.com/matajoh/libnpy/releases/tag/v1.3.1) + +New Features: +- Updated CMake integration to make the library easier to use via `FetchContent` + ## [2021-02-10 - Version 1.3.0](https://github.com/matajoh/libnpy/releases/tag/v1.3.0) New Features: diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a2859e..42ccf78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,11 +20,8 @@ project( libnpy VERSION ${LIBNPY_VERSION} LANGUAGES CXX) # -------------------- Options -------------------------------- -set( BUILD_DOCUMENTATION_DESC "Specifies whether to build the documentation for the API and XML" ) -set( INCLUDE_CSHARP_DESC "Specifies whether to build libnpy with C# bindings" ) - -set( BUILD_DOCUMENTATION ON CACHE BOOL ${BUILD_DOCUMENTATION_DESC} ) -set( INCLUDE_CSHARP ON CACHE BOOL ${INCLUDE_CSHARP_DESC} ) +option( BUILD_DOCUMENTATION "Specifies whether to build the documentation for the API and XML" OFF ) +option( INCLUDE_CSHARP "Specifies whether to build libnpy with C# bindings" OFF ) # ------------------- Detect the system ----------------------- @@ -68,7 +65,7 @@ endif() # -------------------- Find packages -------------------------- -if ( WIN32 ) +if ( WIN32 AND INCLUDE_CSHARP ) enable_language( CSharp ) else() set( INCLUDE_CSHARP OFF ) @@ -80,10 +77,11 @@ if( INCLUDE_CSHARP ) find_package( SWIG REQUIRED ) # Select the .NET architecture + set( CSHARP_PLATFORM_DESC "C# target platform: x86, x64, anycpu, or itanium" ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( CSHARP_PLATFORM "x64" CACHE STRING "C# target platform: x86, x64, anycpu, or itanium") + set( CSHARP_PLATFORM "x64" CACHE STRING ${CSHARP_PLATFORM_DESC}) else() - set( CSHARP_PLATFORM "x86" CACHE STRING "C# target platform: x86, x64, anycpu, or itanium") + set( CSHARP_PLATFORM "x86" CACHE STRING ${CSHARP_PLATFORM_DESC}) endif() endif() diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 251684b..2a4d3a7 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,5 +1,2 @@ New Features: -- Support for Unicode string tensors (npy type 'U') - -Breaking change: -- `CopyFrom` interface for C# Tensors has been changed to use *Buffer objects \ No newline at end of file +- Updated CMake integration to make the library easier to use via `FetchContent` \ No newline at end of file diff --git a/VERSION b/VERSION index 589268e..6261a05 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 6180c3e..11e5e87 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -13,7 +13,7 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY ) -add_custom_target( doc +add_custom_target( npy_doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index c8887f8..487e6d7 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,7 +1,7 @@ -add_executable( images images.cpp ) -target_link_libraries( images npy::npy ) +add_executable( npy_images images.cpp ) +target_link_libraries( npy_images npy::npy ) if( INCLUDE_CSHARP ) - add_executable( images_net images_net.cs ) - target_link_libraries( images_net NumpyIO ${SWIG_MODULE_NumpyIONative_REAL_NAME} ) + add_executable( npy_images_net images_net.cs ) + target_link_libraries( npy_images_net NumpyIO ${SWIG_MODULE_NumpyIONative_REAL_NAME} ) endif() \ No newline at end of file