Small core C++ library with essentials that all other oomuse libraries are built on top of. This library is not music-related, so feel free to use it in any C++ project.
| File or Class | Description |
|---|---|
| int_types | Shorter to type aliases like int32 and uint64 |
| readability_macros | CANT_COPY(MyClass), CANT_MOVE(MyClass), CALL_MEMBER_FN(), ... |
| constexpr_assert | CONSTEXPR_ASSERT(), for asserts in constexpr functions |
| FixedArray | Runtime-determined fixed-length array |
| Optional | Optional value that may or may not be present (useful return type) |
| Validator, Validators |
Simple value validation for numeric ranges, non-empty strings, etc. |
| strings | Simple string utilities like case conversion and whitespace trimming |
- A modern C++ compiler toolchain that supports most C++14 language features and libraries. Recommendations:
- Windows: Microsoft Visual Studio Community 2015 (make sure to choose custom installation and install support for C++).
- Mac: Xcode, which should install Clang (otherwise see Xcode Command Line Tools); or you can directly install the Clang compiler.
- Linux: GCC (almost certainly preinstalled) or Clang.
- A recent version (3.0 or higher) of CMake.
- A recent version of conan, which is used a C++ package manager that downloads and builds needed dependencies.
You can use any build system that conan supports, though CMake is highly recommended (since it is the most widely supported and gives you the flexibility to build your project from most popular compilers and IDEs, including Xcode and Visual Studio).
Add a requires line for oomuse-core within your conanfile.txt file (shown using CMake here):
[requires]
oomuse-core/0.1.2@lindurion/stable
[generators]
cmake
Or, for more advanced projects, you can list this dependency within a conanfile.py file instead (see docs).
If your project is using CMake, include the (about to be) generated conanbuildinfo.cmake file that configures all your conan dependencies (including oomuse-core), setup conan (which makes sure, for example, that all needed header files are now on your include path), and then link your binary or library against all conan-downloaded libs (which will include oomuse-core). For example, within your CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.2)
project(YourProject)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(your_project your_project.cpp)
target_link_libraries(your_project ${CONAN_LIBS})
Include and use any oomuse-core code from your own. For example, from your_project.cpp:
#include "oomuse/core/strings.h"
namespace strings = oomuse::strings;
int main() {
// …
doSomethingWith(strings::trimWhitespace(someUserInput));
// …
}Finally, install conan dependencies (including oomuse-core) and run your build from the command line:
$ cd /path/to/yourproject/build
$ conan install /path/to/yourproject/src --build=missing
$ cmake /path/to/yourproject/src -G "Visual Studio 14 2015 Win64" # Or "Xcode", "Unix Makefiles"
$ cmake --build . --config Release
$ ./bin/your_project
To contribute changes to this library (vs. just using it), you should first clone it on GitHub.
Recommend building from a separate directory (that's not underneath the cloned git project, known as an out-of-source build).
Build & run tests:
$ cd /path/to/build/oomuse-core/
$ conan install /path/to/cloned/src/for/oomuse-core -o testing=True -s build_type=Debug --build=missing
$ conan build /path/to/cloned/src/for/oomuse-core
This open source library is free to use in your own projects, released under the Apache License Version 2.0.