Skip to content

Commit

Permalink
enh(#23): Licensing macros
Browse files Browse the repository at this point in the history
- Initial cut, will undoubtedly need to revise, update and expand later
  • Loading branch information
jharwell committed Nov 15, 2022
1 parent 3f7dd53 commit 2248cca
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmake/project-local.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ add_library(
${rcsw_components_SRC}
)

execute_process(COMMAND git rev-list --count HEAD
OUTPUT_VARIABLE RCSW_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(rcsw_LIBRARY_NAME rcsw-v${RCSW_VERSION})
# execute_process(COMMAND git rev-list --count HEAD
# OUTPUT_VARIABLE RCSW_VERSION
# OUTPUT_STRIP_TRAILING_WHITESPACE)
set(rcsw_LIBRARY_NAME rcsw)
set_target_properties(${rcsw_LIBRARY} PROPERTIES OUTPUT_NAME ${rcsw_LIBRARY_NAME})

########################################
Expand Down
113 changes: 113 additions & 0 deletions include/rcsw/common/licensing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/**
* \file licensing.h
*
* \copyright 2022 John Harwell, All rights reserved.
*
* This file is part of RCSW.
*
* RCSW is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* RCSW is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* RCSW. If not, see <http://www.gnu.org/licenses/
*
*/

#pragma once

/*******************************************************************************
* Includes
******************************************************************************/
#include "rcsw/common/common.h"

/*******************************************************************************
* Macros
******************************************************************************/
/**
* \def RCSW_LICENSE(license, project, year, author)
*
* \brief Get the license notice for the project for displaying at program
* launch/library load.
*
* \param license The name of the license to use. Must be [LGPLV3, GPLV3, MIT].
* \param project The name of the project.
* \param year The copyright year (current year usually).
* \param author The main/original author/organization owning the copyright.
*/
#define RCSW_LICENSE(license, project, year, author) \
RCSW_JOIN(RCSW_LICENSE_, license)(project, year, author)

/**
* \def RCSW_LICENSE_GPLV3(project, year, author)
*
* \brief The license notice for GPLv3+-licensed projects.
*/
#define RCSW_LICENSE_GPLV3(project, year, author) \
"Copyright (c) " RCSW_XSTR(year) " " RCSW_XSTR(author) ".\n" \
"\n" \
RCSW_XSTR(project) " is free software: you can redistribute it and/or modify it\n" \
"under the terms of the GNU General Public License as published by the Free\n" \
"Software Foundation, either version 3 of the License, or (at your option) any\n" \
"later version.\n" \
"\n" \
RCSW_XSTR(project) " is distributed in the hope that it will be useful, but\n" \
"WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" \
"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n" \
"details.\n" \
"\n" \
"You should have received a copy of the GNU General Public License along with\n" \
RCSW_XSTR(project) ". If not, see <https://www.gnu.org/licenses/>.\n"

/**
* \def RCSW_LICENSE_LGPLV3(project, year, author)
*
* \brief The license notice for LGPLv3+-licensed projects.
*/
#define RCSW_LICENSE_LGPLV3(project, year, author) \
"Copyright (c) " RCSW_XSTR(year) " " RCSW_XSTR(author) ".\n" \
"\n" \
RCSW_XSTR(project) " is free software: you can redistribute it and/or modify it\n" \
"under the terms of the GNU Lesser General Public License as published by the\n" \
"Free Software Foundation, either version 3 of the License, or (at your option)\n" \
"any later version.\n" \
"\n" \
RCSW_XSTR(project) " is distributed in the hope that it will be useful, but\n" \
"WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" \
"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n" \
"details.\n" \
"\n" \
"You should have received a copy of the GNU Lesser General Public License along\n" \
"with " RCSW_XSTR(project) ". If not, see <https://www.gnu.org/licenses/>.\n"

/**
* \def RCSW_LICENSE_MIT(project, year, author)
*
* \brief The license notice for MIT-licensed projects.
*/
#define RCSW_LICENSE_MIT(project, year, author) \
"Copyright (c) " RCSW_XSTR(year) " " RCSW_XSTR(author) ".\n" \
RCSW_XSTR(project) " is licensed under the terms of the MIT LICENSE:\n" \
"\n" \
"Permission is hereby granted, free of charge, to any person obtaining a copy\n" \
"of this software and associated documentation files (the \"Software\"), to deal\n" \
"in the Software without restriction, including without limitation the rights\n" \
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" \
"copies of the Software, and to permit persons to whom the Software is\n" \
"furnished to do so, subject to the following conditions:\n" \
"\n" \
"The above copyright notice and this permission notice shall be included in all\n" \
"copies or substantial portions of the Software.\n" \
"\n" \
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" \
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" \
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" \
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" \
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" \
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n" \
"SOFTWARE.\n"
2 changes: 1 addition & 1 deletion libra
Submodule libra updated from 42a888 to 8deb41

0 comments on commit 2248cca

Please sign in to comment.