furnace/CMakeLists.txt

234 lines
6.9 KiB
Text
Raw Normal View History

cmake_minimum_required(VERSION 3.0)
2021-05-13 08:22:57 +00:00
project(furnace)
2021-12-09 08:37:31 +00:00
set(CMAKE_CXX_STANDARD 14)
2021-12-24 23:12:36 +00:00
set(CMAKE_PROJECT_VERSION_MAJOR 0)
2022-01-16 09:23:23 +00:00
set(CMAKE_PROJECT_VERSION_MINOR 4)
2022-01-19 22:02:27 +00:00
set(CMAKE_PROJECT_VERSION_PATCH 5)
2021-12-24 23:12:36 +00:00
2021-12-11 07:10:09 +00:00
if (ANDROID)
set(BUILD_GUI OFF)
else()
set(BUILD_GUI ON)
endif()
2022-01-18 05:45:17 +00:00
option(DEVENDOR_LIBRARIES "Use local versions of dependencies instead of the ones provided by submodules" OFF)
2021-12-11 21:44:02 +00:00
2022-01-18 05:45:17 +00:00
if (NOT DEVENDOR_LIBRARIES)
add_subdirectory(extern/fmt EXCLUDE_FROM_ALL)
2022-01-18 05:45:17 +00:00
endif()
2021-12-30 22:31:08 +00:00
2022-01-18 05:45:17 +00:00
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 EXCLUDE_FROM_ALL)
add_subdirectory(extern/zlib EXCLUDE_FROM_ALL)
2021-12-07 17:21:23 +00:00
2022-01-18 05:45:17 +00:00
include_directories(extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
2022-01-18 07:56:12 +00:00
else()
find_library(HAVE_Z z)
2022-01-18 05:45:17 +00:00
endif()
if (DEVENDOR_LIBRARIES)
find_package(SDL)
if (SDL_FOUND)
set(HAVE_SDL2 ${SDL_LIBRARY})
include_directories(extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd ${SDL_INCLUDE_DIR})
else()
find_package(SDL2 REQUIRED)
2022-01-18 07:56:12 +00:00
set(HAVE_SDL2 ${SDL2_LIBRARIES})
include_directories(extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd ${SDL2_INCLUDE_DIRS})
endif()
2022-01-18 05:45:17 +00:00
find_library(HAVE_JACK jack)
else()
2022-01-18 05:45:17 +00:00
if (WIN32)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL)
set(HAVE_SDL2 SDL2-static)
2022-01-18 05:45:17 +00:00
set(HAVE_Z zlibstatic)
include_directories(extern/SDL/include extern/imgui extern/IconFontCppHeaders extern/imgui/backends extern/igfd extern/fmt/include)
2021-12-11 07:10:09 +00:00
else()
2022-01-18 05:45:17 +00:00
if (BUILD_GUI)
set(SDL_SHARED ON)
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL)
2022-01-18 05:45:17 +00:00
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)
2021-05-28 21:06:57 +00:00
endif()
endif()
set(AUDIO_SOURCES src/audio/abstract.cpp)
if (HAVE_SDL2)
list(APPEND AUDIO_SOURCES src/audio/sdl.cpp)
endif()
if (HAVE_JACK)
list(APPEND AUDIO_SOURCES src/audio/jack.cpp)
endif()
set(ENGINE_SOURCES
src/log.cpp
src/fileutils.cpp
2021-05-12 22:19:18 +00:00
extern/Nuked-OPN2/ym3438.c
2021-12-09 06:03:05 +00:00
extern/opm/opm.c
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/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
2021-05-12 22:19:18 +00:00
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
src/engine/platform/sound/tia/TIASnd.cpp
src/engine/platform/sound/ymfm/ymfm_adpcm.cpp
src/engine/platform/sound/ymfm/ymfm_opm.cpp
src/engine/platform/sound/ymfm/ymfm_opn.cpp
src/engine/platform/sound/ymfm/ymfm_ssg.cpp
2021-12-09 08:37:31 +00:00
2021-12-09 18:25:02 +00:00
src/engine/platform/ym2610Interface.cpp
src/engine/blip_buf.c
src/engine/safeReader.cpp
src/engine/safeWriter.cpp
2022-01-08 21:03:32 +00:00
src/engine/dispatchContainer.cpp
src/engine/engine.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
src/engine/playback.cpp
src/engine/sample.cpp
src/engine/song.cpp
2022-01-19 10:10:06 +00:00
src/engine/wavetable.cpp
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
2021-05-26 08:17:12 +00:00
src/engine/platform/gb.cpp
src/engine/platform/pce.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
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/ay.cpp
2022-01-14 05:02:10 +00:00
src/engine/platform/ay8930.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
src/engine/platform/dummy.cpp)
2021-12-11 07:10:09 +00:00
set(GUI_SOURCES
extern/imgui/imgui.cpp
extern/imgui/imgui_draw.cpp
extern/imgui/imgui_tables.cpp
extern/imgui/imgui_widgets.cpp
extern/imgui/backends/imgui_impl_sdlrenderer.cpp
extern/imgui/backends/imgui_impl_sdl.cpp
2021-12-11 22:41:32 +00:00
extern/imgui/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
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
src/gui/fonts.cpp
2021-12-11 07:10:09 +00:00
src/gui/gui.cpp)
if (NOT WIN32 AND NOT APPLE)
list(APPEND GUI_SOURCES src/gui/icon.c)
endif()
2021-12-16 20:51:19 +00:00
if (WIN32)
list(APPEND ENGINE_SOURCES src/utfutils.cpp)
2021-12-19 08:16:24 +00:00
list(APPEND ENGINE_SOURCES src/engine/winStuff.cpp)
2022-01-07 22:41:47 +00:00
list(APPEND ENGINE_SOURCES res/furnace.rc)
2021-12-16 20:51:19 +00:00
endif()
2021-12-11 07:10:09 +00:00
if (BUILD_GUI)
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${GUI_SOURCES} src/main.cpp)
2021-12-11 08:11:40 +00:00
target_compile_definitions(furnace PUBLIC HAVE_GUI)
2021-12-11 07:10:09 +00:00
else()
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
endif()
2022-01-18 05:45:17 +00:00
if (DEVENDOR_LIBRARIES)
target_compile_definitions(furnace PUBLIC DEVENDOR_LIBRARIES)
endif()
2021-12-11 21:44:02 +00:00
target_link_libraries(furnace ${HAVE_SDL2} ${HAVE_Z} sndfile fmt)
if (HAVE_JACK)
2021-05-13 08:22:57 +00:00
target_link_libraries(furnace ${HAVE_JACK})
2021-06-09 08:33:03 +00:00
target_compile_definitions(furnace PUBLIC HAVE_JACK)
endif()
if (WIN32)
2021-12-19 08:16:24 +00:00
target_link_libraries(furnace shlwapi -static)
endif()
2021-12-24 23:12:36 +00:00
install(TARGETS furnace RUNTIME DESTINATION bin)
if (NOT WIN32 AND NOT APPLE)
include(GNUInstallDirs)
install(FILES res/furnace.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES res/furnace.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
install(DIRECTORY papers DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses)
install(DIRECTORY demos DESTINATION ${CMAKE_INSTALL_DATADIR}/furnace)
install(FILES res/logo.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps)
endif()
2021-12-24 23:12:36 +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)
2021-12-29 23:00:14 +00:00
set(CPACK_DMG_SLA_DIR ${CMAKE_SOURCE_DIR}/res/macLicense)
2021-12-29 22:47:17 +00:00
set(CPACK_DMG_SLA_LANGUAGES en)
2021-12-24 23:12:36 +00:00
set(CPACK_BUNDLE_NAME "Furnace")
2022-01-06 23:36:59 +00:00
set(CPACK_DMG_VOLUME_NAME "Furnace")
2021-12-24 23:12:36 +00:00
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")
endif()
2021-12-29 22:47:17 +00:00
include(CPack)