Skip to content

Commit

Permalink
Prefer variable PROJECT_NAME where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Sep 17, 2024
1 parent 98f7b4b commit 06d1511
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION share/${PROJECT_NAME} FILES_MATCHING PATTERN "*.xml")

install(CODE "file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}\")")
install(CODE "execute_process(COMMAND \"${CMAKE_BINARY_DIR}/src/calfmakerdf\" -m gui -p \"${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}\")")
install(CODE "execute_process(COMMAND \"${CMAKE_BINARY_DIR}/src/${PROJECT_NAME}makerdf\" -m gui -p \"${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}\")")

file(GLOB STYLES ${CMAKE_CURRENT_SOURCE_DIR}/styles/*)
foreach(f ${STYLES})
Expand All @@ -20,6 +20,6 @@ foreach(f ${STYLES})
configure_file("${f}/gtk.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/styles/${sn}/gtk.rc" @ONLY)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/styles/${sn}/gtk.rc"
DESTINATION "share/calf/styles/${sn}")
DESTINATION "share/${PROJECT_NAME}/styles/${sn}")
endforeach()

16 changes: 8 additions & 8 deletions icons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
set(SIZES 16x16 22x22 24x24 32x32 48x48 64x64 128x128 256x256)

foreach(size ${SIZES})
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/calf_${size}.png"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_${size}.png"
DESTINATION "share/icons/hicolor/${size}/apps/"
RENAME "calf.png")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/calf_plugin_${size}.png"
RENAME "${PROJECT_NAME}.png")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_plugin_${size}.png"
DESTINATION "share/icons/hicolor/${size}/apps/"
RENAME "calf_plugin.png")
RENAME "${PROJECT_NAME}_plugin.png")
endforeach()

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/calf_scalable.svg"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_scalable.svg"
DESTINATION "share/icons/hicolor/scalable/apps/"
RENAME "calf.svg")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/calf_plugin_scalable.svg"
RENAME "${PROJECT_NAME}.svg")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_plugin_scalable.svg"
DESTINATION "share/icons/hicolor/scalable/apps/"
RENAME "calf_plugin.svg")
RENAME "${PROJECT_NAME}_plugin.svg")

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -t \"${CMAKE_INSTALL_PREFIX}/share/icons/hicolor\")")
Expand Down
80 changes: 40 additions & 40 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,57 @@ endif()
# libcalf.a
#
if(MSVC)
add_library(calf STATIC audio_fx.cpp analyzer.cpp lv2wrap.cpp metadata.cpp modules_tools.cpp modules_delay.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_filter.cpp modules_mod.cpp modules_pitch.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp pffft.c shaping_clipper.cpp)
add_library(${PROJECT_NAME} STATIC audio_fx.cpp analyzer.cpp lv2wrap.cpp metadata.cpp modules_tools.cpp modules_delay.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_filter.cpp modules_mod.cpp modules_pitch.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp pffft.c shaping_clipper.cpp)
else()
add_library(calf SHARED audio_fx.cpp analyzer.cpp lv2wrap.cpp metadata.cpp modules_tools.cpp modules_delay.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_filter.cpp modules_mod.cpp modules_pitch.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp pffft.c shaping_clipper.cpp)
add_library(${PROJECT_NAME} SHARED audio_fx.cpp analyzer.cpp lv2wrap.cpp metadata.cpp modules_tools.cpp modules_delay.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_filter.cpp modules_mod.cpp modules_pitch.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp pffft.c shaping_clipper.cpp)
endif()

target_include_directories(calf PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

target_include_directories(calf PRIVATE ${EXPAT_INCLUDE_DIRS} ${FluidSynth_INCLUDE_DIRS})
target_link_libraries(calf PUBLIC Threads::Threads ${EXPAT_LIBRARIES} fluidsynth)
target_include_directories(${PROJECT_NAME} PRIVATE ${EXPAT_INCLUDE_DIRS} ${FluidSynth_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads ${EXPAT_LIBRARIES} fluidsynth)

if(USE_GUI)
target_include_directories(calf PRIVATE ${GTK_INCLUDE_DIRS})
target_link_libraries(calf PRIVATE Threads::Threads ${GTK_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${GTK_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads ${GTK_LIBRARIES})
endif()

if(USE_JACK)
target_include_directories(calf PRIVATE ${JACK_INCLUDE_DIRS})
target_link_libraries(calf PRIVATE Threads::Threads ${JACK_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${JACK_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads ${JACK_LIBRARIES})
endif()

if(USE_LASH)
target_include_directories(calf PRIVATE ${LASH_INCLUDE_DIRS})
target_link_libraries(calf PRIVATE Threads::Threads ${LASH_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${LASH_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads ${LASH_LIBRARIES})
endif()

if(USE_LV2)
target_include_directories(calf PRIVATE ${LV2_INCLUDE_DIRS})
target_link_libraries(calf PRIVATE Threads::Threads ${LV2_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${LV2_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads ${LV2_LIBRARIES})
endif()

#
# UIs
#

if(USE_GUI)
add_library(calfgui ctl_curve.cpp ctl_keyboard.cpp ctl_knob.cpp ctl_led.cpp ctl_tube.cpp ctl_vumeter.cpp ctl_frame.cpp ctl_fader.cpp ctl_buttons.cpp ctl_notebook.cpp ctl_meterscale.cpp ctl_combobox.cpp ctl_tuner.cpp ctl_phasegraph.cpp ctl_pattern.cpp gui.cpp gui_config.cpp gui_controls.cpp osctl.cpp plugin_gui_window.cpp preset_gui.cpp utils.cpp ctl_linegraph.cpp drawingutils.cpp)
target_include_directories(calfgui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(calfgui PRIVATE Threads::Threads ${GTK_LIBRARIES} fluidsynth)
add_library(${PROJECT_NAME}gui ctl_curve.cpp ctl_keyboard.cpp ctl_knob.cpp ctl_led.cpp ctl_tube.cpp ctl_vumeter.cpp ctl_frame.cpp ctl_fader.cpp ctl_buttons.cpp ctl_notebook.cpp ctl_meterscale.cpp ctl_combobox.cpp ctl_tuner.cpp ctl_phasegraph.cpp ctl_pattern.cpp gui.cpp gui_config.cpp gui_controls.cpp osctl.cpp plugin_gui_window.cpp preset_gui.cpp utils.cpp ctl_linegraph.cpp drawingutils.cpp)
target_include_directories(${PROJECT_NAME}gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME}gui PRIVATE Threads::Threads ${GTK_LIBRARIES} fluidsynth)
endif()


if(USE_LV2 AND USE_GUI)
set(LV2DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2/calf.lv2")
add_library(calflv2gui SHARED gui.cpp gui_config.cpp gui_controls.cpp ctl_curve.cpp ctl_keyboard.cpp ctl_knob.cpp ctl_led.cpp ctl_tube.cpp ctl_vumeter.cpp ctl_frame.cpp ctl_fader.cpp ctl_buttons.cpp ctl_notebook.cpp ctl_meterscale.cpp ctl_combobox.cpp ctl_tuner.cpp ctl_phasegraph.cpp ctl_pattern.cpp metadata.cpp giface.cpp plugin_gui_window.cpp preset.cpp preset_gui.cpp lv2gui.cpp osctl.cpp utils.cpp ctl_linegraph.cpp drawingutils.cpp)
target_include_directories(calflv2gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
set(LV2DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2")
add_library(${PROJECT_NAME}lv2gui SHARED gui.cpp gui_config.cpp gui_controls.cpp ctl_curve.cpp ctl_keyboard.cpp ctl_knob.cpp ctl_led.cpp ctl_tube.cpp ctl_vumeter.cpp ctl_frame.cpp ctl_fader.cpp ctl_buttons.cpp ctl_notebook.cpp ctl_meterscale.cpp ctl_combobox.cpp ctl_tuner.cpp ctl_phasegraph.cpp ctl_pattern.cpp metadata.cpp giface.cpp plugin_gui_window.cpp preset.cpp preset_gui.cpp lv2gui.cpp osctl.cpp utils.cpp ctl_linegraph.cpp drawingutils.cpp)
target_include_directories(${PROJECT_NAME}lv2gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
check_linker_flag(CXX -Wl,-z,nodelete LINKER_SUPPORTS_NODELETE)
if (LINKER_SUPPORTS_NODELETE)
target_link_options(calflv2gui PRIVATE -Wl,-z,nodelete)
target_link_options(${PROJECT_NAME}lv2gui PRIVATE -Wl,-z,nodelete)
endif()
target_link_libraries(calflv2gui PRIVATE Threads::Threads ${GTK_LIBRARIES} ${EXPAT_LIBRARIES} fluidsynth)
set_target_properties(calf PROPERTIES
target_link_libraries(${PROJECT_NAME}lv2gui PRIVATE Threads::Threads ${GTK_LIBRARIES} ${EXPAT_LIBRARIES} fluidsynth)
set_target_properties(${PROJECT_NAME} PROPERTIES
INSTALL_RPATH "${LV2DIR}"
BUILD_WITH_INSTALL_RPATH TRUE
)
Expand All @@ -75,12 +75,12 @@ endif()
# calfjackhost
#
if(USE_GUI AND USE_JACK)
add_executable(calfjackhost gtk_session_env.cpp host_session.cpp jack_client.cpp jackhost.cpp gtk_main_win.cpp connector.cpp session_mgr.cpp)
add_executable(${PROJECT_NAME}jackhost gtk_session_env.cpp host_session.cpp jack_client.cpp jackhost.cpp gtk_main_win.cpp connector.cpp session_mgr.cpp)

target_include_directories(calfjackhost PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(calfjackhost PRIVATE Threads::Threads calfgui calf ${JACK_LIBRARIES} ${GTK_LIBRARIES} fluidsynth)
target_include_directories(${PROJECT_NAME}jackhost PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME}jackhost PRIVATE Threads::Threads ${PROJECT_NAME}gui ${PROJECT_NAME} ${JACK_LIBRARIES} ${GTK_LIBRARIES} fluidsynth)

set_target_properties(calfjackhost PROPERTIES
set_target_properties(${PROJECT_NAME}jackhost PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}"
BUILD_WITH_INSTALL_RPATH TRUE
)
Expand All @@ -91,12 +91,12 @@ endif()
#

if(MSVC)
add_executable(calfmakerdf makerdf.cpp getopt_windows.cpp)
add_executable(${PROJECT_NAME}makerdf makerdf.cpp getopt_windows.cpp)
else()
add_executable(calfmakerdf makerdf.cpp)
add_executable(${PROJECT_NAME}makerdf makerdf.cpp)
endif()
target_include_directories(calfmakerdf PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${EXPAT_INCLUDE_DIRS})
target_link_libraries(calfmakerdf PRIVATE calf Threads::Threads ${EXPAT_LIBRARIES} fluidsynth)
target_include_directories(${PROJECT_NAME}makerdf PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${EXPAT_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME}makerdf PRIVATE ${PROJECT_NAME} Threads::Threads ${EXPAT_LIBRARIES} fluidsynth)

#
# install
Expand All @@ -106,17 +106,17 @@ install(FILES ${CMAKE_SOURCE_DIR}/presets.xml
DESTINATION share/${PROJECT_NAME}/)

if(USE_GUI)
install(FILES ${CMAKE_SOURCE_DIR}/calf-gui.xml
install(FILES ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}-gui.xml
DESTINATION share/${PROJECT_NAME}/)
if(USE_JACK)
install(TARGETS calfjackhost DESTINATION bin)
install(TARGETS ${PROJECT_NAME}jackhost DESTINATION bin)
endif()
endif()

# Install libs
install(TARGETS calf LIBRARY DESTINATION lib/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME})
if(USE_GUI)
install(TARGETS calflv2gui DESTINATION lib/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}lv2gui DESTINATION lib/${PROJECT_NAME})
endif()

if(USE_LV2)
Expand All @@ -136,29 +136,29 @@ if(USE_LV2)
# OUTPUT_VARIABLE nothing
)
# install(
# CODE "file(COPY \"$<TARGET_FILE:calf>/\" DESTINATION \"lib/lv2/${PROJECT_NAME}.lv2/calf.so\")"
# CODE "file(COPY \"$<TARGET_FILE:${PROJECT_NAME}>/\" DESTINATION \"lib/lv2/${PROJECT_NAME}.lv2/${PROJECT_NAME}.so\")"
# RESULT_VARIABLE calfResult
# OUTPUT_VARIABLE nothing
# )
if(NOT ${calfResult} EQUAL 0)
message(FATAL_ERROR "Could not create ${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/calf.so")
message(FATAL_ERROR "Could not create ${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/${PROJECT_NAME}.so")
endif()
if(USE_GUI)
install(CODE "execute_process( \
COMMAND \"${CMAKE_COMMAND}\" -E create_symlink \
\"${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}/lib${PROJECT_NAME}lv2gui.so\" \
\"${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/calflv2gui.so\" \
\"${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/${PROJECT_NAME}lv2gui.so\" \
)"
RESULT_VARIABLE calfResult
# OUTPUT_VARIABLE nothing
)
# install(
# CODE "file(COPY \"$<TARGET_FILE:calflv2gui>/\" DESTINATION \"lib/lv2/${PROJECT_NAME}.lv2/calflv2gui.so\")"
# CODE "file(COPY \"$<TARGET_FILE:${PROJECT_NAME}lv2gui>/\" DESTINATION \"lib/lv2/${PROJECT_NAME}.lv2/${PROJECT_NAME}lv2gui.so\")"
# RESULT_VARIABLE calfResult
# OUTPUT_VARIABLE nothing
# )
if(NOT ${calfResult} EQUAL 0)
message(FATAL_ERROR "Could not create ${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/calflv2gui.so")
message(FATAL_ERROR "Could not create ${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2/${PROJECT_NAME}lv2gui.so")
endif()
endif()

Expand All @@ -169,7 +169,7 @@ if(USE_LV2)
endforeach()

# Install new .ttl files
install(CODE "execute_process(COMMAND \"${CMAKE_CURRENT_BINARY_DIR}/calfmakerdf\" -m ttl -p \"${CMAKE_INSTALL_PREFIX}/lib/lv2/calf.lv2\" -d \"${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/\")")
install(CODE "execute_process(COMMAND \"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}makerdf\" -m ttl -p \"${CMAKE_INSTALL_PREFIX}/lib/lv2/${PROJECT_NAME}.lv2\" -d \"${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/\")")

# Check files with "sordi"
if(USE_SORDI)
Expand Down

0 comments on commit 06d1511

Please sign in to comment.