Sorry, I fell asleep mid-compile. Really will get to it tonight. If you’d rather get working again and don’t mind applying changes yourself, here’s the diff.
diff --git a/cmake/ConfigBoost.cmake b/cmake/ConfigBoost.cmake
index 9d2f55d..103fd95 100644
--- a/cmake/ConfigBoost.cmake
+++ b/cmake/ConfigBoost.cmake
@@ -11,7 +11,7 @@ list(APPEND needed_components filesystem python regex serialization system timer
if(ENABLE_MPI)
list(APPEND needed_components mpi)
endif()
-set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_STATIC_LIBS OFF) #ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
if(ENABLE_UNIT_TESTS)
diff --git a/src/bin/psi4/CMakeLists.txt b/src/bin/psi4/CMakeLists.txt
index be916c3..5a69f6f 100644
--- a/src/bin/psi4/CMakeLists.txt
+++ b/src/bin/psi4/CMakeLists.txt
@@ -5,10 +5,16 @@ add_custom_target(update_version
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h.tmp
COMMENT "Generating Git info")
-add_library(versioned_code OBJECT version.cc python.cc psi_start.cc)
+add_library(versioned_code OBJECT version.cc python.cc psi_start.cc psi4.cc)
add_dependencies(versioned_code update_version)
add_dependencies(versioned_code mints)
+# Versioned code, but for standalone psi4.so (convenient to add psi4.cc to versioned list)
+add_library(versioned_code_so OBJECT EXCLUDE_FROM_ALL version.cc python.cc psi_start.cc psi4.cc)
+set_property(TARGET versioned_code_so PROPERTY COMPILE_DEFINITIONS MAKE_PYTHON_MODULE)
+add_dependencies(versioned_code_so update_version)
+add_dependencies(versioned_code_so mints)
+
set(headers_list "")
# List of headers
list(APPEND headers_list script.h psi4.h)
@@ -24,8 +30,8 @@ list(SORT headers_list)
set(sources_list "")
# List of sources
-list(APPEND sources_list export_psio.cc export_mints.cc psi_stop.cc export_functional.cc export_oeprop.cc export_plugins.cc export_blas_lapack.cc psi4.cc expor
-list(APPEND sources_list $<TARGET_OBJECTS:versioned_code>)
+list(APPEND sources_list export_psio.cc export_mints.cc psi_stop.cc export_functional.cc export_oeprop.cc export_plugins.cc export_blas_lapack.cc export_cubefi
+#list(APPEND sources_list $<TARGET_OBJECTS:versioned_code>)
# If you want to remove some sources specify them explictly here
if(DEVELOPMENT_CODE)
@@ -34,6 +40,10 @@ else()
list(REMOVE_ITEM sources_list "")
endif()
+# Compile sources_list into an object library
+add_library(psi4_objlib OBJECT ${sources_list})
+add_dependencies(psi4_objlib versioned_code)
+
get_property(from_src_bin GLOBAL PROPERTY PSILIB)
get_property(from_src_lib GLOBAL PROPERTY LIBLIST)
@@ -51,7 +61,8 @@ list(APPEND
)
# Executable psi4
-add_executable(psi4 ${sources_list})
+#add_executable(psi4 ${sources_list})
+add_executable(psi4 $<TARGET_OBJECTS:psi4_objlib> $<TARGET_OBJECTS:versioned_code>)
add_dependencies(psi4 update_version)
if(CUSTOM_BOOST_BUILD)
add_dependencies(psi4 custom_boost)
@@ -65,11 +76,22 @@ if(ENABLE_PCMSOLVER)
endif()
# standalone python module psi4.so
-add_executable(psi4so EXCLUDE_FROM_ALL ${sources_list})
+#add_executable(psi4so EXCLUDE_FROM_ALL ${sources_list})
+add_executable(psi4so EXCLUDE_FROM_ALL $<TARGET_OBJECTS:psi4_objlib> $<TARGET_OBJECTS:versioned_code_so>)
+#add_library(psi4so SHARED EXCLUDE_FROM_ALL $<TARGET_OBJECTS:psi4_objlib> $<TARGET_OBJECTS:versioned_code_so>)
if(CUSTOM_BOOST_BUILD)
add_dependencies(psi4so custom_boost)
endif()
-set_property(TARGET psi4so PROPERTY COMPILE_DEFINITIONS MAKE_PYTHON_MODULE)
+#set_property(TARGET psi4so PROPERTY COMPILE_DEFINITIONS MAKE_PYTHON_MODULE)
set_property(TARGET psi4so PROPERTY LINK_FLAGS "-shared")
set_property(TARGET psi4so PROPERTY OUTPUT_NAME "psi4${CMAKE_EXECUTABLE_SUFFIX}.so")
target_link_libraries(psi4so "${LINKLIBS}")
+
+if(ENABLE_CHEMPS2)
+ target_link_libraries(psi4so CHEMPS2::CHEMPS2)
+endif()
+if(ENABLE_PCMSOLVER)
+ target_link_libraries(psi4so PCMSolver::PCMSolver)
+endif()
+#INSTALL(TARGETS psi4so LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+INSTALL(TARGETS psi4so RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
diff --git a/src/bin/psi4/psi_start.cc b/src/bin/psi4/psi_start.cc
index f75f06b..cca01f8 100644
--- a/src/bin/psi4/psi_start.cc
+++ b/src/bin/psi4/psi_start.cc
@@ -172,9 +172,9 @@ int psi_start(int argc, char *argv[])
fprefix = optarg;
break;
- case 'r': // -r or --restart
- restart_id = optarg;
- break;
+// case 'r': // -r or --restart
+// restart_id = optarg;
+// break;
case 'v': // -v or --verbose
verbose = true;
@@ -239,8 +239,8 @@ int psi_start(int argc, char *argv[])
ofname = Process::environment("PSI_OUTPUT");
if (fprefix.empty() && Process::environment("PSI_PREFIX").size())
fprefix = Process::environment("PSI_PREFIX");
- if (restart_id.empty() && Process::environment("PSI_RESTART").size())
- restart_id = Process::environment("PSI_RESTART");
+// if (restart_id.empty() && Process::environment("PSI_RESTART").size())
+// restart_id = Process::environment("PSI_RESTART");
/* if some arguments still not defined - assign default values */
if (ifname.empty()) ifname = "input.dat";
@@ -287,18 +287,15 @@ int psi_start(int argc, char *argv[])
return(PSI_RETURN_FAILURE);
}
}
-#endif
-
-#if defined(MAKE_PYTHON_MODULE)
- outfile = boost::shared_ptr<PsiOutStream>(new PsiOutStream());
+ if(ofname == "stdout"){
+ outfile=boost::shared_ptr<PsiOutStream>(new PsiOutStream());
+ }
+ else{
+ outfile=boost::shared_ptr<PsiOutStream>
+ (new OutFile(ofname,(append?APPEND:TRUNCATE)));
+ }
#else
- if(ofname == "stdout"){
- outfile=boost::shared_ptr<PsiOutStream>(new PsiOutStream());
- }
- else{
- outfile=boost::shared_ptr<PsiOutStream>
- (new OutFile(ofname,(append?APPEND:TRUNCATE)));
- }
+ outfile = boost::shared_ptr<PsiOutStream>(new PsiOutStream());
#endif
//if(debug)
diff --git a/src/bin/psi4/python.cc b/src/bin/psi4/python.cc
index a4afc33..cd1d979 100644
--- a/src/bin/psi4/python.cc
+++ b/src/bin/psi4/python.cc
@@ -922,7 +922,7 @@ void py_psi_revoke_local_option_changed(std::string const& module, std::string c
data.dechanged();
}
-object py_psi_get_local_option(std::string const& module, std::string const& key)
+boost::python::object py_psi_get_local_option(std::string const& module, std::string const& key)
{
string nonconst_key = key;
Process::environment.options.set_current_module(module);
@@ -930,35 +930,35 @@ object py_psi_get_local_option(std::string const& module, std::string const& key
Data& data = Process::environment.options.get_local(nonconst_key);
if (data.type() == "string" || data.type() == "istring")
- return str(data.to_string());
+ return boost::python::str(data.to_string());
else if (data.type() == "boolean" || data.type() == "int")
- return object(data.to_integer());
+ return boost::python::object(data.to_integer());
else if (data.type() == "double")
- return object(data.to_double());
+ return boost::python::object(data.to_double());
else if (data.type() == "array")
- return object(data.to_list());
+ return boost::python::object(data.to_list());
return object();
}
-object py_psi_get_global_option(std::string const& key)
+boost::python::object py_psi_get_global_option(std::string const& key)
{
string nonconst_key = key;
Data& data = Process::environment.options.get_global(nonconst_key);
if (data.type() == "string" || data.type() == "istring")
- return str(data.to_string());
+ return boost::python::str(data.to_string());
else if (data.type() == "boolean" || data.type() == "int")
- return object(data.to_integer());
+ return boost::python::object(data.to_integer());
else if (data.type() == "double")
- return object(data.to_double());
+ return boost::python::object(data.to_double());
else if (data.type() == "array")
- return object(data.to_list());
+ return boost::python::object(data.to_list());
return object();
}
-object py_psi_get_option(std::string const& module, std::string const& key)
+boost::python::object py_psi_get_option(std::string const& module, std::string const& key)
{
string nonconst_key = key;
Process::environment.options.set_current_module(module);
@@ -966,13 +966,13 @@ object py_psi_get_option(std::string const& module, std::string const& key)
Data& data = Process::environment.options.use_local(nonconst_key);
if (data.type() == "string" || data.type() == "istring")
- return str(data.to_string());
+ return boost::python::str(data.to_string());
else if (data.type() == "boolean" || data.type() == "int")
- return object(data.to_integer());
+ return boost::python::object(data.to_integer());
else if (data.type() == "double")
- return object(data.to_double());
+ return boost::python::object(data.to_double());
else if (data.type() == "array")
- return object(data.to_list());
+ return boost::python::object(data.to_list());
return object();
}
@@ -1268,7 +1268,7 @@ BOOST_PYTHON_MODULE (psi4)
new LibParallel::ParallelEnvironment(0, 0));
// Setup the environment
- Process::arguments.initialize(0, 0);
+ //Process::arguments.initialize(0, 0);
Process::environment.initialize(); // Defaults to obtaining the environment from the global environ variable
// There is only one timer: