Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bostick committed Jan 9, 2025
1 parent 0207f75 commit ea5296c
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 677 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Brenton Bostick
Copyright (c) 2025 Brenton Bostick

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tbt-parser depends on zlib and uses CMake for building.
tbt-parser requires a C++20 compiler because of features such as `__VA_OPT__`.

```
cd cpp
cd tbt-parser
mkdir build
cd build
cmake ..
Expand Down
16 changes: 12 additions & 4 deletions exe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
cmake_minimum_required(VERSION 3.22.1)
include(FetchContent)

#
# De-duplicate libraries on link lines based on linker capabilities.
#
# fixes Xcode complaining:
# ld: warning: ignoring duplicate libraries: 'libcommon.a'
#
cmake_policy(SET CMP0156 NEW)

FetchContent_Declare(common
GIT_REPOSITORY
https://github.com/bostick/common.git
Expand Down Expand Up @@ -48,25 +56,25 @@ add_executable(tbt-info-exe

target_link_libraries(tbt-converter-exe
PRIVATE
tbt-parser-static-lib
tbt-parser-lib
common-lib
)

target_link_libraries(midi-info-exe
PRIVATE
tbt-parser-static-lib
tbt-parser-lib
common-lib
)

target_link_libraries(tbt-printer-exe
PRIVATE
tbt-parser-static-lib
tbt-parser-lib
common-lib
)

target_link_libraries(tbt-info-exe
PRIVATE
tbt-parser-static-lib
tbt-parser-lib
common-lib
)

Expand Down
2 changes: 1 addition & 1 deletion include/tbt-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <map>
#include <variant>
#include <string>
#include <cstdint>
#include <cstdint> // for uint8_t
#include <cstddef> // for size_t


Expand Down
75 changes: 0 additions & 75 deletions include/tbt-parser/rational.h

This file was deleted.

4 changes: 0 additions & 4 deletions include/tbt-parser/tbt-parser-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ std::string fromPascal2String(const char *data);

std::string trim(const std::string &str);

int8_t euclidean_mod(int8_t a, int8_t b);

int64_t euclidean_mod(int64_t a, int64_t b);

uint8_t width(int a);


Expand Down
30 changes: 20 additions & 10 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,29 @@ FetchContent_Declare(common
)
FetchContent_MakeAvailable(common)

FetchContent_Declare(rational
GIT_REPOSITORY
https://github.com/bostick/rational.git
GIT_TAG
v0.1.0
GIT_SHALLOW 1
GIT_PROGRESS 1
)
FetchContent_MakeAvailable(rational)


set(CPP_LIB_SOURCES
midi.cpp
rational.cpp
tbt.cpp
tbt-parser-util.cpp
tablature.cpp
)

add_library(tbt-parser-static-lib STATIC
add_library(tbt-parser-lib STATIC
${CPP_LIB_SOURCES}
)

target_include_directories(tbt-parser-static-lib
target_include_directories(tbt-parser-lib
PUBLIC
../include
#
Expand All @@ -76,15 +85,16 @@ target_include_directories(tbt-parser-static-lib
../lib
)

target_link_libraries(tbt-parser-static-lib
target_link_libraries(tbt-parser-lib
PRIVATE
zlibstatic
common-lib
rational-lib
)

set_target_properties(tbt-parser-static-lib
set_target_properties(tbt-parser-lib
PROPERTIES
OUTPUT_NAME tbt-parser-static
OUTPUT_NAME tbt-parser
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS NO
Expand All @@ -96,19 +106,19 @@ set_target_properties(tbt-parser-static-lib
# https://www.foonathan.net/2018/10/cmake-warnings/
#
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(tbt-parser-static-lib PRIVATE
target_compile_options(tbt-parser-lib PRIVATE
-Wall -Wextra -pedantic -Werror -Wconversion -Wsign-conversion
)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
target_compile_options(tbt-parser-static-lib PRIVATE
target_compile_options(tbt-parser-lib PRIVATE
-Wall -Wextra -pedantic -Werror -Wconversion -Wsign-conversion
)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(tbt-parser-static-lib PRIVATE
target_compile_options(tbt-parser-lib PRIVATE
-Wall -Wextra -pedantic -Werror -Wconversion -Wsign-conversion
)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(tbt-parser-static-lib PRIVATE
target_compile_options(tbt-parser-lib PRIVATE
#
# /Zc:preprocessor is needed for handling __VA_OPT__(,)
#
Expand Down
3 changes: 2 additions & 1 deletion lib/midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "tbt-parser/rational.h"
#include "tbt-parser/tbt-parser-util.h"
#include "tbt-parser/tbt.h"

#include "rational/rational.h"

#undef NDEBUG

#include "common/abort.h"
Expand Down
Loading

0 comments on commit ea5296c

Please sign in to comment.