Skip to content

Commit

Permalink
scons: prevent installed modules from recompiling
Browse files Browse the repository at this point in the history
  • Loading branch information
bkpoon committed Sep 3, 2020
1 parent 9b1d324 commit 4363cde
Show file tree
Hide file tree
Showing 15 changed files with 577 additions and 511 deletions.
74 changes: 38 additions & 36 deletions boost_adaptbx/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ env_etc.boost_include = env_etc.boost_dist
build_boost_libs = True
# Boost source does not exist, headers and libraries exist
# boost directory in cctbx_project is picked up by find_in_repositories
if not os.path.isdir(env_etc.boost_dist) or 'cctbx_project' in env_etc.boost_dist:
if not os.path.isdir(env_etc.boost_dist) or 'cctbx_project' in env_etc.boost_dist \
or env_etc.boost_dist == sys.prefix or libtbx.env.module_is_installed("boost_adaptbx"):
# for conda, standard locations are already defined in libtbx/SConscript
if libtbx.env.build_options.use_conda:
env_etc.boost_dist = env_etc.conda_prefix
Expand Down Expand Up @@ -198,42 +199,43 @@ e.g. with "yum install python-dev" or "apt-get install python-dev".
env['BUILDERS']['SharedObject'].add_emitter(suffix,
gcc_style_pch_emitter)

env_pure_boost_python_ext.SharedLibrary(
target="#lib/boost_python_hybrid_times_ext",
source="hybrid_times_ext.cpp")
if not libtbx.env.module_is_installed("boost_adaptbx"):
env_pure_boost_python_ext.SharedLibrary(
target="#lib/boost_python_hybrid_times_ext",
source="hybrid_times_ext.cpp")

env_pure_boost_python_ext.SharedLibrary(
target="#lib/boost_rational_ext",
source="rational_ext.cpp")
env_pure_boost_python_ext.SharedLibrary(
target="#lib/boost_rational_ext",
source="rational_ext.cpp")

env = env_pure_boost_python_ext.Clone()
env_etc.include_registry.prepend(
env=env,
paths=[env_etc.boost_adaptbx_include])
env.SharedLibrary(
target="#lib/boost_python_meta_ext",
source="meta_ext.cpp")
env.SharedLibrary(
target="#lib/boost_optional_ext",
source="optional_ext.cpp")
env.SharedLibrary(
target="#lib/std_pair_ext",
source="std_pair_ext.cpp")
env.SharedLibrary(
target="#lib/boost_tuple_ext",
source="tuple_ext.cpp")
env.SharedLibrary(
target="#lib/boost_adaptbx_python_streambuf_test_ext",
source="tests/python_streambuf_test_ext.cpp")
SConscript("graph/SConscript")

env = env_base.Clone()
env_etc.include_registry.prepend(
env=env,
paths=[env_etc.boost_adaptbx_include])
env.Program(
target="tests/tst_optional_copy",
source="tests/tst_optional_copy.cpp")
env = env_pure_boost_python_ext.Clone()
env_etc.include_registry.prepend(
env=env,
paths=[env_etc.boost_adaptbx_include])
env.SharedLibrary(
target="#lib/boost_python_meta_ext",
source="meta_ext.cpp")
env.SharedLibrary(
target="#lib/boost_optional_ext",
source="optional_ext.cpp")
env.SharedLibrary(
target="#lib/std_pair_ext",
source="std_pair_ext.cpp")
env.SharedLibrary(
target="#lib/boost_tuple_ext",
source="tuple_ext.cpp")
env.SharedLibrary(
target="#lib/boost_adaptbx_python_streambuf_test_ext",
source="tests/python_streambuf_test_ext.cpp")
SConscript("graph/SConscript")

env = env_base.Clone()
env_etc.include_registry.prepend(
env=env,
paths=[env_etc.boost_adaptbx_include])
env.Program(
target="tests/tst_optional_copy",
source="tests/tst_optional_copy.cpp")

if build_boost_libs:
# Build Boost.filesystem
Expand Down Expand Up @@ -364,7 +366,7 @@ e.g. with "yum install python-dev" or "apt-get install python-dev".
# This also constitutes a nice real-life example of
# how to build such extensions.
if (libtbx.env.build_options.enable_boost_threads and
env_etc.boost_thread_support):
env_etc.boost_thread_support and not libtbx.env.module_is_installed("boost_adaptbx")):
env_boost_threads_test = env_pure_boost_python_ext.Clone()
env_etc.include_registry.append(
env=env_boost_threads_test,
Expand Down
245 changes: 123 additions & 122 deletions cctbx/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,135 +13,136 @@ env_etc.cctbx_common_includes = [
env_etc.boost_include,
]

env = env_base.Clone(
SHLINKFLAGS=env_etc.shlinkflags
)
env_etc.include_registry.append(
env=env,
paths=env_etc.cctbx_common_includes)
envlm = env.Clone(
LIBS=env_etc.libm
)
if not libtbx.env.module_is_installed("cctbx"):
env = env_base.Clone(
SHLINKFLAGS=env_etc.shlinkflags
)
env_etc.include_registry.append(
env=env,
paths=env_etc.cctbx_common_includes)
envlm = env.Clone(
LIBS=env_etc.libm
)

lib_cctbx_sources = [
"eltbx/basic.cpp",
"eltbx/xray_scattering/it1992.cpp",
"eltbx/xray_scattering/wk1995.cpp",
"eltbx/xray_scattering/n_gaussian_raw.cpp",
"eltbx/xray_scattering/n_gaussian.cpp",
"eltbx/fp_fdp.cpp",
"eltbx/henke.cpp",
"eltbx/henke_tables_01_12.cpp",
"eltbx/henke_tables_13_24.cpp",
"eltbx/henke_tables_25_36.cpp",
"eltbx/henke_tables_37_48.cpp",
"eltbx/henke_tables_49_60.cpp",
"eltbx/henke_tables_61_72.cpp",
"eltbx/henke_tables_73_84.cpp",
"eltbx/henke_tables_85_92.cpp",
"eltbx/icsd_radii.cpp",
"eltbx/covalent_radii.cpp",
"eltbx/neutron.cpp",
"eltbx/sasaki.cpp",
"eltbx/sasaki_tables_01_12.cpp",
"eltbx/sasaki_tables_13_24.cpp",
"eltbx/sasaki_tables_25_36.cpp",
"eltbx/sasaki_tables_37_48.cpp",
"eltbx/sasaki_tables_49_60.cpp",
"eltbx/sasaki_tables_61_72.cpp",
"eltbx/sasaki_tables_73_82.cpp",
"eltbx/tiny_pse.cpp",
"eltbx/wavelengths.cpp",
"eltbx/electron_scattering/peng1996.cpp",
"eltbx/attenuation_coefficient.cpp",
lib_cctbx_sources = [
"eltbx/basic.cpp",
"eltbx/xray_scattering/it1992.cpp",
"eltbx/xray_scattering/wk1995.cpp",
"eltbx/xray_scattering/n_gaussian_raw.cpp",
"eltbx/xray_scattering/n_gaussian.cpp",
"eltbx/fp_fdp.cpp",
"eltbx/henke.cpp",
"eltbx/henke_tables_01_12.cpp",
"eltbx/henke_tables_13_24.cpp",
"eltbx/henke_tables_25_36.cpp",
"eltbx/henke_tables_37_48.cpp",
"eltbx/henke_tables_49_60.cpp",
"eltbx/henke_tables_61_72.cpp",
"eltbx/henke_tables_73_84.cpp",
"eltbx/henke_tables_85_92.cpp",
"eltbx/icsd_radii.cpp",
"eltbx/covalent_radii.cpp",
"eltbx/neutron.cpp",
"eltbx/sasaki.cpp",
"eltbx/sasaki_tables_01_12.cpp",
"eltbx/sasaki_tables_13_24.cpp",
"eltbx/sasaki_tables_25_36.cpp",
"eltbx/sasaki_tables_37_48.cpp",
"eltbx/sasaki_tables_49_60.cpp",
"eltbx/sasaki_tables_61_72.cpp",
"eltbx/sasaki_tables_73_82.cpp",
"eltbx/tiny_pse.cpp",
"eltbx/wavelengths.cpp",
"eltbx/electron_scattering/peng1996.cpp",
"eltbx/attenuation_coefficient.cpp",

"miller/asu.cpp",
"miller/bins.cpp",
"miller/index_generator.cpp",
"miller/index_span.cpp",
"miller/match_bijvoet_mates.cpp",
"miller/match_indices.cpp",
"miller/match_multi_indices.cpp",
"miller/sym_equiv.cpp",
"miller/asu.cpp",
"miller/bins.cpp",
"miller/index_generator.cpp",
"miller/index_span.cpp",
"miller/match_bijvoet_mates.cpp",
"miller/match_indices.cpp",
"miller/match_multi_indices.cpp",
"miller/sym_equiv.cpp",

"sgtbx/bricks.cpp",
"sgtbx/change_of_basis_op.cpp",
"sgtbx/find_affine.cpp",
"sgtbx/group_codes.cpp",
"sgtbx/hall_in.cpp",
"sgtbx/lattice_tr.cpp",
"sgtbx/lattice_symmetry.cpp",
"sgtbx/miller.cpp",
"sgtbx/reciprocal_space_asu.cpp",
"sgtbx/reciprocal_space_ref_asu.cpp",
"sgtbx/rot_mx.cpp",
"sgtbx/rot_mx_info.cpp",
"sgtbx/row_echelon_solve.cpp",
"sgtbx/rt_mx.cpp",
"sgtbx/select_generators.cpp",
"sgtbx/seminvariant.cpp",
"sgtbx/site_symmetry.cpp",
"sgtbx/space_group.cpp",
"sgtbx/space_group_type.cpp",
"sgtbx/symbols.cpp",
"sgtbx/tensor_rank_2.cpp",
"sgtbx/tr_group.cpp",
"sgtbx/tr_vec.cpp",
"sgtbx/utils.cpp",
"sgtbx/wyckoff.cpp",
"sgtbx/reference_settings/hall_symbol_table.cpp",
"sgtbx/reference_settings/matrix_group_code_table.cpp",
"sgtbx/reference_settings/normalizer.cpp",
"sgtbx/reference_settings/wyckoff.cpp",
"sgtbx/bricks.cpp",
"sgtbx/change_of_basis_op.cpp",
"sgtbx/find_affine.cpp",
"sgtbx/group_codes.cpp",
"sgtbx/hall_in.cpp",
"sgtbx/lattice_tr.cpp",
"sgtbx/lattice_symmetry.cpp",
"sgtbx/miller.cpp",
"sgtbx/reciprocal_space_asu.cpp",
"sgtbx/reciprocal_space_ref_asu.cpp",
"sgtbx/rot_mx.cpp",
"sgtbx/rot_mx_info.cpp",
"sgtbx/row_echelon_solve.cpp",
"sgtbx/rt_mx.cpp",
"sgtbx/select_generators.cpp",
"sgtbx/seminvariant.cpp",
"sgtbx/site_symmetry.cpp",
"sgtbx/space_group.cpp",
"sgtbx/space_group_type.cpp",
"sgtbx/symbols.cpp",
"sgtbx/tensor_rank_2.cpp",
"sgtbx/tr_group.cpp",
"sgtbx/tr_vec.cpp",
"sgtbx/utils.cpp",
"sgtbx/wyckoff.cpp",
"sgtbx/reference_settings/hall_symbol_table.cpp",
"sgtbx/reference_settings/matrix_group_code_table.cpp",
"sgtbx/reference_settings/normalizer.cpp",
"sgtbx/reference_settings/wyckoff.cpp",

"uctbx/uctbx.cpp",
"uctbx/spoil_optimization.cpp",
"uctbx/crystal_orientation.cpp",
]
"uctbx/uctbx.cpp",
"uctbx/spoil_optimization.cpp",
"uctbx/crystal_orientation.cpp",
]

if (env_etc.static_libraries): builder = envlm.StaticLibrary
else: builder = envlm.SharedLibrary
builder(
target="#lib/cctbx",
source=lib_cctbx_sources)
if (env_etc.static_libraries): builder = envlm.StaticLibrary
else: builder = envlm.SharedLibrary
builder(
target="#lib/cctbx",
source=lib_cctbx_sources)

SConscript("examples/SConscript")
SConscript("examples/SConscript")

if (not env_etc.no_boost_python):
Import("env_no_includes_boost_python_ext")
if (not env_etc.no_boost_python):
Import("env_no_includes_boost_python_ext")

env_cctbx_boost_python_ext = env_no_includes_boost_python_ext.Clone()
env_cctbx_boost_python_ext.Prepend(LIBS=["scitbx_boost_python"])
env_etc.include_registry.append(
env=env_cctbx_boost_python_ext,
paths=env_etc.cctbx_common_includes + [env_etc.python_include])
Export("env_cctbx_boost_python_ext")
env_cctbx_boost_python_ext = env_no_includes_boost_python_ext.Clone()
env_cctbx_boost_python_ext.Prepend(LIBS=["scitbx_boost_python"])
env_etc.include_registry.append(
env=env_cctbx_boost_python_ext,
paths=env_etc.cctbx_common_includes + [env_etc.python_include])
Export("env_cctbx_boost_python_ext")

SConscript("math/boost_python/SConscript")
SConscript("array_family/boost_python/SConscript")
SConscript("eltbx/boost_python/SConscript")
SConscript("uctbx/boost_python/SConscript")
SConscript("sgtbx/boost_python/SConscript")
SConscript("adptbx/boost_python/SConscript")
SConscript("miller/boost_python/SConscript")
SConscript("xray/boost_python/SConscript")
SConscript("maptbx/boost_python/SConscript")
SConscript("masks/boost_python/SConscript")
SConscript("translation_search/boost_python/SConscript")
SConscript("dmtbx/boost_python/SConscript")
SConscript("boost_python/SConscript")
SConscript("crystal/SConscript")
SConscript("geometry_restraints/SConscript")
SConscript("geometry/boost_python/SConscript")
SConscript("covariance/boost_python/SConscript")
SConscript("adp_restraints/SConscript")
SConscript("symmetry_search/boost_python/SConscript")
SConscript("xray/observations/boost_python/SConscript")
SConscript("merging/SConscript")
SConscript("multipolar/SConscript")
SConscript("uctbx/determine_unit_cell/SConscript")
SConscript("examples/merging/SConscript")
SConscript("math/boost_python/SConscript")
SConscript("array_family/boost_python/SConscript")
SConscript("eltbx/boost_python/SConscript")
SConscript("uctbx/boost_python/SConscript")
SConscript("sgtbx/boost_python/SConscript")
SConscript("adptbx/boost_python/SConscript")
SConscript("miller/boost_python/SConscript")
SConscript("xray/boost_python/SConscript")
SConscript("maptbx/boost_python/SConscript")
SConscript("masks/boost_python/SConscript")
SConscript("translation_search/boost_python/SConscript")
SConscript("dmtbx/boost_python/SConscript")
SConscript("boost_python/SConscript")
SConscript("crystal/SConscript")
SConscript("geometry_restraints/SConscript")
SConscript("geometry/boost_python/SConscript")
SConscript("covariance/boost_python/SConscript")
SConscript("adp_restraints/SConscript")
SConscript("symmetry_search/boost_python/SConscript")
SConscript("xray/observations/boost_python/SConscript")
SConscript("merging/SConscript")
SConscript("multipolar/SConscript")
SConscript("uctbx/determine_unit_cell/SConscript")
SConscript("examples/merging/SConscript")

SConscript("sgtbx/direct_space_asu/proto/SConscript")
SConscript("math/SConscript")
SConscript("maptbx/SConscript")
SConscript("sgtbx/direct_space_asu/proto/SConscript")
SConscript("math/SConscript")
SConscript("maptbx/SConscript")
15 changes: 8 additions & 7 deletions chiltbx/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ env_etc.chiltbx_common_includes = [
env_etc.chiltbx_include,
]

env = env_base.Clone()
env_etc.include_registry.append(
env=env,
paths=env_etc.chiltbx_common_includes)
env.Program(target="handle_test", source="handle_test.cpp")
#env.Program(target="grammar/test", source="grammar/test.cpp")
#env.Program(target="chil/test", source="chil/test.cpp")
if not libtbx.env.module_is_installed("chiltbx"):
env = env_base.Clone()
env_etc.include_registry.append(
env=env,
paths=env_etc.chiltbx_common_includes)
env.Program(target="handle_test", source="handle_test.cpp")
#env.Program(target="grammar/test", source="grammar/test.cpp")
#env.Program(target="chil/test", source="chil/test.cpp")
11 changes: 6 additions & 5 deletions cma_es/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ if (not env_etc.no_boost_python):
env=env_bpl,
paths=[env_etc.cma_es_include])

env_bpl.SharedLibrary(
target = "#lib/cma_es_ext",
source = ['cma_es_ext.cpp',
'cma/cmaes.cpp',
])
if not libtbx.env.module_is_installed("cma_es"):
env_bpl.SharedLibrary(
target = "#lib/cma_es_ext",
source = ['cma_es_ext.cpp',
'cma/cmaes.cpp',
])
Loading

0 comments on commit 4363cde

Please sign in to comment.