Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/cmake-macOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CMake macOS

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: macos-14
strategy:
matrix:
build_type: [Debug, Release]

steps:
- name: Clone
uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCINDER_BUILD_TESTS=1

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}

- name: Run Unit Tests
working-directory: ${{github.workspace}}/build
run: ${{github.workspace}}/build/${{matrix.build_type}}/UnitTests/UnitTests.app/Contents/MacOS/UnitTests
30 changes: 0 additions & 30 deletions .github/workflows/xcode-macOS.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ if( CINDER_LINUX )
include( "${CINDER_CMAKE_DIR}/platform_linux.cmake" )
elseif( CINDER_MAC )
include( "${CINDER_CMAKE_DIR}/platform_macosx.cmake" )
elseif( CINDER_COCOA_TOUCH )
include( "${CINDER_CMAKE_DIR}/platform_ios.cmake" )
elseif( CINDER_ANDROID )
include( "${CINDER_CMAKE_DIR}/platform_android.cmake" )
elseif( CINDER_MSW )
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@ git clone --recursive https://github.com/cinder/Cinder.git

You might also prefer one of our [pre-packaged downloads](https://libcinder.org/download).

### Building Cinder

Debug:
```
cmake -B build
cmake --build build -j
```

Release:
```
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
```

This works on macOS, Windows, and Linux.

Cinder [guides](https://libcinder.org/docs/branch/master/guides/index.html) and [reference documentation](https://libcinder.org/docs/branch/master/reference/index.html) are available on the website.

Cinder supports macOS, Windows, Linux, and iOS. It requires Xcode 11.3.1 or later for development on the Mac, and Visual C++ 2022 or later on Windows.
Cinder supports macOS, Windows, and Linux. It requires a C++20 compiler: Xcode 11.3.1+ on Mac, Visual C++ 2022+ on Windows.

Cinder is released under the [Modified BSD License](COPYING). Please visit [our website](https://libcinder.org) for more information.

Expand Down
4 changes: 2 additions & 2 deletions include/cinder/Cinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ using std::uint64_t;
#elif defined( macintosh ) || defined( __APPLE__ ) || defined( __APPLE_CC__ )
#define CINDER_POSIX
#define CINDER_COCOA
#define CINDER_GLFW
#define _GLFW_COCOA 1
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#if TARGET_OS_IPHONE
Expand All @@ -80,6 +78,8 @@ using std::uint64_t;
#endif
#else
#define CINDER_MAC
#define CINDER_GLFW
#define _GLFW_COCOA 1
#endif
// This is defined to prevent the inclusion of some unfortunate macros in <AssertMacros.h>
#define __ASSERTMACROS__
Expand Down
17 changes: 14 additions & 3 deletions proj/cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ endif()
ci_log_v( "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )

# Set default target to build for
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
if( CMAKE_SYSTEM_NAME MATCHES "iOS" )
set( CINDER_TARGET_DEFAULT "ios" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set( CINDER_TARGET_DEFAULT "macosx" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux" )
set( CINDER_TARGET_DEFAULT "linux" )
Expand Down Expand Up @@ -87,8 +89,11 @@ if( CINDER_TARGET_GL )
set( CINDER_GL_CORE TRUE )
endif()
else()
ci_log_v( "No target GL has been set. Defaulting to Core Profile.")
set( CINDER_GL_CORE TRUE )
# iOS and Android use GL ES, set in their platform files
if( NOT CINDER_COCOA_TOUCH AND NOT CINDER_ANDROID )
ci_log_v( "No target GL has been set. Defaulting to Core Profile.")
set( CINDER_GL_CORE TRUE )
endif()
endif()


Expand Down Expand Up @@ -120,6 +125,12 @@ if( CINDER_LINUX )
set( CINDER_TARGET_SUBFOLDER "linux/${CINDER_ARCH}/${CINDER_TARGET_GL}" )
elseif( CINDER_MAC )
set( CINDER_TARGET_SUBFOLDER "macosx" )
elseif( CINDER_COCOA_TOUCH )
if( CMAKE_OSX_SYSROOT MATCHES "[Ss]imulator" )
set( CINDER_TARGET_SUBFOLDER "ios-sim" )
else()
set( CINDER_TARGET_SUBFOLDER "ios" )
endif()
elseif( CINDER_ANDROID )
#set( CINDER_ANDROID_NDK_PLATFORM 21 CACHE STRING "Android NDK Platform version number." )
#set( CINDER_ANDROID_NDK_ARCH "armeabi-v7a" CACHE STRING "Android NDK target architecture." )
Expand Down
25 changes: 14 additions & 11 deletions proj/cmake/libcinder_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ target_compile_definitions( cinder PUBLIC ${CINDER_DEFINES} )
if( CINDER_MSW )
set( PLATFORM_TOOLSET "$(PlatformToolset)" )
if( NOT ( "${CMAKE_GENERATOR}" MATCHES "Visual Studio.+" ) )
# Assume Visual Studio 2019
set( PLATFORM_TOOLSET "v142" )
if( MSVC_VERSION LESS 1920 ) # Visual Studio 2015
set( PLATFORM_TOOLSET "v140" )
elseif( MSVC_VERSION LESS 1900 ) # Visual Studio 2013
set( PLATFORM_TOOLSET "v120" )
elseif( MSVC_VERSION LESS 1800 )
message( FATAL_ERROR "Unsupported MSVC version: ${MSVC_VERSION}" )
endif()
set( PLATFORM_TOOLSET "v143" )
endif()

set( OUTPUT_DIRECTORY_BASE "${CINDER_PATH}/lib/${CINDER_TARGET_SUBFOLDER}" )
Expand Down Expand Up @@ -69,13 +61,24 @@ elseif( CINDER_MAC )
STATIC_LIBRARY_FLAGS "${CINDER_STATIC_LIBS_DEPENDS}"
)
elseif( CINDER_COCOA_TOUCH )
set( OUTPUT_DIRECTORY_BASE "${CINDER_PATH}/lib/${CINDER_TARGET_SUBFOLDER}" )
set_target_properties( cinder PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY_BASE}/Debug"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY_BASE}/Release"
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${OUTPUT_DIRECTORY_BASE}/MinSizeRel"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${OUTPUT_DIRECTORY_BASE}/RelWithDebInfo"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY_BASE}/Debug"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY_BASE}/Release"
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${OUTPUT_DIRECTORY_BASE}/MinSizeRel"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${OUTPUT_DIRECTORY_BASE}/RelWithDebInfo"
)
elseif( CINDER_LINUX )
endif()

# Enforce the minimum C++ standard Cinder requires.
if( CINDER_MSW AND MSVC )
if( MSVC_VERSION LESS 1920 )
message( FATAL_ERROR "Cinder requires Visual Studio 2019 (MSVC 19.20) or newer." )
if( MSVC_VERSION LESS 1930 )
message( FATAL_ERROR "Cinder requires Visual Studio 2022 (MSVC 19.30) or newer." )
endif()
endif()

Expand Down
138 changes: 134 additions & 4 deletions proj/cmake/platform_ios.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,137 @@
cmake_minimum_required( VERSION 3.16 FATAL_ERROR )
set( CMAKE_VERBOSE_MAKEFILE ON )

set( CINDER_PLATFORM "Cocoa" )
set( CINDER_TARGET_SUBFOLDER "ios" )
set( CINDER_PLATFORM "CocoaTouch" )

message( FATAL_ERROR "Building with cmake for platform iOS not yet supported." )
# Force OpenGL ES
set( CINDER_GL_ES TRUE )
set( CINDER_GL_ES_3 TRUE )

# iOS deployment target
if( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
set( CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "iOS minimum deployment target" FORCE )
endif()

# iOS source files
list( APPEND SRC_SET_COCOA_TOUCH
${CINDER_SRC_DIR}/cinder/CaptureImplAvFoundation.mm
${CINDER_SRC_DIR}/cinder/Filesystem.cpp
${CINDER_SRC_DIR}/cinder/ImageSourceFileQuartz.cpp
${CINDER_SRC_DIR}/cinder/ImageTargetFileQuartz.cpp
${CINDER_SRC_DIR}/cinder/UrlImplCocoa.mm
${CINDER_SRC_DIR}/cinder/cocoa/CinderCocoa.mm
${CINDER_SRC_DIR}/cinder/cocoa/CinderCocoaTouch.mm
)

list( APPEND SRC_SET_APP_COCOA_TOUCH
${CINDER_SRC_DIR}/cinder/app/cocoa/AppCocoaTouch.cpp
${CINDER_SRC_DIR}/cinder/app/cocoa/AppImplCocoaTouch.mm
${CINDER_SRC_DIR}/cinder/app/cocoa/CinderViewCocoaTouch.mm
${CINDER_SRC_DIR}/cinder/app/cocoa/PlatformCocoa.cpp
${CINDER_SRC_DIR}/cinder/app/cocoa/RendererImplGlCocoaTouch.mm
)

if( NOT CINDER_DISABLE_AUDIO )
list( APPEND SRC_SET_AUDIO_COCOA_TOUCH
${CINDER_SRC_DIR}/cinder/audio/cocoa/CinderCoreAudio.cpp
${CINDER_SRC_DIR}/cinder/audio/cocoa/ContextAudioUnit.cpp
${CINDER_SRC_DIR}/cinder/audio/cocoa/DeviceManagerAudioSession.mm
${CINDER_SRC_DIR}/cinder/audio/cocoa/FileCoreAudio.cpp
)
endif()

if( NOT CINDER_DISABLE_VIDEO )
list( APPEND SRC_SET_VIDEO_COCOA_TOUCH
${CINDER_SRC_DIR}/cinder/qtime/AvfUtils.mm
${CINDER_SRC_DIR}/cinder/qtime/AvfWriter.mm
${CINDER_SRC_DIR}/cinder/qtime/QuickTimeGlImplAvf.cpp
${CINDER_SRC_DIR}/cinder/qtime/QuickTimeImplAvf.mm
${CINDER_SRC_DIR}/cinder/qtime/QuickTimeUtils.cpp
)
endif()

# Files that need Objective-C++ compilation
list( APPEND CINDER_SOURCES_OBJCPP
${CINDER_SRC_DIR}/cinder/Capture.cpp
${CINDER_SRC_DIR}/cinder/Clipboard.cpp
${CINDER_SRC_DIR}/cinder/Display.cpp
${CINDER_SRC_DIR}/cinder/Font.cpp
${CINDER_SRC_DIR}/cinder/Log.cpp
${CINDER_SRC_DIR}/cinder/System.cpp
${CINDER_SRC_DIR}/cinder/Utilities.cpp
${CINDER_SRC_DIR}/cinder/app/cocoa/PlatformCocoa.cpp
${CINDER_SRC_DIR}/cinder/app/cocoa/AppCocoaTouch.cpp
${CINDER_SRC_DIR}/cinder/app/AppBase.cpp
${CINDER_SRC_DIR}/cinder/app/Renderer.cpp
${CINDER_SRC_DIR}/cinder/app/RendererGl.cpp
${CINDER_SRC_DIR}/cinder/app/Window.cpp
${CINDER_SRC_DIR}/cinder/gl/Environment.cpp
)

if( NOT CINDER_DISABLE_VIDEO )
list( APPEND CINDER_SOURCES_OBJCPP
${CINDER_SRC_DIR}/cinder/qtime/QuickTimeGlImplAvf.cpp
)
endif()

set_source_files_properties( ${CINDER_SOURCES_OBJCPP}
PROPERTIES COMPILE_FLAGS "-x objective-c++"
)

list( APPEND CINDER_SRC_FILES
${SRC_SET_COCOA_TOUCH}
${SRC_SET_APP_COCOA_TOUCH}
${SRC_SET_AUDIO_COCOA_TOUCH}
${SRC_SET_VIDEO_COCOA_TOUCH}
)

source_group( "cinder\\cocoa" FILES ${SRC_SET_COCOA_TOUCH} )
source_group( "cinder\\app\\cocoa" FILES ${SRC_SET_APP_COCOA_TOUCH} )
source_group( "cinder\\audio\\cocoa" FILES ${SRC_SET_AUDIO_COCOA_TOUCH} )
source_group( "cinder\\video\\cocoa" FILES ${SRC_SET_VIDEO_COCOA_TOUCH} )

# iOS frameworks
find_library( UIKIT_FRAMEWORK UIKit REQUIRED )
find_library( OPENGLES_FRAMEWORK OpenGLES REQUIRED )
find_library( AVFOUNDATION_FRAMEWORK AVFoundation REQUIRED )
find_library( COREVIDEO_FRAMEWORK CoreVideo REQUIRED )
find_library( ACCELERATE_FRAMEWORK Accelerate REQUIRED )
find_library( COREGRAPHICS_FRAMEWORK CoreGraphics REQUIRED )
find_library( QUARTZCORE_FRAMEWORK QuartzCore REQUIRED )
find_library( FOUNDATION_FRAMEWORK Foundation REQUIRED )
find_library( IMAGEIO_FRAMEWORK ImageIO REQUIRED )
find_library( MOBILECORESERVICES_FRAMEWORK MobileCoreServices REQUIRED )

if( NOT CINDER_DISABLE_AUDIO )
find_library( AUDIOTOOLBOX_FRAMEWORK AudioToolbox REQUIRED )
find_library( COREAUDIO_FRAMEWORK CoreAudio REQUIRED )
find_library( AVFAUDIO_FRAMEWORK AVFAudio REQUIRED )
endif()

if( NOT CINDER_DISABLE_VIDEO )
find_library( COREMEDIA_FRAMEWORK CoreMedia REQUIRED )
endif()

list( APPEND CINDER_LIBS_DEPENDS
${UIKIT_FRAMEWORK}
${OPENGLES_FRAMEWORK}
${AVFOUNDATION_FRAMEWORK}
${COREVIDEO_FRAMEWORK}
${ACCELERATE_FRAMEWORK}
${COREGRAPHICS_FRAMEWORK}
${QUARTZCORE_FRAMEWORK}
${FOUNDATION_FRAMEWORK}
${IMAGEIO_FRAMEWORK}
${MOBILECORESERVICES_FRAMEWORK}
${AUDIOTOOLBOX_FRAMEWORK}
${COREAUDIO_FRAMEWORK}
${AVFAUDIO_FRAMEWORK}
${COREMEDIA_FRAMEWORK}
)

# Include paths for CocoaTouch headers
list( APPEND CINDER_INCLUDE_SYSTEM_PRIVATE
${CINDER_INC_DIR}/cinder/app/cocoa
)

# GL ES defines
list( APPEND CINDER_DEFINES "-DCINDER_GL_ES" "-DCINDER_GL_ES_3" )
Loading