Juce-1.46 with cmake support


#1

Hi, my name is Miguel. Great work!.
So, only now for linux users. http://mkarmona2.dnsalias.com/juce_cmk_146.tgz . It is only juce lib with cmake support. if some people are interested on win and mac then i’ll try to support it (i think it is easy) too.

tar xzf file

mkdir juce_build
cd juce_build
cmake …/juce_cmk_146/
make

(in main CMakefile.txt you can select:
set(SHARED OFF)
set(JUCE_CORE_ONLY OFF)

and Release or Debug
SET(CMAKE_BUILD_TYPE Release)
#set(CMAKE_BUILD_TYPE Debug)

plattaform specific code files are in src/core/pd and src/appframework/pd
it is not necesary we have it in the include path.

you can copy juce_cmk_146/include/* in some include path or use it
and copy your juce_core.a and juce_appframework.a (this one include juce_core.a)

then you can only now include JUCE.h for your project

I have some questions:

i know what amalgamated files are but it is not necesary, then why? with a clean project and with cmake support you dont need it.

i think this hierarchy is better to mantain the code and to use the lib.

PD: great work again! :smiley:


#2

Sorry, now you can download it again.


#3

Thanks - I’ve been trying to find time to experiment with cmake, but have been busy lately and haven’t managed to try it yet.

The amalgamated version is great for building lots of projects with different build configurations - rather than having to rebuild juce for each one, they can all just change the settings locally and there’s no clashes. Regardless of how easy it might be to build the library with cmake, it’s always going to be easier not to have to build it at all!


#4

CMake would be huge for me, as a lot of libraries that are used here also use CMake, so being able to create a CMake that bundles all libraries and JUCE for deploying projects would be a winner.


#5

Hi, here is our CMakeLists.txt file, not intended to handle usages other than ours (opengl is required and asio can be switched on or off),
but should be useful if someone wants to write one that fits for every one

FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})

OPTION(JUCE_ASIO_SUPPORT "Build Juce Asio support." ON)

IF (JUCE_ASIO_SUPPORT)
  INCLUDE_DIRECTORIES(../asiosdk2)
  ADD_DEFINITIONS(-DJUCE_ASIO)
ENDIF(JUCE_ASIO_SUPPORT)

# Enable stack-unwinding support in c objects on gcc-based platforms.
# Failing to do so will cause your program to be terminated when a png
# or a jpeg exception is thrown on linux or macosx.
IF (CMAKE_COMPILER_IS_GNUCC)
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
ENDIF(CMAKE_COMPILER_IS_GNUCC)


IF (WIN32)
  SET(JUCE_PLATFORM_SPECIFIC_DIR build/win32/platform_specific_code)
  ADD_DEFINITIONS(-DDONT_AUTOLINK_TO_JUCE_LIBRARY)
  SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES
    kernel32.lib
    user32.lib
    shell32.lib
    gdi32.lib
    vfw32.lib
    comdlg32.lib
    winmm.lib
    wininet.lib
    rpcrt4.lib
    ole32.lib
    advapi32.lib
    ws2_32.lib
    OpenGL32.Lib
    GlU32.Lib
  )
ELSE (WIN32)
  IF   (UNIX)
    IF   (APPLE)
      SET(JUCE_PLATFORM_SPECIFIC_DIR build/macosx/platform_specific_code)
      SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES "-framework Carbon -framework Cocoa -framework CoreFoundation -framework CoreAudio -framework CoreMidi -framework IOKit -framework AGL -lobjc")
    ELSE (APPLE)
      FIND_PACKAGE(X11 REQUIRED)
      INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
      INCLUDE_DIRECTORIES(/usr/include/freetype2)
      ADD_DEFINITIONS(-DLINUX)
      SET(JUCE_PLATFORM_SPECIFIC_DIR build/linux/platform_specific_code)
      SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES ${X11_LIBRARIES} asound freetype Xinerama)
    ENDIF(APPLE)
  ENDIF(UNIX)
ENDIF(WIN32)

FILE(GLOB JUCE_CORE_BASICS_SOURCES
  src/juce_core/basics/*.cpp
  src/juce_core/basics/*.h
)

FILE(GLOB JUCE_CORE_CRYPTOGRAPHY_SOURCES
  src/juce_core/cryptography/*.cpp
  src/juce_core/cryptography/*.h
)

FILE(GLOB JUCE_CORE_CONTAINERS_SOURCES
  src/juce_core/containers/*.cpp
  src/juce_core/containers/*.h
)

FILE(GLOB JUCE_CORE_IO_SOURCES
  src/juce_core/io/*.cpp
  src/juce_core/io/*.h
  src/juce_core/io/files/*.cpp
  src/juce_core/io/files/*.h
  src/juce_core/io/network/*.cpp
  src/juce_core/io/network/*.h
  src/juce_core/io/streams/*.cpp
  src/juce_core/io/streams/*.h
)

FILE(GLOB JUCE_CORE_MISC_SOURCES
  src/juce_core/misc/*.cpp
  src/juce_core/misc/*.h
)

FILE(GLOB JUCE_CORE_TEXT_SOURCES
  src/juce_core/text/*.cpp
  src/juce_core/text/*.h
)

FILE(GLOB JUCE_CORE_THREADS_SOURCES
  src/juce_core/threads/*.cpp
  src/juce_core/threads/*.h
)

FILE(GLOB JUCE_CORE_SOURCES
  juce.h
  juce_Config.h
  src/juce_core_includes.h
  ${JUCE_CORE_BASICS_SOURCES}
  ${JUCE_CORE_CRYPTOGRAPHY_SOURCES}
  ${JUCE_CORE_CONTAINERS_SOURCES}
  ${JUCE_CORE_IO_SOURCES}
  ${JUCE_CORE_MISC_SOURCES}
  ${JUCE_CORE_TEXT_SOURCES}
  ${JUCE_CORE_THREADS_SOURCES}
)

FILE(GLOB JUCE_APP_APPLICATION_SOURCES
  src/juce_appframework/application/*.cpp
  src/juce_appframework/application/*.h
)

FILE(GLOB JUCE_APP_AUDIO_SOURCES
  src/juce_appframework/audio/*.cpp
  src/juce_appframework/audio/*.h
  src/juce_appframework/audio/audio_file_formats/*.cpp
  src/juce_appframework/audio/audio_file_formats/*.h
  src/juce_appframework/audio/audio_sources/*.cpp
  src/juce_appframework/audio/audio_sources/*.h
  src/juce_appframework/audio/devices/*.cpp
  src/juce_appframework/audio/devices/*.h
  src/juce_appframework/audio/dsp/*.cpp
  src/juce_appframework/audio/dsp/*.h
  src/juce_appframework/audio/plugins/*.cpp
  src/juce_appframework/audio/plugins/*.h
  src/juce_appframework/audio/plugins/formats/*.cpp
  src/juce_appframework/audio/plugins/formats/*.h
  src/juce_appframework/audio/processors/*.cpp
  src/juce_appframework/audio/processors/*.h
  src/juce_appframework/audio/synthetisers/*.cpp
  src/juce_appframework/audio/synthetisers/*.h
  src/juce_appframework/audio/midi/*.cpp
  src/juce_appframework/audio/midi/*.h
)

FILE(GLOB JUCE_APP_DOCUMENTS_SOURCES
  src/juce_appframework/documents/*.cpp
  src/juce_appframework/documents/*.h
)

FILE(GLOB JUCE_APP_EVENTS_SOURCES
  src/juce_appframework/events/*.cpp
  src/juce_appframework/events/*.h
)

FILE(GLOB JUCE_APP_GUI_GRAPHICS_SOURCES
  src/juce_appframework/gui/graphics/brushes/*.cpp
  src/juce_appframework/gui/graphics/brushes/*.h
  src/juce_appframework/gui/graphics/colour/*.cpp
  src/juce_appframework/gui/graphics/colour/*.h
  src/juce_appframework/gui/graphics/contexts/*.cpp
  src/juce_appframework/gui/graphics/contexts/*.h
  src/juce_appframework/gui/graphics/drawables/*.cpp
  src/juce_appframework/gui/graphics/drawables/*.h
  src/juce_appframework/gui/graphics/effects/*.cpp
  src/juce_appframework/gui/graphics/effects/*.h
  src/juce_appframework/gui/graphics/fonts/*.cpp
  src/juce_appframework/gui/graphics/fonts/*.h
  src/juce_appframework/gui/graphics/geometry/*.cpp
  src/juce_appframework/gui/graphics/geometry/*.h
  src/juce_appframework/gui/graphics/imaging/*.cpp
  src/juce_appframework/gui/graphics/imaging/*.h
  src/juce_appframework/gui/graphics/imaging/image_file_formats/*.cpp
  src/juce_appframework/gui/graphics/imaging/image_file_formats/*.h
)

FILE(GLOB JUCE_APP_GUI_COMPONENTS_SOURCES
  src/juce_appframework/gui/components/*.cpp
  src/juce_appframework/gui/components/*.h
  src/juce_appframework/gui/components/buttons/*.cpp
  src/juce_appframework/gui/components/buttons/*.h
  src/juce_appframework/gui/components/controls/*.cpp
  src/juce_appframework/gui/components/controls/*.h
  src/juce_appframework/gui/components/filebrowser/*.cpp
  src/juce_appframework/gui/components/filebrowser/*.h
  src/juce_appframework/gui/components/keyboard/*.cpp
  src/juce_appframework/gui/components/keyboard/*.h
  src/juce_appframework/gui/components/layout/*.cpp
  src/juce_appframework/gui/components/layout/*.h
  src/juce_appframework/gui/components/lookandfeel/*.cpp
  src/juce_appframework/gui/components/lookandfeel/*.h
  src/juce_appframework/gui/components/menus/*.cpp
  src/juce_appframework/gui/components/menus/*.h
  src/juce_appframework/gui/components/mouse/*.cpp
  src/juce_appframework/gui/components/mouse/*.h
  src/juce_appframework/gui/components/properties/*.cpp
  src/juce_appframework/gui/components/properties/*.h
  src/juce_appframework/gui/components/special/*.cpp
  src/juce_appframework/gui/components/special/*.h
  src/juce_appframework/gui/components/windows/*.cpp
  src/juce_appframework/gui/components/windows/*.h
)

FILE(GLOB JUCE_APP_TOOLBAG_SOURCES
  src/juce_appframework/toolbag/*.cpp
  src/juce_appframework/toolbag/*.h
)

FILE(GLOB JUCE_APP_SOURCES
  src/juce_app_includes.h
  ${JUCE_APP_APPLICATION_SOURCES}
  ${JUCE_APP_AUDIO_SOURCES}
  ${JUCE_APP_DOCUMENTS_SOURCES}
  ${JUCE_APP_EVENTS_SOURCES}
  ${JUCE_APP_GUI_GRAPHICS_SOURCES}
  ${JUCE_APP_GUI_COMPONENTS_SOURCES}
  ${JUCE_APP_TOOLBAG_SOURCES}
)

FILE(GLOB JUCE_PLATFORM_SOURCES
  ${JUCE_PLATFORM_SPECIFIC_DIR}/*.h 
  ${JUCE_PLATFORM_SPECIFIC_DIR}/*.cpp
  ${JUCE_PLATFORM_SPECIFIC_DIR}/*.mm
)

SET(JUCE_SOURCES
  ${JUCE_CORE_SOURCES}
  ${JUCE_APP_SOURCES}
  ${JUCE_PLATFORM_SOURCES}
)

SOURCE_GROUP(Headers FILES
  juce.h
  juce_Config.h
  src/juce_core_includes.h
  src/juce_app_includes.h
  src/juce_DefineMacros.h
  src/juce_WithoutMacros.h
)

SOURCE_GROUP(Core/Basics        FILES   ${JUCE_CORE_BASICS_SOURCES})
SOURCE_GROUP(Core/Crypto        FILES   ${JUCE_CORE_CRYPTOGRAPHY_SOURCES})
SOURCE_GROUP(Core/Containers    FILES   ${JUCE_CORE_CONTAINERS_SOURCES})
SOURCE_GROUP(Core/IO            FILES   ${JUCE_CORE_IO_SOURCES})
SOURCE_GROUP(Core/Misc          FILES   ${JUCE_CORE_MISC_SOURCES})
SOURCE_GROUP(Core/Text          FILES   ${JUCE_CORE_TEXT_SOURCES})
SOURCE_GROUP(Core/Threads       FILES   ${JUCE_CORE_THREADS_SOURCES})

SOURCE_GROUP(App/Application    FILES   ${JUCE_APP_APPLICATION_SOURCES})
SOURCE_GROUP(App/Audio          FILES   ${JUCE_APP_AUDIO_SOURCES})
SOURCE_GROUP(App/Documents      FILES   ${JUCE_APP_DOCUMENTS_SOURCES})
SOURCE_GROUP(App/Events         FILES   ${JUCE_APP_EVENTS_SOURCES})
SOURCE_GROUP(App/Gui/Graphics   FILES   ${JUCE_APP_GUI_GRAPHICS_SOURCES})
SOURCE_GROUP(App/Gui/Components FILES   ${JUCE_APP_GUI_COMPONENTS_SOURCES})
SOURCE_GROUP(App/Toolbag        FILES   ${JUCE_APP_TOOLBAG_SOURCES})

SOURCE_GROUP(Platform           FILES   ${JUCE_PLATFORM_SOURCES})

ADD_LIBRARY(juce
  ${JUCE_SOURCES}
)

SET_TARGET_PROPERTIES(juce PROPERTIES PROJECT_LABEL "LIB Juce")

TARGET_LINK_LIBRARIES(juce
  ${JUCE_PLATFORM_SPECIFIC_LIBRARIES}
  ${OPENGL_LIBRARIES}
)