Skip to content

Commit

Permalink
Merge pull request #20 from karel-burda/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
karel-burda authored Jun 26, 2019
2 parents 2d1b247 + 80711dd commit ca54cc8
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 50 deletions.
30 changes: 15 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

project(function-loader VERSION 1.2.5 LANGUAGES CXX)
project(function-loader VERSION 1.2.6 LANGUAGES CXX)

add_library(${PROJECT_NAME} INTERFACE)

target_sources(${PROJECT_NAME}
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/function_loader.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/exceptions.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/function_loader.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/exceptions.hpp

${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/function_loader_base.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/function_loader_platform_specific.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/function_loader_base.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/function_loader_platform_specific.hpp
$<$<PLATFORM_ID:Windows>:
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/function_loader_platform_specific_windows.hpp>
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/function_loader_platform_specific_windows.hpp>
$<$<PLATFORM_ID:Unix>:
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/function_loader_platform_specific_unix.hpp>
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/function_loader_platform_specific_unix.hpp>

${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/library_loader.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/library_loader_base.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/library_loader_platform_specific.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/library_loader.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/library_loader_base.hpp
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/library_loader_platform_specific.hpp
$<$<PLATFORM_ID:Windows>:
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/library_loader_platform_specific_windows.hpp>
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/library_loader_platform_specific_windows.hpp>
$<$<PLATFORM_ID:Unix>:
${CMAKE_CURRENT_SOURCE_DIR}/include/function_loader/detail/library_loader_platform_specific_unix.hpp>)
${CMAKE_CURRENT_LIST_DIR}/include/function_loader/detail/library_loader_platform_specific_unix.hpp>)

target_include_directories(${PROJECT_NAME}
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include)
${CMAKE_CURRENT_LIST_DIR}/include)

if (CMAKE_DL_LIBS)
message(STATUS "Will add ${CMAKE_DL_LIBS}")
Expand All @@ -43,8 +43,8 @@ install(TARGETS ${PROJECT_NAME}
EXPORT _targets)

export(EXPORT _targets
NAMESPACE burda::
FILE "${PROJECT_NAME}-config.cmake")
NAMESPACE burda::
FILE "${PROJECT_NAME}-config.cmake")

include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Version](https://img.shields.io/badge/version-1.2.5-blue.svg)
![Version](https://img.shields.io/badge/version-1.2.6-blue.svg)
[![License](https://img.shields.io/badge/license-MIT_License-blue.svg?style=flat)](LICENSE)
[![Build Status](https://travis-ci.org/karel-burda/function-loader.svg?branch=master)](https://travis-ci.org/karel-burda/function-loader)
[![Codecov Status](https://codecov.io/gh/karel-burda/function-loader/branch/develop/graph/badge.svg)](https://codecov.io/gh/karel-burda/function-loader/branch/master)
Expand Down
18 changes: 8 additions & 10 deletions demo-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

project(demo-library LANGUAGES CXX)

message(STATUS "Building demo library")

include(${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)

add_library(${PROJECT_NAME} SHARED)

include(GenerateExportHeader)
set(CMAKE_CXX_VISIBILITY_PRESET default)
generate_export_header(${PROJECT_NAME} EXPORT_FILE_NAME "export.hpp")
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/export.hpp
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/src)
DESTINATION ${CMAKE_CURRENT_LIST_DIR}/src)

target_sources(${PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/demo-library.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/demo-library.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/export.hpp)
${CMAKE_CURRENT_LIST_DIR}/src/demo-library.hpp
${CMAKE_CURRENT_LIST_DIR}/src/demo-library.cpp
${CMAKE_CURRENT_LIST_DIR}/src/export.hpp)

# Unfortunately, we cannot use SUFFIX as empty string property on MSVC, because the LoadLibrary method from WinAPI
# checks whether the file name has some suffix at all. For simplicity, use the same suffix also on POSIXEs
# Unfortunately, we cannot use SUFFIX as empty string property on MSVC, because the LoadLibrary(...) method from the WinAPI
# checks whether the file name has some suffix at all; for simplicity, use the same suffix also on POSIXEs
set_target_properties(${PROJECT_NAME}
PROPERTIES
PREFIX ""
SUFFIX ".dll")

burda_cmake_helpers_cpp_warnings_add_pedantic_level(${PROJECT_NAME} PRIVATE CXX)
burda_cmake_helpers_cpp_warnings_add_pedantic_level_cxx(${PROJECT_NAME} PRIVATE)
12 changes: 5 additions & 7 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

project(example LANGUAGES CXX)

message(STATUS "Building example")

include(${CMAKE_CURRENT_SOURCE_DIR}/../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)

add_executable(${PROJECT_NAME} "")

target_sources(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
${CMAKE_CURRENT_LIST_DIR}/src/main.cpp)

find_package(function-loader CONFIG REQUIRED)
message(STATUS "Found version of function-loader is: ${function-loader_VERSION}")
target_link_libraries(${PROJECT_NAME} PRIVATE burda::function-loader)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../demo-library ${CMAKE_CURRENT_BINARY_DIR}/demo-library)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../demo-library ${CMAKE_CURRENT_BINARY_DIR}/demo-library)
add_dependencies(${PROJECT_NAME} demo-library)

include(${CMAKE_CURRENT_SOURCE_DIR}/../demo-library/post_build_steps.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../demo-library/post_build_steps.cmake)
_burda_function_loader_demo_library_add_post_build_steps(${PROJECT_NAME})

burda_cmake_helpers_cpp_warnings_add_pedantic_level(${PROJECT_NAME} PRIVATE CXX)
burda_cmake_helpers_cpp_warnings_add_pedantic_level_cxx(${PROJECT_NAME} PRIVATE)
28 changes: 13 additions & 15 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

project(tests LANGUAGES CXX)

message(STATUS "Building unit tests")

include(${CMAKE_CURRENT_SOURCE_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_coverage.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_gtest.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_coverage.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_gtest.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../../submodules/cmake-helpers/cmake-helpers/cpp_warnings.cmake)

add_executable(${PROJECT_NAME} "")

target_sources(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/helpers.hpp
${CMAKE_CURRENT_LIST_DIR}/include/helpers.hpp

${CMAKE_CURRENT_SOURCE_DIR}/src/exceptions_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/function_loader_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/library_loader_test.cpp)
${CMAKE_CURRENT_LIST_DIR}/src/exceptions_test.cpp
${CMAKE_CURRENT_LIST_DIR}/src/function_loader_test.cpp
${CMAKE_CURRENT_LIST_DIR}/src/library_loader_test.cpp)

target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
${CMAKE_CURRENT_LIST_DIR}/include)

find_package(test-utils CONFIG REQUIRED)
message(STATUS "Found version of test-utils is: ${test-utils_VERSION}")
Expand All @@ -38,13 +36,13 @@ burda_cmake_helpers_cpp_gtest_bootstrap_and_link(${PROJECT_NAME} "release-1.8.1"

if (COVERAGE)
message(STATUS "Building unit tests with code coverage")
burda_cmake_helpers_cpp_coverage_add_build_options(${PROJECT_NAME} PRIVATE CXX)
burda_cmake_helpers_cpp_coverage_add_build_options_cxx(${PROJECT_NAME} PRIVATE)
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../demo-library ${CMAKE_CURRENT_BINARY_DIR}/demo-library)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../demo-library ${CMAKE_CURRENT_BINARY_DIR}/demo-library)
add_dependencies(${PROJECT_NAME} demo-library)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../demo-library/post_build_steps.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../../demo-library/post_build_steps.cmake)
_burda_function_loader_demo_library_add_post_build_steps(${PROJECT_NAME})

# Create invalid (empty) file that will be used in the tests to verify, whether the implementation correctly refuses to load this file
Expand All @@ -59,5 +57,5 @@ add_custom_target(run-all-tests-verbose
COMMAND ${CMAKE_CTEST_COMMAND} -V -C ${CMAKE_BUILD_TYPE} --build-run-dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} --timeout 300
DEPENDS ${PROJECT_NAME})

burda_cmake_helpers_cpp_warnings_add_pedantic_level(${PROJECT_NAME} PRIVATE CXX)
burda_cmake_helpers_cpp_warnings_suppress(${PROJECT_NAME} "keyword-macro" PRIVATE CXX)
burda_cmake_helpers_cpp_warnings_add_pedantic_level_cxx(${PROJECT_NAME} PRIVATE)
burda_cmake_helpers_cpp_warnings_suppress_cxx(${PROJECT_NAME} "keyword-macro" PRIVATE)

0 comments on commit ca54cc8

Please sign in to comment.