Skip to content

Commit

Permalink
Dynamically link inih library
Browse files Browse the repository at this point in the history
  • Loading branch information
complexlogic committed Oct 26, 2024
1 parent 38d9aa4 commit 6e5000f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 468 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
defaults:
run:
shell: bash
env:
VCPKG_COMMITTISH: 10b7a178346f3f0abef60cecd5130e295afd8da4

permissions:
actions: none
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:
submodules: true

- uses: friendlyanon/setup-vcpkg@v1
with: { committish: 501cb01e517ee5689577bb01ba8bd1b4c1041a53 }
with: { committish: ${{env.VCPKG_COMMITTISH}} }

- name: Configure
run: cmake -B build -G "${{env.CMAKE_GENERATOR}}" -D "CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{env.VCPKG_TRIPLET}}
Expand Down Expand Up @@ -97,7 +99,7 @@ jobs:
- name: "Install dependencies"
run: |
if [[ "${{matrix.config.name}}" == "Debian" ]]; then
apt update && apt install -y build-essential git cmake pkg-config libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
apt update && apt install -y build-essential git cmake pkg-config libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libinih-dev
fi
- name: Build
Expand Down Expand Up @@ -161,7 +163,7 @@ jobs:
run: |
echo '#!/bin/bash' >> rpi
echo "sudo apt update &&" >> rpi
echo "sudo apt install -y libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev &&" >> rpi
echo "sudo apt install -y libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libinih-dev &&" >> rpi
echo "cd ${{env.REPO_TITLE}} &&" >> rpi
echo "cmake -B build -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DPACKAGE=DEB -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=arm64 -DRPI=1 &&" >> rpi
echo "cmake --build build --target package --config ${{env.CMAKE_BUILD_TYPE}}" >> rpi
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (UNIX)
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2>=${MIN_SDL_VERSION})
pkg_check_modules(SDL2_IMAGE REQUIRED IMPORTED_TARGET SDL2_image>=${MIN_SDL_IMAGE_VERSION})
pkg_check_modules(SDL2_TTF REQUIRED IMPORTED_TARGET SDL2_ttf>=${MIN_SDL_TTF_VERSION})
pkg_check_modules(INIH REQUIRED IMPORTED_TARGET inih)
endif ()

# Find dependencies - Windows
Expand All @@ -53,6 +54,8 @@ if (WIN32)
find_package(sdl2_image CONFIG REQUIRED)
find_package(SDL2_ttf CONFIG REQUIRED)

find_path(INIH_INCLUDE_DIR "ini.h" REQUIRED)
find_library(INIH inih REQUIRED)
find_path(GETOPT_INCLUDE_DIR "getopt.h" REQUIRED)
find_library(GETOPT getopt REQUIRED)
endif ()
Expand Down Expand Up @@ -150,7 +153,7 @@ if (UNIX)
if (NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
endif ()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsdl2-2.0-0 (>= ${MIN_SDL_VERSION}), libsdl2-image-2.0-0 (>= ${MIN_SDL_IMAGE_VERSION}), libsdl2-ttf-2.0-0 (>= ${MIN_SDL_TTF_VERSION}), libc6 (>= ${MIN_GLIBC_VERSION})")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsdl2-2.0-0 (>= ${MIN_SDL_VERSION}), libsdl2-image-2.0-0 (>= ${MIN_SDL_IMAGE_VERSION}), libsdl2-ttf-2.0-0 (>= ${MIN_SDL_TTF_VERSION}), libc6 (>= ${MIN_GLIBC_VERSION}), libinih1")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "complexlogic")
set(CPACK_DEBIAN_PACKAGE_SECTION "video")
set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
Expand Down
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ if (WIN32)
endif()

# Build libraries
add_subdirectory("external")
add_subdirectory("platform")

# Link libraries together
target_link_libraries(${EXECUTABLE_TITLE} platform inih)
target_link_libraries(${EXECUTABLE_TITLE} platform)
if (UNIX)
target_link_libraries(${EXECUTABLE_TITLE} PkgConfig::SDL2 PkgConfig::SDL2_IMAGE PkgConfig::SDL2_TTF m)
target_link_libraries(${EXECUTABLE_TITLE} PkgConfig::SDL2 PkgConfig::SDL2_IMAGE PkgConfig::SDL2_TTF PkgConfig::INIH m)
else ()
target_link_libraries(${EXECUTABLE_TITLE}
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
${GETOPT}
${INIH}
${GETOPT}
PowrProf
)
target_include_directories(${EXECUTABLE_TITLE} PUBLIC ${GETOPT_INCLUDE_DIR})
target_include_directories(${EXECUTABLE_TITLE} PUBLIC ${INIH_INCLUDE_DIR} ${GETOPT_INCLUDE_DIR})
endif ()
target_include_directories(${EXECUTABLE_TITLE} SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/external")
1 change: 0 additions & 1 deletion src/external/CMakeLists.txt

This file was deleted.

298 changes: 0 additions & 298 deletions src/external/ini.c

This file was deleted.

Loading

0 comments on commit 6e5000f

Please sign in to comment.