Top Level Namespace

Defined Under Namespace

Modules: Swisseph

Constant Summary collapse

Sweph =

Shorthand alias

Swisseph

Instance Method Summary collapse

Instance Method Details

#cmake_available?Boolean

Check if CMake is available

Returns:

  • (Boolean)


5
6
7
# File 'ext/swisseph/extconf.rb', line 5

def cmake_available?
  system('cmake --version > /dev/null 2>&1')
end

#fetch_swisseph_with_cmakeObject

Run CMake to fetch Swiss Ephemeris sources



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'ext/swisseph/extconf.rb', line 10

def fetch_swisseph_with_cmake
  puts "Fetching Swiss Ephemeris sources with CMake..."

  build_dir = File.join(__dir__, 'cmake_build')
  FileUtils.mkdir_p(build_dir)

  # Configure CMake
  unless system("cmake -S #{__dir__} -B #{build_dir}")
    raise "CMake configuration failed. Please ensure CMake 3.14+ is installed."
  end

  # Build (which triggers FetchContent)
  unless system("cmake --build #{build_dir}")
    raise "CMake build failed."
  end

  # Verify sources were fetched
  stamp_file = File.join(__dir__, '.swisseph_fetched')
  unless File.exist?(stamp_file)
    raise "Swiss Ephemeris sources not fetched successfully."
  end

  # Clean up build directory (keep fetched sources)
  FileUtils.rm_rf(build_dir)

  puts "Swiss Ephemeris sources fetched successfully."
end