Use project-specific SOURCE_DIR and BINARY_DIR (#1040)

This commit is contained in:
devingryu 2022-01-29 21:11:29 +09:00 committed by GitHub
parent 91515b09c4
commit b89898ef7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 71 deletions

View file

@ -33,7 +33,7 @@ if(POLICY CMP0091) # new in CMake 3.15, defaults to OLD
endif()
project ( FluidSynth C CXX )
list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_admin )
list( APPEND CMAKE_MODULE_PATH ${FluidSynth_SOURCE_DIR}/cmake_admin )
# FluidSynth package name
set ( PACKAGE "fluidsynth" )
@ -449,13 +449,13 @@ endif ( CMAKE_BUILD_TYPE MATCHES "Debug" )
file(GLOB_RECURSE
ALL_SOURCE_FILES
LIST_DIRECTORIES false
${CMAKE_SOURCE_DIR}/*.[chi]
${CMAKE_SOURCE_DIR}/*.[chi]pp
${CMAKE_SOURCE_DIR}/*.[chi]xx
${CMAKE_SOURCE_DIR}/*.cc
${CMAKE_SOURCE_DIR}/*.hh
${CMAKE_SOURCE_DIR}/*.ii
${CMAKE_SOURCE_DIR}/*.[CHI]
${FluidSynth_SOURCE_DIR}/*.[chi]
${FluidSynth_SOURCE_DIR}/*.[chi]pp
${FluidSynth_SOURCE_DIR}/*.[chi]xx
${FluidSynth_SOURCE_DIR}/*.cc
${FluidSynth_SOURCE_DIR}/*.hh
${FluidSynth_SOURCE_DIR}/*.ii
${FluidSynth_SOURCE_DIR}/*.[CHI]
)
find_program ( ASTYLE "astyle" )
@ -736,11 +736,11 @@ if ( OpenMP_FOUND OR OpenMP_C_FOUND )
endif()
# manipulate some variables to setup a proper test env
set(TEST_SOUNDFONT "${CMAKE_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf2")
set(TEST_SOUNDFONT_UTF8_1 "${CMAKE_SOURCE_DIR}/sf2/\\xE2\\x96\\xA0VintageDreamsWaves-v2\\xE2\\x96\\xA0.sf2")
set(TEST_SOUNDFONT_UTF8_2 "${CMAKE_SOURCE_DIR}/sf2/VìntàgèDrèàmsWàvès-v2.sf2")
set(TEST_SOUNDFONT_SF3 "${CMAKE_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf3")
set(TEST_MIDI_UTF8 "${CMAKE_SOURCE_DIR}/test/èmpty.mid")
set(TEST_SOUNDFONT "${FluidSynth_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf2")
set(TEST_SOUNDFONT_UTF8_1 "${FluidSynth_SOURCE_DIR}/sf2/\\xE2\\x96\\xA0VintageDreamsWaves-v2\\xE2\\x96\\xA0.sf2")
set(TEST_SOUNDFONT_UTF8_2 "${FluidSynth_SOURCE_DIR}/sf2/VìntàgèDrèàmsWàvès-v2.sf2")
set(TEST_SOUNDFONT_SF3 "${FluidSynth_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf3")
set(TEST_MIDI_UTF8 "${FluidSynth_SOURCE_DIR}/test/èmpty.mid")
# Make sure to link against libm before checking for math functions below
set ( CMAKE_REQUIRED_LIBRARIES "${LIBFLUID_LIBS};${WINDOWS_LIBS}" )
@ -810,8 +810,8 @@ if ( HAVE_SOCKLEN_T )
endif ( HAVE_SOCKLEN_T )
# General configuration file
configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
${CMAKE_BINARY_DIR}/config.h )
configure_file ( ${FluidSynth_SOURCE_DIR}/src/config.cmake
${FluidSynth_BINARY_DIR}/config.h )
# required to allow ctest to be called from top-level build directory
ENABLE_TESTING()
@ -835,8 +835,8 @@ else ()
set ( includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}" )
endif ()
generate_pkgconfig_spec(fluidsynth.pc.in ${CMAKE_BINARY_DIR}/fluidsynth.pc libfluidsynth-OBJ)
install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
generate_pkgconfig_spec(fluidsynth.pc.in ${FluidSynth_BINARY_DIR}/fluidsynth.pc libfluidsynth-OBJ)
install ( FILES ${FluidSynth_BINARY_DIR}/fluidsynth.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
# Exported targets for cmake: find_package(FluidSynth)
@ -845,7 +845,7 @@ install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
# targets in the build directory
export(EXPORT FluidSynthTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/FluidSynthTargets.cmake"
FILE "${FluidSynth_BINARY_DIR}/FluidSynthTargets.cmake"
NAMESPACE FluidSynth::
)
@ -861,8 +861,8 @@ write_basic_package_version_file(
# support generating a config.cmake file for both the installed
# package and for using the build directory directly.
configure_file(FluidSynthConfig.cmake.in FluidSynthConfig.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/FluidSynthConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/FluidSynthConfigVersion.cmake"
install(FILES "${FluidSynth_BINARY_DIR}/FluidSynthConfig.cmake"
"${FluidSynth_BINARY_DIR}/FluidSynthConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fluidsynth
)
@ -870,18 +870,18 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/FluidSynthConfig.cmake"
if ( UNIX )
if ( DEFINED FLUID_DAEMON_ENV_FILE)
configure_file ( fluidsynth.service.in
${CMAKE_BINARY_DIR}/fluidsynth.service @ONLY )
${FluidSynth_BINARY_DIR}/fluidsynth.service @ONLY )
configure_file ( fluidsynth.conf.in
${CMAKE_BINARY_DIR}/fluidsynth.conf @ONLY )
${FluidSynth_BINARY_DIR}/fluidsynth.conf @ONLY )
endif ( DEFINED FLUID_DAEMON_ENV_FILE )
# uninstall custom target
configure_file ( "${CMAKE_SOURCE_DIR}/cmake_admin/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
configure_file ( "${FluidSynth_SOURCE_DIR}/cmake_admin/cmake_uninstall.cmake.in"
"${FluidSynth_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target ( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
"${CMAKE_COMMAND}" -P "${FluidSynth_BINARY_DIR}/cmake_uninstall.cmake")
endif ( UNIX )
include ( report )
@ -889,8 +889,8 @@ include ( report )
# CPack support
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "FluidSynth real-time synthesizer" )
set ( CPACK_PACKAGE_VENDOR "fluidsynth.org" )
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE" )
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${FluidSynth_SOURCE_DIR}/README.md" )
set ( CPACK_RESOURCE_FILE_LICENSE "${FluidSynth_SOURCE_DIR}/LICENSE" )
set ( CPACK_PACKAGE_VERSION_MAJOR ${FLUIDSYNTH_VERSION_MAJOR} )
set ( CPACK_PACKAGE_VERSION_MINOR ${FLUIDSYNTH_VERSION_MINOR} )
set ( CPACK_PACKAGE_VERSION_PATCH ${FLUIDSYNTH_VERSION_MICRO} )

View file

@ -106,7 +106,7 @@ if ( OBOE_SUPPORT )
set ( fluid_oboe_SOURCES drivers/fluid_oboe.cpp )
endif ( OBOE_SUPPORT )
set ( config_SOURCES ${CMAKE_BINARY_DIR}/config.h )
set ( config_SOURCES ${FluidSynth_BINARY_DIR}/config.h )
set ( libfluidsynth_SOURCES
utils/fluid_conv.c
@ -183,32 +183,32 @@ set ( libfluidsynth_SOURCES
)
set ( public_HEADERS
${CMAKE_SOURCE_DIR}/include/fluidsynth/audio.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/event.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/gen.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/ladspa.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/log.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/midi.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/misc.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/mod.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/seq.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/seqbind.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/settings.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/sfont.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/shell.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/synth.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/types.h
${CMAKE_SOURCE_DIR}/include/fluidsynth/voice.h
${CMAKE_BINARY_DIR}/include/fluidsynth/version.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/audio.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/event.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/gen.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/ladspa.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/log.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/midi.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/misc.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/mod.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/seq.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/seqbind.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/settings.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/sfont.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/shell.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/synth.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/types.h
${FluidSynth_SOURCE_DIR}/include/fluidsynth/voice.h
${FluidSynth_BINARY_DIR}/include/fluidsynth/version.h
)
set ( public_main_HEADER
${CMAKE_BINARY_DIR}/include/fluidsynth.h
${FluidSynth_BINARY_DIR}/include/fluidsynth.h
)
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth/version.h.in
${CMAKE_BINARY_DIR}/include/fluidsynth/version.h )
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
configure_file ( ${FluidSynth_SOURCE_DIR}/include/fluidsynth/version.h.in
${FluidSynth_BINARY_DIR}/include/fluidsynth/version.h )
configure_file ( ${FluidSynth_SOURCE_DIR}/include/fluidsynth.cmake
${public_main_HEADER} )
if ( WIN32 )
@ -258,17 +258,17 @@ add_library ( libfluidsynth-OBJ OBJECT
)
target_include_directories ( libfluidsynth-OBJ PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/include
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/drivers
${CMAKE_SOURCE_DIR}/src/synth
${CMAKE_SOURCE_DIR}/src/rvoice
${CMAKE_SOURCE_DIR}/src/midi
${CMAKE_SOURCE_DIR}/src/utils
${CMAKE_SOURCE_DIR}/src/sfloader
${CMAKE_SOURCE_DIR}/src/bindings
${CMAKE_SOURCE_DIR}/include
${FluidSynth_BINARY_DIR}
${FluidSynth_BINARY_DIR}/include
${FluidSynth_SOURCE_DIR}/src
${FluidSynth_SOURCE_DIR}/src/drivers
${FluidSynth_SOURCE_DIR}/src/synth
${FluidSynth_SOURCE_DIR}/src/rvoice
${FluidSynth_SOURCE_DIR}/src/midi
${FluidSynth_SOURCE_DIR}/src/utils
${FluidSynth_SOURCE_DIR}/src/sfloader
${FluidSynth_SOURCE_DIR}/src/bindings
${FluidSynth_SOURCE_DIR}/include
)
if ( LIBFLUID_CPPFLAGS )
@ -457,16 +457,16 @@ if ( FLUID_CPPFLAGS )
endif ( FLUID_CPPFLAGS )
target_include_directories ( fluidsynth PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/include
${CMAKE_SOURCE_DIR}/src/bindings
${CMAKE_SOURCE_DIR}/src/midi
${CMAKE_SOURCE_DIR}/src/rvoice
${CMAKE_SOURCE_DIR}/src/sfloader
${CMAKE_SOURCE_DIR}/src/synth
${CMAKE_SOURCE_DIR}/src/utils
${CMAKE_SOURCE_DIR}/src/
${CMAKE_SOURCE_DIR}/include
${FluidSynth_BINARY_DIR}
${FluidSynth_BINARY_DIR}/include
${FluidSynth_SOURCE_DIR}/src/bindings
${FluidSynth_SOURCE_DIR}/src/midi
${FluidSynth_SOURCE_DIR}/src/rvoice
${FluidSynth_SOURCE_DIR}/src/sfloader
${FluidSynth_SOURCE_DIR}/src/synth
${FluidSynth_SOURCE_DIR}/src/utils
${FluidSynth_SOURCE_DIR}/src/
${FluidSynth_SOURCE_DIR}/include
)
target_link_libraries ( fluidsynth PRIVATE
@ -551,6 +551,6 @@ ExternalProject_Add(gentables
"${CMAKE_COMMAND}" -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -G "${CMAKE_GENERATOR}" -B "${GENTAB_BDIR}" "${GENTAB_SDIR}"
BUILD_COMMAND
"${CMAKE_COMMAND}" --build "${GENTAB_BDIR}"
INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${CMAKE_BINARY_DIR}/"
INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${FluidSynth_BINARY_DIR}/"
)
add_dependencies(libfluidsynth-OBJ gentables)