Skip to content

Commit 2348bec

Browse files
Add support for CMake and standardized project structure
1 parent 4a5f540 commit 2348bec

7 files changed

Lines changed: 56 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

CMakeLists.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (C) 2024 by Skyward
2+
#
3+
# This program is free software; you can redistribute it and/or
4+
# it under the terms of the GNU General Public License as published
5+
# the Free Software Foundation; either version 2 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# As a special exception, if other files instantiate templates or use
14+
# macros or inline functions from this file, or you compile this file
15+
# and link it with other works to produce a work based on this file,
16+
# this file does not by itself cause the resulting work to be covered
17+
# by the GNU General Public License. However the source code for this
18+
# file must still be made available in accordance with the GNU
19+
# Public License. This exception does not invalidate any other
20+
# why a work based on this file might be covered by the GNU General
21+
# Public License.
22+
#
23+
# You should have received a copy of the GNU General Public License
24+
# along with this program; if not, see <http://www.gnu.org/licenses/>
25+
26+
cmake_minimum_required(VERSION 3.16)
27+
28+
project(TsCpp
29+
DESCRIPTION "Trivial serialization for C++"
30+
LANGUAGES CXX
31+
)
32+
33+
add_library(tscpp INTERFACE)
34+
target_sources(tscpp INTERFACE src/tscpp/buffer.cpp src/tscpp/stream.cpp)
35+
target_include_directories(tscpp INTERFACE include)
36+
37+
add_executable(1_stream_known examples/1_stream_known.cpp)
38+
target_link_libraries(1_stream_known tscpp)
39+
40+
add_executable(2_stream_unknown examples/2_stream_unknown.cpp)
41+
target_link_libraries(2_stream_unknown tscpp)
42+
43+
add_executable(3_buffer_known examples/3_buffer_known.cpp)
44+
target_link_libraries(3_buffer_known tscpp)
45+
46+
add_executable(4_buffer_unknown examples/4_buffer_unknown.cpp)
47+
target_link_libraries(4_buffer_unknown tscpp)
48+
49+
add_executable(5_stream_failtest examples/5_stream_failtest.cpp)
50+
target_link_libraries(5_stream_failtest tscpp)
51+
52+
add_executable(6_buffer_failtest examples/6_buffer_failtest.cpp)
53+
target_link_libraries(6_buffer_failtest tscpp)

examples/Makefile

Lines changed: 0 additions & 21 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

buffer.cpp renamed to src/tscpp/buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* along with this program; if not, see <http://www.gnu.org/licenses/> *
2626
***************************************************************************/
2727

28-
#include "buffer.h"
28+
#include <tscpp/buffer.h>
2929

3030
using namespace std;
3131

stream.cpp renamed to src/tscpp/stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* along with this program; if not, see <http://www.gnu.org/licenses/> *
2626
***************************************************************************/
2727

28-
#include "stream.h"
28+
#include <tscpp/stream.h>
2929
#include <memory>
3030
#if defined(__GNUC__) && !defined(_MIOSIX)
3131
#include <cxxabi.h>

0 commit comments

Comments
 (0)