Skip to content

Commit

Permalink
PIC replaced with CMake variable: #802
Browse files Browse the repository at this point in the history
  • Loading branch information
Artiom N. authored and rdementi committed Sep 29, 2024
1 parent e72f9b9 commit 0a0d9ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci-cmake-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
make install -j$(nproc)
- name: CMake Release install
run: |
Expand All @@ -41,7 +41,7 @@ jobs:
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
make install -j$(nproc)
- name: CMake Debug install
run: |
Expand All @@ -50,7 +50,7 @@ jobs:
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Debug
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
make install -j$(nproc)
- name: CMake RelWithDebInfo install
run: |
Expand All @@ -59,7 +59,7 @@ jobs:
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
make install -j$(nproc)
- name: CMake Custom build install
run: |
Expand All @@ -83,7 +83,7 @@ jobs:
run: |
cmake --version
rm -rf ${{ github.workspace }}/build
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_CXX_FLAGS="-O2 -g -fPIC"
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_CXX_FLAGS="-O2 -g"
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
Expand All @@ -95,7 +95,7 @@ jobs:
export CXXFLAGS="-grecord-gcc-switches"
export CFLAGS="-fstack-protector-strong"
export LDFLAGS="-Wl,-z,now"
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_CXX_FLAGS_CUSTOM:STRING="-O2 -g -fPIC" -DCMAKE_BUILD_TYPE=CUSTOM
cmake -B ${{ github.workspace }}/build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build -DCMAKE_CXX_FLAGS_CUSTOM:STRING="-O2 -g" -DCMAKE_BUILD_TYPE=CUSTOM
cd ${{ github.workspace }}/build
export VERBOSE=1
make install -j$(nproc)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(PCM)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)


option(PCM_NO_ASAN "Disable address sanitizer" OFF)
Expand Down Expand Up @@ -64,7 +64,7 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
message(STATUS "initial CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")

# required PCM common flags
set (PCM_COMMON_FLAGS "-Wno-unknown-pragmas -fPIC -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
set (PCM_COMMON_FLAGS "-Wno-unknown-pragmas -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"")

if(LINUX)
set (PCM_COMMON_FLAGS "${PCM_COMMON_FLAGS} -Wextra -DPCM_USE_PERF")
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if(UNIX) # LINUX, FREE_BSD, APPLE
$<$<CONFIG:RelWithDebInfo>:PCM_SILENT>
)

target_compile_options(PCM_STATIC_SILENT PRIVATE "-fPIC")
set_target_properties(PCM_STATIC_SILENT PROPERTIES POSITION_INDEPENDENT_CODE ON)

# libpcm.so
add_library(PCM_SHARED SHARED pcm-core.cpp)
Expand Down

0 comments on commit 0a0d9ab

Please sign in to comment.