60 lines
2.4 KiB
Plaintext
60 lines
2.4 KiB
Plaintext
--- src/CMakeLists.txt.orig 2026-07-22 17:50:04 UTC
|
|
+++ src/CMakeLists.txt
|
|
@@ -407,7 +407,7 @@ endif()
|
|
endif()
|
|
endif()
|
|
|
|
-include_directories(${CMAKE_BINARY_DIR}/include)
|
|
+include_directories(BEFORE ${CMAKE_BINARY_DIR}/include)
|
|
|
|
# Pick up `llvm-config` to setup LLVM flags.
|
|
if(LLVM)
|
|
@@ -549,7 +549,7 @@ endif()
|
|
string(APPEND LEAN_EXTRA_LINKER_FLAGS " -lm")
|
|
endif()
|
|
|
|
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
+if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD")
|
|
if(BSYMBOLIC)
|
|
string(APPEND LEANC_SHARED_LINKER_FLAGS " -Wl,-Bsymbolic")
|
|
string(APPEND TOOLCHAIN_SHARED_LINKER_FLAGS " -Wl,-Bsymbolic")
|
|
@@ -562,6 +562,19 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
" -Wl,--whole-archive ${CMAKE_BINARY_DIR}/lib/lean/libLake.a.export -Wl,--no-whole-archive"
|
|
)
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-rpath=$ORIGIN/../lib:$ORIGIN/../lib/lean")
|
|
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
+ if(BSYMBOLIC)
|
|
+ string(APPEND LEANC_SHARED_LINKER_FLAGS " -Wl,-Bsymbolic")
|
|
+ string(APPEND TOOLCHAIN_SHARED_LINKER_FLAGS " -Wl,-Bsymbolic")
|
|
+ endif()
|
|
+ string(APPEND CMAKE_CXX_FLAGS " -fPIC -ftls-model=initial-exec")
|
|
+ string(APPEND LEANC_EXTRA_FLAGS " -fPIC")
|
|
+ string(APPEND TOOLCHAIN_SHARED_LINKER_FLAGS " -Wl,-rpath=\\$$ORIGIN/..:\\$$ORIGIN")
|
|
+ string(
|
|
+ APPEND LAKESHARED_LINKER_FLAGS
|
|
+ " -Wl,--whole-archive ${CMAKE_BINARY_DIR}/lib/lean/libLake.a.export -Wl,--no-whole-archive"
|
|
+ )
|
|
+ string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-rpath=$ORIGIN/../lib:$ORIGIN/../lib/lean")
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
string(APPEND CMAKE_CXX_FLAGS " -ftls-model=initial-exec")
|
|
string(APPEND INIT_SHARED_LINKER_FLAGS " -install_name @rpath/libInit_shared.dylib")
|
|
@@ -720,6 +733,9 @@ string(APPEND LEANC_OPTS " -I${CMAKE_BINARY_DIR}/inclu
|
|
# Lean code only needs this one include
|
|
string(APPEND LEANC_OPTS " -I${CMAKE_BINARY_DIR}/include")
|
|
|
|
+# Include extra flags (e.g., -fPIC on FreeBSD)
|
|
+string(APPEND LEANC_OPTS " ${LEANC_EXTRA_FLAGS}")
|
|
+
|
|
# Use CMake profile C++ flags for building Lean libraries, but do not embed in `leanc`
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
|
string(APPEND LEANC_OPTS " ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}}")
|
|
@@ -1037,7 +1053,7 @@ install(
|
|
|
|
install(
|
|
DIRECTORY "${CMAKE_SOURCE_DIR}/"
|
|
- DESTINATION src/lean
|
|
+ DESTINATION share/lean4/src/lean
|
|
FILES_MATCHING
|
|
PATTERN "*.lean"
|
|
PATTERN "*.md"
|