/treecore

a reforged JUCE core library with cmake build control and more regular project layout

Primary LanguageC++MIT LicenseMIT

treecore

a reforged JUCE core library with CMake build control and more regular project layout

Introduction

We found JUCE library very useful, but we are not satisfied with JUCE's project layout, so we reformed it and added/modified some features.

  • everything in treecore namespace.
  • SIMD operations.
  • atomic operations wrapped both in functions and objects.
  • picked out network system because we don't need it.
  • reforged reference counted object class and its holder class.
  • system config macros are generated by CMake proxy and file generation, not by a series of macro proxy.
  • use MT19937 to replace juce::Random.

Compile from Source Code

Prerequisites

  • cmake
  • some compiler, such as MSVC, GCC (or MinGW), CLang...
  • under Linux: build tools like GNU make

Build in Linux, or Windows using MinGW

Firstly, create a directory to hold the build results. This directory is preferably outside the source directory:

$ mkdir treejuce-build

Then run cmake in this directory, using the source directory as its argument. You may also specify a install prefix, otherwise treejuce will be installed to system-wide /usr/local.

$ cd treejuce-build
$ cmake /home/yourname/path_to_source/treejuce -DCMAKE_INSTALL_PREFIX=/home/yourname/software/treejuce

After that, a Makefile should have been created. Run make to build all stuffs:

$ make

If every thing goes OK, run make install to copy headers and libraries to install prefix:

$ make install

Bulid in Windows using MSVC

  1. Run cmake GUI from start menu.

  2. Specify treecore source directory and the build directory.

  3. Click "configure" button at the bottom of the window. It will pop up a dialog to let you select project generator. Select the MSVC generator with version you prefer.

  4. The project will be configured and showing a lot of options. At this time, you may specify CMAKE_INSTALL_PREFIX.

  5. Click "configure" button again, until there are no option entries showing in red (which means it is changed in this turn of configuration).

  6. Click "generate" button. The MSVC stuffs should have been generated into the build directory.

  7. Double click the .sln MSVC solution file. MSVC should be opened, and you can do the build stuffs inside it.

  8. You can build the INSTALL project to have the libraries and the headers installed to the directory specified by CMAKE_INSTALL_PREFIX.

Use treecore

Use installed treecore

The CMake treecore finding module will be installed to CMake module path. In your project that use treecore, firstly find it:

find_package(TreeCore)

As treecore library uses lots of compiler options and macros, to eass the use we provided a wrapper CMake function target_use_treecore. It set header inclusion directories, treecore library and compiling options in one CMake call:

add_executable(my_prog my_prog.cpp)
target_use_treecore(my_prog)

add_library(my_lib my _lib.cpp)
target_use_treecore(my_lib)

Also, we wrapped JUCE's binary builder to another CMake function treecore_wrap_resource. It accepts two parameters: the input directory and the output class name. Resultant source files will be generated at CMAKE_CURRENT_BINARY_DIR in which treecore_wrap_resource is called.

Use treecore as subproject

You can directly move treecore source code hierarchy to your source code directory, and include treecore by:

add_subdirectory(treecore)