diff --git a/BUILD_OPTIONS.md b/BUILD_OPTIONS.md index 88fe52e6fb..6fc62a5b64 100644 --- a/BUILD_OPTIONS.md +++ b/BUILD_OPTIONS.md @@ -51,18 +51,18 @@ For a more complete list of cmake variables, take a look in the file `CMakeCache -DEIGEN3_INCLUDE_DIR=your/path/to/eigen -# Set the Python executable: PYTHON_EXECUTABLE +# Set the Python executable: Python3_EXECUTABLE # If working from a virtual environment, cmake will automatically set this as # the executable in the environment's directory. It may, however, have trouble # finding the system Python library and include directory of the same version, so -# setting PYTHON_LIBRARY and PYTHON_INCLUDE_DIR manually is encouraged. --DPYTHON_EXECUTABLE=/usr/bin/python3 +# setting Python3_LIBRARY and Python3_INCLUDE_DIR manually is encouraged. +-DPython3_EXECUTABLE=/usr/bin/python3 -# Set the Python include directory: PYTHON_INCLUDE_DIR --DPYTHON_INCLUDE_DIR=/usr/include/python3.7m +# Set the Python include directory: Python3_INCLUDE_DIR +-DPython3_INCLUDE_DIR=/usr/include/python3.10 -# Set the Python library: PYTHON_LIBRARY --DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so +# Set the Python library: Python3_LIBRARY +-DPython3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.10.so # Switch HepMC on/off: WITH_HEPMC (On|Off) diff --git a/README_OSX.md b/README_OSX.md index 6a860649cd..1c092b3dcd 100644 --- a/README_OSX.md +++ b/README_OSX.md @@ -71,7 +71,7 @@ Configure GAMBIT. Key optional extras: `-D WITH_MPI=ON` if you want scanners to be parallelised `-D WITH_HEPMC=ON` if you want HepMC enabled ``` -cmake -D PYTHON_EXECUTABLE=/usr/bin/python3 -D PYTHON_LIBRARY=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/Current/Python3 -D PYTHON_INCLUDE_DIR=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Headers .. +cmake -D Python3_EXECUTABLE=/usr/bin/python3 -D Python3_LIBRARY=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/Current/Python3 -D Python3_INCLUDE_DIR=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Headers .. ``` Now, see the instructions in the main README.md for possible make targets, and BUILD_OPTIONS.md for other cmake options. diff --git a/ScannerBit/python/CMakeLists.txt b/ScannerBit/python/CMakeLists.txt index fd7839e1f7..5d73829db6 100644 --- a/ScannerBit/python/CMakeLists.txt +++ b/ScannerBit/python/CMakeLists.txt @@ -20,7 +20,7 @@ if(Python3_Interpreter_FOUND) ################## ScannerBit_python_interface ################## set(scan_module_libraries - #${PYTHON_LIBRARIES} + #${Python3_LIBRARIES} yaml-cpp ${OpenMP_omp_LIBRARY} ) diff --git a/ScannerBit/python/cmake/scannerbit_python_interface_utils.cmake b/ScannerBit/python/cmake/scannerbit_python_interface_utils.cmake index 087c27b5b4..43b0384987 100644 --- a/ScannerBit/python/cmake/scannerbit_python_interface_utils.cmake +++ b/ScannerBit/python/cmake/scannerbit_python_interface_utils.cmake @@ -40,7 +40,7 @@ function(add_gambit_deps obj_name) target_link_libraries(${obj_name} ${Mathematica_WSTP_LIBRARIES}) endif() #if(pybind11_FOUND) - # target_link_libraries(${obj_name} ${PYTHON_LIBRARIES}) + # target_link_libraries(${obj_name} ${Python3_LIBRARIES}) #endif() if(SQLITE3_FOUND) target_link_libraries(${obj_name} ${SQLITE3_LIBRARIES}) diff --git a/ScannerBit/scripts/scanner+_harvester.py b/ScannerBit/scripts/scanner+_harvester.py index 753411897b..418498ab4d 100644 --- a/ScannerBit/scripts/scanner+_harvester.py +++ b/ScannerBit/scripts/scanner+_harvester.py @@ -459,7 +459,7 @@ def main(argv): inc_commands += [incdir] scanbit_reqs[plugin[7]][plugin_name][version][5] += [incdir] inc_files += [[inc, incdir]] - elif inc == "ROOT" or inc == "GSL" or inc == "pybind11" or inc == "Python" or inc == "PYTHONLIBS": + elif inc == "ROOT" or inc == "GSL" or inc == "pybind11" or inc == "Python3": auto_incs += [inc] #scanbit_reqs[plugin[7]][plugin_name][version][5] += [inc] if scanbit_reqs[plugin[7]][plugin_name][version][2] == "": @@ -840,7 +840,7 @@ def main(argv): temp = set(inc for inc in scanbit_auto_incs[plug_type[i]][directory]) for inc in temp: - if inc == "ROOT" or inc == "Python": + if inc == "ROOT" or inc == "Python3": towrite += """ if ({2}_FOUND) set ({0}_plugin_includes_{1} @@ -867,19 +867,6 @@ def main(argv): set ({0}_ok_flag_{1} \"${{{0}_ok_flag_{1}}} \\n - file missing: \\\"{2}\\\"\") endif() """.format(plug_type[i], directory, inc, "PYBIND11") - elif inc == "PYTHONLIBS": - towrite += """ -if ({2}_FOUND) - set ({0}_plugin_includes_{1} - ${{{0}_plugin_includes_{1}}} - ${{{3}_INCLUDE_DIRS}} - ) - set ({0}_plugin_found_incs_{1} \"${{{0}_plugin_found_incs_{1}}} \\\"{2}\\\": ${{{3}_INCLUDE_DIRS}}\\n\") -else() - message(\"-- Did not find {0} header {2}. Disabling scanners that depend on this.\") - set ({0}_ok_flag_{1} \"${{{0}_ok_flag_{1}}} \\n - file missing: \\\"{2}\\\"\") -endif() -""".format(plug_type[i], directory, inc, "PYTHON") else: towrite += """ unset({0}_{1}_{3}_INCLUDE_PATH CACHE) diff --git a/ScannerBit/src/objectives/python/python.cpp b/ScannerBit/src/objectives/python/python.cpp index 076859af9a..72abe457cb 100644 --- a/ScannerBit/src/objectives/python/python.cpp +++ b/ScannerBit/src/objectives/python/python.cpp @@ -65,7 +65,7 @@ namespace Gambit objective_plugin(python, version(1, 0, 0)) { - reqd_headers("PYTHONLIBS"); + reqd_headers("Python3"); reqd_headers("pybind11"); Gambit::Utils::python_interpreter_guard g; diff --git a/ScannerBit/src/scanners/python/python.cpp b/ScannerBit/src/scanners/python/python.cpp index 31c9341596..a875ca7456 100644 --- a/ScannerBit/src/scanners/python/python.cpp +++ b/ScannerBit/src/scanners/python/python.cpp @@ -76,7 +76,7 @@ namespace Gambit scanner_plugin(python, version(1, 0, 0)) { - reqd_headers("PYTHONLIBS"); + reqd_headers("Python3"); reqd_headers("pybind11"); Gambit::Utils::python_interpreter_guard g; diff --git a/gum/gum b/gum/gum index 2feb508ace..4dba04268c 100755 --- a/gum/gum +++ b/gum/gum @@ -23,7 +23,7 @@ if [ -f ${cmake_variables_file} ] then # Extract location of python executable - python_exec=`awk -F\" '/^PYTHON_EXECUTABLE/{print $2}' ${cmake_variables_file}` + python_exec=`awk -F\" '/^Python3_EXECUTABLE/{print $2}' ${cmake_variables_file}` # If the variable does not appear on the cmake_variable file, something went wrong if [ -z ${python_exec} ] diff --git a/gum/src/cmake_variables.py.in b/gum/src/cmake_variables.py.in index 5feceee26d..9141a5f2fc 100644 --- a/gum/src/cmake_variables.py.in +++ b/gum/src/cmake_variables.py.in @@ -20,7 +20,7 @@ GUM_DIR = "@GUM_DIR@" # Python executable -PYTHON_EXECUTABLE = "@PYTHON_EXECUTABLE@" +Python3_EXECUTABLE = "@Python3_EXECUTABLE@" # Pythia version (No longer a constant) # base_pythia_version = "@BASE_PYTHIA_VERSION@" diff --git a/gum/src/pythia.py b/gum/src/pythia.py index 2d8cec166c..170427b7b7 100644 --- a/gum/src/pythia.py +++ b/gum/src/pythia.py @@ -407,7 +407,7 @@ def write_pythia_cmake_entry(model, output_dir, base_pythia_version): " BUILD_IN_SOURCE 1\n"\ " PATCH_COMMAND patch -p1 < ${model_specific_patch}\n"\ " COMMAND patch -p1 < ${patch}\n"\ - " COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Backends/patches/${name}/${ver}/patch_${name}.py\n"\ + " COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Backends/patches/${name}/${ver}/patch_${name}.py\n"\ " CONFIGURE_COMMAND ./configure ${EXTRA_CONFIG} --enable-shared --cxx=\"${CMAKE_CXX_COMPILER}\" --cxx-common=\"${pythia_CXXFLAGS}\" --cxx-shared=\"${pythia_CXX_SHARED_FLAGS}\" --cxx-soname=\"${pythia_CXX_SONAME_FLAGS}\" --lib-suffix=\".so\"\n"\ " BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} CXX=\"${CMAKE_CXX_COMPILER}\" lib/${lib}.so\n"\ " INSTALL_COMMAND \"\"\n"\