Skip to content

Commit

Permalink
Change how OpenMPT is linked.
Browse files Browse the repository at this point in the history
This is necessitated by OpenMPT being a C++ library.

Related: liballeg#1598
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Nov 28, 2024
1 parent dbb2300 commit 6001127
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions addons/acodec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ add_our_addon_library(allegro_acodec
"${AUDIO_LINK_WITH};${ACODEC_LIBRARIES}"
)

if(SUPPORT_OPENMPT AND SHARED AND NOT WANT_MONOLITH)
set_target_properties(allegro_acodec PROPERTIES LINKER_LANGUAGE CXX)
endif()

install_our_headers(${ACODEC_INCLUDE_FILES})

add_addon(acodec)
Expand Down
16 changes: 8 additions & 8 deletions cmake/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function(add_our_library target framework_name sources extra_flags link_with)
if(WANT_STATIC_RUNTIME)
# TODO: The -static is a bit of a hack for MSYS2 to force the static linking of pthreads.
# There has to be a better way.
set(extra_link_flags "-static-libgcc -static-libstdc++ -static -lpthread")
set(extra_link_flags "-static-libgcc -static-libstdc++ -static -lpthread -Wl,--exclude-libs=libpthread.a -Wl,--exclude-libs=libgcc_eh.a")
endif()
endif()

Expand All @@ -121,7 +121,7 @@ function(add_our_library target framework_name sources extra_flags link_with)
if(NOT BUILD_SHARED_LIBS)
set(static_flag "-DALLEGRO_STATICLINK")
endif(NOT BUILD_SHARED_LIBS)

if(NOT ANDROID)
set_target_properties(${target}
PROPERTIES
Expand All @@ -137,7 +137,7 @@ function(add_our_library target framework_name sources extra_flags link_with)
)
set_property(GLOBAL APPEND PROPERTY JNI_LIBS ${target})
endif(NOT ANDROID)

# Construct the output name.
set(output_name ${target})
append_lib_type_suffix(output_name)
Expand Down Expand Up @@ -261,12 +261,12 @@ function(fix_executable nm)

# FIXME:We want those as project attributes, not target attributes, but I don't know how
set_target_properties(${nm} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")

# We have to add an icon to every executable on IPhone else
# cmake won't create a resource copy build phase for us.
# And re-creating those by hand would be a major pain.
set_target_properties(${nm} PROPERTIES MACOSX_BUNDLE_ICON_FILE icon.png)

set_source_files_properties("${CMAKE_SOURCE_DIR}/misc/icon.png" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources"
)
Expand All @@ -293,7 +293,7 @@ function(add_our_executable nm)
if(NOT OPTS_SRCS)
set(OPTS_SRCS "${nm}.c")
endif()

if(IPHONE)
set(EXECUTABLE_TYPE MACOSX_BUNDLE)
set(OPTS_SRCS ${OPTS_SRCS} "${CMAKE_SOURCE_DIR}/misc/icon.png")
Expand All @@ -307,7 +307,7 @@ function(add_our_executable nm)
if(NOT BUILD_SHARED_LIBS)
list(APPEND OPTS_DEFINES ALLEGRO_STATICLINK)
endif()

foreach(d ${OPTS_DEFINES})
set_property(TARGET ${nm} APPEND PROPERTY COMPILE_DEFINITIONS ${d})
endforeach()
Expand Down Expand Up @@ -337,7 +337,7 @@ function(add_our_executable nm)
set_target_properties(${nm} PROPERTIES LINK_FLAGS "-Wl,-subsystem,windows")
endif()
endif()

fix_executable(${nm})
endfunction()

Expand Down

0 comments on commit 6001127

Please sign in to comment.