mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-09-01 06:30:52 +02:00
Do NOT set visibility to hidden for all targets
only if requested and only for our target use clang-tidy too on CI on cmacos
This commit is contained in:
parent
1b3755e6e5
commit
a50af55582
7 changed files with 26 additions and 16 deletions
|
@ -6,7 +6,7 @@ clang-analyzer-*,\
|
||||||
cppcoreguidelines-*,\
|
cppcoreguidelines-*,\
|
||||||
-cppcoreguidelines-macro-usage,\
|
-cppcoreguidelines-macro-usage,\
|
||||||
-cppcoreguidelines-owning-memory,\
|
-cppcoreguidelines-owning-memory,\
|
||||||
-hicpp-*,\
|
hicpp-*,\
|
||||||
misc-*,\
|
misc-*,\
|
||||||
-misc-non-private-member-variables-in-classes,\
|
-misc-non-private-member-variables-in-classes,\
|
||||||
-modernize-*,\
|
-modernize-*,\
|
||||||
|
|
4
.github/workflows/macos.yml
vendored
4
.github/workflows/macos.yml
vendored
|
@ -37,3 +37,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd build
|
cd build
|
||||||
ctest --build-config Debug
|
ctest --build-config Debug
|
||||||
|
|
||||||
|
- name: build standalone with clang-tidy
|
||||||
|
run: |
|
||||||
|
cmake -S standalone -B build/standalone -DUSE_STATIC_ANALYZER=clang-tidy
|
||||||
|
|
2
.github/workflows/standalone.yml
vendored
2
.github/workflows/standalone.yml
vendored
|
@ -4,9 +4,11 @@ name: Standalone
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
- master
|
||||||
- develop
|
- develop
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -52,14 +52,21 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS source/*.cpp)
|
||||||
add_library(Greeter ${headers} ${sources})
|
add_library(Greeter ${headers} ${sources})
|
||||||
set_target_properties(Greeter PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
set_target_properties(Greeter PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
||||||
|
|
||||||
# for SameMajorVersion upgrade stategie
|
# Note: for SameMajorVersion upgrade stategie
|
||||||
set_target_properties(Greeter PROPERTIES SOVERSION 1 VERSION ${PROJECT_VERSION})
|
set_target_properties(
|
||||||
|
Greeter
|
||||||
|
PROPERTIES SOVERSION 1
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
VISIBILITY_INLINES_HIDDEN ${BUILD_SHARED_LIBS}
|
||||||
|
CMAKE_VISIBILITY_INLINES_HIDDEN ${BUILD_SHARED_LIBS}
|
||||||
|
)
|
||||||
|
|
||||||
# being a cross-platform target, we enforce standards conformance on MSVC
|
# being a cross-platform target, we enforce standards conformance on MSVC
|
||||||
target_compile_options(Greeter PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive>")
|
target_compile_options(Greeter PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive>)
|
||||||
|
|
||||||
# Link dependencies, but Note: the fmt lib does not work with SHARED yet! CK
|
# Link dependencies
|
||||||
target_link_libraries(Greeter PUBLIC fmt::fmt-header-only)
|
target_link_libraries(Greeter PUBLIC $<BUILD_INTERFACE:fmt::fmt-header-only>)
|
||||||
|
# XXX target_link_libraries(Greeter PUBLIC fmt::fmt)
|
||||||
|
|
||||||
set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME}-${PROJECT_VERSION})
|
set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME}-${PROJECT_VERSION})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
|
@ -89,7 +96,7 @@ packageProject(
|
||||||
BINARY_DIR ${PROJECT_BINARY_DIR}
|
BINARY_DIR ${PROJECT_BINARY_DIR}
|
||||||
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
|
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
|
||||||
INCLUDE_DESTINATION ${INCLUDE_INSTALL_DIR}
|
INCLUDE_DESTINATION ${INCLUDE_INSTALL_DIR}
|
||||||
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
|
VERSION_HEADER ${VERSION_HEADER_LOCATION}
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion
|
||||||
DEPENDENCIES "fmt 7.1.3"
|
# XXX DEPENDENCIES "fmt 7.1.3"
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,7 +44,7 @@ test: install
|
||||||
|
|
||||||
# all together
|
# all together
|
||||||
all: test
|
all: test
|
||||||
cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1
|
cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1 -DUSE_STATIC_ANALYZER=clang-tidy
|
||||||
cmake --build build/$@
|
cmake --build build/$@
|
||||||
cmake --build build/$@ --target test
|
cmake --build build/$@ --target test
|
||||||
cmake --build build/$@ --target check-format
|
cmake --build build/$@ --target check-format
|
||||||
|
@ -66,4 +66,5 @@ standalone:
|
||||||
|
|
||||||
# check the library
|
# check the library
|
||||||
check: standalone
|
check: standalone
|
||||||
run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone
|
run-clang-tidy.py -p build/standalone standalone
|
||||||
|
# TODO builddriver run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set(CPM_DOWNLOAD_VERSION 0.31.0)
|
set(CPM_DOWNLOAD_VERSION 0.31.1)
|
||||||
|
|
||||||
if(CPM_SOURCE_CACHE)
|
if(CPM_SOURCE_CACHE)
|
||||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||||
|
|
|
@ -5,10 +5,6 @@ endif()
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Create shared libraries" YES)
|
option(BUILD_SHARED_LIBS "Create shared libraries" YES)
|
||||||
|
|
||||||
# Set default visibility to hidden for all targets
|
|
||||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
||||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
|
|
||||||
|
|
||||||
# build the dynamic libraries and executables together at bin directory
|
# build the dynamic libraries and executables together at bin directory
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue