devendor libraries

This commit is contained in:
tildearrow 2022-01-18 00:45:17 -05:00
parent 345962092e
commit 4419f72218
2 changed files with 43 additions and 26 deletions

View File

@ -13,39 +13,52 @@ else()
set(BUILD_GUI ON)
endif()
add_subdirectory(extern/fmt)
option(DEVENDOR_LIBRARIES "Use local versions of dependencies instead of the ones provided by submodules" OFF)
set(BUILD_TESTING OFF CACHE BOOL "aaaaaa" FORCE)
set(BUILD_PROGRAMS OFF CACHE BOOL "aaa" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "a" FORCE)
set(ENABLE_EXTERNAL_LIBS OFF CACHE BOOL "come on" FORCE)
set(ENABLE_MPEG OFF CACHE BOOL "come on" FORCE)
add_subdirectory(extern/libsndfile)
add_subdirectory(extern/zlib)
if (NOT DEVENDOR_LIBRARIES)
add_subdirectory(extern/fmt)
endif()
include_directories(extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
if (NOT DEVENDOR_LIBRARIES)
set(BUILD_TESTING OFF CACHE BOOL "aaaaaa" FORCE)
set(BUILD_PROGRAMS OFF CACHE BOOL "aaa" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "a" FORCE)
set(ENABLE_EXTERNAL_LIBS OFF CACHE BOOL "come on" FORCE)
set(ENABLE_MPEG OFF CACHE BOOL "come on" FORCE)
add_subdirectory(extern/libsndfile)
add_subdirectory(extern/zlib)
if (WIN32)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
add_subdirectory(extern/SDL)
set(HAVE_SDL2 SDL2-static)
set(HAVE_Z zlibstatic)
include_directories(extern/SDL/include extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd extern/fmt/include)
include_directories(extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
endif()
if (DEVENDOR_LIBRARIES)
find_package(SDL REQUIRED)
set(HAVE_SDL2 ${SDL_LIBRARY})
include_directories(extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd ${SDL_INCLUDE_DIR})
find_library(HAVE_JACK jack)
else()
if (BUILD_GUI)
set(SDL_SHARED ON)
if (WIN32)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
add_subdirectory(extern/SDL)
include_directories(extern/SDL/include extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd extern/fmt/include)
set(HAVE_SDL2 SDL2-static)
set(HAVE_Z zlibstatic)
include_directories(extern/SDL/include extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd extern/fmt/include)
else()
find_library(HAVE_SDL2 SDL2)
if (BUILD_GUI)
set(SDL_SHARED ON)
add_subdirectory(extern/SDL)
include_directories(extern/SDL/include extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd extern/fmt/include)
set(HAVE_SDL2 SDL2-static)
else()
find_library(HAVE_SDL2 SDL2)
endif()
if (NOT APPLE)
find_library(HAVE_JACK jack)
endif()
find_library(HAVE_SNDFILE sndfile)
set(HAVE_Z zlibstatic)
endif()
if (NOT APPLE)
find_library(HAVE_JACK jack)
endif()
find_library(HAVE_SNDFILE sndfile)
set(HAVE_Z zlibstatic)
endif()
set(AUDIO_SOURCES src/audio/abstract.cpp)
@ -154,6 +167,10 @@ else()
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
endif()
if (DEVENDOR_LIBRARIES)
target_compile_definitions(furnace PUBLIC DEVENDOR_LIBRARIES)
endif()
target_link_libraries(furnace ${HAVE_SDL2} ${HAVE_Z} sndfile fmt)
if (HAVE_JACK)

View File

@ -1,5 +1,5 @@
#include "taAudio.h"
#if defined(_WIN32) || defined(HAVE_GUI)
#if (defined(_WIN32) || defined(HAVE_GUI)) && !defined(DEVENDOR_LIBRARIES)
#include <SDL.h>
#else
#include <SDL2/SDL.h>