Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce github action for windows with clang #1201

Merged
merged 26 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7fe754b
Introduce github action workflow to test windows with clang
fspindle Jul 13, 2023
31a3f92
Rename windows workflow and update
fspindle Jul 13, 2023
04c9ac3
Fix warning : extra ';' after member function definition
fspindle Jul 15, 2023
8acad0c
Fix warning detected with clang on windows: empty expression statemen…
fspindle Jul 15, 2023
335ae96
Fix documentation indentation
fspindle Jul 15, 2023
62e1289
Fix wwarning detected with clang on windows : extra ';' after member …
fspindle Jul 15, 2023
db7359d
Fix warning detected with clang on windows: declaration shadows a fie…
fspindle Jul 15, 2023
d6450f1
Fix warning detected with clang on windows: enumeration value 'perspe…
fspindle Jul 15, 2023
1984756
Fix warning detected with clang on windows: variable 'deltav_py' may …
fspindle Jul 15, 2023
93e9d32
Fix warning detected with clang on windows : 'TARGET_OS_IPHONE' is no…
fspindle Jul 15, 2023
fed230f
Fix warning detected with clang on windows: 'break' will never be exe…
fspindle Jul 15, 2023
de427ee
Fix build with clang on windows where -avx and -avx2 flags are requested
fspindle Jul 15, 2023
47c9a8b
Mute warning detected with clang on windows
fspindle Jul 15, 2023
2806f9e
Remove clang -dumpmachine flag usage on windows
fspindle Jul 15, 2023
ad1592d
Mute warnings detected with clang on windows
fspindle Jul 15, 2023
7aba004
Fix warning detected with clang on windows : macro name is a reserved…
fspindle Jul 16, 2023
4c03fd5
Update VISP_INPUT_IMAGE_PATH in ci to be more explicit pointing to th…
fspindle Jul 16, 2023
a8b18a8
Set VISP_INPUT_IMAGE_PATH explicitely
fspindle Jul 16, 2023
a4acf65
Improve add_extra_compiler_option cmake macro (inspired from OpenCV)
fspindle Jul 16, 2023
9295490
Fix previous changes around -fvisibility=hidden that is required on o…
fspindle Jul 16, 2023
2fa9fa0
Atempt to fix macos ci removing flags introduced to mute clang on win…
fspindle Jul 17, 2023
7791d45
New attempt by commenting lines
fspindle Jul 17, 2023
a09e887
Try to use msvc17
fspindle Jul 17, 2023
7414a1d
Add ctest verbosity
fspindle Jul 17, 2023
2837999
Set VISP_INPUT_IMAGE_PATH before cmake configure
fspindle Jul 17, 2023
7459a05
Add avx flags to common flags only when msvc + clang
fspindle Jul 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/macos-ustk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Clone ustk-dataset
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Clone visp_sample
Expand All @@ -76,7 +76,7 @@ jobs:

- name: Run unit tests
working-directory: build
run: ctest -j$(sysctl -n hw.logicalcpu) --output-on-failure
run: ctest -j$(sysctl -n hw.logicalcpu) --output-on-failure -V

- name: ViSP as 3rdparty with cmake
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/other-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
apt-get update && apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
export VISP_INPUT_IMAGE_PATH=$HOME
export VISP_INPUT_IMAGE_PATH=$HOME/visp-images
echo ${VISP_INPUT_IMAGE_PATH}

pwd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-dep-apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Clone visp_sample
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-dep-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Configure CMake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Configure CMake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-ustk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Clone ustk-dataset
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}

- name: Configure CMake
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/windows-clang.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Windows - clang
on:
pull_request:
push:

jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: cmd
strategy:
fail-fast: false
matrix:
name: [windows-latest-clang]

include:
- name: windows-latest-clang
os: windows-2022
compiler: clang-cl

steps:
# https://github.com/marketplace/actions/cancel-workflow-action
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Display the workspace path
working-directory: ${{ github.workspace }}
run: pwd

- name: Clone visp-images
shell: bash
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}"

- name: Configure ViSP
working-directory: ${{ github.workspace }}
run: |
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
echo %VISP_INPUT_IMAGE_PATH%
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -T "ClangCl" -A "x64"
type ViSP-third-party.txt

- name: Build ViSP
working-directory: build
run: |
cmake --build . --config Release

- name: Install ViSP
working-directory: build
run: |
cmake --build . --config Release --target install

- name: Check installation folder
working-directory: build
run: |
dir ${{ github.workspace }}\build\install\
dir ${{ github.workspace }}\build\install\x64\
dir ${{ github.workspace }}\build\install\x64\vc17\
dir ${{ github.workspace }}\build\install\x64\vc17\bin

- name: Test ViSP
working-directory: build
run: |
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
echo %VISP_INPUT_IMAGE_PATH%
set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc17\bin
echo "PATH: "
echo %PATH%
ctest --output-on-failure -C Release -V
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ jobs:
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV

- name: Configure ViSP
working-directory: ${{ github.workspace }}
run: |
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
echo %VISP_INPUT_IMAGE_PATH%
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A "x64" -DCMAKE_GENERATOR_PLATFORM=x64
cmake .. -G "Visual Studio 16 2019" -A "x64"
type ViSP-third-party.txt

- name: Build ViSP
Expand All @@ -65,7 +68,9 @@ jobs:
- name: Test ViSP
working-directory: build
run: |
echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}"
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
echo %VISP_INPUT_IMAGE_PATH%
set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin
echo "PATH: "
echo %PATH%
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/clapack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if(NOT BUILD_SHARED_LIBS)
vp_install_target(${LAPACK_LIBRARY} EXPORT VISPModules ARCHIVE DESTINATION ${VISP_3P_LIB_INSTALL_PATH} COMPONENT dev)
endif()

if(MSVC)
if(MSVC AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
# Disable Visual C++ warnings
foreach(f ${lib_srcs})
vp_set_source_file_compile_flag(${f} /wd4244 /wd4267 /wd4273 /wd4554 /wd4723 /wd4996)
Expand Down
23 changes: 8 additions & 15 deletions 3rdparty/simdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(X86 OR X86_64)
set(AVX_FLAG "")
set(AVX2_FLAG "")

if(MSVC)
if(MSVC AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
if(NOT MSVC64)
vp_check_compiler_flag(CXX "/arch:SSE2" HAVE_SSE2_FLAG "${VISP_SOURCE_DIR}/cmake/checks/cpu_sse2.cpp")
endif()
Expand Down Expand Up @@ -136,6 +136,11 @@ if(X86 OR X86_64)
if(HAVE_NO_MISSING_FIELD_FLAG)
set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -Wno-missing-field-initializers")
endif()

if(MSVC AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
# Clang under windows needs AVX flags
set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG} ${AVX2_FLAG}")
endif()
endif()

file(GLOB_RECURSE SIMD_BASE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdBase*.cpp)
Expand All @@ -148,22 +153,10 @@ if(X86 OR X86_64)
set_source_files_properties(${SIMD_SSE41_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${SSE4_2_FLAG}")

file(GLOB_RECURSE SIMD_AVX1_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdAvx1*.cpp)
if(MSVC)
set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}")
elseif((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}")
else()
set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}")
endif()
set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}")

file(GLOB_RECURSE SIMD_AVX2_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdAvx2*.cpp)
if(MSVC)
set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}")
elseif((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}")
else()
set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}")
endif()
set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}")

set(SIMD_LIB_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}")
set(SIMD_ALG_SRC ${SIMD_BASE_SRC} ${SIMD_SSE2_SRC} ${SIMD_SSE41_SRC} ${SIMD_AVX1_SRC} ${SIMD_AVX2_SRC})
Expand Down
65 changes: 60 additions & 5 deletions cmake/AddExtraCompilationFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ macro(add_extra_compiler_option option)
if(CMAKE_BUILD_TYPE)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
endif()
vp_check_flag_support(CXX "${option}" _varname "")
vp_check_flag_support(CXX "${option}" _varname "${VISP_EXTRA_CXX_FLAGS} ${ARGN}")
if(_varname)
list(APPEND VISP_EXTRA_CXX_FLAGS ${option})
set(VISP_EXTRA_CXX_FLAGS "${VISP_EXTRA_CXX_FLAGS} ${option}")
endif()

vp_check_flag_support(C "${option}" _varname "")
vp_check_flag_support(C "${option}" _varname "${VISP_EXTRA_C_FLAGS} ${ARGN}")
if(_varname)
list(APPEND VISP_EXTRA_C_FLAGS ${option})
set(VISP_EXTRA_C_FLAGS "${VISP_EXTRA_C_FLAGS} ${option}")
endif()
endmacro()

Expand Down Expand Up @@ -126,7 +126,9 @@ if(BUILD_COVERAGE)
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-fvisibility=hidden)
#if(NOT (WIN32 AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))))
add_extra_compiler_option(-fvisibility=hidden)
#endif()

if(ENABLE_AVX AND X86_64)
add_extra_compiler_option(-mavx)
Expand Down Expand Up @@ -178,6 +180,59 @@ if(MSVC)
# Avoid build error C1128
list(APPEND VISP_EXTRA_CXX_FLAGS "/bigobj")
endif()
#if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
# add_extra_compiler_option("-Wno-c++98-compat") # turn off warning due to json
# add_extra_compiler_option("-Wno-c++98-compat-pedantic")
# add_extra_compiler_option("-Wno-c11-extensions")
# add_extra_compiler_option("-Wno-covered-switch-default")
# add_extra_compiler_option("-Wno-unused-template") # turn off warning due to eigen
# add_extra_compiler_option("-Wno-deprecated-copy-with-dtor")
# add_extra_compiler_option("-Wno-anon-enum-enum-conversion") # turn off warning due to opencv
# add_extra_compiler_option("-Wno-cast-align")
# add_extra_compiler_option("-Wno-cast-qual")
# add_extra_compiler_option("-Wno-covered-switch-default")
# add_extra_compiler_option("-Wno-deprecated-copy-with-user-provided-dtor")
# add_extra_compiler_option("-Wno-documentation")
# add_extra_compiler_option("-Wno-documentation-deprecated-sync")
# add_extra_compiler_option("-Wno-documentation-unknown-command")
# add_extra_compiler_option("-Wno-double-promotion")
# add_extra_compiler_option("-Wno-enum-enum-conversion")
# add_extra_compiler_option("-Wno-exit-time-destructors")
# add_extra_compiler_option("-Wno-extra-semi")
# add_extra_compiler_option("-Wno-extra-semi-stmt")
# add_extra_compiler_option("-Wno-float-equal")
# add_extra_compiler_option("-Wno-implicit-int-float-conversion")
# add_extra_compiler_option("-Wno-implicit-float-conversion")
# add_extra_compiler_option("-Wno-inconsistent-missing-destructor-override")
# add_extra_compiler_option("-Wno-language-extension-token")
# add_extra_compiler_option("-Wno-microsoft-enum-value")
# add_extra_compiler_option("-Wno-newline-eof")
# add_extra_compiler_option("-Wno-old-style-cast")
# add_extra_compiler_option("-Wno-reserved-identifier")
# add_extra_compiler_option("-Wno-shift-sign-overflow")
# add_extra_compiler_option("-Wno-sign-conversion")
# add_extra_compiler_option("-Wno-undefined-reinterpret-cast")
# add_extra_compiler_option("-Wno-zero-as-null-pointer-constant")
# add_extra_compiler_option("-Wno-cast-function-type") # ViSP
# add_extra_compiler_option("-Wno-comma")
# add_extra_compiler_option("-Wno-deprecated-copy-dtor")
# add_extra_compiler_option("-Wno-deprecated-dynamic-exception-spec")
# add_extra_compiler_option("-Wno-format-nonliteral")
# add_extra_compiler_option("-Wno-global-constructors")
# add_extra_compiler_option("-Wno-implicit-int-conversion")
# add_extra_compiler_option("-Wno-implicit-fallthrough")
# add_extra_compiler_option("-Wno-missing-noreturn")
# add_extra_compiler_option("-Wno-missing-variable-declarations")
# add_extra_compiler_option("-Wno-missing-prototypes")
# add_extra_compiler_option("-Wno-nonportable-system-include-path")
# add_extra_compiler_option("-Wno-shadow")
# add_extra_compiler_option("-Wno-suggest-destructor-override")
# add_extra_compiler_option("-Wno-suggest-override")
# add_extra_compiler_option("-Wno-switch-enum")
# add_extra_compiler_option("-Wno-unreachable-code")
# add_extra_compiler_option("-Wno-unused-macros")
# add_extra_compiler_option("-Wno-unused-member-function")
#endif()
endif()

# adjust -Wl,-rpath-link
Expand Down
Loading
Loading