Skip to content

Commit

Permalink
Version 1.7.0 (#8)
Browse files Browse the repository at this point in the history
feat: cross-platform DYLIB_API macro
feat: the library is now in snake_case
fix: documentation
fix: win32 check on CMakeLists
fix: license up-to-date

Co-authored-by: @MaximeHouis <[email protected]>
  • Loading branch information
martin-olivier and rmaxi-me authored Jan 12, 2022
1 parent af702ee commit 2a9b4d5
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 247 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/unit_tests.yml → .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,35 @@ defaults:

jobs:
run_unit_tests:

strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
bin: unit_tests.exe
dir: Debug
dir: ./Debug/
- os: ubuntu-latest
bin: unit_tests
dir: .
dir: ./
- os: macos-latest
bin: unit_tests
dir: .
dir: ./

name: Unit Tests
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Create Build Directory
run: mkdir build

- name: Generate Project Files
working-directory: build
run: cmake -DCMAKE_BUILD_TYPE=Release ..
run: cmake . -B build/ -DCMAKE_BUILD_TYPE=Release

- name: Build Dynamic Library and Unit Tests
working-directory: build
run: cmake --build .
run: cmake --build build/

- name: Run Unit Tests
working-directory: ${{ matrix.dir }}
run: ./${{ matrix.bin }}
run: ${{ matrix.dir }}${{ matrix.bin }}

- name: Send Coverage to codecov.io
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
46 changes: 20 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project(DyLib)
project(dylib)

set(CMAKE_VERBOSE_MAKEFILE off)

Expand All @@ -12,43 +12,37 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
option(WITH_TESTS "Enable testing" ON)

if(WITH_TESTS)
include(cmake/FindGTest.cmake)
include(import/FetchGoogleTest.cmake)

if (UNIX)
if(UNIX)
add_compile_options(-Wall -Wextra -Weffc++)
else ()
elseif(WIN32)
add_compile_options(/W4)
endif()

include(cmake/BuildDynLib.cmake)

if (UNIX AND NOT APPLE)
add_compile_options(--coverage)
endif()
add_library(dynlib SHARED test/myDynLib.cpp)
target_include_directories(dynlib PRIVATE .)
set_target_properties(dynlib PROPERTIES PREFIX "")

enable_testing()

add_executable(unit_tests
test/tests.cpp)
add_executable(unit_tests test/tests.cpp)

target_include_directories(unit_tests PRIVATE .)

if (UNIX AND NOT APPLE)
target_link_libraries(unit_tests PRIVATE
gcov
)
if(UNIX AND NOT APPLE)
add_compile_options(--coverage)
target_link_libraries(unit_tests PRIVATE gcov)
endif()

if (UNIX)
if(UNIX)
target_link_libraries(unit_tests PRIVATE
dl
pthread
dl
pthread
)
endif()

target_link_libraries(unit_tests PRIVATE
gtest_main
)
target_link_libraries(unit_tests PRIVATE gtest_main)

include(GoogleTest)

Expand All @@ -57,11 +51,11 @@ gtest_discover_tests(unit_tests)
add_dependencies(unit_tests dynlib)
endif(WITH_TESTS)

set(CPACK_PACKAGE_NAME "DyLib")
set(CPACK_PACKAGE_NAME "dylib")
set(CPACK_PACKAGE_VENDOR "Martin Olivier")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "6")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_VERSION_MINOR "7")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_DESCRIPTION "Cross-platform Dynamic Library Loader for C++")
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
Expand All @@ -72,7 +66,7 @@ include(CMakePackageConfigHelpers)

set(PackagingTemplatesDir "${CMAKE_CURRENT_SOURCE_DIR}/packaging")

set(LIB_NAME "DyLib")
set(LIB_NAME "dylib")
string(TOUPPER "${LIB_NAME}" LIB_NAME_UPPER)
set(CMAKE_EXPORT_NAME "${LIB_NAME}")
set(PKG_CONFIG_NAME "${LIB_NAME}")
Expand Down Expand Up @@ -123,7 +117,7 @@ set("CPACK_RPM_DEV_PACKAGE_SUGGESTS" "${CPACK_DEBIAN_DEV_PACKAGE_SUGGESTS}")

set(CPACK_COMPONENTS_ALL "dev")

set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/tocola/DyLib")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/tocola/dylib")
set(CPACK_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_MAINTAINER}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Martin Olivier
Copyright (c) 2022 Martin Olivier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 2a9b4d5

Please sign in to comment.