Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to use released version of shlibpp instead of the vendored one #86

Merged
merged 2 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ slprj
*.tmw
*.dmr
*.mk

.build
.pixi
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16...3.31)
project(blockfactory LANGUAGES CXX VERSION 0.8.5)

if(BUILD_DOCS)
Expand Down Expand Up @@ -109,6 +109,18 @@ endif()
# Handle unit tests support
option(BUILD_TESTING "Create tests using CMake" OFF)

option(BLOCKFACTORY_USES_SYSTEM_SHLIBPP "If ON, find shlibpp with find_package(shlibpp)" OFF)
if(BLOCKFACTORY_USES_SYSTEM_SHLIBPP)
find_package(shlibpp REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
shlibpp
URL https://github.com/ami-iit/shlibpp/archive/refs/tags/v0.0.2.zip
)
FetchContent_MakeAvailable(shlibpp)
endif()

add_subdirectory(deps)
add_subdirectory(sources)

Expand Down
120 changes: 71 additions & 49 deletions cmake/AddUninstallTarget.cmake
Original file line number Diff line number Diff line change
@@ -1,70 +1,92 @@
#.rst:
# AddUninstallTarget
# ------------------
#
# Add the "uninstall" target for your project::
#
# include(AddUninstallTarget)
#
#
# will create a file cmake_uninstall.cmake in the build directory and add a
# custom target uninstall that will remove the files installed by your package
# (using install_manifest.txt)

#=============================================================================
# Copyright 2008-2013 Kitware, Inc.
# Copyright 2013 Istituto Italiano di Tecnologia (IIT)
# Authors: Daniele E. Domenichelli <daniele.domenichelli@iit.it>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)


if(DEFINED __ADD_UNINSTALL_TARGET_INCLUDED)
# SPDX-FileCopyrightText: 2012-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-FileCopyrightText: 2008-2013 Kitware Inc.
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
AddUninstallTarget
------------------

Add the "uninstall" target for your project::

include(AddUninstallTarget)


will create a file ``cmake_uninstall.cmake`` in the build directory and add a
custom target ``uninstall`` (or ``UNINSTALL`` on Visual Studio and Xcode) that
will remove the files installed by your package (using
``install_manifest.txt``).
See also
https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake

The :module:`AddUninstallTarget` module must be included in your main
``CMakeLists.txt``. If included in a subdirectory it does nothing.
This allows you to use it safely in your main ``CMakeLists.txt`` and include
your project using ``add_subdirectory`` (for example when using it with
:cmake:module:`FetchContent`).

If the ``uninstall`` target already exists, the module does nothing.
#]=======================================================================]


# AddUninstallTarget works only when included in the main CMakeLists.txt
if(NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
return()
endif()
set(__ADD_UNINSTALL_TARGET_INCLUDED TRUE)

# The name of the target is uppercase in MSVC and Xcode (for coherence with the
# other standard targets)
if("${CMAKE_GENERATOR}" MATCHES "^(Visual Studio|Xcode)")
set(_uninstall "UNINSTALL")
else()
set(_uninstall "uninstall")
endif()

# If target is already defined don't do anything
if(TARGET ${_uninstall})
return()
endif()

set(_filename ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

file(WRITE ${_filename}
set(_filename cmake_uninstall.cmake)

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_filename}"
"if(NOT EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\")
message(WARNING \"Cannot find install manifest: \\\"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\\\"\")
return()
message(WARNING \"Cannot find install manifest: \\\"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\\\"\")
return()
endif()

file(READ \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\" files)
string(STRIP \"\${files}\" files)
string(REGEX REPLACE \"\\n\" \";\" files \"\${files}\")
list(REVERSE files)
foreach(file \${files})
if(IS_SYMLINK \"\$ENV{DESTDIR}\${file}\" OR EXISTS \"\$ENV{DESTDIR}\${file}\")
message(STATUS \"Uninstalling: \$ENV{DESTDIR}\${file}\")
if(EXISTS \"\$ENV{DESTDIR}\${file}\")
execute_process(
COMMAND \${CMAKE_COMMAND} -E remove \"\$ENV{DESTDIR}\${file}\"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval)
if(NOT \"\${rm_retval}\" EQUAL 0)
message(FATAL_ERROR \"Problem when removing \\\"\$ENV{DESTDIR}\${file}\\\"\")
endif()
else()
message(STATUS \"File \\\"\$ENV{DESTDIR}\${file}\\\" does not exist.\")
execute_process(
COMMAND \${CMAKE_COMMAND} -E remove \"\$ENV{DESTDIR}\${file}\"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval)
if(NOT \"\${rm_retval}\" EQUAL 0)
message(FATAL_ERROR \"Problem when removing \\\"\$ENV{DESTDIR}\${file}\\\"\")
endif()
else()
message(STATUS \"Not-found: \$ENV{DESTDIR}\${file}\")
endif()
endforeach(file)
")

if("${CMAKE_GENERATOR}" MATCHES "^(Visual Studio|Xcode)")
set(_uninstall "UNINSTALL")
set(_desc "Uninstall the project...")
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(_comment COMMAND \$\(CMAKE_COMMAND\) -E cmake_echo_color --switch=$\(COLOR\) --cyan "${_desc}")
else()
set(_uninstall "uninstall")
set(_comment COMMENT "${_desc}")
endif()
add_custom_target(${_uninstall} COMMAND "${CMAKE_COMMAND}" -P "${_filename}")
add_custom_target(${_uninstall}
${_comment}
COMMAND ${CMAKE_COMMAND} -P ${_filename}
USES_TERMINAL
BYPRODUCTS uninstall_byproduct
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_property(SOURCE uninstall_byproduct PROPERTY SYMBOLIC 1)

set_property(TARGET ${_uninstall} PROPERTY FOLDER "CMakePredefinedTargets")
2 changes: 0 additions & 2 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ if(USES_MATLAB)
add_subdirectory(mxpp)
endif()

add_subdirectory(sharedlibpp)

if(BUILD_TESTING)
add_subdirectory(catch)
endif()
2 changes: 0 additions & 2 deletions deps/sharedlibpp/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions deps/sharedlibpp/AUTHORS

This file was deleted.

86 changes: 0 additions & 86 deletions deps/sharedlibpp/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions deps/sharedlibpp/LICENSE

This file was deleted.

45 changes: 0 additions & 45 deletions deps/sharedlibpp/README.md

This file was deleted.

Loading
Loading