Skip to content

Commit

Permalink
Static link glibc
Browse files Browse the repository at this point in the history
  • Loading branch information
In-line committed Jul 24, 2019
1 parent 22b82a3 commit 92d96cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ file(GLOB_RECURSE SOURCE_FILES ${SRC_DIR}/*.h ${SRC_DIR}/*.cpp ${AMXXSDK}/sdk/*.

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} )

set(FLAGS "-m32 -O3 -mtune=generic -fvisibility=hidden -flto -fPIC")
set(FLAGS "-m32 -O3 -mtune=generic -fvisibility=hidden -flto=thin -fpic")
set(PORTABLE_LINK_FLAGS "${FLAGS} -static-libgcc -static-libstdc++ -Wl,--gc-sections -Wl,--version-script=${CMAKE_SOURCE_DIR}/version_script.lds")

set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${FLAGS} -fdata-sections -ffunction-sections -fpermissive")
Expand All @@ -43,7 +43,7 @@ if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX "_amxx_i386.dll")
else()
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}-rust pthread) # TODO: Conditional dynamic linking of OpenSSL. (ssl crypto)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${PORTABLE_LINK_FLAGS} -fuse-ld=lld")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${PORTABLE_LINK_FLAGS} -static -fuse-ld=lld -Wl,--allow-multiple-definition")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX "_amxx_i386.so")
endif()

Expand Down
4 changes: 2 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["staticlib"]
panic = "unwind"

[profile.release]
lto = "fat"
lto = "thin"
panic = "unwind"
codegen-units = 1
opt-level = 3
Expand Down Expand Up @@ -42,4 +42,4 @@ owning_ref = "0.4.0"
fnv = "1.0.6"

[build-dependencies]
cbindgen = "0.9.0"
cbindgen = "0.9.0"

0 comments on commit 92d96cb

Please sign in to comment.