Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize compiler and linker flags #7255

Merged
merged 14 commits into from
Jun 2, 2024
2 changes: 1 addition & 1 deletion cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)

IF(LMMS_BUILD_APPLE)
IF ("${PLUGIN_LINK}" STREQUAL "SHARED")
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
TARGET_LINK_OPTIONS(${PLUGIN_NAME} PUBLIC "-undefined dynamic_lookup")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
ENDIF()
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
Expand Down
6 changes: 2 additions & 4 deletions plugins/GigPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ if(LMMS_HAVE_GIG)
SET(CMAKE_AUTOUIC ON)

# Required for not crashing loading files with libgig
SET(GCC_COVERAGE_COMPILE_FLAGS "-fexceptions")
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
add_compile_options("-fexceptions")

# disable deprecated check for mingw-x-libgig
if(LMMS_BUILD_WIN32)
SET(GCC_GIG_COMPILE_FLAGS "-Wno-deprecated")
add_definitions(${GCC_GIG_COMPILE_FLAGS})
add_compile_options("-Wno-deprecated")
endif(LMMS_BUILD_WIN32)

link_directories(${GIG_LIBRARY_DIRS})
Expand Down
9 changes: 0 additions & 9 deletions plugins/LadspaEffect/caps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,3 @@ IF(LMMS_BUILD_WIN32)
COMMAND_EXPAND_LISTS
)
ENDIF(LMMS_BUILD_WIN32)

IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
SET_TARGET_PROPERTIES(caps PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
DomClark marked this conversation as resolved.
Show resolved Hide resolved
ENDIF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)

IF(LMMS_BUILD_LINUX)
SET_TARGET_PROPERTIES(caps PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
ENDIF(LMMS_BUILD_LINUX)

29 changes: 15 additions & 14 deletions plugins/LadspaEffect/swh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ FILE(WRITE ladspa/config.h "")
IF(LMMS_BUILD_WIN32)
SET(PIC_FLAGS "")
ELSE()
SET(PIC_FLAGS "-fPIC -DPIC")
SET(PIC_FLAGS -fPIC -DPIC)
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
ENDIF()

# Additional compile flags
if(MSVC)
set(COMPILE_FLAGS "${COMPILE_FLAGS} /wd4244 /wd4273 /wd4305")
set(COMPILE_FLAGS ${COMPILE_FLAGS} /wd4244 /wd4273 /wd4305)
else()
set(COMPILE_FLAGS "${COMPILE_FLAGS} -O3 -Wall")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fomit-frame-pointer -funroll-loops -ffast-math -c -fno-strict-aliasing")
set(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}")
set(COMPILE_FLAGS ${COMPILE_FLAGS} -O3 -Wall -c
-fomit-frame-pointer -funroll-loops -ffast-math -fno-strict-aliasing
${PIC_FLAGS}
)
endif()

# Loop over every XML file
Expand Down Expand Up @@ -61,8 +62,8 @@ FOREACH(_item ${XML_SOURCES})
endif(LMMS_BUILD_WIN32)

SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES PREFIX "")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
TARGET_COMPILE_OPTIONS("${_plugin}" PUBLIC "${COMPILE_FLAGS}")
TARGET_LINK_OPTIONS("${_plugin}" PUBLIC "${LINK_FLAGS}")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
INSTALL(TARGETS "${_plugin}" LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")
ENDFOREACH()

Expand All @@ -75,7 +76,7 @@ INCLUDE_DIRECTORIES(
)

ADD_LIBRARY(iir STATIC ladspa/util/iir.c)
SET_TARGET_PROPERTIES(iir PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(iir PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(bandpass_a_iir_1893 iir)
TARGET_LINK_LIBRARIES(bandpass_iir_1892 iir)
TARGET_LINK_LIBRARIES(butterworth_1902 iir)
Expand All @@ -86,23 +87,23 @@ TARGET_LINK_LIBRARIES(notch_iir_1894 iir)
FILE(GLOB GSM_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/gsm/*.c")
LIST(SORT GSM_SOURCES)
ADD_LIBRARY(gsm STATIC ${GSM_SOURCES})
SET_TARGET_PROPERTIES(gsm PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(gsm PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(gsm_1215 gsm)

ADD_LIBRARY(gverb STATIC ladspa/gverb/gverb.c ladspa/gverb/gverbdsp.c)
SET_TARGET_PROPERTIES(gverb PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(gverb PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(gverb_1216 gverb)

ADD_LIBRARY(blo STATIC ladspa/util/blo.c)
SET_TARGET_PROPERTIES(blo PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(blo PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(analogue_osc_1416 blo)
TARGET_LINK_LIBRARIES(fm_osc_1415 blo)
TARGET_LINK_LIBRARIES(hermes_filter_1200 blo)

ADD_LIBRARY(rms STATIC ladspa/util/rms.c)
ADD_LIBRARY(db STATIC ladspa/util/db.c)
SET_TARGET_PROPERTIES(rms PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
SET_TARGET_PROPERTIES(db PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(rms PUBLIC "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(db PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(sc1_1425 rms db)
TARGET_LINK_LIBRARIES(sc2_1426 rms db)
TARGET_LINK_LIBRARIES(sc3_1427 rms db)
Expand All @@ -111,7 +112,7 @@ TARGET_LINK_LIBRARIES(sc4m_1916 rms db)
TARGET_LINK_LIBRARIES(se4_1883 rms db)

ADD_LIBRARY(pitchscale STATIC ladspa/util/pitchscale.c)
SET_TARGET_PROPERTIES(pitchscale PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
TARGET_COMPILE_OPTIONS(pitchscale PUBLIC "${PIC_FLAGS}")
TARGET_LINK_LIBRARIES(pitchscale ${FFTW3F_LIBRARIES})
TARGET_LINK_LIBRARIES(pitch_scale_1193 pitchscale)
TARGET_LINK_LIBRARIES(pitch_scale_1194 pitchscale)
5 changes: 1 addition & 4 deletions plugins/VstBase/RemoteVstPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ target_compile_definitions(${EXE_NAME} PRIVATE BUILD_REMOTE_PLUGIN_CLIENT)

# Workaround for missing WinMain
if(MSVC)
set_property(TARGET ${EXE_NAME}
APPEND
PROPERTY LINK_FLAGS "/entry:mainCRTStartup"
)
target_link_options(${EXE_NAME} PRIVATE "/entry:mainCRTStartup")
endif()

if(IS_MINGW)
Expand Down
4 changes: 2 additions & 2 deletions plugins/ZynAddSubFx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ SET_PROPERTY(GLOBAL APPEND PROPERTY PLUGINS_BUILT "RemoteZynAddSubFx")
TARGET_COMPILE_DEFINITIONS(RemoteZynAddSubFx PRIVATE BUILD_REMOTE_PLUGIN_CLIENT)

IF(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES(RemoteZynAddSubFx PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows")
ENDIF(LMMS_BUILD_WIN32)
target_link_options(RemoteZynAddSubFx PUBLIC "-mwindows")
Rossmaxx marked this conversation as resolved.
Show resolved Hide resolved
ENDIF()

# Remove useless dependencies from FLTK. Use fltk-config to avoid static library
# in older environments
Expand Down
Loading