Skip to content

Commit

Permalink
Add support for CMake and standardized project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
NidasioAlberto committed Apr 14, 2024
1 parent 4a5f540 commit c175364
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
53 changes: 53 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 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.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.16)

project(TsCpp
DESCRIPTION "Trivial serialization for C++"
LANGUAGES CXX
)

add_library(tscpp INTERFACE)
target_sources(tscpp INTERFACE src/tscpp/buffer.cpp src/tscpp/stream.cpp)
target_include_directories(tscpp INTERFACE include)

add_executable(1_stream_known EXCLUDE_FROM_ALL examples/1_stream_known.cpp)
target_link_libraries(1_stream_known tscpp)

add_executable(2_stream_unknown EXCLUDE_FROM_ALL examples/2_stream_unknown.cpp)
target_link_libraries(2_stream_unknown tscpp)

add_executable(3_buffer_known EXCLUDE_FROM_ALL examples/3_buffer_known.cpp)
target_link_libraries(3_buffer_known tscpp)

add_executable(4_buffer_unknown EXCLUDE_FROM_ALL examples/4_buffer_unknown.cpp)
target_link_libraries(4_buffer_unknown tscpp)

add_executable(5_stream_failtest EXCLUDE_FROM_ALL examples/5_stream_failtest.cpp)
target_link_libraries(5_stream_failtest tscpp)

add_executable(6_buffer_failtest EXCLUDE_FROM_ALL examples/6_buffer_failtest.cpp)
target_link_libraries(6_buffer_failtest tscpp)
21 changes: 0 additions & 21 deletions examples/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion buffer.cpp → src/tscpp/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/

#include "buffer.h"
#include <tscpp/buffer.h>

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion stream.cpp → src/tscpp/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/

#include "stream.h"
#include <tscpp/stream.h>
#include <memory>
#if defined(__GNUC__) && !defined(_MIOSIX)
#include <cxxabi.h>
Expand Down

0 comments on commit c175364

Please sign in to comment.