Skip to content

Conversation

@PokhodenkoSA
Copy link
Contributor

@diptorupd
Copy link
Contributor

Required security compiler’s flags:

-Wformat -Wformat-security -fstack-protector-all -D_FORTIFY_SOURCE=2 -fpic -fPIC -O3

Linker flags:

-Wl,-z,noexecstack,-z,relro,-z,now

Any recent GLIBC and stdlibc++ would work, I thought.

-Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations \
-fdiagnostics-color=auto -O3 \
")
set(SDL_FLAGS "-fstack-protector -fstack-protector-all -fpic -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fno-strict-overflow -fno-delete-null-pointer-checks")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reformat the flags like this to make them readable. Also do we not need -O3 ?

    set(CMAKE_C_FLAGS "                                                        \
        ${CMAKE_C_FLAGS}                                                       \
       -Wall                                                                   \
       -Wextra                                                                 \
       -Winit-self                                                             \
       -Wuninitialized                                                         \
       -Wmissing-declarations                                                  \
       -fdiagnostics-color=auto -O3                                            \
    ")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qstd=c++17")
    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3 -DDEBUG ")
elseif(UNIX)
    set(SDL_FLAGS "                                                            \
        -fstack-protector                                                      \
        -fstack-protector-all                                                  \
        -fpic                                                                  \
        -fPIC                                                                  \
        -D_FORTIFY_SOURCE=2                                                    \
        -Wformat                                                               \
        -Wformat-security                                                      \
        -fno-strict-overflow                                                   \
        -fno-delete-null-pointer-checks                                        \
        "
    )
    set(CMAKE_C_FLAGS "                                                        \
        ${CMAKE_C_FLAGS}                                                       \
        ${SDL_FLAGS}                                                           \
        -Wall                                                                  \
        -Wextra                                                                \
        -Winit-self                                                            \
        -Wuninitialized                                                        \
        -Wmissing-declarations                                                 \
        -fdiagnostics-color=auto                                               \
        -O3                                                                    \
        "
    )
    set(CMAKE_C_FLAGS_DEBUG "                                                  \
        ${CMAKE_C_FLAGS_DEBUG}                                                 \
         ${SDL_FLAGS}                                                          \
        -Wall                                                                  \
        -Wextra                                                                \
        -Winit-self                                                            \
        -Wuninitialized                                                        \
        -Wmissing-declarations                                                 \
        -fdiagnostics-color=auto                                               \
        -O0                                                                    \
        -ggdb3                                                                 \
        -DDEBUG                                                                \
        "
    )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style of formatting makes a lot spaces in commands. You can see all calls to compilers if use make -j4 VERBOSE=1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be a lot of spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would propose to use add_compile_options()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, Then never mind.

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SDL_FLAGS} -Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations -fdiagnostics-color=auto")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3 -DDEBUG ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fsycl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SDL_FLAGS} -std=c++17 -fsycl")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-O3 needs to be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-O3 is part of CMAKE_CXX_FLAGS_RELEASE.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course.

@diptorupd diptorupd merged commit 519b077 into IntelPython:master Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants