Created
January 26, 2023 20:16
-
-
Save LensPlaysGames/41223da224f3050a8faf3718b2c70dbb to your computer and use it in GitHub Desktop.
GNU Fribidi CMake support automatic imported target (requires `meson`)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: REQUIRES MESON https://mesonbuild.com | |
# GNU FRIBIDI (Logical to Visual reordering for bidirectional text display) | |
# Use the following snippet within your CMakeLists.txt, replacing your-target-here | |
# with the name of the CMake target you'd like to link with GNU Fribidi. | |
# FIXME: Untested on MacOS | |
include(ExternalProject) | |
ExternalProject_Add(ext_fribidi | |
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fribidi | |
GIT_REPOSITORY https://github.com/fribidi/fribidi.git | |
CONFIGURE_COMMAND meson setup . ../ext_fribidi -Dbin=false -Ddocs=false -Dtests=false | |
BUILD_COMMAND meson compile | |
INSTALL_COMMAND "" | |
TEST_COMMAND "" | |
) | |
add_library(fribidi SHARED IMPORTED) | |
target_include_directories( | |
fribidi | |
INTERFACE | |
${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi/lib | |
${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/lib | |
${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/gen.tab | |
) | |
if(WIN32) | |
set_target_properties( | |
fribidi PROPERTIES | |
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/lib/libfribidi-0.dll.a | |
IMPORTED_IMPLIB ${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/lib/libfribidi-0.dll | |
) | |
elseif(APPLE) | |
set_target_properties( | |
fribidi PROPERTIES | |
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/lib/libfribidi-0.dylib | |
) | |
else() | |
set_target_properties( | |
fribidi PROPERTIES | |
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/fribidi/src/ext_fribidi-build/lib/libfribidi-0.so | |
) | |
endif() | |
target_link_libraries(your-target-here fribidi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment