a reforged JUCE core library with CMake build control and more regular project layout
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.
- cmake
- some compiler, such as MSVC, GCC (or MinGW), CLang...
- under Linux: build tools like GNU make
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
-
Run cmake GUI from start menu.
-
Specify treecore source directory and the build directory.
-
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.
-
The project will be configured and showing a lot of options. At this time, you may specify CMAKE_INSTALL_PREFIX.
-
Click "configure" button again, until there are no option entries showing in red (which means it is changed in this turn of configuration).
-
Click "generate" button. The MSVC stuffs should have been generated into the build directory.
-
Double click the .sln MSVC solution file. MSVC should be opened, and you can do the build stuffs inside it.
-
You can build the INSTALL project to have the libraries and the headers installed to the directory specified by CMAKE_INSTALL_PREFIX.
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.
You can directly move treecore source code hierarchy to your source code directory, and include treecore by:
add_subdirectory(treecore)