├── CMakeLists.txt ├── README.md └── cmake ├── juce_linux.cmake ├── juce_osx.cmake └── juce_win32.cmake /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.6) 2 | project(juce) 3 | 4 | # 5 | # P L A T F O R M S 6 | # 7 | # These add definitions and define a variable: JUCE_PLATFORM_SPECIFIC_LIBRARIES 8 | 9 | set(EXTRA_FLAGS) 10 | if(WIN32) 11 | include(cmake/juce_win32.cmake) 12 | elseif(UNIX) 13 | if(APPLE) 14 | include(cmake/juce_osx.cmake) 15 | set(EXTRA_FLAGS "-x objective-c++") 16 | else() 17 | include(cmake/juce_linux.cmake) 18 | endif() 19 | endif() 20 | 21 | # 22 | # F I L E S 23 | # 24 | file(GLOB modules JuceLibraryCode/modules/juce*) 25 | foreach(modpath ${modules}) 26 | get_filename_component(mod ${modpath} NAME) 27 | file(GLOB mod_srcs ${modpath}/*.cpp ${modpath}/*.h) 28 | list(APPEND JUCE_SRCS ${mod_srcs}) 29 | endforeach() 30 | 31 | # 32 | # S T A T I C L I B R A R Y 33 | # 34 | 35 | set_directory_properties(PROPERTIES 36 | COMPILE_DEFINITIONS NDEBUG 37 | COMPILE_DEFINITIONS_DEBUG DEBUG 38 | COMPILE_DEFINITIONS_RELEASE NDEBUG 39 | ) 40 | 41 | include_directories(JuceLibraryCode) 42 | add_library(juce STATIC ${JUCE_SRCS}) 43 | target_link_libraries(juce ${JUCE_PLATFORM_SPECIFIC_LIBRARIES}) 44 | set_target_properties(juce PROPERTIES COMPILE_FLAGS ${EXTRA_FLAGS}) 45 | 46 | # 47 | # O U T P U T 48 | # 49 | set(JUCE_LIBRARIES juce ${JUCE_PLATFORM_SPECIFIC_LIBRARIES} PARENT_SCOPE) 50 | set(JUCE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/JuceLibraryCode PARENT_SCOPE) 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | cmake-juce 2 | ========== 3 | 4 | A [CMake][1] based build system for [Juce][2]. 5 | 6 | The aim here is to develop a set of CMake files that can be added to the modules created by *The Introjucer* to aid integration with a parent project. 7 | 8 | ### Instructions 9 | 10 | 1. Create a new static library project using *The Introjucer*. Install the modules to something like myproject/juce. 11 | 2. Copy the files in this repository to: myproject/juce 12 | 3. Update the parent project's CMakeLists.txt. 13 | 14 | You should end up with a directory structure that looks like: 15 | 16 | myproject\ 17 | CMakeLists.txt <-- The CMakeLists.txt file for your project 18 | juce\ 19 | CMakeLists.txt | 20 | cmake\ | 21 | juce-linux.cmake | -- This repository's files 22 | juce-osx.cmake | 23 | juce-win32.cmake | 24 | myproject.jucer 25 | Builds\ 26 | ...(ignored) 27 | JuceLibraryCode\ 28 | ...(good stuff) 29 | Source\ 30 | ...(ignored) 31 | 32 | To statically link [JUCE][2] with your project's CMakeLists.txt, follow this example: 33 | 34 | ```cmake 35 | add_subdirectory(juce) 36 | include_directories(${JUCE_INCLUDE_DIRS}) 37 | target_link_libraries( my-app-target ${JUCE_LIBRARIES}) 38 | ``` 39 | 40 | ### Status 41 | 42 | I'm just starting to use these files for my personal projects. I have built a toy project on osx, but the windows and linux builds are completely untested. Also, I'm just starting to use [JUCE][2], so it's entirely possible this is a terribly wrong approach to using the library. 43 | 44 | So, *caveat utilitor*. 45 | 46 | [1]: http://www.cmake.org/cmake/help/documentation.html 47 | [2]: http://www.juce.com/ 48 | -------------------------------------------------------------------------------- /cmake/juce_linux.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # linux platform specific libraries 3 | # 4 | 5 | find_package(X11 REQUIRED) 6 | find_package(Freetype REQUIRED) 7 | 8 | include_directories(${X11_INCLUDE_DIR}) 9 | include_directories(${FREETYPE_INCLUDE_DIRS}) 10 | #add_definitions(-DLINUX) 11 | set(JUCE_PLATFORM_SPECIFIC_LIBRARIES 12 | ${X11_LIBRARIES} 13 | asound 14 | ${FREETYPE_LIBRARIES} 15 | Xinerama) 16 | 17 | -------------------------------------------------------------------------------- /cmake/juce_osx.cmake: -------------------------------------------------------------------------------- 1 | # osx platform specific libraries 2 | SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES 3 | "-framework Carbon" 4 | "-framework Cocoa" 5 | "-framework CoreFoundation" 6 | "-framework CoreAudio" 7 | "-framework CoreMidi" 8 | "-framework QuartzCore" 9 | "-framework IOKit" 10 | "-framework AGL" 11 | "-lobjc") 12 | 13 | -------------------------------------------------------------------------------- /cmake/juce_win32.cmake: -------------------------------------------------------------------------------- 1 | # win32 platform libs 2 | SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES 3 | kernel32.lib 4 | user32.lib 5 | shell32.lib 6 | gdi32.lib 7 | vfw32.lib 8 | comdlg32.lib 9 | winmm.lib 10 | wininet.lib 11 | rpcrt4.lib 12 | ole32.lib 13 | advapi32.lib 14 | ws2_32.lib 15 | OpenGL32.Lib 16 | GlU32.Lib 17 | ) 18 | 19 | --------------------------------------------------------------------------------