Skip to content

Commit

Permalink
Structured ENVs
Browse files Browse the repository at this point in the history
  • Loading branch information
like-a-freedom committed Jan 29, 2025
1 parent f32ff6a commit d02d476
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@ ENV MAKEFLAGS="-j1"
ENV CMAKE_BUILD_PARALLEL_LEVEL=1
ENV ONNX_ML=1
ENV ONNX_BUILD_TESTS=OFF
ENV CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF ONNX_USE_LITE_PROTO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_FULLY_DISCONNECTED=ON -Wno-dev"
ENV CFLAGS="-O2 -pipe"
ENV CXXFLAGS="-O2 -pipe"
# CMake-specific flags
ENV CMAKE_ARGS=" \
-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF \
-DONNX_USE_LITE_PROTO=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DFETCHCONTENT_FULLY_DISCONNECTED=ON \
-Wno-dev \
"

# Compiler optimization and position-independent code
ENV CFLAGS="-O3 -pipe -fPIC -Wall"
ENV CXXFLAGS="-O3 -pipe -fPIC -Wall"

# Linker flags
ENV LDFLAGS="-Wl,--as-needed"
ENV CMAKE_CXX_FLAGS="--fPIC"
ENV CMAKE_C_FLAGS="--fPIC"

# (Optional) CMake compiler flags for finer control
# These ensure position-independent code and additional compiler warnings
ENV CMAKE_C_FLAGS="${CFLAGS}"
ENV CMAKE_CXX_FLAGS="${CXXFLAGS}"

WORKDIR /app

Expand Down

0 comments on commit d02d476

Please sign in to comment.