furnace/CMakeLists.txt

1122 lines
37 KiB
Text
Raw Permalink Normal View History

cmake_minimum_required(VERSION 3.0)
2022-01-31 21:33:37 +00:00
if (APPLE)
set(MACOSX_DEPLOYMENT_TARGET 10.9)
endif()
2021-05-13 08:22:57 +00:00
project(furnace)
if (APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif()
2021-12-09 08:37:31 +00:00
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
2021-12-24 23:12:36 +00:00
set(CMAKE_PROJECT_VERSION_MAJOR 0)
set(CMAKE_PROJECT_VERSION_MINOR 6)
2024-02-03 05:58:43 +00:00
set(CMAKE_PROJECT_VERSION_PATCH 1)
2021-12-24 23:12:36 +00:00
2022-05-08 20:59:42 +00:00
set(BUILD_GUI_DEFAULT ON)
set(USE_SDL2_DEFAULT ON)
set(USE_SNDFILE_DEFAULT ON)
2022-05-08 20:59:42 +00:00
set(SYSTEM_SDL2_DEFAULT OFF)
2022-07-15 03:15:14 +00:00
include(CheckIncludeFile)
include(TestBigEndian)
2022-07-15 03:15:14 +00:00
execute_process(COMMAND git status RESULT_VARIABLE DONT_HAVE_GIT WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if (NOT DONT_HAVE_GIT)
message(STATUS "Git is available")
else()
message(WARNING "either Git is not available, or this Git repository has not been initialized.
if you have used the \"Source code\" option in the GitHub release page, you are doing it wrong! unless you manually initialize submodules, the build is guaranteed to FAIL spectacularly!
read the \"developer info\" section of README.md for more information.")
endif()
2021-12-11 07:10:09 +00:00
if (ANDROID)
set(USE_RTMIDI_DEFAULT OFF)
set(WITH_PORTAUDIO_DEFAULT OFF)
2022-05-24 18:06:29 +00:00
set(USE_BACKWARD_DEFAULT OFF)
2022-05-27 20:51:57 +00:00
find_library(TERMUX rt)
if (TERMUX)
message(STATUS "Termux detected")
endif()
2021-12-11 07:10:09 +00:00
else()
set(USE_RTMIDI_DEFAULT ON)
set(WITH_PORTAUDIO_DEFAULT ON)
2022-07-24 03:19:07 +00:00
if (WIN32 OR APPLE)
2022-07-15 03:15:14 +00:00
set(USE_BACKWARD_DEFAULT ON)
else()
2022-07-24 03:19:07 +00:00
CHECK_INCLUDE_FILE(execinfo.h EXECINFO_FOUND)
if (EXECINFO_FOUND)
2022-07-15 03:15:14 +00:00
set(USE_BACKWARD_DEFAULT ON)
else()
set(USE_BACKWARD_DEFAULT OFF)
endif()
endif()
2021-12-11 07:10:09 +00:00
endif()
find_package(PkgConfig)
2022-05-08 20:59:42 +00:00
if (PKG_CONFIG_FOUND AND NOT ANDROID)
pkg_check_modules(JACK jack)
set(WITH_JACK_DEFAULT ${JACK_FOUND})
else()
set(WITH_JACK_DEFAULT OFF)
endif()
2021-12-11 21:44:02 +00:00
set(WITH_RENDER_SDL_DEFAULT ON)
if (APPLE)
set(WITH_RENDER_OPENGL_DEFAULT OFF)
else()
set(WITH_RENDER_OPENGL_DEFAULT ON)
endif()
if (WIN32)
set(WITH_RENDER_DX11_DEFAULT ON)
else()
set(WITH_RENDER_DX11_DEFAULT OFF)
endif()
2023-06-03 20:05:55 +00:00
if (ANDROID)
set(USE_GLES_DEFAULT ON)
else()
set(USE_GLES_DEFAULT OFF)
endif()
option(BUILD_GUI "Build the tracker (disable to build only a headless player)" ${BUILD_GUI_DEFAULT})
option(USE_RTMIDI "Build with MIDI support using RtMidi." ${USE_RTMIDI_DEFAULT})
option(USE_SDL2 "Build with SDL2. Required to build with GUI." ${USE_SDL2_DEFAULT})
option(USE_SNDFILE "Build with libsndfile. Required in order to work with audio files." ${USE_SNDFILE_DEFAULT})
2022-05-24 18:06:29 +00:00
option(USE_BACKWARD "Use backward-cpp to print a backtrace on crash/abort." ${USE_BACKWARD_DEFAULT})
option(WITH_JACK "Whether to build with JACK support. Auto-detects if JACK is available" ${WITH_JACK_DEFAULT})
option(WITH_PORTAUDIO "Whether to build with PortAudio for audio output." ${WITH_PORTAUDIO_DEFAULT})
option(WITH_RENDER_SDL "Whether to build with the SDL_Renderer render backend." ${WITH_RENDER_SDL_DEFAULT})
option(WITH_RENDER_OPENGL "Whether to build with the OpenGL render backend." ${WITH_RENDER_OPENGL_DEFAULT})
option(WITH_RENDER_DX11 "Whether to build with the DirectX 11 render backend." ${WITH_RENDER_DX11_DEFAULT})
2023-06-03 20:05:55 +00:00
option(USE_GLES "Use OpenGL ES for the OpenGL render backend." ${USE_GLES_DEFAULT})
2023-10-16 11:14:44 +00:00
option(USE_FREETYPE "Use FreeType for font rendering." ON)
option(SYSTEM_FFTW "Use a system-installed version of FFTW instead of the vendored one" OFF)
option(SYSTEM_FMT "Use a system-installed version of fmt instead of the vendored one" OFF)
option(SYSTEM_FREETYPE "Use a system-installed version of FreeType instead of the vendored one" OFF)
option(SYSTEM_LIBSNDFILE "Use a system-installed version of libsndfile instead of the vendored one" OFF)
option(SYSTEM_PORTAUDIO "Use a system-installed version of PortAudio instead of the vendored one" OFF)
2022-02-13 20:02:43 +00:00
option(SYSTEM_RTMIDI "Use a system-installed version of RtMidi instead of the vendored one" OFF)
option(SYSTEM_ZLIB "Use a system-installed version of zlib instead of the vendored one" OFF)
2022-02-01 21:05:01 +00:00
option(SYSTEM_SDL2 "Use a system-installed version of SDL2 instead of the vendored one" ${SYSTEM_SDL2_DEFAULT})
2022-12-31 23:36:33 +00:00
option(SUPPORT_XP "Build a Windows XP-compatible binary" OFF)
option(WARNINGS_ARE_ERRORS "Whether warnings in furnace's C++ code should be treated as errors" OFF)
option(WITH_DEMOS "Install demo songs" ON)
option(WITH_INSTRUMENTS "Install instruments" ON)
option(WITH_WAVETABLES "Install wavetables" ON)
2024-02-05 02:52:10 +00:00
option(SHOW_OPEN_ASSETS_MENU_ENTRY "Show option to open built-in assets directory (on supported platforms)" OFF)
2023-10-29 00:07:40 +00:00
set(DEPENDENCIES_INCLUDE_DIRS extern/IconFontCppHeaders src/icon)
2022-05-11 21:09:23 +00:00
2022-05-27 20:51:57 +00:00
if (ANDROID AND NOT TERMUX)
set(DEPENDENCIES_DEFINES "IS_MOBILE")
2022-05-11 21:09:23 +00:00
else()
set(DEPENDENCIES_DEFINES "")
endif()
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if (IS_BIG_ENDIAN)
list(APPEND DEPENDENCIES_DEFINES "TA_BIG_ENDIAN")
2022-05-11 21:09:23 +00:00
endif()
set(DEPENDENCIES_COMPILE_OPTIONS "")
set(DEPENDENCIES_LIBRARIES "")
set(DEPENDENCIES_LIBRARY_DIRS "")
set(DEPENDENCIES_LINK_OPTIONS "")
set(DEPENDENCIES_LEGACY_LDFLAGS "")
if (BUILD_GUI AND WITH_RENDER_SDL)
2022-02-01 21:05:01 +00:00
set(SYSTEM_SDL_MIN_VER 2.0.18)
else()
set(SYSTEM_SDL_MIN_VER 2.0.0)
endif()
if (WIN32)
# support Windows XP
if (SUPPORT_XP)
add_compile_definitions("_WIN32_WINNT=0x0501")
endif()
endif()
2023-11-30 23:53:38 +00:00
#list(APPEND DEPENDENCIES_INCLUDE_DIRS "extern/SAASound/include")
2022-09-16 14:48:06 +00:00
list(APPEND DEPENDENCIES_INCLUDE_DIRS "extern/vgsound_emu-modified")
find_package(Threads REQUIRED)
list(APPEND DEPENDENCIES_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if (SYSTEM_FFTW)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFTW REQUIRED fftw3>=3.3)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${FFTW_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${FFTW_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${FFTW_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${FFTW_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${FFTW_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${FFTW_LDFLAGS})
message(STATUS "Using system-installed FFTW")
else()
2022-05-31 17:42:47 +00:00
if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WITH_OUR_MALLOC ON CACHE BOOL "aaa" FORCE)
endif()
2022-06-25 21:08:41 +00:00
set(BUILD_TESTS OFF CACHE BOOL "come on" FORCE)
add_subdirectory(extern/fftw EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/fftw/api)
list(APPEND DEPENDENCIES_LIBRARIES fftw3)
message(STATUS "Using vendored FFTW")
endif()
if (SYSTEM_FMT)
if (PKG_CONFIG_FOUND)
2022-04-11 07:05:58 +00:00
pkg_check_modules(FMT fmt>=7.1.0)
if (FMT_FOUND)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${FMT_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${FMT_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${FMT_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${FMT_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${FMT_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${FMT_LDFLAGS})
endif()
endif()
if (NOT FMT_FOUND)
find_package(fmt REQUIRED)
list(APPEND DEPENDENCIES_LIBRARIES fmt::fmt)
endif()
message(STATUS "Using system-installed fmt")
else()
add_subdirectory(extern/fmt EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/fmt/include)
list(APPEND DEPENDENCIES_LIBRARIES fmt)
message(STATUS "Using vendored fmt")
2022-01-18 05:45:17 +00:00
endif()
2021-12-30 22:31:08 +00:00
if (BUILD_GUI AND USE_FREETYPE)
# TODO: FIX FIX FIX FIX FIX
if (SYSTEM_FREETYPE)
if (PKG_CONFIG_FOUND)
2024-01-27 07:52:42 +00:00
pkg_check_modules(FREETYPE freetype2>=2.0.0)
if (FREETYPE_FOUND)
2024-01-27 07:52:42 +00:00
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${FREETYPE_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${FREETYPE_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${FREETYPE_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${FREETYPE_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${FREETYPE_LDFLAGS})
endif()
endif()
if (NOT FREETYPE_FOUND)
find_package(freetype REQUIRED)
list(APPEND DEPENDENCIES_LIBRARIES freetype::freetype)
endif()
message(STATUS "Using system-installed FreeType")
else()
2023-10-16 11:14:44 +00:00
set(FT_DISABLE_BROTLI ON CACHE BOOL "one" FORCE)
set(FT_DISABLE_BZIP2 ON CACHE BOOL "two" FORCE)
set(FT_DISABLE_HARFBUZZ ON CACHE BOOL "three" FORCE)
set(FT_DISABLE_PNG ON CACHE BOOL "four" FORCE)
set(FT_DISABLE_ZLIB ON CACHE BOOL "five" FORCE)
add_subdirectory(extern/freetype EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/freetype/include)
list(APPEND DEPENDENCIES_LIBRARIES freetype)
message(STATUS "Using vendored FreeType")
endif()
list(APPEND DEPENDENCIES_DEFINES HAVE_FREETYPE)
endif()
if (USE_SNDFILE)
list(APPEND DEPENDENCIES_DEFINES HAVE_SNDFILE)
if (SYSTEM_LIBSNDFILE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBSNDFILE REQUIRED sndfile)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${LIBSNDFILE_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${LIBSNDFILE_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${LIBSNDFILE_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${LIBSNDFILE_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${LIBSNDFILE_LDFLAGS})
message(STATUS "Using system-installed libsndfile")
else()
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 EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_LIBRARIES sndfile)
message(STATUS "Using vendored libsndfile")
endif()
else()
message(STATUS "Not using libsndfile")
endif()
2021-12-07 17:21:23 +00:00
if (WITH_PORTAUDIO)
if (SYSTEM_PORTAUDIO)
find_package(PkgConfig REQUIRED)
2023-09-07 09:38:16 +00:00
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${PORTAUDIO_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${PORTAUDIO_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${PORTAUDIO_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${PORTAUDIO_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${PORTAUDIO_LDFLAGS})
message(STATUS "Using system-installed PortAudio")
else()
set(PA_BUILD_SHARED_LIBS OFF CACHE BOOL "Build dynamic library" FORCE)
2023-08-31 04:14:47 +00:00
# don't - Furnace has its own implementation
set(PA_USE_JACK OFF CACHE BOOL "Enable support for JACK Audio Connection Kit" FORCE)
add_subdirectory(extern/portaudio EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_LIBRARIES PortAudio)
message(STATUS "Using vendored PortAudio")
endif()
endif()
if (USE_RTMIDI)
if (SYSTEM_RTMIDI)
find_package(PkgConfig REQUIRED)
pkg_check_modules(RTMIDI REQUIRED rtmidi)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${RTMIDI_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${RTMIDI_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${RTMIDI_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${RTMIDI_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${RTMIDI_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${RTMIDI_LDFLAGS})
message(STATUS "Using system-installed RtMidi")
else()
add_subdirectory(extern/rtmidi EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_LIBRARIES rtmidi)
message(STATUS "Using vendored RtMidi")
endif()
2022-02-13 20:02:43 +00:00
endif()
if (SYSTEM_ZLIB)
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZLIB REQUIRED zlib)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${ZLIB_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${ZLIB_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${ZLIB_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${ZLIB_LDFLAGS})
message(STATUS "Using system-installed zlib")
2022-01-18 07:56:12 +00:00
else()
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/zlib EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
list(APPEND DEPENDENCIES_LIBRARIES zlibstatic)
message(STATUS "Using vendored zlib")
2022-01-18 05:45:17 +00:00
endif()
if (USE_SDL2)
if (SYSTEM_SDL2)
if (PKG_CONFIG_FOUND)
pkg_check_modules(SDL2 sdl2>=${SYSTEM_SDL_MIN_VER})
if (SDL2_FOUND)
list(APPEND DEPENDENCIES_DEFINES HAVE_SDL2)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${SDL2_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${SDL2_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${SDL2_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${SDL2_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${SDL2_LDFLAGS})
endif()
endif()
if (NOT SDL2_FOUND)
find_package(SDL2 ${SYSTEM_SDL_MIN_VER} REQUIRED)
list(APPEND DEPENDENCIES_DEFINES HAVE_SDL2)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
list(APPEND DEPENDENCIES_LIBRARIES ${SDL2_LIBRARY})
endif()
message(STATUS "Using system-installed SDL2")
2022-05-08 20:59:42 +00:00
else()
2022-05-27 20:51:57 +00:00
if (ANDROID AND NOT TERMUX)
set(SDL_SHARED ON CACHE BOOL "Force no dynamically-linked SDL" FORCE)
set(SDL_STATIC OFF CACHE BOOL "Force statically-linked SDL" FORCE)
else()
set(SDL_SHARED OFF CACHE BOOL "Force no dynamically-linked SDL" FORCE)
set(SDL_STATIC ON CACHE BOOL "Force statically-linked SDL" FORCE)
endif()
# https://github.com/libsdl-org/SDL/issues/5535
# disable PipeWire support due to an unfixable bug:
# Looks like their headers have a C90 violation... I imagine they're probably on C99 so not the craziest bug in the world. Definitely file this at the PipeWire repository as well so they know this is out there.
set(SDL_PIPEWIRE OFF CACHE BOOL "Use Pipewire audio" FORCE)
# https://github.com/libsdl-org/SDL/issues/1481
# On 2014-06-22 17:15:50 +0000, Sam Lantinga wrote:
# If you link SDL statically, you also need to define HAVE_LIBC so it builds with the C runtime that your application uses.
# This should probably go in a FAQ.
set(SDL_LIBC ON CACHE BOOL "Tell SDL that we want it to use our C runtime (required for proper static linking)" FORCE)
2023-07-23 09:42:38 +00:00
# https://github.com/tildearrow/furnace/issues/1237
# enabling this will result in SDL finding the Direct3D headers, forcing _WIN32_WINNT to an undesirable value (which makes the Wine headers define GetTickCount64)
if (SUPPORT_XP)
set(SDL_RENDER_D3D OFF CACHE BOOL "Enable the Direct3D render driver" FORCE)
endif()
CHECK_INCLUDE_FILE(GLES/gl.h GLES_GL_FOUND)
if (NOT GLES_GL_FOUND AND NOT USE_GLES)
set(SDL_OPENGLES OFF CACHE BOOL "Enable OpenGL ES" FORCE)
endif()
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_DEFINES HAVE_SDL2)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/SDL/include)
2022-05-27 20:51:57 +00:00
if (ANDROID AND NOT TERMUX)
list(APPEND DEPENDENCIES_LIBRARIES SDL2)
else()
list(APPEND DEPENDENCIES_LIBRARIES SDL2-static)
endif()
# Work around add_subdirectory'd SDL not propagating HAVE_LIBC to MSVC furnace build
if (MSVC)
list(APPEND DEPENDENCIES_COMPILE_OPTIONS "/DHAVE_LIBC")
endif()
2023-01-14 19:57:03 +00:00
if (WIN32)
list(APPEND DEPENDENCIES_LIBRARIES SDL2main)
endif()
message(STATUS "Using vendored SDL2")
2022-05-08 20:59:42 +00:00
endif()
else()
message(STATUS "Not using SDL2")
if (BUILD_GUI)
message(FATAL_ERROR "SDL2 is required in order to build with GUI! Disable BUILD_GUI otherwise.")
endif()
endif()
if (BUILD_GUI)
if (NOT WITH_RENDER_SDL AND NOT WITH_RENDER_OPENGL AND NOT WITH_RENDER_DX11)
message(FATAL_ERROR "No render backends selected!")
endif()
endif()
set(AUDIO_SOURCES
src/audio/abstract.cpp
src/audio/midi.cpp
)
if (USE_SDL2)
2022-06-23 21:25:51 +00:00
list(APPEND AUDIO_SOURCES src/audio/sdlAudio.cpp)
endif()
if (WITH_JACK)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JACK REQUIRED jack)
list(APPEND AUDIO_SOURCES extern/weakjack/weak_libjack.c)
list(APPEND AUDIO_SOURCES src/audio/jack.cpp)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${JACK_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_DEFINES HAVE_JACK)
list(APPEND DEPENDENCIES_DEFINES USE_WEAK_JACK)
#list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${JACK_CFLAGS_OTHER})
#list(APPEND DEPENDENCIES_LIBRARIES ${JACK_LIBRARIES})
#list(APPEND DEPENDENCIES_LIBRARY_DIRS ${JACK_LIBRARY_DIRS})
#list(APPEND DEPENDENCIES_LINK_OPTIONS ${JACK_LDFLAGS_OTHER})
#list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${JACK_LDFLAGS})
message(STATUS "Building with JACK support")
else()
message(STATUS "Building without JACK support")
endif()
if (WITH_PORTAUDIO)
list(APPEND AUDIO_SOURCES src/audio/pa.cpp)
message(STATUS "Building with PortAudio")
list(APPEND DEPENDENCIES_DEFINES HAVE_PA)
else()
message(STATUS "Building without PortAudio")
endif()
if (USE_RTMIDI)
list(APPEND AUDIO_SOURCES src/audio/rtmidi.cpp)
message(STATUS "Building with RtMidi")
list(APPEND DEPENDENCIES_DEFINES HAVE_RTMIDI)
else()
message(STATUS "Building without RtMidi")
endif()
set(ENGINE_SOURCES
src/log.cpp
2022-11-13 21:25:50 +00:00
src/baseutils.cpp
src/fileutils.cpp
src/utfutils.cpp
2021-05-12 22:19:18 +00:00
extern/SAASound/src/SAAAmp.cpp
extern/SAASound/src/SAADevice.cpp
extern/SAASound/src/SAAEnv.cpp
extern/SAASound/src/SAAFreq.cpp
extern/SAASound/src/SAAImpl.cpp
extern/SAASound/src/SAANoise.cpp
extern/SAASound/src/SAASndC.cpp
extern/SAASound/src/SAASound.cpp
2022-09-16 14:48:06 +00:00
extern/vgsound_emu-modified/vgsound_emu/src/core/vox/vox.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es550x.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es550x_alu.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es550x_filter.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5504.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.cpp
extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.cpp
extern/vgsound_emu-modified/vgsound_emu/src/k005289/k005289.cpp
extern/vgsound_emu-modified/vgsound_emu/src/k007232/k007232.cpp
extern/vgsound_emu-modified/vgsound_emu/src/k053260/k053260.cpp
extern/vgsound_emu-modified/vgsound_emu/src/msm6295/msm6295.cpp
extern/vgsound_emu-modified/vgsound_emu/src/n163/n163.cpp
extern/vgsound_emu-modified/vgsound_emu/src/scc/scc.cpp
extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.cpp
extern/vgsound_emu-modified/vgsound_emu/src/x1_010/x1_010.cpp
extern/adpcm/bs_codec.c
extern/adpcm/oki_codec.c
extern/adpcm/yma_codec.c
extern/adpcm/ymb_codec.c
extern/adpcm/ymz_codec.c
extern/opn/ym3438.c
2022-05-26 23:46:20 +00:00
extern/Nuked-PSG/ympsg.c
2021-12-09 06:03:05 +00:00
extern/opm/opm.c
extern/Nuked-OPLL/opll.c
extern/opl/opl3.c
2023-11-23 00:28:36 +00:00
extern/YM3812-LLE/fmopl2.c
extern/YMF262-LLE/fmopl3.c
2023-11-25 23:02:21 +00:00
extern/YMF276-LLE/fmopn2.c
extern/ESFMu/esfm.c
extern/ESFMu/esfm_registers.c
2023-09-20 05:24:55 +00:00
2024-01-21 11:44:29 +00:00
extern/pwrnoise/pwrnoise.c
2023-09-20 05:24:55 +00:00
src/pch.cpp
2021-05-14 08:23:40 +00:00
src/engine/platform/sound/sn76496.cpp
src/engine/platform/sound/ay8910.cpp
2022-01-14 21:29:27 +00:00
src/engine/platform/sound/saa1099.cpp
src/engine/platform/sound/namco.cpp
src/engine/platform/sound/segapcm.cpp
src/engine/platform/sound/gb/apu.c
src/engine/platform/sound/gb/timing.c
src/engine/platform/sound/pce_psg.cpp
2021-12-03 21:04:07 +00:00
src/engine/platform/sound/nes/apu.c
2022-04-04 03:37:16 +00:00
src/engine/platform/sound/nes/fds.c
2022-04-06 05:34:12 +00:00
src/engine/platform/sound/nes/mmc5.c
2022-03-10 20:51:27 +00:00
src/engine/platform/sound/vera_psg.c
src/engine/platform/sound/vera_pcm.c
2021-05-12 22:19:18 +00:00
2022-05-02 03:52:22 +00:00
src/engine/platform/sound/nes_nsfplay/nes_apu.cpp
src/engine/platform/sound/nes_nsfplay/nes_dmc.cpp
src/engine/platform/sound/nes_nsfplay/nes_fds.cpp
src/engine/platform/sound/nes_nsfplay/nes_mmc5.cpp
src/engine/platform/sound/nes_nsfplay/nes_n106.cpp
src/engine/platform/sound/nes_nsfplay/nes_vrc6.cpp
2021-12-04 07:42:22 +00:00
src/engine/platform/sound/c64/sid.cc
src/engine/platform/sound/c64/voice.cc
src/engine/platform/sound/c64/wave.cc
src/engine/platform/sound/c64/envelope.cc
src/engine/platform/sound/c64/filter.cc
src/engine/platform/sound/c64/extfilt.cc
src/engine/platform/sound/c64/pot.cc
src/engine/platform/sound/c64/version.cc
src/engine/platform/sound/c64/wave6581_PS_.cc
src/engine/platform/sound/c64/wave6581_PST.cc
src/engine/platform/sound/c64/wave6581_P_T.cc
src/engine/platform/sound/c64/wave6581__ST.cc
src/engine/platform/sound/c64/wave8580_PS_.cc
src/engine/platform/sound/c64/wave8580_PST.cc
src/engine/platform/sound/c64/wave8580_P_T.cc
src/engine/platform/sound/c64/wave8580__ST.cc
2023-02-14 06:02:35 +00:00
src/engine/platform/sound/c64_fp/array.cpp
2022-08-28 20:10:16 +00:00
src/engine/platform/sound/c64_fp/Dac.cpp
src/engine/platform/sound/c64_fp/EnvelopeGenerator.cpp
src/engine/platform/sound/c64_fp/ExternalFilter.cpp
src/engine/platform/sound/c64_fp/Filter6581.cpp
src/engine/platform/sound/c64_fp/Filter8580.cpp
src/engine/platform/sound/c64_fp/Filter.cpp
src/engine/platform/sound/c64_fp/FilterModelConfig6581.cpp
src/engine/platform/sound/c64_fp/FilterModelConfig8580.cpp
src/engine/platform/sound/c64_fp/FilterModelConfig.cpp
src/engine/platform/sound/c64_fp/Integrator6581.cpp
src/engine/platform/sound/c64_fp/Integrator8580.cpp
src/engine/platform/sound/c64_fp/OpAmp.cpp
src/engine/platform/sound/c64_fp/SID.cpp
src/engine/platform/sound/c64_fp/Spline.cpp
src/engine/platform/sound/c64_fp/WaveformCalculator.cpp
src/engine/platform/sound/c64_fp/WaveformGenerator.cpp
src/engine/platform/sound/c64_fp/resample/SincResampler.cpp
2023-07-05 22:09:02 +00:00
src/engine/platform/sound/c64_d/dsid.c
2022-09-10 04:21:45 +00:00
src/engine/platform/sound/tia/AudioChannel.cpp
src/engine/platform/sound/tia/Audio.cpp
src/engine/platform/sound/ymfm/ymfm_adpcm.cpp
src/engine/platform/sound/ymfm/ymfm_opl.cpp
src/engine/platform/sound/ymfm/ymfm_opm.cpp
src/engine/platform/sound/ymfm/ymfm_opn.cpp
2022-02-10 04:19:02 +00:00
src/engine/platform/sound/ymfm/ymfm_opz.cpp
src/engine/platform/sound/ymfm/ymfm_pcm.cpp
src/engine/platform/sound/ymfm/ymfm_ssg.cpp
2021-12-09 08:37:31 +00:00
2022-02-20 17:15:15 +00:00
src/engine/platform/sound/lynx/Mikey.cpp
src/engine/platform/sound/pokey/mzpokeysnd.c
src/engine/platform/sound/pokey/AltASAP.cpp
2022-02-22 09:01:57 +00:00
src/engine/platform/sound/qsound.c
2022-03-07 12:04:20 +00:00
src/engine/platform/sound/swan.cpp
2022-03-06 16:13:47 +00:00
src/engine/platform/sound/su.cpp
2022-03-22 07:48:48 +00:00
src/engine/platform/sound/vic20sound.c
2022-05-18 06:55:33 +00:00
src/engine/platform/sound/ymz280b.cpp
2022-10-09 00:37:22 +00:00
src/engine/platform/sound/vsu.cpp
2022-10-09 20:18:52 +00:00
src/engine/platform/sound/t6w28/T6W28_Apu.cpp
2022-05-20 18:45:26 +00:00
src/engine/platform/sound/rf5c68.cpp
2022-10-01 08:15:40 +00:00
src/engine/platform/sound/oki/msm5232.cpp
2022-05-22 22:49:41 +00:00
src/engine/platform/sound/oki/okim6258.cpp
2022-03-21 07:38:12 +00:00
src/engine/platform/sound/snes/SPC_DSP.cpp
2022-05-22 22:49:41 +00:00
2022-12-15 11:03:54 +00:00
src/engine/platform/sound/ga20/iremga20.cpp
2023-02-11 12:37:11 +00:00
src/engine/platform/sound/sm8521.c
2023-03-18 22:15:13 +00:00
src/engine/platform/sound/d65modified.c
2023-07-23 09:42:38 +00:00
src/engine/platform/sound/ted-sound.c
src/engine/platform/sound/c140_c219.c
2023-08-08 12:27:12 +00:00
2024-02-03 07:57:48 +00:00
src/engine/platform/sound/dave/dave.cpp
2022-05-13 19:59:36 +00:00
src/engine/platform/oplAInterface.cpp
2022-05-13 07:52:43 +00:00
src/engine/platform/ym2608Interface.cpp
2021-12-09 18:25:02 +00:00
src/engine/platform/ym2610Interface.cpp
2024-02-05 19:08:53 +00:00
src/engine/fileOps/fileOpsCommon.cpp
src/engine/fileOps/dmf.cpp
src/engine/fileOps/fc.cpp
src/engine/fileOps/ftm.cpp
src/engine/fileOps/fur.cpp
src/engine/fileOps/mod.cpp
src/engine/fileOps/s3m.cpp
src/engine/blip_buf.c
2022-09-24 09:27:53 +00:00
src/engine/brrUtils.c
src/engine/safeReader.cpp
src/engine/safeWriter.cpp
2023-09-05 09:38:57 +00:00
src/engine/workPool.cpp
src/engine/cmdStream.cpp
src/engine/cmdStreamOps.cpp
2022-02-18 18:11:04 +00:00
src/engine/config.cpp
src/engine/configEngine.cpp
2022-01-08 21:03:32 +00:00
src/engine/dispatchContainer.cpp
src/engine/engine.cpp
2023-03-13 19:17:05 +00:00
src/engine/export.cpp
2022-04-03 07:15:04 +00:00
src/engine/fileOpsIns.cpp
2023-08-21 19:56:10 +00:00
src/engine/fileOpsSample.cpp
2022-03-20 08:14:00 +00:00
src/engine/filter.cpp
2022-01-19 08:28:29 +00:00
src/engine/instrument.cpp
src/engine/macroInt.cpp
2021-12-09 06:44:40 +00:00
src/engine/pattern.cpp
2023-10-11 07:48:39 +00:00
src/engine/pitchTable.cpp
src/engine/playback.cpp
src/engine/sample.cpp
src/engine/song.cpp
src/engine/sysDef.cpp
2022-01-19 10:10:06 +00:00
src/engine/wavetable.cpp
2022-04-07 20:46:48 +00:00
src/engine/waveSynth.cpp
src/engine/wavOps.cpp
2022-02-18 17:58:36 +00:00
src/engine/vgmOps.cpp
2022-05-26 05:24:21 +00:00
src/engine/zsmOps.cpp
src/engine/zsm.cpp
2023-03-13 09:20:54 +00:00
src/engine/platform/abstract.cpp
2021-05-12 22:19:18 +00:00
src/engine/platform/genesis.cpp
2021-05-16 22:43:10 +00:00
src/engine/platform/genesisext.cpp
src/engine/platform/sms.cpp
src/engine/platform/opll.cpp
2021-05-26 08:17:12 +00:00
src/engine/platform/gb.cpp
src/engine/platform/pce.cpp
2022-04-06 05:34:12 +00:00
src/engine/platform/mmc5.cpp
2021-12-04 06:19:54 +00:00
src/engine/platform/nes.cpp
2021-12-05 04:55:28 +00:00
src/engine/platform/c64.cpp
2021-12-08 22:40:35 +00:00
src/engine/platform/arcade.cpp
src/engine/platform/tx81z.cpp
src/engine/platform/ym2203.cpp
src/engine/platform/ym2203ext.cpp
2022-05-13 07:52:43 +00:00
src/engine/platform/ym2608.cpp
2022-05-19 03:49:21 +00:00
src/engine/platform/ym2608ext.cpp
2021-12-09 18:25:02 +00:00
src/engine/platform/ym2610.cpp
2021-12-14 19:31:57 +00:00
src/engine/platform/ym2610ext.cpp
src/engine/platform/ym2610b.cpp
src/engine/platform/ym2610bext.cpp
src/engine/platform/ay.cpp
2022-01-14 05:02:10 +00:00
src/engine/platform/ay8930.cpp
src/engine/platform/opl.cpp
2022-04-04 03:37:16 +00:00
src/engine/platform/fds.cpp
src/engine/platform/tia.cpp
2022-01-14 21:29:27 +00:00
src/engine/platform/saa.cpp
2022-01-15 22:28:33 +00:00
src/engine/platform/amiga.cpp
2022-10-01 08:15:40 +00:00
src/engine/platform/msm5232.cpp
2022-05-24 00:01:10 +00:00
src/engine/platform/msm6258.cpp
2022-05-23 06:46:58 +00:00
src/engine/platform/msm6295.cpp
2022-03-04 23:18:43 +00:00
src/engine/platform/pcspkr.cpp
src/engine/platform/segapcm.cpp
2022-02-22 09:01:57 +00:00
src/engine/platform/qsound.cpp
src/engine/platform/x1_010.cpp
src/engine/platform/pokey.cpp
2022-02-20 17:15:15 +00:00
src/engine/platform/lynx.cpp
src/engine/platform/su.cpp
2022-03-07 12:04:20 +00:00
src/engine/platform/swan.cpp
2022-10-12 05:12:56 +00:00
src/engine/platform/t6w28.cpp
2022-10-09 00:37:22 +00:00
src/engine/platform/vb.cpp
2022-03-04 11:13:49 +00:00
src/engine/platform/vera.cpp
src/engine/platform/zxbeeper.cpp
2023-03-05 17:58:27 +00:00
src/engine/platform/zxbeeperquadtone.cpp
src/engine/platform/bubsyswsg.cpp
2022-03-22 16:48:45 +00:00
src/engine/platform/n163.cpp
2022-03-21 14:02:51 +00:00
src/engine/platform/pet.cpp
2022-12-13 18:32:35 +00:00
src/engine/platform/pokemini.cpp
2022-10-24 08:19:42 +00:00
src/engine/platform/pong.cpp
2022-03-22 07:48:48 +00:00
src/engine/platform/vic20.cpp
src/engine/platform/vrc6.cpp
src/engine/platform/es5506.cpp
2022-05-10 04:18:25 +00:00
src/engine/platform/scc.cpp
2022-05-18 06:55:33 +00:00
src/engine/platform/ymz280b.cpp
2022-05-20 18:22:35 +00:00
src/engine/platform/namcowsg.cpp
2022-05-20 18:45:26 +00:00
src/engine/platform/rf5c68.cpp
2022-03-21 07:38:12 +00:00
src/engine/platform/snes.cpp
src/engine/platform/k007232.cpp
2022-12-15 11:03:54 +00:00
src/engine/platform/ga20.cpp
2023-02-11 12:37:11 +00:00
src/engine/platform/sm8521.cpp
src/engine/platform/pv1000.cpp
2023-04-02 05:32:47 +00:00
src/engine/platform/k053260.cpp
2023-07-23 09:42:38 +00:00
src/engine/platform/ted.cpp
2023-08-08 12:27:12 +00:00
src/engine/platform/c140.cpp
src/engine/platform/esfm.cpp
2024-01-21 11:44:29 +00:00
src/engine/platform/powernoise.cpp
src/engine/platform/dave.cpp
src/engine/platform/pcmdac.cpp
src/engine/platform/dummy.cpp
2023-03-13 09:20:54 +00:00
src/engine/export/abstract.cpp
2023-03-13 19:17:05 +00:00
src/engine/export/amigaValidation.cpp
2023-05-21 09:39:36 +00:00
src/engine/effect/abstract.cpp
src/engine/effect/dummy.cpp
)
if (USE_SNDFILE)
list(APPEND ENGINE_SOURCES src/engine/sfWrapper.cpp)
endif()
if (WIN32)
list(APPEND ENGINE_SOURCES src/utfutils.cpp)
list(APPEND ENGINE_SOURCES src/engine/winStuff.cpp)
list(APPEND ENGINE_SOURCES res/furnace.rc)
endif()
set(CLI_SOURCES
src/cli/cli.cpp
)
2021-12-11 07:10:09 +00:00
set(GUI_SOURCES
extern/imgui_patched/imgui.cpp
extern/imgui_patched/imgui_draw.cpp
extern/imgui_patched/imgui_tables.cpp
extern/imgui_patched/imgui_widgets.cpp
2023-06-08 06:00:47 +00:00
extern/imgui_patched/backends/imgui_impl_sdl2.cpp
extern/imgui_patched/misc/cpp/imgui_stdlib.cpp
2021-12-11 07:10:09 +00:00
extern/igfd/ImGuiFileDialog.cpp
2021-12-18 22:54:26 +00:00
src/gui/plot_nolerp.cpp
2023-02-15 23:32:31 +00:00
src/gui/render.cpp
src/gui/render/abstract.cpp
src/gui/font_exo.cpp
src/gui/font_liberationSans.cpp
src/gui/font_mononoki.cpp
src/gui/font_plexMono.cpp
src/gui/font_plexSans.cpp
src/gui/font_proggyClean.cpp
src/gui/font_ptMono.cpp
src/gui/font_unifont.cpp
2021-12-21 05:30:55 +00:00
src/gui/font_icon.cpp
2023-08-15 01:02:10 +00:00
src/gui/font_furicon.cpp
src/gui/fonts.cpp
2023-02-15 23:32:31 +00:00
src/gui/image_icon.cpp
2023-02-16 09:13:43 +00:00
src/gui/image_talogo.cpp
src/gui/image_tachip.cpp
src/gui/image_logo.cpp
2023-02-17 21:30:24 +00:00
src/gui/image_wordmark.cpp
2023-02-18 00:40:18 +00:00
src/gui/image_introbg.cpp
2023-02-19 00:43:23 +00:00
src/gui/image_pat.cpp
2023-02-15 23:32:31 +00:00
src/gui/image.cpp
2022-01-27 05:29:16 +00:00
src/gui/debug.cpp
src/gui/fileDialog.cpp
2022-02-17 19:04:39 +00:00
2022-02-17 18:08:17 +00:00
src/gui/intConst.cpp
src/gui/guiConst.cpp
2022-02-17 19:04:39 +00:00
2023-02-23 10:56:48 +00:00
src/gui/introTune.cpp
src/gui/about.cpp
src/gui/channels.cpp
src/gui/chanOsc.cpp
2022-11-10 06:26:59 +00:00
src/gui/clock.cpp
src/gui/compatFlags.cpp
src/gui/cursor.cpp
src/gui/dataList.cpp
src/gui/debugWindow.cpp
src/gui/doAction.cpp
src/gui/editing.cpp
src/gui/editControls.cpp
2022-04-19 23:44:05 +00:00
src/gui/effectList.cpp
2023-12-06 11:50:19 +00:00
src/gui/exportOptions.cpp
2022-06-06 10:03:19 +00:00
src/gui/findReplace.cpp
2023-03-18 00:12:09 +00:00
src/gui/fmPreview.cpp
src/gui/gradient.cpp
2023-02-05 07:56:39 +00:00
src/gui/grooves.cpp
2022-02-17 19:04:39 +00:00
src/gui/insEdit.cpp
2023-02-15 21:25:35 +00:00
src/gui/intro.cpp
src/gui/log.cpp
src/gui/mixer.cpp
2022-03-29 21:09:15 +00:00
src/gui/midiMap.cpp
src/gui/newSong.cpp
2023-06-15 05:04:45 +00:00
src/gui/commandPalette.cpp
2022-02-18 03:40:23 +00:00
src/gui/orders.cpp
src/gui/osc.cpp
src/gui/patManager.cpp
2022-02-17 19:04:39 +00:00
src/gui/pattern.cpp
src/gui/piano.cpp
src/gui/presets.cpp
src/gui/regView.cpp
src/gui/sampleEdit.cpp
src/gui/scaling.cpp
src/gui/settings.cpp
src/gui/songInfo.cpp
src/gui/songNotes.cpp
src/gui/speed.cpp
2022-06-20 20:20:02 +00:00
src/gui/spoiler.cpp
src/gui/stats.cpp
src/gui/subSongs.cpp
src/gui/sysConf.cpp
src/gui/sysEx.cpp
2022-08-19 09:41:45 +00:00
src/gui/sysManager.cpp
src/gui/sysPartNumber.cpp
2022-08-27 00:30:13 +00:00
src/gui/sysPicker.cpp
2023-02-19 05:08:37 +00:00
src/gui/tutorial.cpp
src/gui/util.cpp
src/gui/waveEdit.cpp
src/gui/volMeter.cpp
2023-11-01 07:56:43 +00:00
src/gui/xyOsc.cpp
src/gui/gui.cpp
)
2021-12-11 07:10:09 +00:00
2022-12-31 23:36:33 +00:00
if (WIN32 AND NOT SUPPORT_XP)
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_common.cpp)
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_win.cpp)
endif()
if (USE_FREETYPE)
list(APPEND GUI_SOURCES extern/imgui_patched/misc/freetype/imgui_freetype.cpp)
endif()
if (APPLE)
2022-12-28 21:07:01 +00:00
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_common.cpp)
list(APPEND GUI_SOURCES src/gui/macstuff.m)
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_cocoa.mm)
endif()
if (WITH_RENDER_SDL)
list(APPEND GUI_SOURCES src/gui/render/renderSDL.cpp)
2023-06-08 06:00:47 +00:00
list(APPEND GUI_SOURCES extern/imgui_patched/backends/imgui_impl_sdlrenderer2.cpp)
list(APPEND DEPENDENCIES_DEFINES HAVE_RENDER_SDL)
message(STATUS "UI render backend: SDL_Renderer")
endif()
if (WITH_RENDER_OPENGL)
list(APPEND GUI_SOURCES src/gui/render/renderGL.cpp)
list(APPEND GUI_SOURCES extern/imgui_patched/backends/imgui_impl_opengl3.cpp)
list(APPEND DEPENDENCIES_DEFINES HAVE_RENDER_GL)
2023-06-03 20:05:55 +00:00
if (USE_GLES)
list(APPEND DEPENDENCIES_DEFINES USE_GLES)
list(APPEND DEPENDENCIES_DEFINES IMGUI_IMPL_OPENGL_ES2)
endif()
if (WIN32)
list(APPEND DEPENDENCIES_LIBRARIES opengl32)
2023-06-03 20:05:55 +00:00
elseif(USE_GLES)
list(APPEND DEPENDENCIES_LIBRARIES GLESv2)
else()
list(APPEND DEPENDENCIES_LIBRARIES GL)
endif()
message(STATUS "UI render backend: OpenGL")
endif()
if (WITH_RENDER_DX11)
if (WIN32)
if (SUPPORT_XP)
message(FATAL_ERROR "SUPPORT_XP is on. cannot enable DirectX 11 backend.")
else()
list(APPEND GUI_SOURCES src/gui/render/renderDX11.cpp)
list(APPEND GUI_SOURCES extern/imgui_patched/backends/imgui_impl_dx11.cpp)
list(APPEND DEPENDENCIES_DEFINES HAVE_RENDER_DX11)
list(APPEND DEPENDENCIES_LIBRARIES d3d11)
message(STATUS "UI render backend: DirectX 11")
endif()
else()
message(FATAL_ERROR "DirectX 11 render backend only for Windows!")
endif()
endif()
2023-02-15 23:32:31 +00:00
if (NOT WIN32 AND NOT APPLE)
2022-06-23 21:23:46 +00:00
CHECK_INCLUDE_FILE(sys/io.h SYS_IO_FOUND)
CHECK_INCLUDE_FILE(linux/input.h LINUX_INPUT_FOUND)
CHECK_INCLUDE_FILE(linux/kd.h LINUX_KD_FOUND)
if (SYS_IO_FOUND)
try_compile(HAVE_INOUTB ${CMAKE_BINARY_DIR}/check SOURCES ${CMAKE_SOURCE_DIR}/src/check/check_sysIO.c)
if (HAVE_INOUTB)
list(APPEND DEPENDENCIES_DEFINES HAVE_SYS_IO)
message(STATUS "PC speaker output: outb()")
else()
message(STATUS "sys/io.h found but inb()/outb() not present")
endif()
2022-06-23 21:23:46 +00:00
endif()
if (LINUX_INPUT_FOUND)
list(APPEND DEPENDENCIES_DEFINES HAVE_LINUX_INPUT)
message(STATUS "PC speaker output: evdev")
endif()
if (LINUX_KD_FOUND)
list(APPEND DEPENDENCIES_DEFINES HAVE_LINUX_KD)
message(STATUS "PC speaker output: KIOCSOUND")
endif()
endif()
if (NOT WIN32)
try_compile(HAVE_DIRENT_TYPE ${CMAKE_BINARY_DIR}/check SOURCES ${CMAKE_SOURCE_DIR}/src/check/check_dirent_type.c)
if (HAVE_DIRENT_TYPE)
list(APPEND DEPENDENCIES_DEFINES HAVE_DIRENT_TYPE)
endif()
endif()
set(USED_SOURCES ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${CLI_SOURCES} src/main.cpp)
2022-01-20 07:59:14 +00:00
2022-05-24 18:06:29 +00:00
if (USE_BACKWARD)
list(APPEND USED_SOURCES src/backtrace.cpp)
if (WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-gcodeview GCC_CODEVIEW)
if (GCC_CODEVIEW)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--pdb= ")
add_compile_options(-gcodeview)
message(STATUS "Enabling -gcodeview flag for backward-cpp.")
else()
message(WARNING "Could not enable -gcodeview! backward-cpp will not work.")
endif()
list(APPEND DEPENDENCIES_LIBRARIES dbghelp psapi)
endif()
2022-05-24 18:17:40 +00:00
endif()
2022-07-15 03:15:14 +00:00
find_library(EXECINFO_IS_LIBRARY execinfo)
if (EXECINFO_IS_LIBRARY)
list(APPEND DEPENDENCIES_LIBRARIES execinfo)
endif()
2022-05-29 04:12:22 +00:00
message(STATUS "Using backward-cpp")
else()
message(STATUS "Not using backward-cpp")
2022-05-24 18:06:29 +00:00
endif()
2021-12-11 07:10:09 +00:00
if (BUILD_GUI)
2022-01-20 07:59:14 +00:00
list(APPEND USED_SOURCES ${GUI_SOURCES})
list(APPEND DEPENDENCIES_INCLUDE_DIRS
extern/imgui_patched
extern/imgui_patched/backends
extern/igfd
)
if (WIN32 OR APPLE)
list(APPEND DEPENDENCIES_INCLUDE_DIRS
extern/nfd-modified/src/include
)
endif()
list(APPEND DEPENDENCIES_DEFINES HAVE_GUI)
message(STATUS "Building GUI")
2021-12-11 07:10:09 +00:00
else()
message(STATUS "Building headless")
2021-12-11 07:10:09 +00:00
endif()
if (WIN32)
list(APPEND DEPENDENCIES_LIBRARIES shlwapi)
2022-02-02 06:06:29 +00:00
if (NOT MSVC)
list(APPEND DEPENDENCIES_LIBRARIES -static)
endif()
2022-11-16 10:07:13 +00:00
elseif (APPLE)
2022-02-10 11:40:51 +00:00
find_library(COCOA Cocoa REQUIRED)
list(APPEND DEPENDENCIES_LIBRARIES ${COCOA})
2022-11-16 10:07:13 +00:00
else()
list(APPEND DEPENDENCIES_LIBRARIES dl)
2022-02-10 11:40:51 +00:00
endif()
if (NOT MSVC)
set(WARNING_FLAGS -Wall -Wextra -Wno-unused-parameter)
2022-03-14 03:21:01 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2022-06-20 09:55:28 +00:00
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)
# nothing
else()
list(APPEND WARNING_FLAGS -Wno-cast-function-type)
endif()
2022-03-14 03:21:01 +00:00
endif()
if (WARNINGS_ARE_ERRORS)
list(APPEND WARNING_FLAGS -Werror)
endif()
else()
add_compile_options("/utf-8")
set(WARNING_FLAGS /W2 /D_CRT_SECURE_NO_WARNINGS)
2022-04-02 16:35:00 +00:00
list(APPEND WARNING_FLAGS
/wd4244 # implicit type conversions
/wd4305 # truncations
/wd4309 # truncations of constant values
)
if (WARNINGS_ARE_ERRORS)
list(APPEND WARNING_FLAGS /WX)
endif()
endif()
# Nicer but cannot be narrowed down to just C++
# target_compile_options(furnace PRIVATE ${WARNING_FLAGS})
string(REPLACE ";" " " WARNING_FLAGS_STRING "${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_STRING}")
if (WARNINGS_ARE_ERRORS)
message(STATUS
"Treating all warnings in furnace's C++ code as errors! "
"Please report any errors you encounter on the bug tracker."
)
endif()
if (NOT ANDROID OR TERMUX)
if (NOT WIN32 AND NOT APPLE)
if (NOT DONT_HAVE_GIT)
add_custom_command(OUTPUT furnace.appdata.xml COMMAND res/make-appdata.sh ARGS ${CMAKE_SOURCE_DIR}/res/furnace.appdata.xml.in ${CMAKE_BINARY_DIR}/furnace.appdata.xml DEPENDS res/furnace.appdata.xml.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
list(APPEND USED_SOURCES furnace.appdata.xml)
endif()
endif()
endif()
2023-02-14 06:02:35 +00:00
if(ANDROID AND NOT TERMUX)
2022-05-08 20:59:42 +00:00
add_library(furnace SHARED ${USED_SOURCES})
elseif(WIN32)
2023-04-17 05:22:37 +00:00
add_executable(furnace WIN32 ${USED_SOURCES})
else()
add_executable(furnace ${USED_SOURCES})
endif()
target_include_directories(furnace SYSTEM PRIVATE ${DEPENDENCIES_INCLUDE_DIRS})
target_compile_definitions(furnace PRIVATE ${DEPENDENCIES_DEFINES})
2023-02-25 08:26:27 +00:00
target_compile_options(furnace PRIVATE ${DEPENDENCIES_COMPILE_OPTIONS})
target_link_libraries(furnace PRIVATE ${DEPENDENCIES_LIBRARIES})
2022-02-20 22:58:12 +00:00
if (PKG_CONFIG_FOUND AND (SYSTEM_FMT OR SYSTEM_LIBSNDFILE OR SYSTEM_ZLIB OR SYSTEM_SDL2 OR SYSTEM_RTMIDI OR WITH_JACK))
if ("${CMAKE_VERSION}" VERSION_LESS "3.13")
message(WARNING
"CMake version is <3.13, using old pkg-config LDFLAGS. "
"You may encounter linking problems with these!"
)
target_link_libraries(furnace PRIVATE ${DEPENDENCIES_LEGACY_LDFLAGS})
else()
target_link_directories(furnace PRIVATE ${DEPENDENCIES_LIBRARY_DIRS})
target_link_options(furnace PRIVATE ${DEPENDENCIES_LINK_OPTIONS})
2022-01-20 07:59:14 +00:00
endif()
endif()
2021-12-24 23:12:36 +00:00
2023-09-20 05:24:55 +00:00
# why 3.16..... why not 3.0?
2023-09-22 01:20:38 +00:00
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.16")
2023-09-20 05:24:55 +00:00
if (BUILD_GUI)
target_precompile_headers(furnace PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h>
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/extern/imgui_patched/imgui.h>
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/extern/imgui_patched/imgui_internal.h>
)
else()
target_precompile_headers(furnace PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h>
)
endif()
endif()
2022-05-27 20:51:57 +00:00
if (NOT ANDROID OR TERMUX)
2022-05-08 20:59:42 +00:00
if (NOT WIN32 AND NOT APPLE)
include(GNUInstallDirs)
install(TARGETS furnace RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2022-05-08 20:59:42 +00:00
install(FILES res/furnace.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
if (NOT DONT_HAVE_GIT)
install(FILES ${CMAKE_BINARY_DIR}/furnace.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
endif()
2023-06-05 05:08:37 +00:00
install(DIRECTORY doc DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY papers DESTINATION ${CMAKE_INSTALL_DOCDIR}/other)
2022-05-08 20:59:42 +00:00
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/furnace)
if (WITH_DEMOS OR WITH_INSTRUMENTS OR WITH_WAVETABLES)
2024-02-08 20:00:21 +00:00
set(FURNACE_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/furnace)
if (WITH_DEMOS)
install(DIRECTORY demos DESTINATION ${FURNACE_DATADIR})
endif()
if (WITH_INSTRUMENTS)
install(DIRECTORY instruments DESTINATION ${FURNACE_DATADIR})
endif()
if (WITH_WAVETABLES)
install(DIRECTORY wavetables DESTINATION ${FURNACE_DATADIR})
endif()
2024-02-08 20:00:21 +00:00
add_compile_definitions(FURNACE_DATADIR="${FURNACE_DATADIR}")
if (SHOW_OPEN_ASSETS_MENU_ENTRY)
add_compile_definitions(SHOW_OPEN_ASSETS_MENU_ENTRY)
endif()
endif()
2022-05-16 17:16:55 +00:00
foreach(num 16 32 64 128 256 512)
set(res ${num}x${num})
install(FILES res/icon.iconset/icon_${res}.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${res}/apps)
2022-05-16 17:25:15 +00:00
install(FILES res/icon.iconset/icon_${res}@2x.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${res}@2/apps)
2022-05-16 17:16:55 +00:00
endforeach()
2022-05-08 20:59:42 +00:00
install(FILES res/logo.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/1024x1024/apps)
else()
install(TARGETS furnace RUNTIME DESTINATION bin)
2022-05-08 20:59:42 +00:00
endif()
2022-05-08 20:59:42 +00:00
set(CPACK_PACKAGE_NAME "Furnace")
set(CPACK_PACKAGE_VENDOR "tildearrow")
set(CPACK_PACKAGE_DESCRIPTION "free and open-source chiptune tracker")
if (APPLE)
set(CPACK_GENERATOR Bundle)
set(CPACK_DMG_SLA_DIR ${CMAKE_SOURCE_DIR}/res/macLicense)
set(CPACK_DMG_SLA_LANGUAGES en)
set(CPACK_BUNDLE_NAME "Furnace")
set(CPACK_DMG_VOLUME_NAME "Furnace")
set(CPACK_BUNDLE_PLIST ${CMAKE_SOURCE_DIR}/res/Info.plist)
set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/res/icon.icns)
set(CPACK_BUNDLE_STARTUP_COMMAND "furnace")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
2022-05-08 20:59:42 +00:00
endif()
include(CPack)
2021-12-24 23:12:36 +00:00
endif()