cmake_minimum_required(VERSION 3.14) project(RNBOCommandLine LANGUAGES CXX) # -------------------------------------------------------------------- # Tooling / IntelliSense # -------------------------------------------------------------------- set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # RNBO requires at least C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) # -------------------------------------------------------------------- # libsndfile via FetchContent # -------------------------------------------------------------------- FetchContent_Declare( libsndfile GIT_REPOSITORY https://github.com/libsndfile/libsndfile.git GIT_TAG 1.2.2 # or any version you prefer ) # Optional: disable features you don't need to reduce build time set(BUILD_PROGRAMS OFF CACHE BOOL "" FORCE) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) set(ENABLE_EXTERNAL_LIBS OFF CACHE BOOL "" FORCE) FetchContent_MakeAvailable(libsndfile) # libsndfile provides the target: sndfile # -------------------------------------------------------------------- # Main executable add_executable(RNBOCommandLine main.cpp export/sound-file-mixer.cpp export/rnbo/RNBO.cpp ) # RNBO headers target_include_directories(RNBOCommandLine PRIVATE export/rnbo export/rnbo/common ) # Link against libsndfile target_link_libraries(RNBOCommandLine PRIVATE sndfile ) # -------------------------------------------------------------------- # macOS system frameworks # -------------------------------------------------------------------- if(APPLE) find_library(CORE_FOUNDATION Foundation) find_library(APPLICATION_SERVICES ApplicationServices) find_library(CORE_SERVICES CoreServices) target_link_libraries(RNBOCommandLine PRIVATE ${CORE_FOUNDATION} ${APPLICATION_SERVICES} ${CORE_SERVICES} ) endif() # -------------------------------------------------------------------- # Copy the executable up one level after build # -------------------------------------------------------------------- add_custom_command( TARGET RNBOCommandLine POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR} )