Skip to content

Commit 73aaacd

Browse files
krystophnyclaude
andcommitted
Add Fortran LLDB development configuration
- Create configure-lldb-fortran.sh script for optimal build setup - Add LLDBConfigFortran.cmake module for Fortran-specific configuration - Integrate Fortran configuration into main LLDB CMake build - Update BACKLOG.md to reflect completed task This establishes the foundation for efficient LLDB Fortran development with minimal build times and proper test infrastructure support. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 986a2f2 commit 73aaacd

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

BACKLOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Goal**: Establish efficient development and testing environment
66

77
### Story 1.1: Minimal Build Configuration
8-
- [ ] Create optimal CMake configuration for Fortran LLDB development
8+
- [x] Create optimal CMake configuration for Fortran LLDB development
99
- [ ] Document build time and disk space requirements
1010
- [ ] Verify build works with both Debug and Release configurations
1111
- [ ] Test with different generators (Ninja, Make)

configure-lldb-fortran.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Optimal build configuration for LLDB Fortran development
3+
# This script creates a minimal build with only necessary components
4+
5+
BUILD_DIR="${1:-build-fortran}"
6+
BUILD_TYPE="${2:-RelWithDebInfo}"
7+
8+
echo "Configuring LLVM/LLDB for Fortran development..."
9+
echo "Build directory: $BUILD_DIR"
10+
echo "Build type: $BUILD_TYPE"
11+
12+
cmake -S llvm -B "$BUILD_DIR" -G Ninja \
13+
-DLLVM_ENABLE_PROJECTS="clang;lldb;flang" \
14+
-DLLVM_TARGETS_TO_BUILD="X86" \
15+
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
16+
-DLLVM_ENABLE_ASSERTIONS=ON \
17+
-DLLDB_INCLUDE_TESTS=ON \
18+
-DLLVM_INSTALL_UTILS=ON \
19+
-DLLVM_USE_LINKER=lld \
20+
-DLLVM_PARALLEL_LINK_JOBS=2 \
21+
-DLLVM_PARALLEL_COMPILE_JOBS=6 \
22+
-DLLDB_TEST_FORTRAN=ON \
23+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
24+
25+
echo "Configuration complete. To build:"
26+
echo " ninja -C $BUILD_DIR lldb lldb-test"
27+
echo "To run Fortran tests:"
28+
echo " ninja -C $BUILD_DIR check-lldb-lang-fortran"

lldb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ endif()
3838
include(LLDBConfig)
3939
include(AddLLDB)
4040
include(LLDBLayeringCheck)
41+
include(LLDBConfigFortran)
4142

4243
set(LLDB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
4344

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# LLDB Fortran Support Configuration
2+
# This module handles configuration specific to Fortran language support in LLDB
3+
4+
# Option to enable Fortran support testing
5+
option(LLDB_TEST_FORTRAN "Enable Fortran language tests" ON)
6+
7+
# Find Fortran compiler for testing
8+
if(LLDB_TEST_FORTRAN)
9+
include(CheckLanguage)
10+
check_language(Fortran)
11+
12+
if(CMAKE_Fortran_COMPILER)
13+
enable_language(Fortran)
14+
message(STATUS "Found Fortran compiler: ${CMAKE_Fortran_COMPILER}")
15+
16+
# Check if it's gfortran or flang
17+
execute_process(
18+
COMMAND ${CMAKE_Fortran_COMPILER} --version
19+
OUTPUT_VARIABLE FORTRAN_COMPILER_VERSION
20+
ERROR_QUIET
21+
)
22+
23+
if(FORTRAN_COMPILER_VERSION MATCHES "GNU Fortran")
24+
set(LLDB_TEST_FORTRAN_COMPILER "gfortran")
25+
elseif(FORTRAN_COMPILER_VERSION MATCHES "flang")
26+
set(LLDB_TEST_FORTRAN_COMPILER "flang")
27+
else()
28+
set(LLDB_TEST_FORTRAN_COMPILER "unknown")
29+
endif()
30+
31+
message(STATUS "Fortran compiler type: ${LLDB_TEST_FORTRAN_COMPILER}")
32+
else()
33+
message(WARNING "No Fortran compiler found. Fortran tests will be disabled.")
34+
set(LLDB_TEST_FORTRAN OFF)
35+
endif()
36+
endif()
37+
38+
# Export variables for use in test configuration
39+
set(LLDB_TEST_FORTRAN ${LLDB_TEST_FORTRAN} PARENT_SCOPE)
40+
set(LLDB_TEST_FORTRAN_COMPILER ${LLDB_TEST_FORTRAN_COMPILER} PARENT_SCOPE)
41+
42+
# Add Fortran test directory if enabled
43+
if(LLDB_TEST_FORTRAN)
44+
list(APPEND LLDB_TEST_DEPS lldb-test)
45+
46+
# Add custom target for Fortran tests only
47+
add_custom_target(check-lldb-lang-fortran
48+
COMMAND ${CMAKE_COMMAND} -E echo "Running LLDB Fortran language tests..."
49+
COMMAND ${Python3_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/llvm/utils/lit/lit.py
50+
--param lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/lit.site.cfg.py
51+
${CMAKE_CURRENT_SOURCE_DIR}/test/API/lang/fortran/
52+
DEPENDS ${LLDB_TEST_DEPS}
53+
COMMENT "Running LLDB Fortran language tests"
54+
USES_TERMINAL
55+
)
56+
endif()

0 commit comments

Comments
 (0)