cmake_minimum_required(VERSION 3.12)

project(SongToFap VERSION 1.0.0)

set(TargetName ${PROJECT_NAME})

# Generates the projectinfo.cpp from the template. Also see the target_include_directories at the bottom.
configure_file(../../ProjectInfo.h_cmake_template ProjectInfo.h)

juce_add_console_app(${TargetName}
        PRODUCT_NAME "Song to FAP")

target_sources(${TargetName}
        PRIVATE
        main.cpp
        Tool.cpp
        Tool.h
        ProjectInfo.h                       # Generated by CMake from a template (see configure_file above).

        ../../../source/export/fap/FapExporter.cpp
        ../../../source/export/fap/FapExporter.h
        ../../../thirdParty/fap/FapCrunch.cpp
        ../../../thirdParty/fap/FapCrunch.h
        ../../../thirdParty/fap/Lzss.cpp
        ../../../thirdParty/fap/Lzss.h
        ../../../thirdParty/fap/Types.h
        ../../../thirdParty/fap/YmData.cpp
        ../../../thirdParty/fap/YmData.h
        ../../../thirdParty/fap/YmLoad.cpp
        ../../../thirdParty/fap/YmLoad.h

        ../../../source/export/ym/YmExporter.cpp
        ../../../source/export/ym/YmExporter.h
        ../../../source/export/ym/YmStreamEncoder.cpp
        ../../../source/export/ym/YmStreamEncoder.h
        ../../../source/export/ym/YmStreamEncoderInterleaved.cpp
        ../../../source/export/ym/YmStreamEncoderInterleaved.h
        ../../../source/export/ym/YmStreamEncoderNonInterleaved.cpp
        ../../../source/export/ym/YmStreamEncoderNonInterleaved.h

        ../../../source/export/samples/SampleEncoder.cpp
        ../../../source/export/samples/SampleEncoder.h
        ../../../source/export/samples/SampleCodeGenerator.cpp
        ../../../source/export/samples/SampleCodeGenerator.h
        ../../../source/export/samples/SampleEncoderFlags.cpp
        ../../../source/export/samples/SampleEncoderFlags.h

        ../../../source/business/instrument/SampleResampler.cpp
        ../../../source/business/instrument/SampleResampler.h
)

# This allows the generated file by CMake (such as projectinfo.h) to be seen by the sources.
target_include_directories(${TargetName}
        PRIVATE
        ${PROJECT_BINARY_BIN}
)

target_link_libraries(${TargetName}
        PRIVATE
        BaseExport
        ThirdPartyFap
        juce::juce_core
        PUBLIC
        juce::juce_recommended_config_flags
        juce::juce_recommended_lto_flags
        juce::juce_recommended_warning_flags
)
