From 8557b43a101eaa9e85555f0c55e9fa73cbd1d0c8 Mon Sep 17 00:00:00 2001 From: "Damien Buhl (alias daminetreg)" Date: Wed, 18 May 2022 18:52:31 +0200 Subject: [PATCH 1/4] :sparkles: initial tipi.build integration --- .gitignore | 1 + .tipi/deps | 6 +++++ README | 63 ------------------------------------------- README.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 63 deletions(-) create mode 100644 .tipi/deps delete mode 100644 README create mode 100644 README.md diff --git a/.gitignore b/.gitignore index c59dc9c..fa87f69 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ libcity unit_tests doc include +/build diff --git a/.tipi/deps b/.tipi/deps new file mode 100644 index 0000000..9907c1b --- /dev/null +++ b/.tipi/deps @@ -0,0 +1,6 @@ +{ + "unittest-cpp/unittest-cpp" : { "@" : "v2.0.0", + "x:linux": ["UnitTest++/Win32/*"], + "x:macos": ["UnitTest++/Win32/*"], + "x:windows": ["UnitTest++/Posix/*"] } +} diff --git a/README b/README deleted file mode 100644 index 1185200..0000000 --- a/README +++ /dev/null @@ -1,63 +0,0 @@ -This is libcity. - -AUTHOR - Radek Pazdera - -BUILD - To build the library write - - make - - This will build both the staticaly and dynamicaly linked versions - and also extract headers from source tree into include/. - -DOCUMENTATION - Documentation can be extracted from the source codes with doxygen. - - make doc - - Will create documentation into doc/ folder. - -INSTALL - In order to install this library to your Unix-like operating - system you can use the generic Makefile. - - Write - - make - - to compile the code and - - sudo make install - - to install the binaries to /usr/local/bin and header files to - /usr/local/include. - - You might have to hack the Makefile to make it work on some - platforms (like Windows, Mac OS and others), but the code itself - should be platform-independent. - -TESTING - Unit tests for the library are available in the test/ subdirectory. The - UnitTest++ framework is required to run them. Specify path to frameworks - library and headers in Makefile. - - In order to be able to build tests correctly, UnitTest++ framework - must be installed or an include and link path must be set in the - Makefile. See UNITTESTCPP_LIB and UNITTESTCPP_INCLUDE_DIR variables. - -LICENSE - Copyright (C) 2011 Radek Pazdera - - This program 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. - - This program 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 this program. If not, see . diff --git a/README.md b/README.md new file mode 100644 index 0000000..deab4d2 --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# This is libcity. + +## AUTHOR + Radek Pazdera + +## BUILD +To build the library write + + make + +This will build both the staticaly and dynamicaly linked versions +and also extract headers from source tree into include/. + +## BUILD with tipi.build +To build and hack on libcity, you can build, install dependencies and run all tests with any of : + - `tipi . -t macos` + - `tipi . -t linux` + - `tipi . -t windows` + +## INSTALL with tipi.build +`libcity` can be easily used with the [tipi.build](https://tipi.build) dependency manager, by adding the following to a `.tipi/deps`: + +```json +{ + "CallForSanity/libcity": { } +} +``` + +## DOCUMENTATION +Documentation can be extracted from the source codes with doxygen. + + make doc + +Will create documentation into doc/ folder. + +## INSTALL +In order to install this library to your Unix-like operating +system you can use the generic Makefile. + +Write + + make + +to compile the code and + + sudo make install + +to install the binaries to /usr/local/bin and header files to +/usr/local/include. + +You might have to hack the Makefile to make it work on some +platforms (like Windows, Mac OS and others), but the code itself +should be platform-independent. + +## TESTING +Unit tests for the library are available in the test/ subdirectory. The +UnitTest++ framework is required to run them. Specify path to frameworks +library and headers in Makefile. + +In order to be able to build tests correctly, UnitTest++ framework +must be installed or an include and link path must be set in the +Makefile. See UNITTESTCPP_LIB and UNITTESTCPP_INCLUDE_DIR variables. + +## LICENSE + Copyright (C) 2011 Radek Pazdera + + This program 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. + + This program 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 this program. If not, see . From 380fc54347f4c291283d306c707c76cf451ea8e6 Mon Sep 17 00:00:00 2001 From: "Damien Buhl (alias daminetreg)" Date: Wed, 18 May 2022 18:52:48 +0200 Subject: [PATCH 2/4] :wrench: const correctness improvements --- src/geometry/point.cpp | 10 +++++----- src/geometry/point.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/geometry/point.cpp b/src/geometry/point.cpp index d86a8f0..e9189ea 100644 --- a/src/geometry/point.cpp +++ b/src/geometry/point.cpp @@ -46,19 +46,19 @@ void Point::set(double const& xCoord, double const& yCoord, double const& zCoord zPosition = zCoord; } -bool Point::operator==(Point const& second) +bool Point::operator==(Point const& second) const { return std::abs(xPosition - second.x()) < libcity::COORDINATES_EPSILON && std::abs(yPosition - second.y()) < libcity::COORDINATES_EPSILON && std::abs(zPosition - second.z()) < libcity::COORDINATES_EPSILON; } -bool Point::operator!=(Point const& second) +bool Point::operator!=(Point const& second) const { return !(*this == second); } -bool Point::operator<(Point const& second) +bool Point::operator<(Point const& second) const { if (x() < second.x()) { @@ -72,7 +72,7 @@ bool Point::operator<(Point const& second) return false; } -bool Point::operator>(Point const& second) +bool Point::operator>(Point const& second) const { if (x() > second.x()) { @@ -110,4 +110,4 @@ std::string Point::toString() const std::stringstream convertor; convertor << "Point(" << xPosition << ", " << yPosition << ", " << zPosition << ")"; return convertor.str(); -} \ No newline at end of file +} diff --git a/src/geometry/point.h b/src/geometry/point.h index 6d9ba4d..b6dd027 100644 --- a/src/geometry/point.h +++ b/src/geometry/point.h @@ -43,10 +43,10 @@ class Point void setY(double const& coordinate); void setZ(double const& coordinate); - bool operator==(Point const& second); - bool operator!=(Point const& second); - bool operator<(Point const& second); - bool operator>(Point const& second); + bool operator==(Point const& second) const; + bool operator!=(Point const& second) const; + bool operator<(Point const& second) const; + bool operator>(Point const& second) const; Point& operator+=(Vector const& difference); Point operator+(Vector const& difference) const; @@ -84,4 +84,4 @@ inline void Point::setZ(double const& coordinate) zPosition = coordinate; } -#endif \ No newline at end of file +#endif From 6630ef9fdb976542d7c3e9f473c3e5d66f5927e6 Mon Sep 17 00:00:00 2001 From: "Damien Buhl (alias daminetreg)" Date: Wed, 18 May 2022 18:53:07 +0200 Subject: [PATCH 3/4] :rocket: add autogenerated continuous integration via `tipi ci` --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5c58a2e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +name: build +# This workflow is triggered on pushes to the repository. +on: [push] + +jobs: + build: + name: build-linux + runs-on: ubuntu-latest + container: tipibuild/tipi-ubuntu + steps: + - name: checkout + uses: actions/checkout@v2 + - name: tipi builds project + run: | + export HOME=/root + mkdir -p ~/.tipi + tipi . -t linux --dont-upgrade --verbose --test all From e7ef144de78870490ecf3602ac2881ab94dcb32f Mon Sep 17 00:00:00 2001 From: "Damien Buhl (alias daminetreg)" Date: Wed, 18 May 2022 19:59:44 +0200 Subject: [PATCH 4/4] :book: just add small bits to the README. --- README | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 78 ------------------------------------------------------ 2 files changed, 79 insertions(+), 78 deletions(-) create mode 100644 README delete mode 100644 README.md diff --git a/README b/README new file mode 100644 index 0000000..6ac381d --- /dev/null +++ b/README @@ -0,0 +1,79 @@ +This is libcity. + +AUTHOR + Radek Pazdera + +BUILD + To build the library write + + make + + This will build both the staticaly and dynamicaly linked versions + and also extract headers from source tree into include/. + +BUILD with tipi.build + To build and hack on libcity, you can build, install dependencies and run all tests with any of : + - `tipi . -t macos` + - `tipi . -t linux` + - `tipi . -t windows` + +INSTALL with tipi.build + `libcity` can be easily used with the [tipi.build](https://tipi.build) dependency manager, by adding the following to a `.tipi/deps`: + + ```json + { + "CallForSanity/libcity": { } + } + ``` + + +DOCUMENTATION + Documentation can be extracted from the source codes with doxygen. + + make doc + + Will create documentation into doc/ folder. + +INSTALL + In order to install this library to your Unix-like operating + system you can use the generic Makefile. + + Write + + make + + to compile the code and + + sudo make install + + to install the binaries to /usr/local/bin and header files to + /usr/local/include. + + You might have to hack the Makefile to make it work on some + platforms (like Windows, Mac OS and others), but the code itself + should be platform-independent. + +TESTING + Unit tests for the library are available in the test/ subdirectory. The + UnitTest++ framework is required to run them. Specify path to frameworks + library and headers in Makefile. + + In order to be able to build tests correctly, UnitTest++ framework + must be installed or an include and link path must be set in the + Makefile. See UNITTESTCPP_LIB and UNITTESTCPP_INCLUDE_DIR variables. + +LICENSE + Copyright (C) 2011 Radek Pazdera + + This program 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. + + This program 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 this program. If not, see . diff --git a/README.md b/README.md deleted file mode 100644 index deab4d2..0000000 --- a/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# This is libcity. - -## AUTHOR - Radek Pazdera - -## BUILD -To build the library write - - make - -This will build both the staticaly and dynamicaly linked versions -and also extract headers from source tree into include/. - -## BUILD with tipi.build -To build and hack on libcity, you can build, install dependencies and run all tests with any of : - - `tipi . -t macos` - - `tipi . -t linux` - - `tipi . -t windows` - -## INSTALL with tipi.build -`libcity` can be easily used with the [tipi.build](https://tipi.build) dependency manager, by adding the following to a `.tipi/deps`: - -```json -{ - "CallForSanity/libcity": { } -} -``` - -## DOCUMENTATION -Documentation can be extracted from the source codes with doxygen. - - make doc - -Will create documentation into doc/ folder. - -## INSTALL -In order to install this library to your Unix-like operating -system you can use the generic Makefile. - -Write - - make - -to compile the code and - - sudo make install - -to install the binaries to /usr/local/bin and header files to -/usr/local/include. - -You might have to hack the Makefile to make it work on some -platforms (like Windows, Mac OS and others), but the code itself -should be platform-independent. - -## TESTING -Unit tests for the library are available in the test/ subdirectory. The -UnitTest++ framework is required to run them. Specify path to frameworks -library and headers in Makefile. - -In order to be able to build tests correctly, UnitTest++ framework -must be installed or an include and link path must be set in the -Makefile. See UNITTESTCPP_LIB and UNITTESTCPP_INCLUDE_DIR variables. - -## LICENSE - Copyright (C) 2011 Radek Pazdera - - This program 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. - - This program 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 this program. If not, see .