Fix for Xcode new build system

CI: add new build-macos-xcode job
This commit is contained in:
Carles Fernandez 2022-11-29 23:38:27 +01:00
parent bb03d42177
commit a975e33dab
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 80 additions and 76 deletions

View File

@ -41,6 +41,21 @@ jobs:
- name: default position_test
run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test
build-macos-xcode:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: install dependencies
run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako
- name: configure
run: cd build && cmake -GXcode ..
- name: build
run: cd build && xcodebuild -configuration Release
- name: check
run: cd build && xcodebuild -configuration Release -target check && ../install/volk_gnsssdr_profile && ../install/run_tests
- name: default position_test
run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && xcodebuild -configuration Release -target position_test && ../install/position_test
clang-format:
runs-on: macos-latest
steps:

View File

@ -1115,13 +1115,11 @@ if(NOT VOLKGNSSSDR_FOUND)
if(PYTHON_EXECUTABLE)
set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_GENERATOR STREQUAL Xcode)
set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild"
"-configuration" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>
"-alltargets"
)
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild"
"-configuration" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>
)
endif()
if(CMAKE_TOOLCHAIN_FILE)
@ -1155,11 +1153,7 @@ if(NOT VOLKGNSSSDR_FOUND)
${STRIP_VOLK_GNSSSDR_PROFILE}
${USE_THIS_PYTHON}
)
if(CMAKE_VERSION VERSION_GREATER 3.18.99 AND CMAKE_GENERATOR STREQUAL Xcode)
if(XCODE_VERSION VERSION_GREATER 11)
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -T buildsystem=1)
endif()
endif()
if(DEFINED ENV{OECORE_TARGET_SYSROOT})
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCROSSCOMPILE_MULTILIB=TRUE

View File

@ -35,8 +35,6 @@ add_executable(volk_gnsssdr_profile
${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc
)
add_dependencies(volk_gnsssdr_profile volk_gnsssdr)
if(MSVC)
target_include_directories(volk_gnsssdr_profile
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cmake/msvc>
@ -59,7 +57,6 @@ if(NOT FILESYSTEM_FOUND)
target_link_libraries(volk_gnsssdr_profile PRIVATE ${Boost_LIBRARIES})
endif()
if(FILESYSTEM_FOUND)
add_definitions(-DHAS_STD_FILESYSTEM=1)
if(${find_experimental})
@ -72,10 +69,8 @@ if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr_static ${orc_lib})
else()
target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr ${orc_lib})
add_dependencies(volk_gnsssdr_profile volk_gnsssdr)
endif()
if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile
@ -84,23 +79,19 @@ if(ENABLE_STRIP)
endif()
endif()
install(
TARGETS volk_gnsssdr_profile
DESTINATION bin
COMPONENT "volk_gnsssdr"
)
# MAKE volk_gnsssdr-config-info
add_executable(volk_gnsssdr-config-info volk_gnsssdr-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc)
if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${orc_lib})
else()
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${orc_lib})
add_dependencies(volk_gnsssdr-config-info volk_gnsssdr)
endif()
if(ENABLE_STRIP)
@ -117,7 +108,6 @@ install(
COMPONENT "volk_gnsssdr"
)
# Launch volk_gnsssdr_profile if requested to do so
if(ENABLE_PROFILING)
if(DEFINED VOLK_CONFIGPATH)

View File

@ -558,65 +558,70 @@ else()
endif()
# Add dynamic library
if(CMAKE_GENERATOR STREQUAL Xcode)
add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources})
else()
add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>)
endif()
if(USE_CPU_FEATURES)
if(CPUFEATURES_FOUND)
target_link_libraries(volk_gnsssdr
PUBLIC ${volk_gnsssdr_libraries}
PRIVATE CpuFeature::cpu_features
)
# Note: new Xcode buildsystem does not allow building both static and dynamic libraries
# so we only build dynamic if ENABLE_STATIC_LIBS is not enabled in that generator.
# For other generators than XCode, the dynamic library is always built.
if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode)))
if(CMAKE_GENERATOR STREQUAL Xcode)
add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources})
else()
target_link_libraries(volk_gnsssdr
PUBLIC ${volk_gnsssdr_libraries}
PRIVATE cpu_features
)
add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>)
endif()
else()
target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries})
endif()
target_include_directories(volk_gnsssdr
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/kernels>
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<INSTALL_INTERFACE:include>
)
if(USE_CPU_FEATURES)
if(CPUFEATURES_FOUND)
target_include_directories(volk_gnsssdr
PRIVATE
$<TARGET_PROPERTY:CpuFeature::cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
)
if(USE_CPU_FEATURES)
if(CPUFEATURES_FOUND)
target_link_libraries(volk_gnsssdr
PUBLIC ${volk_gnsssdr_libraries}
PRIVATE CpuFeature::cpu_features
)
else()
target_link_libraries(volk_gnsssdr
PUBLIC ${volk_gnsssdr_libraries}
PRIVATE cpu_features
)
endif()
else()
target_include_directories(volk_gnsssdr
PRIVATE
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries})
endif()
endif()
# Configure target properties
if(ORC_FOUND)
target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES})
endif()
if(NOT MSVC)
target_link_libraries(volk_gnsssdr PUBLIC m)
endif()
set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION})
set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION})
set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
target_include_directories(volk_gnsssdr
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/kernels>
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<INSTALL_INTERFACE:include>
)
if(USE_CPU_FEATURES)
if(CPUFEATURES_FOUND)
target_include_directories(volk_gnsssdr
PRIVATE
$<TARGET_PROPERTY:CpuFeature::cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
)
else()
target_include_directories(volk_gnsssdr
PRIVATE
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
)
endif()
endif()
# Configure target properties
if(ORC_FOUND)
target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES})
endif()
if(NOT MSVC)
target_link_libraries(volk_gnsssdr PUBLIC m)
endif()
set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION})
set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION})
set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
# Install locations
install(TARGETS volk_gnsssdr
EXPORT VOLK_GNSSSDR-export
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file
RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file
)
# Install locations
install(TARGETS volk_gnsssdr
EXPORT VOLK_GNSSSDR-export
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file
RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file
)
endif()
# Configure static library
if(ENABLE_STATIC_LIBS)