add ConfigureOp class
This commit is contained in:
parent
d196845c85
commit
64caaa9a53
@ -3,6 +3,7 @@ require_relative "rscons/application"
|
||||
require_relative "rscons/build_target"
|
||||
require_relative "rscons/builder"
|
||||
require_relative "rscons/cache"
|
||||
require_relative "rscons/configure_op"
|
||||
require_relative "rscons/environment"
|
||||
require_relative "rscons/job_set"
|
||||
require_relative "rscons/script"
|
||||
|
@ -76,37 +76,12 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def configure
|
||||
co = ConfigureOp.new("#{@build_dir}/configure")
|
||||
if ccc = @script.check_c_compiler
|
||||
check_c_compiler(ccc)
|
||||
co.check_c_compiler(ccc)
|
||||
end
|
||||
end
|
||||
|
||||
# Configure: check for a working C compiler.
|
||||
#
|
||||
# @param ccc [Array<String>]
|
||||
# C compiler(s) to check for.
|
||||
#
|
||||
# @return [void]
|
||||
def check_c_compiler(ccc)
|
||||
if ccc.empty?
|
||||
# Default C compiler search array.
|
||||
ccc = %w[gcc clang]
|
||||
end
|
||||
cc = ccc.find do |cc|
|
||||
test_c_compiler(cc)
|
||||
end
|
||||
end
|
||||
|
||||
# Test a C compiler.
|
||||
#
|
||||
# @param cc [String]
|
||||
# C compiler to test.
|
||||
#
|
||||
# @return [Boolean]
|
||||
# Whether the C compiler tested successfully.
|
||||
def test_c_compiler(cc)
|
||||
end
|
||||
|
||||
# Determine the number of threads to use by default.
|
||||
#
|
||||
# @return [Integer]
|
||||
|
45
lib/rscons/configure_op.rb
Normal file
45
lib/rscons/configure_op.rb
Normal file
@ -0,0 +1,45 @@
|
||||
require "fileutils"
|
||||
|
||||
module Rscons
|
||||
# Class to manage a configure operation.
|
||||
class ConfigureOp
|
||||
|
||||
# Create a ConfigureOp.
|
||||
#
|
||||
# @param work_dir [String]
|
||||
# Work directory for configure operation.
|
||||
def initialize(work_dir)
|
||||
@work_dir = work_dir
|
||||
FileUtils.mkdir_p(@work_dir)
|
||||
end
|
||||
|
||||
# Check for a working C compiler.
|
||||
#
|
||||
# @param ccc [Array<String>]
|
||||
# C compiler(s) to check for.
|
||||
#
|
||||
# @return [void]
|
||||
def check_c_compiler(ccc)
|
||||
if ccc.empty?
|
||||
# Default C compiler search array.
|
||||
ccc = %w[gcc clang]
|
||||
end
|
||||
cc = ccc.find do |cc|
|
||||
test_c_compiler(cc)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Test a C compiler.
|
||||
#
|
||||
# @param cc [String]
|
||||
# C compiler to test.
|
||||
#
|
||||
# @return [Boolean]
|
||||
# Whether the C compiler tested successfully.
|
||||
def test_c_compiler(cc)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user