From ae43bec5eb9c4aacea5986d3e52ef45fc0dfb934 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 09:26:55 +0200 Subject: [PATCH 01/79] Use modern CMake --- src/CMakeLists.txt | 3 +-- src/search/CMakeLists.txt | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b28cf83733..e361c854f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,8 +27,7 @@ # -DCMAKE_BUILD_TYPE=type # to the cmake call. -# Version 2.8.3 introduces CMakeParseArguments. -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.16) # Select a default compiler because CMake does not respect the PATH environment variable for some generators, # e.g. used by existing compute servers in Basel. diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 79579c2480..bb2c897a49 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -1,6 +1,4 @@ -cmake_minimum_required(VERSION 2.8.3) -# For Windows we require CMake 3.12, but this is currently not -# available for Ubuntu 18.04. +cmake_minimum_required(VERSION 3.16) if(NOT FAST_DOWNWARD_MAIN_CMAKELISTS_READ) message( From 04c92e15db9bfaf1192700fbc84a6798a06c5837 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 26 Jul 2023 11:52:51 +0200 Subject: [PATCH 02/79] Update Apple compiler ID string. --- src/cmake_modules/FastDownwardMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 3e5f4bfe35..ba7e843e7e 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -14,7 +14,7 @@ macro(fast_downward_set_compiler_flags) # Note: on CMake >= 3.0 the compiler ID of Apple-provided clang is AppleClang. # If we change the required CMake version from 2.8.3 to 3.0 or greater, # we have to fix this. - if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") check_and_set_compiler_flag( "-std=c++20" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") From 0ecab3ed5dd6e09c8af3edaef628022a3845cc5a Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 26 Jul 2023 12:01:08 +0200 Subject: [PATCH 03/79] Allow non-Apple clang again. --- src/cmake_modules/FastDownwardMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index ba7e843e7e..d69396551d 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -14,7 +14,7 @@ macro(fast_downward_set_compiler_flags) # Note: on CMake >= 3.0 the compiler ID of Apple-provided clang is AppleClang. # If we change the required CMake version from 2.8.3 to 3.0 or greater, # we have to fix this. - if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") check_and_set_compiler_flag( "-std=c++20" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") From aa2b3169d6123df5a8780addab40188e21d875b8 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 19:46:53 +0200 Subject: [PATCH 04/79] Remove profile build, simplify build.py --- build.py | 74 +++++++--------------- src/CMakeLists.txt | 15 ++--- src/cmake_modules/FastDownwardMacros.cmake | 15 +---- 3 files changed, 28 insertions(+), 76 deletions(-) diff --git a/build.py b/build.py index a94ad21ec3..e0be5ed6d8 100755 --- a/build.py +++ b/build.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import errno -import multiprocessing import os import subprocess import sys @@ -12,24 +11,9 @@ if not config.startswith("_")} DEFAULT_CONFIG_NAME = CONFIGS.pop("DEFAULT") DEBUG_CONFIG_NAME = CONFIGS.pop("DEBUG") - CMAKE = "cmake" -DEFAULT_MAKE_PARAMETERS = [] -if os.name == "posix": - MAKE = "make" - try: - num_cpus = multiprocessing.cpu_count() - except NotImplementedError: - pass - else: - DEFAULT_MAKE_PARAMETERS.append('-j{}'.format(num_cpus)) - CMAKE_GENERATOR = "Unix Makefiles" -elif os.name == "nt": - MAKE = "nmake" - CMAKE_GENERATOR = "NMake Makefiles" -else: - print("Unsupported OS: " + os.name) - sys.exit(1) +# Number of usable CPUs (see https://docs.python.org/3/library/os.html) +NUM_CPUS = len(os.sched_getaffinity(0)) def print_usage(): @@ -43,18 +27,14 @@ def print_usage(): configs.append(name + "\n " + " ".join(args)) configs_string = "\n ".join(configs) cmake_name = os.path.basename(CMAKE) - make_name = os.path.basename(MAKE) - generator_name = CMAKE_GENERATOR.lower() default_config_name = DEFAULT_CONFIG_NAME debug_config_name = DEBUG_CONFIG_NAME - print("""Usage: {script_name} [BUILD [BUILD ...]] [--all] [--debug] [MAKE_OPTIONS] + print(f"""Usage: {script_name} [BUILD [BUILD ...]] [--all] [--debug] [MAKE_OPTIONS] Build one or more predefined build configurations of Fast Downward. Each build -uses {cmake_name} to generate {generator_name} and then uses {make_name} to compile the -code. Build configurations differ in the parameters they pass to {cmake_name}. -By default, the build uses N threads on a machine with N cores if the number of -cores can be determined. Use the "-j" option for {cmake_name} to override this default -behaviour. +uses {cmake_name} compile the code. Build configurations differ in the +parameters they pass to {cmake_name}. By default, the build uses all available cores. +Use the "-j" option for {cmake_name} to override this default behaviour. Build configurations {configs_string} @@ -64,7 +44,7 @@ def print_usage(): --help Print this message and exit. Make options - All other parameters are forwarded to {make_name}. + All other parameters are forwarded to the build step. Example usage: ./{script_name} # build {default_config_name} in #cores threads @@ -73,7 +53,7 @@ def print_usage(): ./{script_name} --debug # build {debug_config_name} ./{script_name} release debug # build release and debug configs ./{script_name} --all VERBOSE=true # build all build configs with detailed logs -""".format(**locals())) +""") def get_project_root_path(): @@ -92,41 +72,31 @@ def get_src_path(): def get_build_path(config_name): return os.path.join(get_builds_path(), config_name) -def try_run(cmd, cwd): - print('Executing command "{}" in directory "{}".'.format(" ".join(cmd), cwd)) +def try_run(cmd): + print(f'Executing command "{" ".join(cmd)}"') try: - subprocess.check_call(cmd, cwd=cwd) + subprocess.check_call(cmd) except OSError as exc: if exc.errno == errno.ENOENT: - print("Could not find '%s' on your PATH. For installation instructions, " - "see https://www.fast-downward.org/ObtainingAndRunningFastDownward." % - cmd[0]) + print(f"Could not find '{cmd[0]}' on your PATH. For installation instructions, " + "see https://www.fast-downward.org/ObtainingAndRunningFastDownward.") sys.exit(1) else: raise -def build(config_name, cmake_parameters, make_parameters): - print("Building configuration {config_name}.".format(**locals())) - build_path = get_build_path(config_name) - rel_src_path = os.path.relpath(get_src_path(), build_path) - try: - os.makedirs(build_path) - except OSError as exc: - if exc.errno == errno.EEXIST and os.path.isdir(build_path): - pass - else: - raise +def build(config_name, configure_parameters, build_parameters): + print(f"Building configuration {config_name}.") - try_run([CMAKE, "-G", CMAKE_GENERATOR] + cmake_parameters + [rel_src_path], - cwd=build_path) - try_run([MAKE] + make_parameters, cwd=build_path) + build_path = get_build_path(config_name) + try_run([CMAKE, "-S", get_src_path(), "-B", build_path] + configure_parameters) + try_run([CMAKE, "--build", build_path, "-j", f"{NUM_CPUS}", "--"] + build_parameters) - print("Built configuration {config_name} successfully.".format(**locals())) + print(f"Built configuration {config_name} successfully.") def main(): config_names = [] - make_parameters = DEFAULT_MAKE_PARAMETERS + build_parameters = [] for arg in sys.argv[1:]: if arg == "--help" or arg == "-h": print_usage() @@ -138,11 +108,11 @@ def main(): elif arg in CONFIGS: config_names.append(arg) else: - make_parameters.append(arg) + build_parameters.append(arg) if not config_names: config_names.append(DEFAULT_CONFIG_NAME) for config_name in config_names: - build(config_name, CONFIGS[config_name], make_parameters) + build(config_name, CONFIGS[config_name], build_parameters) if __name__ == "__main__": diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e361c854f3..a363225fd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,23 +1,19 @@ # Usage: -# mkdir -p builds/release -# cd builds/release -# cmake path/to/src -# make [-j4] -# The call to cmake caches settings in the build directory and reads +# cmake -S src -B builds/release +# cmake --build builds/release +# The first call caches settings in the build directory and reads # them from the cache on subsequent builds. If you want to change the -# settings of some options, do _not_ change the CMakeLIsts.txt files. +# settings of some options, do _not_ change the CMakeLists.txt files. # Instead, create a new build directory, pass -DMY_OPTION=my_value to # cmake. Alternatively, you can use a cmake GUI like ccmake to edit # the cache. # -# Three build targets are defined: +# Two build targets are defined: # # * release (default) # -O3 optimisation, debugging symbols, assertions inactive # * debug # -O3 optimisation, full debugging information, assertions active -# * profile -# like Debug but with profile information linked in # # In all build targets, we overwrite the default configuration to # include "-g", allow cross compilation and switch to pedantic error @@ -45,7 +41,6 @@ fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. # This means that cmake has to be called twice for multi-config generators like Visual Studio. fast_downward_set_configuration_types() -fast_downward_add_profile_build() set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index d69396551d..4e693ee781 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -34,7 +34,6 @@ macro(fast_downward_set_compiler_flags) if(USE_GLIBCXX_DEBUG) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") endif() - set(CMAKE_CXX_FLAGS_PROFILE "-O3 -pg") elseif(MSVC) check_and_set_compiler_flag( "/std:c++20" ) @@ -67,18 +66,6 @@ macro(fast_downward_set_linker_flags) endif() endmacro() -macro(fast_downward_add_profile_build) - # We don't offer a dedicated PROFILE build on Windows. - if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - if(NOT CMAKE_CONFIGURATION_TYPES) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY HELPSTRING "Choose the type of build") - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;Profile") - endif() - set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_CXX_FLAGS_DEBUG}) - set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -pg") - endif() -endmacro() - macro(fast_downward_default_to_release_build) # Only for single-config generators (like Makefiles) that choose the build type at generation time. if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) @@ -91,7 +78,7 @@ macro(fast_downward_set_configuration_types) # Only for multi-config generators (like Visual Studio Projects) that choose # the build type at build time. if(CMAKE_CONFIGURATION_TYPES) - set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Profile" + set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Reset the configurations to what we need" FORCE) endif() endmacro() From 2b696230dce637eafb1c2ab8b006011d9dd73a6d Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 20:32:06 +0200 Subject: [PATCH 05/79] Fix counting of CPUs --- build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index e0be5ed6d8..13a7987da5 100755 --- a/build.py +++ b/build.py @@ -12,9 +12,12 @@ DEFAULT_CONFIG_NAME = CONFIGS.pop("DEFAULT") DEBUG_CONFIG_NAME = CONFIGS.pop("DEBUG") CMAKE = "cmake" -# Number of usable CPUs (see https://docs.python.org/3/library/os.html) -NUM_CPUS = len(os.sched_getaffinity(0)) - +try: + # Number of usable CPUs (Unix only) + NUM_CPUS = len(os.sched_getaffinity(0)) +except AttributeError: + # Number of available CPUs as a fall-back (may be None) + NUM_CPUS = os.cpu_count() or 1 def print_usage(): script_name = os.path.basename(__file__) From dadb7f194694ca17f0a0d8cfb9b9d68412605fdf Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 21:31:48 +0200 Subject: [PATCH 06/79] Fix CMake generators --- build.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 13a7987da5..b4afd76c60 100755 --- a/build.py +++ b/build.py @@ -12,12 +12,17 @@ DEFAULT_CONFIG_NAME = CONFIGS.pop("DEFAULT") DEBUG_CONFIG_NAME = CONFIGS.pop("DEBUG") CMAKE = "cmake" +CMAKE_GENERATOR = None +if os.name == "posix": + CMAKE_GENERATOR = "Unix Makefiles" +elif os.name == "nt": + CMAKE_GENERATOR = "NMake Makefiles" try: # Number of usable CPUs (Unix only) NUM_CPUS = len(os.sched_getaffinity(0)) except AttributeError: # Number of available CPUs as a fall-back (may be None) - NUM_CPUS = os.cpu_count() or 1 + NUM_CPUS = os.cpu_count() def print_usage(): script_name = os.path.basename(__file__) @@ -91,8 +96,18 @@ def build(config_name, configure_parameters, build_parameters): print(f"Building configuration {config_name}.") build_path = get_build_path(config_name) - try_run([CMAKE, "-S", get_src_path(), "-B", build_path] + configure_parameters) - try_run([CMAKE, "--build", build_path, "-j", f"{NUM_CPUS}", "--"] + build_parameters) + generator_cmd = [CMAKE, "-S", get_src_path(), "-B", build_path] + if CMAKE_GENERATOR: + generator_cmd += ["-G", CMAKE_GENERATOR] + generator_cmd += configure_parameters + try_run(generator_cmd) + + build_cmd = [CMAKE, "--build", build_path] + if NUM_CPUS: + build_cmd += ["-j", f"{NUM_CPUS}"] + if build_parameters: + build_cmd += ["--"] + build_parameters + try_run(build_cmd) print(f"Built configuration {config_name} successfully.") From 5534719179cf7f6a8130f3ca83ea228eef3fad45 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 22:26:50 +0200 Subject: [PATCH 07/79] More modern way of setting compiler requirements --- src/cmake_modules/FastDownwardMacros.cmake | 17 ----------------- src/search/CMakeLists.txt | 10 +++++++--- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 4e693ee781..b34390169d 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -1,22 +1,7 @@ include(CMakeParseArguments) -macro(check_and_set_compiler_flag FLAG) - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag( "${FLAG}" FLAG_FOUND ) - if(NOT FLAG_FOUND) - message(FATAL_ERROR "${CMAKE_CXX_COMPILER} does not support ${FLAG}") - endif() - message("Flag '${FLAG}' set for '${CMAKE_CXX_COMPILER}'") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") -endmacro() - macro(fast_downward_set_compiler_flags) - # Note: on CMake >= 3.0 the compiler ID of Apple-provided clang is AppleClang. - # If we change the required CMake version from 2.8.3 to 3.0 or greater, - # we have to fix this. if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") - check_and_set_compiler_flag( "-std=c++20" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Wfloat-conversion -Wmissing-declarations -Wzero-as-null-pointer-constant") @@ -35,8 +20,6 @@ macro(fast_downward_set_compiler_flags) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") endif() elseif(MSVC) - check_and_set_compiler_flag( "/std:c++20" ) - # Enable exceptions. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index bb2c897a49..1e6ed44c1d 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -13,11 +13,13 @@ endif() project(downward) -# TODO: use multi-line strings to break up the long string when we switch to CMake 3. -# https://stackoverflow.com/questions/7637539/how-to-split-strings-across-multiple-lines-in-cmake option( USE_GLIBCXX_DEBUG - "Enable the libstdc++ debug mode that does additional safety checks. (On Linux systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks come at a significant performance cost and should only be enabled in debug mode. Enabling them makes the binary incompatible with libraries that are not compiled with this flag, which can lead to hard-to-debug errors." + "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ +systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks \ +come at a significant performance cost and should only be enabled in debug mode. \ +Enabling them makes the binary incompatible with libraries that are not compiled \ +with this flag, which can lead to hard-to-debug errors." FALSE) fast_downward_set_compiler_flags() @@ -27,6 +29,8 @@ fast_downward_set_linker_flags() include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") add_executable(downward ${PLANNER_SOURCES}) +target_compile_features(downward PUBLIC cxx_std_20) + ## == Libraries == # On Linux, find the rt library for clock_gettime(). From edc879641d723f9a93119ad988fd3d500761949b Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 26 Jul 2023 22:59:15 +0200 Subject: [PATCH 08/79] Use versions in Cplex find script --- src/cmake_modules/FindCplex.cmake | 91 +++++++++++++++---------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index 0eafe7ff41..32848d7124 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -41,6 +41,23 @@ find_path(CPLEX_INCLUDE_DIRS include/ilcplex ) +if(CPLEX_INCLUDE_DIRS) + # Parse CPLEX version. + file(STRINGS ${CPLEX_INCLUDE_DIRS}/cpxconst.h CPLEX_VERSION_STR + REGEX "#define[ ]+CPX_VERSION[ ]+[0-9]+") + string(REGEX MATCH "[0-9]+" CPLEX_VERSION_STR ${CPLEX_VERSION_STR}) + if(CPLEX_VERSION_STR) + math(EXPR CPLEX_VERSION_MAJOR "${CPLEX_VERSION_STR} / 1000000") + math(EXPR CPLEX_VERSION_MINOR "${CPLEX_VERSION_STR} / 10000 % 100") + math(EXPR CPLEX_VERSION_SUBMINOR "${CPLEX_VERSION_STR} / 100 % 100") + set(CPLEX_VERSION + "${CPLEX_VERSION_MAJOR}.${CPLEX_VERSION_MINOR}.${CPLEX_VERSION_SUBMINOR}") + set(CPLEX_VERSION_NO_DOTS + "${CPLEX_VERSION_MAJOR}${CPLEX_VERSION_MINOR}${CPLEX_VERSION_SUBMINOR}") + endif() +endif() + + if(APPLE) set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32 "lib/x86_osx/static_pic") @@ -108,14 +125,10 @@ endif() # CMake uses the first discovered library, searching in the order they # are mentioned here. We prefer dynamic libraries over static ones -# (see issue925) and otherwise prefer the latest available version. +# (see issue925). find_library(CPLEX_LIBRARY_RELEASE NAMES - cplex2211 - cplex1290 - cplex1280 - cplex1271 - cplex1262 + cplex${CPLEX_VERSION_NO_DOTS} cplex HINTS ${CPLEX_HINT_PATHS_RELEASE} @@ -126,11 +139,7 @@ find_library(CPLEX_LIBRARY_RELEASE # See above. find_library(CPLEX_LIBRARY_DEBUG NAMES - cplex2211 - cplex1290 - cplex1280 - cplex1271 - cplex1262 + cplex${CPLEX_VERSION_NO_DOTS} cplex HINTS ${CPLEX_HINT_PATHS_DEBUG} @@ -138,46 +147,32 @@ find_library(CPLEX_LIBRARY_DEBUG ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG} ) -if(CPLEX_INCLUDE_DIRS) - # Parse CPLEX version. - file(STRINGS ${CPLEX_INCLUDE_DIRS}/cpxconst.h CPLEX_VERSION_STR - REGEX "#define[ ]+CPX_VERSION[ ]+[0-9]+") - string(REGEX MATCH "[0-9]+" CPLEX_VERSION_STR ${CPLEX_VERSION_STR}) - if(CPLEX_VERSION_STR) - math(EXPR CPLEX_VERSION_MAJOR "${CPLEX_VERSION_STR} / 1000000") - math(EXPR CPLEX_VERSION_MINOR "${CPLEX_VERSION_STR} / 10000 % 100") - math(EXPR CPLEX_VERSION_SUBMINOR "${CPLEX_VERSION_STR} / 100 % 100") - set(CPLEX_VERSION - "${CPLEX_VERSION_MAJOR}.${CPLEX_VERSION_MINOR}.${CPLEX_VERSION_SUBMINOR}") - endif() - - if(CPLEX_LIBRARY_RELEASE OR CPLEX_LIBRARY_DEBUG) - find_package(Threads REQUIRED) - - set(CPLEX_LIBRARIES_COMMON ${CMAKE_THREAD_LIBS_INIT}) - if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) - set(CPLEX_LIBRARIES_COMMON ${CPLEX_LIBRARIES_COMMON} ${CMAKE_DL_LIBS}) - endif() +if(CPLEX_LIBRARY_RELEASE OR CPLEX_LIBRARY_DEBUG) + find_package(Threads REQUIRED) - set(CPLEX_LIBRARIES - optimized ${CPLEX_LIBRARY_RELEASE} ${CPLEX_LIBRARIES_COMMON} - debug ${CPLEX_LIBRARY_DEBUG} ${CPLEX_LIBRARIES_COMMON} - ) + set(CPLEX_LIBRARIES_COMMON ${CMAKE_THREAD_LIBS_INIT}) + if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) + set(CPLEX_LIBRARIES_COMMON ${CPLEX_LIBRARIES_COMMON} ${CMAKE_DL_LIBS}) endif() - # HACK: there must be a better way to find the dll file. - find_path(CPLEX_RUNTIME_LIBRARY_PATH - NAMES - cplex2211.dll - HINTS - ${CPLEX_HINT_PATHS_RELEASE} - ${CPLEX_HINT_PATHS_DEBUG} - PATH_SUFFIXES - ${CPLEX_RUNTIME_LIBRARY_HINT} + set(CPLEX_LIBRARIES + optimized ${CPLEX_LIBRARY_RELEASE} ${CPLEX_LIBRARIES_COMMON} + debug ${CPLEX_LIBRARY_DEBUG} ${CPLEX_LIBRARIES_COMMON} ) - if(CPLEX_RUNTIME_LIBRARY_PATH) - set(CPLEX_RUNTIME_LIBRARY "${CPLEX_RUNTIME_LIBRARY_PATH}/cplex2211.dll") - endif() +endif() + +# HACK: there must be a better way to find the dll file. +find_path(CPLEX_RUNTIME_LIBRARY_PATH + NAMES + cplex${CPLEX_VERSION_NO_DOTS}.dll + HINTS + ${CPLEX_HINT_PATHS_RELEASE} + ${CPLEX_HINT_PATHS_DEBUG} + PATH_SUFFIXES + ${CPLEX_RUNTIME_LIBRARY_HINT} +) +if(CPLEX_RUNTIME_LIBRARY_PATH) + set(CPLEX_RUNTIME_LIBRARY "${CPLEX_RUNTIME_LIBRARY_PATH}/cplex${CPLEX_VERSION_NO_DOTS}.dll") endif() # Check if everything was found and set CPLEX_FOUND. @@ -194,5 +189,5 @@ mark_as_advanced( CPLEX_LIBRARY_PATH_SUFFIX_RELEASE CPLEX_LIBRARY_PATH_SUFFIX_DEBUG CPLEX_LIBRARY_RELEASE CPLEX_LIBRARY_DEBUG CPLEX_RUNTIME_LIBRARY_PATH CPX_VERSION CPLEX_VERSION_MAJOR CPLEX_VERSION_MINOR CPLEX_VERSION_STR - CPLEX_VERSION_SUBMINOR + CPLEX_VERSION_SUBMINOR CPLEX_VERSION_NO_DOTS ) From 4f149c4f1133bf62a6077b829d3535645b1adb24 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Thu, 27 Jul 2023 18:50:08 +0200 Subject: [PATCH 09/79] Replace 'set(CMAKE_*' calls. --- src/CMakeLists.txt | 14 ++-- src/cmake_modules/FastDownwardMacros.cmake | 80 +++++++++++++--------- src/search/CMakeLists.txt | 17 +++-- 3 files changed, 66 insertions(+), 45 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a363225fd0..366c5147ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,10 +32,15 @@ find_program(CMAKE_C_COMPILER NAMES $ENV{CC} cc gcc PATHS ENV PATH NO_DEFAULT_PA find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ PATHS ENV PATH NO_DEFAULT_PATH) # Path containing custom CMake modules -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) +# TODO: I could not find anything other than modifying the CMAKE_* variable directly, +# but appending to the list sounds at least better than just setting the variable +# https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html#variable:CMAKE_MODULE_PATH +# says the variable is intended to be set by the project, so I guess this is the intended way? +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) +#TODO: is there a better place for this call? +define_interface_library() -fast_downward_default_to_release_build() project(fast-downward) fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. @@ -44,8 +49,6 @@ fast_downward_set_configuration_types() set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) - # Write compiler ID and version to the cache to allow retrieving this information # with "cmake -LA" (see test-memory-leaks.py). set(DOWNWARD_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID} CACHE STRING "") @@ -56,10 +59,11 @@ mark_as_advanced(DOWNWARD_CXX_COMPILER_ID DOWNWARD_CXX_COMPILER_VERSION) # Copy the translator into the output directory. add_custom_target(translate ALL) +get_target_property(bin_dir fd_interface_library RUNTIME_OUTPUT_DIRECTORY) add_custom_command(TARGET translate POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/translate - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/translate + ${bin_dir}/${CMAKE_CFG_INTDIR}/translate COMMENT "Copying translator module into output directory") add_subdirectory(search) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index b34390169d..ded1cafd3b 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -1,38 +1,51 @@ include(CMakeParseArguments) -macro(fast_downward_set_compiler_flags) - if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Wfloat-conversion -Wmissing-declarations -Wzero-as-null-pointer-constant") - if (CMAKE_COMPILER_IS_GNUCXX +macro(define_interface_library) + add_library(fd_interface_library INTERFACE) + target_compile_features(fd_interface_library INTERFACE cxx_std_20) + # TODO: rework. The idea was that downward inherits this property, but it doesn't + # Instead, maybe an "install" command would be sensible? + set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + + # TODO: check if these are the correct names + set(gcc_cxx "$") + set(clang_cxx "$") + set(msvc_cxx "$") + + if(gcc_cxx OR clang_cxx) + target_compile_options(fd_interface_library INTERFACE "-g") + target_compile_options(fd_interface_library INTERFACE "-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant") + + if (gcc_cxx AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-restrict") + target_compile_options(fd_interface_library INTERFACE "-Wno-restrict") endif() ## Configuration-specific flags - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fomit-frame-pointer") - set(CMAKE_CXX_FLAGS_DEBUG "-O3") + target_compile_options(fd_interface_library INTERFACE "$<$:-O3;-DNDEBUG;-fomit-frame-pointer>") + target_compile_options(fd_interface_library INTERFACE "$<$:-O3>") if(USE_GLIBCXX_DEBUG) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") + target_compile_options(fd_interface_library INTERFACE "$<$:-D_GLIBCXX_DEBUG>") endif() - elseif(MSVC) + elseif(msvc_cxx) # Enable exceptions. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") + target_compile_options(fd_interface_library INTERFACE "/EHsc") # Use warning level 4 (/W4). # /Wall currently detects too many warnings outside of our code to be useful. - string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + target_compile_options(fd_interface_library INTERFACE "/W4") + # TODO: before, we replaced W3 with W4. Do we still need to do that? # Disable warnings that currently trigger in the code until we fix them. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4456") # declaration hides previous local declaration - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4458") # declaration hides class member - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4459") # declaration hides global declaration - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") # conversion with possible loss of data - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") # conversion from size_t to int with possible loss of data + target_compile_options(fd_interface_library INTERFACE "/wd4456") # declaration hides previous local declaration + target_compile_options(fd_interface_library INTERFACE "/wd4458") # declaration hides class member + target_compile_options(fd_interface_library INTERFACE "/wd4459") # declaration hides global declaration + target_compile_options(fd_interface_library INTERFACE "/wd4244") # conversion with possible loss of data + target_compile_options(fd_interface_library INTERFACE "/wd4267") # conversion from size_t to int with possible loss of data # TODO: Configuration-specific flags. We currently rely on the fact that # CMAKE_CXX_FLAGS_RELEASE and CMAKE_CXX_FLAGS_DEBUG get reasonable settings @@ -43,20 +56,25 @@ macro(fast_downward_set_compiler_flags) endif() endmacro() -macro(fast_downward_set_linker_flags) - if(UNIX) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g") - endif() -endmacro() - -macro(fast_downward_default_to_release_build) - # Only for single-config generators (like Makefiles) that choose the build type at generation time. - if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - message(STATUS "Defaulting to release build.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE) - endif() -endmacro() - +# TODO: I'm not sure if we need this anymore? I could not find a corresponding +# "modern" command and it compiled without it +#~ macro(fast_downward_set_linker_flags) + #~ if(UNIX) + #~ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g") + #~ endif() +#~ endmacro() + +# TODO: It seems this is not needed anymore? When I call build, it never enters +# the if block... +#~ macro(fast_downward_default_to_release_build) + #~ # Only for single-config generators (like Makefiles) that choose the build type at generation time. + #~ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + #~ message(STATUS "Defaulting to release build.") + #~ set(default_build_type "Release") + #~ endif() +#~ endmacro() + +# TODO: I cannot find out how to replace this set(CMAKE_* ...) call macro(fast_downward_set_configuration_types) # Only for multi-config generators (like Visual Studio Projects) that choose # the build type at build time. diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 1e6ed44c1d..ec0053c9c3 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -22,20 +22,19 @@ Enabling them makes the binary incompatible with libraries that are not compiled with this flag, which can lead to hard-to-debug errors." FALSE) -fast_downward_set_compiler_flags() -fast_downward_set_linker_flags() - # Collect source files needed for the active plugins. include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") add_executable(downward ${PLANNER_SOURCES}) -target_compile_features(downward PUBLIC cxx_std_20) +target_link_libraries(downward PUBLIC fd_interface_library) +get_target_property(bin_dir fd_interface_library RUNTIME_OUTPUT_DIRECTORY) +set_target_properties(downward PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bin_dir}) ## == Libraries == # On Linux, find the rt library for clock_gettime(). if(UNIX AND NOT APPLE) - target_link_libraries(downward rt) + target_link_libraries(downward PRIVATE rt) endif() # On Windows, find the psapi library for determining peak memory. @@ -61,7 +60,7 @@ if(PLUGIN_LP_SOLVER_ENABLED AND USE_LP) if(CPLEX_FOUND) add_definitions("-D HAS_CPLEX") include_directories(${CPLEX_INCLUDE_DIRS}) - target_link_libraries(downward ${CPLEX_LIBRARIES}) + target_link_libraries(downward PRIVATE ${CPLEX_LIBRARIES}) if(CPLEX_RUNTIME_LIBRARY) add_custom_command(TARGET downward POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy @@ -75,15 +74,15 @@ if(PLUGIN_LP_SOLVER_ENABLED AND USE_LP) if (SOPLEX_FOUND) add_definitions("-D HAS_SOPLEX") include_directories(${SOPLEX_INCLUDE_DIRS}) - target_link_libraries(downward ${SOPLEX_LIBRARIES}) + target_link_libraries(downward PRIVATE ${SOPLEX_LIBRARIES}) find_package(ZLIB REQUIRED) if(ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) - target_link_libraries(downward ${ZLIB_LIBRARIES}) + target_link_libraries(downward PRIVATE ${ZLIB_LIBRARIES}) endif() find_library(GMP_LIBRARY gmp REQUIRED) if(GMP_LIBRARY) - target_link_libraries(downward ${GMP_LIBRARY}) + target_link_libraries(downward PRIVATE ${GMP_LIBRARY}) endif() endif() From 7cbd2140d5e2afe90422612966f03badbc5c0b95 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Thu, 27 Jul 2023 18:54:17 +0200 Subject: [PATCH 10/79] AdBugfix: add PRIVATE keyword to target_link_libraries call --- src/search/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ec0053c9c3..3cd33a662a 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -40,7 +40,7 @@ endif() # On Windows, find the psapi library for determining peak memory. if(WIN32) cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward psapi) + target_link_libraries(downward PRIVATE psapi) endif() # If any enabled plugin requires an LP solver, compile with all From e1e098aaf1001c42df61e01b1d5788efcc229a48 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 00:44:12 +0200 Subject: [PATCH 11/79] define plugins as interface libraries --- src/CMakeLists.txt | 4 +- src/cmake_modules/FastDownwardMacros.cmake | 81 ++++++---------------- src/search/CMakeLists.txt | 40 +++++------ src/search/DownwardFiles.cmake | 13 ---- 4 files changed, 42 insertions(+), 96 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 366c5147ed..43eac8a015 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,10 +38,10 @@ find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ PATHS ENV PATH NO_DEFAUL # says the variable is intended to be set by the project, so I guess this is the intended way? list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) -#TODO: is there a better place for this call? -define_interface_library() project(fast-downward) +#TODO: is there a better place for this call? +define_interface_library() fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. # This means that cmake has to be called twice for multi-config generators like Visual Studio. diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index ded1cafd3b..544034f249 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -8,10 +8,9 @@ macro(define_interface_library) # Instead, maybe an "install" command would be sensible? set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) - # TODO: check if these are the correct names - set(gcc_cxx "$") - set(clang_cxx "$") - set(msvc_cxx "$") + set(gcc_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "Gnu")) + set(clang_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) + set(msvc_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")) if(gcc_cxx OR clang_cxx) target_compile_options(fd_interface_library INTERFACE "-g") @@ -125,67 +124,27 @@ function(fast_downward_plugin) if(NOT _PLUGIN_SOURCES) message(FATAL_ERROR "fast_downward_plugin: 'SOURCES' argument required.") endif() + fast_downward_add_existing_sources_to_list(_PLUGIN_SOURCES) - # Check optional arguments. - if(NOT _PLUGIN_DISPLAY_NAME) - string(TOLOWER ${_PLUGIN_NAME} _PLUGIN_DISPLAY_NAME) - endif() - if(NOT _PLUGIN_HELP) - set(_PLUGIN_HELP ${_PLUGIN_DISPLAY_NAME}) - endif() - # Decide whether the plugin should be enabled by default. - if (DISABLE_PLUGINS_BY_DEFAULT) - set(_OPTION_DEFAULT FALSE) - else() - set(_OPTION_DEFAULT TRUE) - endif() - # Overwrite default value for core plugins and dependecy-only plugins. - if (_PLUGIN_CORE_PLUGIN) - set(_OPTION_DEFAULT TRUE) - elseif(_PLUGIN_DEPENDENCY_ONLY) - set(_OPTION_DEFAULT FALSE) - endif() - option(PLUGIN_${_PLUGIN_NAME}_ENABLED ${_PLUGIN_HELP} ${_OPTION_DEFAULT}) - if(_PLUGIN_DEPENDENCY_ONLY OR _PLUGIN_CORE_PLUGIN) - mark_as_advanced(PLUGIN_${_PLUGIN_NAME}_ENABLED) + if (NOT _PLUGIN_CORE_PLUGIN AND NOT _PLUGIN_DEPENDENCY_ONLY) + # Decide whether the plugin should be enabled by default. + if (DISABLE_PLUGINS_BY_DEFAULT) + set(_OPTION_DEFAULT FALSE) + else() + set(_OPTION_DEFAULT TRUE) + endif() + option(PLUGIN_${_PLUGIN_NAME}_ENABLED ${_PLUGIN_HELP} ${_OPTION_DEFAULT}) endif() - set(PLUGIN_${_PLUGIN_NAME}_DISPLAY_NAME ${_PLUGIN_DISPLAY_NAME} PARENT_SCOPE) - set(PLUGIN_${_PLUGIN_NAME}_SOURCES ${_PLUGIN_SOURCES} PARENT_SCOPE) - set(PLUGIN_${_PLUGIN_NAME}_DEPENDS ${_PLUGIN_DEPENDS} PARENT_SCOPE) - list(APPEND PLUGINS ${_PLUGIN_NAME}) - set(PLUGINS ${PLUGINS} PARENT_SCOPE) -endfunction() - -function(fast_downward_add_plugin_sources _SOURCES_LIST_VAR) - set(_UNCHECKED_PLUGINS) - foreach(PLUGIN ${PLUGINS}) - if(PLUGIN_${PLUGIN}_ENABLED) - list(APPEND _UNCHECKED_PLUGINS ${PLUGIN}) - endif() + add_library(downward_${_PLUGIN_NAME} INTERFACE) + target_sources(downward_${_PLUGIN_NAME} INTERFACE ${_PLUGIN_SOURCES}) + foreach(DEPENDENCY ${_PLUGIN_DEPENDS}) + target_link_libraries(downward_${_PLUGIN_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() + set_target_properties(downward_${_PLUGIN_NAME} PROPERTIES LINKER_LANGUAGE CXX) - while(_UNCHECKED_PLUGINS) - list(GET _UNCHECKED_PLUGINS 0 PLUGIN) - list(REMOVE_AT _UNCHECKED_PLUGINS 0) - foreach(DEPENDENCY ${PLUGIN_${PLUGIN}_DEPENDS}) - if (NOT PLUGIN_${DEPENDENCY}_ENABLED) - message(STATUS "Enabling plugin ${PLUGIN_${DEPENDENCY}_DISPLAY_NAME} " - "because plugin ${PLUGIN_${PLUGIN}_DISPLAY_NAME} is enabled and depends on it.") - set(PLUGIN_${DEPENDENCY}_ENABLED TRUE) - set(PLUGIN_${DEPENDENCY}_ENABLED TRUE PARENT_SCOPE) - list(APPEND _UNCHECKED_PLUGINS ${DEPENDENCY}) - endif() - endforeach() - endwhile() - - foreach(PLUGIN ${PLUGINS}) - if(PLUGIN_${PLUGIN}_ENABLED) - message(STATUS "Using plugin: ${PLUGIN_${PLUGIN}_DISPLAY_NAME}") - source_group(${PLUGIN_${PLUGIN}_DISPLAY_NAME} FILES ${PLUGIN_${PLUGIN}_SOURCES}) - list(APPEND ${_SOURCES_LIST_VAR} "${PLUGIN_${PLUGIN}_SOURCES}") - endif() - endforeach() - set(${_SOURCES_LIST_VAR} ${${_SOURCES_LIST_VAR}} PARENT_SCOPE) + if (_PLUGIN_CORE_PLUGIN OR PLUGIN_${_PLUGIN_NAME}_ENABLED) + target_link_libraries(downward PUBLIC downward_${_PLUGIN_NAME}) + endif() endfunction() diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 3cd33a662a..a1444d3ede 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -11,7 +11,7 @@ endif() ## == Project == -project(downward) +project(downward LANGUAGES CXX) option( USE_GLIBCXX_DEBUG @@ -22,9 +22,9 @@ Enabling them makes the binary incompatible with libraries that are not compiled with this flag, which can lead to hard-to-debug errors." FALSE) -# Collect source files needed for the active plugins. +add_executable(downward planner.cc) + include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") -add_executable(downward ${PLANNER_SOURCES}) target_link_libraries(downward PUBLIC fd_interface_library) get_target_property(bin_dir fd_interface_library RUNTIME_OUTPUT_DIRECTORY) @@ -53,37 +53,37 @@ option( "Compile with support for all LP solvers installed on this system." TRUE) -if(PLUGIN_LP_SOLVER_ENABLED AND USE_LP) - add_definitions("-D USE_LP") - +if(USE_LP) find_package(Cplex) if(CPLEX_FOUND) - add_definitions("-D HAS_CPLEX") - include_directories(${CPLEX_INCLUDE_DIRS}) - target_link_libraries(downward PRIVATE ${CPLEX_LIBRARIES}) + add_library(downward_cplex_interface INTERFACE) + target_compile_definitions(downward_cplex_interface INTERFACE HAS_CPLEX) + target_include_directories(downward_cplex_interface INTERFACE ${CPLEX_INCLUDE_DIRS}) + target_link_libraries(downward_cplex_interface INTERFACE ${CPLEX_LIBRARIES}) if(CPLEX_RUNTIME_LIBRARY) - add_custom_command(TARGET downward POST_BUILD + add_custom_command(TARGET downward_cplex_interface POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_RUNTIME_LIBRARY} $ ) endif() + target_sources(downward_cplex_interface INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) + target_link_libraries(downward_LP_SOLVER INTERFACE downward_cplex_interface) endif() find_package(SoPlex) if (SOPLEX_FOUND) - add_definitions("-D HAS_SOPLEX") - include_directories(${SOPLEX_INCLUDE_DIRS}) - target_link_libraries(downward PRIVATE ${SOPLEX_LIBRARIES}) + add_library(downward_soplex_interface INTERFACE) + target_compile_definitions(downward_soplex_interface INTERFACE HAS_SOPLEX) + target_include_directories(downward_soplex_interface INTERFACE ${SOPLEX_INCLUDE_DIRS}) + target_link_libraries(downward_soplex_interface INTERFACE ${SOPLEX_LIBRARIES}) find_package(ZLIB REQUIRED) - if(ZLIB_FOUND) - include_directories(${ZLIB_INCLUDE_DIRS}) - target_link_libraries(downward PRIVATE ${ZLIB_LIBRARIES}) - endif() + target_include_directories(downward_soplex_interface INTERFACE ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(downward_soplex_interface INTERFACE ${ZLIB_LIBRARIES}) find_library(GMP_LIBRARY gmp REQUIRED) - if(GMP_LIBRARY) - target_link_libraries(downward PRIVATE ${GMP_LIBRARY}) - endif() + target_link_libraries(downward_soplex_interface INTERFACE ${GMP_LIBRARY}) + target_sources(downward_soplex_interface INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) + target_link_libraries(downward_LP_SOLVER INTERFACE downward_soplex_interface) endif() if(CPLEX_FOUND OR SOPLEX_FOUND) diff --git a/src/search/DownwardFiles.cmake b/src/search/DownwardFiles.cmake index 4f154cf58e..eb07fa6ada 100644 --- a/src/search/DownwardFiles.cmake +++ b/src/search/DownwardFiles.cmake @@ -476,11 +476,9 @@ fast_downward_plugin( NAME LP_SOLVER HELP "Interface to an LP solver" SOURCES - lp/cplex_solver_interface lp/lp_internals lp/lp_solver lp/solver_interface - lp/soplex_solver_interface DEPENDS NAMED_VECTOR DEPENDENCY_ONLY ) @@ -809,14 +807,3 @@ fast_downward_plugin( algorithms/sccs DEPENDENCY_ONLY ) - -fast_downward_add_plugin_sources(PLANNER_SOURCES) - -# The order in PLANNER_SOURCES influences the order in which object -# files are given to the linker, which can have a significant influence -# on performance (see issue67). The general recommendation seems to be -# to list files that define functions after files that use them. -# We approximate this by reversing the list, which will put the plugins -# first, followed by the core files, followed by the main file. -# This is certainly not optimal, but works well enough in practice. -list(REVERSE PLANNER_SOURCES) From 90bace835dc998bf50e3ca543d0249b9e2fb8ea5 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 06:59:53 +0200 Subject: [PATCH 12/79] add debug output --- src/cmake_modules/FastDownwardMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 544034f249..b8a80c0e6b 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -12,6 +12,8 @@ macro(define_interface_library) set(clang_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) set(msvc_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")) + message(WARNING "Compiler ID is ${CMAKE_CXX_COMPILER_ID}") + if(gcc_cxx OR clang_cxx) target_compile_options(fd_interface_library INTERFACE "-g") target_compile_options(fd_interface_library INTERFACE "-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant") @@ -21,6 +23,7 @@ macro(define_interface_library) AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 + message(WARNING "Adding flag -Wno-restrict") target_compile_options(fd_interface_library INTERFACE "-Wno-restrict") endif() From f16bd72dd37bbd641e890a79c5a5902c966e9ff3 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 08:30:13 +0200 Subject: [PATCH 13/79] restructure warnings and compiler-dependent code --- src/cmake_modules/FastDownwardMacros.cmake | 84 +++++++++++----------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index b8a80c0e6b..79e87349cc 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -1,60 +1,64 @@ include(CMakeParseArguments) -macro(define_interface_library) - add_library(fd_interface_library INTERFACE) - target_compile_features(fd_interface_library INTERFACE cxx_std_20) - # TODO: rework. The idea was that downward inherits this property, but it doesn't - # Instead, maybe an "install" command would be sensible? - set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + add_library(fd_warnings INTERFACE) - set(gcc_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "Gnu")) - set(clang_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) - set(msvc_cxx (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")) + if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) + target_compile_options(fd_warnings INTERFACE + "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") - message(WARNING "Compiler ID is ${CMAKE_CXX_COMPILER_ID}") - if(gcc_cxx OR clang_cxx) - target_compile_options(fd_interface_library INTERFACE "-g") - target_compile_options(fd_interface_library INTERFACE "-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant") - - if (gcc_cxx + if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "Gnu") AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 - message(WARNING "Adding flag -Wno-restrict") - target_compile_options(fd_interface_library INTERFACE "-Wno-restrict") - endif() - - ## Configuration-specific flags - target_compile_options(fd_interface_library INTERFACE "$<$:-O3;-DNDEBUG;-fomit-frame-pointer>") - target_compile_options(fd_interface_library INTERFACE "$<$:-O3>") - if(USE_GLIBCXX_DEBUG) - target_compile_options(fd_interface_library INTERFACE "$<$:-D_GLIBCXX_DEBUG>") + target_compile_options(fd_warnings INTERFACE "-Wno-restrict") endif() - elseif(msvc_cxx) - # Enable exceptions. - target_compile_options(fd_interface_library INTERFACE "/EHsc") - + elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") # Use warning level 4 (/W4). # /Wall currently detects too many warnings outside of our code to be useful. - target_compile_options(fd_interface_library INTERFACE "/W4") + target_compile_options(fd_warnings INTERFACE "/W4") # TODO: before, we replaced W3 with W4. Do we still need to do that? # Disable warnings that currently trigger in the code until we fix them. - target_compile_options(fd_interface_library INTERFACE "/wd4456") # declaration hides previous local declaration - target_compile_options(fd_interface_library INTERFACE "/wd4458") # declaration hides class member - target_compile_options(fd_interface_library INTERFACE "/wd4459") # declaration hides global declaration - target_compile_options(fd_interface_library INTERFACE "/wd4244") # conversion with possible loss of data - target_compile_options(fd_interface_library INTERFACE "/wd4267") # conversion from size_t to int with possible loss of data - - # TODO: Configuration-specific flags. We currently rely on the fact that - # CMAKE_CXX_FLAGS_RELEASE and CMAKE_CXX_FLAGS_DEBUG get reasonable settings - # from cmake. This is the case for most build environments, but we have less - # control over the way the binary is created. + target_compile_options(fd_warnings INTERFACE "/wd4456") # declaration hides previous local declaration + target_compile_options(fd_warnings INTERFACE "/wd4458") # declaration hides class member + target_compile_options(fd_warnings INTERFACE "/wd4459") # declaration hides global declaration + target_compile_options(fd_warnings INTERFACE "/wd4244") # conversion with possible loss of data + target_compile_options(fd_warnings INTERFACE "/wd4267") # conversion from size_t to int with possible loss of data + else() + message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}") + endif() +endmacro() + +macro(define_interface_library) + add_library(fd_interface_library INTERFACE) + target_compile_features(fd_interface_library INTERFACE cxx_std_20) + + define_warnings_library() + target_link_libraries(fd_interface_library INTERFACE fd_warnings) + + # TODO: rework. The idea was that downward inherits this property, but it doesn't + # Instead, maybe an "install" command would be sensible? + set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + + if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) + target_compile_options(fd_interface_library INTERFACE + "-O3" "-g" "$<$:-DNDEBUG;-fomit-frame-pointer>") + + if(USE_GLIBCXX_DEBUG) + target_compile_definitions(fd_interface_library INTERFACE "$<$:_GLIBCXX_DEBUG>") + endif() + elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + # Enable exceptions. + target_compile_options(fd_interface_library INTERFACE "/EHsc") else() - message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER}") + message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}") endif() endmacro() From 251af3612d1ffa0a5e76aa07cde03a41e254ed2d Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Fri, 28 Jul 2023 08:54:54 +0200 Subject: [PATCH 14/79] Add debug output. --- src/cmake_modules/FastDownwardMacros.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 79e87349cc..4e8de44dec 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -3,9 +3,12 @@ include(CMakeParseArguments) add_library(fd_warnings INTERFACE) + message("CMAKE CXX COMPILER ID: ${CMAKE_CXX_COMPILER_ID}") + if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) + message("Compiler is Gnu or Clang") target_compile_options(fd_warnings INTERFACE "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") @@ -18,6 +21,7 @@ include(CMakeParseArguments) target_compile_options(fd_warnings INTERFACE "-Wno-restrict") endif() elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + message("Compiler is MSVC") # Use warning level 4 (/W4). # /Wall currently detects too many warnings outside of our code to be useful. target_compile_options(fd_warnings INTERFACE "/W4") From 71c28fdedc8d08fcf1814d8d03e94d8c7528dfab Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Fri, 28 Jul 2023 09:14:04 +0200 Subject: [PATCH 15/79] Remove debug output, specify COMPILER_ID var differently. --- src/cmake_modules/FastDownwardMacros.cmake | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 4e8de44dec..e3eb855de3 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -3,25 +3,20 @@ include(CMakeParseArguments) add_library(fd_warnings INTERFACE) - message("CMAKE CXX COMPILER ID: ${CMAKE_CXX_COMPILER_ID}") - - if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) - message("Compiler is Gnu or Clang") + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(fd_warnings INTERFACE "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") - if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "Gnu") + if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 target_compile_options(fd_warnings INTERFACE "-Wno-restrict") endif() - elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") - message("Compiler is MSVC") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Use warning level 4 (/W4). # /Wall currently detects too many warnings outside of our code to be useful. target_compile_options(fd_warnings INTERFACE "/W4") From e3af72ac64188b7cc73de0bfe078a6f9a494a43f Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Fri, 28 Jul 2023 09:17:08 +0200 Subject: [PATCH 16/79] Yet another way to specify COMPILER_ID (needed if cmake version less than 3.1) --- src/cmake_modules/FastDownwardMacros.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index e3eb855de3..1f7c4009c5 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -3,20 +3,20 @@ include(CMakeParseArguments) add_library(fd_warnings INTERFACE) - if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + OR ("${CMAKE_CXX_COMPILER_ID MATCHES}" "Clang")) target_compile_options(fd_warnings INTERFACE "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") - if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 target_compile_options(fd_warnings INTERFACE "-Wno-restrict") endif() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Use warning level 4 (/W4). # /Wall currently detects too many warnings outside of our code to be useful. target_compile_options(fd_warnings INTERFACE "/W4") From c99c9798392c0c3173a0beda0629c5a7ae1aea94 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Fri, 28 Jul 2023 09:18:16 +0200 Subject: [PATCH 17/79] Fix typo. --- src/cmake_modules/FastDownwardMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 1f7c4009c5..f2d4f1f37c 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -4,7 +4,7 @@ include(CMakeParseArguments) add_library(fd_warnings INTERFACE) if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - OR ("${CMAKE_CXX_COMPILER_ID MATCHES}" "Clang")) + OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) target_compile_options(fd_warnings INTERFACE "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") From e4ccc422850b35e9b8105908fce73da08290fc20 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 11:01:47 +0200 Subject: [PATCH 18/79] use generator expressions again --- src/cmake_modules/FastDownwardMacros.cmake | 90 ++++++++++------------ 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index f2d4f1f37c..6df38d0717 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -1,64 +1,54 @@ include(CMakeParseArguments) - add_library(fd_warnings INTERFACE) - - if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) - target_compile_options(fd_warnings INTERFACE - "-Wall" "-Wextra" "-Wpedantic" "-Wnon-virtual-dtor" "-Wfloat-conversion" "-Wmissing-declarations" "-Wzero-as-null-pointer-constant") - - - if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12 - AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) - ## We ignore the warning "restrict" because of a bug in GCC 12: - ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 - target_compile_options(fd_warnings INTERFACE "-Wno-restrict") - endif() - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # Use warning level 4 (/W4). - # /Wall currently detects too many warnings outside of our code to be useful. - target_compile_options(fd_warnings INTERFACE "/W4") - # TODO: before, we replaced W3 with W4. Do we still need to do that? - - # Disable warnings that currently trigger in the code until we fix them. - target_compile_options(fd_warnings INTERFACE "/wd4456") # declaration hides previous local declaration - target_compile_options(fd_warnings INTERFACE "/wd4458") # declaration hides class member - target_compile_options(fd_warnings INTERFACE "/wd4459") # declaration hides global declaration - target_compile_options(fd_warnings INTERFACE "/wd4244") # conversion with possible loss of data - target_compile_options(fd_warnings INTERFACE "/wd4267") # conversion from size_t to int with possible loss of data - else() - message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}") - endif() -endmacro() - macro(define_interface_library) add_library(fd_interface_library INTERFACE) target_compile_features(fd_interface_library INTERFACE cxx_std_20) - define_warnings_library() + set(gcc_like_cxx "$") + set(gcc_cxx "$") + set(msvc_cxx "$") + set(gcc_like_release "$>") + set(gcc_like_debug "$>") + set(should_use_glibcxx_debug "$>") + + target_compile_options(fd_interface_library INTERFACE + "$<${gcc_like_cxx}:-O3;-g>") + target_compile_options(fd_interface_library INTERFACE + "$<${gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") + target_compile_definitions(fd_interface_library INTERFACE + "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") + # Enable exceptions for MSVC. + target_compile_options(fd_interface_library INTERFACE + "$<${msvc_cxx}:/EHsc>") + + add_library(fd_warnings INTERFACE) + target_compile_options(fd_warnings INTERFACE + "$<${gcc_like_cxx}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") + + ## We ignore the warning "restrict" because of a bug in GCC 12: + ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 + set(v12_or_later "$,12>") + set(before_v13 "$,13>") + set(bugged_gcc_cxx "$") + target_compile_options(fd_warnings INTERFACE + "$<${bugged_gcc_cxx}:-Wno-restrict>") + + # For MSVC, use warning level 4 (/W4) because /Wall currently detects too + # many warnings outside of our code to be useful. + target_compile_options(fd_warnings INTERFACE + "$<${msvc_cxx}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") + # Disable warnings that currently trigger in the code until we fix them. + # /wd4456: declaration hides previous local declaration + # /wd4458: declaration hides class member + # /wd4459: declaration hides global declaration + # /wd4244: conversion with possible loss of data + # /wd4267: conversion from size_t to int with possible loss of data target_link_libraries(fd_interface_library INTERFACE fd_warnings) # TODO: rework. The idea was that downward inherits this property, but it doesn't # Instead, maybe an "install" command would be sensible? set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) - - if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) - target_compile_options(fd_interface_library INTERFACE - "-O3" "-g" "$<$:-DNDEBUG;-fomit-frame-pointer>") - - if(USE_GLIBCXX_DEBUG) - target_compile_definitions(fd_interface_library INTERFACE "$<$:_GLIBCXX_DEBUG>") - endif() - elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") - # Enable exceptions. - target_compile_options(fd_interface_library INTERFACE "/EHsc") - else() - message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}") - endif() endmacro() # TODO: I'm not sure if we need this anymore? I could not find a corresponding @@ -144,11 +134,11 @@ function(fast_downward_plugin) endif() add_library(downward_${_PLUGIN_NAME} INTERFACE) + target_link_libraries(downward_${_PLUGIN_NAME} INTERFACE fd_interface_library) target_sources(downward_${_PLUGIN_NAME} INTERFACE ${_PLUGIN_SOURCES}) foreach(DEPENDENCY ${_PLUGIN_DEPENDS}) target_link_libraries(downward_${_PLUGIN_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() - set_target_properties(downward_${_PLUGIN_NAME} PROPERTIES LINKER_LANGUAGE CXX) if (_PLUGIN_CORE_PLUGIN OR PLUGIN_${_PLUGIN_NAME}_ENABLED) target_link_libraries(downward PUBLIC downward_${_PLUGIN_NAME}) From 1a7041f18d177d8328ba12c0be825384fcfde03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Fri, 28 Jul 2023 11:44:00 +0200 Subject: [PATCH 19/79] Remove some TODOs, revert how to set output dir, revert commenting out code. --- src/CMakeLists.txt | 11 +++----- src/cmake_modules/FastDownwardMacros.cmake | 32 ++++++++-------------- src/search/CMakeLists.txt | 4 --- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43eac8a015..cb55b474e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,15 +32,11 @@ find_program(CMAKE_C_COMPILER NAMES $ENV{CC} cc gcc PATHS ENV PATH NO_DEFAULT_PA find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ PATHS ENV PATH NO_DEFAULT_PATH) # Path containing custom CMake modules -# TODO: I could not find anything other than modifying the CMAKE_* variable directly, -# but appending to the list sounds at least better than just setting the variable -# https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html#variable:CMAKE_MODULE_PATH -# says the variable is intended to be set by the project, so I guess this is the intended way? list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) project(fast-downward) -#TODO: is there a better place for this call? +#TODO: Restructure so this is not a call to a macro define_interface_library() fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. @@ -49,6 +45,8 @@ fast_downward_set_configuration_types() set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + # Write compiler ID and version to the cache to allow retrieving this information # with "cmake -LA" (see test-memory-leaks.py). set(DOWNWARD_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID} CACHE STRING "") @@ -59,11 +57,10 @@ mark_as_advanced(DOWNWARD_CXX_COMPILER_ID DOWNWARD_CXX_COMPILER_VERSION) # Copy the translator into the output directory. add_custom_target(translate ALL) -get_target_property(bin_dir fd_interface_library RUNTIME_OUTPUT_DIRECTORY) add_custom_command(TARGET translate POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/translate - ${bin_dir}/${CMAKE_CFG_INTDIR}/translate + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/translate COMMENT "Copying translator module into output directory") add_subdirectory(search) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 6df38d0717..6bb40597c8 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -46,28 +46,20 @@ macro(define_interface_library) # /wd4267: conversion from size_t to int with possible loss of data target_link_libraries(fd_interface_library INTERFACE fd_warnings) - # TODO: rework. The idea was that downward inherits this property, but it doesn't - # Instead, maybe an "install" command would be sensible? - set_target_properties(fd_interface_library PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + if(UNIX) + target_link_options(fd_interface_library INTERFACE "-g") + endif() endmacro() -# TODO: I'm not sure if we need this anymore? I could not find a corresponding -# "modern" command and it compiled without it -#~ macro(fast_downward_set_linker_flags) - #~ if(UNIX) - #~ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g") - #~ endif() -#~ endmacro() - -# TODO: It seems this is not needed anymore? When I call build, it never enters -# the if block... -#~ macro(fast_downward_default_to_release_build) - #~ # Only for single-config generators (like Makefiles) that choose the build type at generation time. - #~ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - #~ message(STATUS "Defaulting to release build.") - #~ set(default_build_type "Release") - #~ endif() -#~ endmacro() + + +macro(fast_downward_default_to_release_build) + # Only for single-config generators (like Makefiles) that choose the build type at generation time. + if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + message(STATUS "Defaulting to release build.") + set(default_build_type "Release") + endif() +endmacro() # TODO: I cannot find out how to replace this set(CMAKE_* ...) call macro(fast_downward_set_configuration_types) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index a1444d3ede..d9ef2df43e 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -26,10 +26,6 @@ add_executable(downward planner.cc) include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") -target_link_libraries(downward PUBLIC fd_interface_library) -get_target_property(bin_dir fd_interface_library RUNTIME_OUTPUT_DIRECTORY) -set_target_properties(downward PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bin_dir}) - ## == Libraries == # On Linux, find the rt library for clock_gettime(). From b838b685e7814e38569cd170eb64fad4c224830f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Fri, 28 Jul 2023 11:54:31 +0200 Subject: [PATCH 20/79] Trying out dirty hack for fixing windows cplex builds. --- src/search/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index d9ef2df43e..428561899a 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -57,7 +57,8 @@ if(USE_LP) target_include_directories(downward_cplex_interface INTERFACE ${CPLEX_INCLUDE_DIRS}) target_link_libraries(downward_cplex_interface INTERFACE ${CPLEX_LIBRARIES}) if(CPLEX_RUNTIME_LIBRARY) - add_custom_command(TARGET downward_cplex_interface POST_BUILD + add_custom_target(copy-cplex ALL) + add_custom_command(TARGET copy-cplex POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_RUNTIME_LIBRARY} $ From 3c1a5dc78965281197e485a7c9457043050180a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Fri, 28 Jul 2023 12:22:58 +0200 Subject: [PATCH 21/79] Rename plugin to library. --- src/cmake_modules/FastDownwardMacros.cmake | 36 ++-- src/search/DownwardFiles.cmake | 188 ++++++++++----------- 2 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 6bb40597c8..9a215110ae 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -100,39 +100,39 @@ function(fast_downward_add_existing_sources_to_list _SOURCES_LIST_VAR) set(${_SOURCES_LIST_VAR} ${_ALL_FILES} PARENT_SCOPE) endfunction() -function(fast_downward_plugin) - set(_OPTIONS DEPENDENCY_ONLY CORE_PLUGIN) +function(create_fast_downward_library) + set(_OPTIONS DEPENDENCY_ONLY CORE_LIBRARY) set(_ONE_VALUE_ARGS NAME DISPLAY_NAME HELP) set(_MULTI_VALUE_ARGS SOURCES DEPENDS) - cmake_parse_arguments(_PLUGIN "${_OPTIONS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN}) + cmake_parse_arguments(_LIBRARY "${_OPTIONS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN}) # Check mandatory arguments. - if(NOT _PLUGIN_NAME) - message(FATAL_ERROR "fast_downward_plugin: 'NAME' argument required.") + if(NOT _LIBRARY_NAME) + message(FATAL_ERROR "fast_downward_library: 'NAME' argument required.") endif() - if(NOT _PLUGIN_SOURCES) - message(FATAL_ERROR "fast_downward_plugin: 'SOURCES' argument required.") + if(NOT _LIBRARY_SOURCES) + message(FATAL_ERROR "fast_downward_library: 'SOURCES' argument required.") endif() - fast_downward_add_existing_sources_to_list(_PLUGIN_SOURCES) + fast_downward_add_existing_sources_to_list(_LIBRARY_SOURCES) - if (NOT _PLUGIN_CORE_PLUGIN AND NOT _PLUGIN_DEPENDENCY_ONLY) + if (NOT _LIBRARY_CORE_LIBRARY AND NOT _LIBRARY_DEPENDENCY_ONLY) # Decide whether the plugin should be enabled by default. - if (DISABLE_PLUGINS_BY_DEFAULT) + if (DISABLE_LIBRARIES_BY_DEFAULT) set(_OPTION_DEFAULT FALSE) else() set(_OPTION_DEFAULT TRUE) endif() - option(PLUGIN_${_PLUGIN_NAME}_ENABLED ${_PLUGIN_HELP} ${_OPTION_DEFAULT}) + option(LIBRARY_${_LIBRARY_NAME}_ENABLED ${_LIBRARY_HELP} ${_OPTION_DEFAULT}) endif() - add_library(downward_${_PLUGIN_NAME} INTERFACE) - target_link_libraries(downward_${_PLUGIN_NAME} INTERFACE fd_interface_library) - target_sources(downward_${_PLUGIN_NAME} INTERFACE ${_PLUGIN_SOURCES}) - foreach(DEPENDENCY ${_PLUGIN_DEPENDS}) - target_link_libraries(downward_${_PLUGIN_NAME} INTERFACE downward_${DEPENDENCY}) + add_library(downward_${_LIBRARY_NAME} INTERFACE) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE fd_interface_library) + target_sources(downward_${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) + foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() - if (_PLUGIN_CORE_PLUGIN OR PLUGIN_${_PLUGIN_NAME}_ENABLED) - target_link_libraries(downward PUBLIC downward_${_PLUGIN_NAME}) + if (_LIBRARY_CORE_LIBRARY OR PLUGIN_${_LIBRARY_NAME}_ENABLED) + target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) endif() endfunction() diff --git a/src/search/DownwardFiles.cmake b/src/search/DownwardFiles.cmake index eb07fa6ada..29f02bc6c3 100644 --- a/src/search/DownwardFiles.cmake +++ b/src/search/DownwardFiles.cmake @@ -1,24 +1,24 @@ # See https://www.fast-downward.org/ForDevelopers/AddingSourceFiles -# for general information on adding source files and CMake plugins. +# for general information on adding source files and CMake libraries. # -# All plugins are enabled by default and users can disable them by specifying -# -DPLUGIN_FOO_ENABLED=FALSE -# The default behavior can be changed so all non-essential plugins are +# All libraries are enabled by default and users can disable them by specifying +# -DLIBRARY_FOO_ENABLED=FALSE +# The default behavior can be changed so all non-essential libraries are # disabled by default by specifying -# -DDISABLE_PLUGINS_BY_DEFAULT=TRUE -# In that case, individual plugins can be enabled with -# -DPLUGIN_FOO_ENABLED=TRUE +# -DDISABLE_LIBRARIES_BY_DEFAULT=TRUE +# In that case, individual libraries can be enabled with +# -DLIBRARY_FOO_ENABLED=TRUE # # Defining a new plugin: -# fast_downward_plugin( +# create_fast_downward_library( # NAME # [ DISPLAY_NAME ] # [ HELP ] # SOURCES # [ ... ] -# [ DEPENDS [ ... ] ] +# [ DEPENDS [ ... ] ] # [ DEPENDENCY_ONLY ] -# [ CORE_PLUGIN ] +# [ CORE_LIBRARY ] # ) # # defaults to lower case and is used to group files @@ -27,22 +27,22 @@ # SOURCES lists the source files that are part of the plugin. Entries are # listed without extension. For an entry , both .h and .cc # are added if the files exist. -# DEPENDS lists plugins that will be automatically enabled if this plugin is +# DEPENDS lists libraries that will be automatically enabled if this plugin is # enabled. If the dependency was not enabled before, this will be logged. # DEPENDENCY_ONLY disables the plugin unless it is needed as a dependency and # hides the option to enable the plugin in cmake GUIs like ccmake. -# CORE_PLUGIN always enables the plugin (even if DISABLE_PLUGINS_BY_DEFAULT +# CORE_LIBRARY always enables the plugin (even if DISABLE_LIBRARYS_BY_DEFAULT # is used) and hides the option to disable it in CMake GUIs like ccmake. option( - DISABLE_PLUGINS_BY_DEFAULT - "If set to YES only plugins that are specifically enabled will be compiled" + DISABLE_LIBRARIES_BY_DEFAULT + "If set to YES only libraries that are specifically enabled will be compiled" NO) # This option should not show up in CMake GUIs like ccmake where all -# plugins are enabled or disabled manually. -mark_as_advanced(DISABLE_PLUGINS_BY_DEFAULT) +# libraries are enabled or disabled manually. +mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) -fast_downward_plugin( +create_fast_downward_library( NAME CORE_SOURCES HELP "Core source files" SOURCES @@ -77,10 +77,10 @@ fast_downward_plugin( task_proxy DEPENDS CAUSAL_GRAPH INT_HASH_SET INT_PACKER ORDERED_SET SEGMENTED_VECTOR SUBSCRIBER SUCCESSOR_GENERATOR TASK_PROPERTIES - CORE_PLUGIN + CORE_LIBRARY ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGINS HELP "Plugin definition" SOURCES @@ -94,10 +94,10 @@ fast_downward_plugin( plugins/registry plugins/registry_types plugins/types - CORE_PLUGIN + CORE_LIBRARY ) -fast_downward_plugin( +create_fast_downward_library( NAME PARSER HELP "Option parsing" SOURCES @@ -106,10 +106,10 @@ fast_downward_plugin( parser/lexical_analyzer parser/syntax_analyzer parser/token_stream - CORE_PLUGIN + CORE_LIBRARY ) -fast_downward_plugin( +create_fast_downward_library( NAME UTILS HELP "System utilities" SOURCES @@ -129,52 +129,52 @@ fast_downward_plugin( utils/system_unix utils/system_windows utils/timer - CORE_PLUGIN + CORE_LIBRARY ) -fast_downward_plugin( +create_fast_downward_library( NAME ALTERNATION_OPEN_LIST HELP "Open list that alternates between underlying open lists in a round-robin manner" SOURCES open_lists/alternation_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME BEST_FIRST_OPEN_LIST HELP "Open list that selects the best element according to a single evaluation function" SOURCES open_lists/best_first_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME EPSILON_GREEDY_OPEN_LIST HELP "Open list that chooses an entry randomly with probability epsilon" SOURCES open_lists/epsilon_greedy_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME PARETO_OPEN_LIST HELP "Pareto open list" SOURCES open_lists/pareto_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME TIEBREAKING_OPEN_LIST HELP "Tiebreaking open list" SOURCES open_lists/tiebreaking_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME TYPE_BASED_OPEN_LIST HELP "Type-based open list" SOURCES open_lists/type_based_open_list ) -fast_downward_plugin( +create_fast_downward_library( NAME DYNAMIC_BITSET HELP "Poor man's version of boost::dynamic_bitset" SOURCES @@ -182,7 +182,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME NAMED_VECTOR HELP "Generic vector with associated name for each element" SOURCES @@ -190,7 +190,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME EQUIVALENCE_RELATION HELP "Equivalence relation over [1, ..., n] that can be iteratively refined" SOURCES @@ -198,7 +198,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME INT_HASH_SET HELP "Hash set storing non-negative integers" SOURCES @@ -206,7 +206,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME INT_PACKER HELP "Greedy bin packing algorithm to pack integer variables with small domains tightly into memory" SOURCES @@ -214,7 +214,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME MAX_CLIQUES HELP "Implementation of the Max Cliques algorithm by Tomita et al." SOURCES @@ -222,7 +222,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME PRIORITY_QUEUES HELP "Three implementations of priority queue: HeapQueue, BucketQueue and AdaptiveQueue" SOURCES @@ -230,7 +230,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME ORDERED_SET HELP "Set of elements ordered by insertion time" SOURCES @@ -238,7 +238,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME SEGMENTED_VECTOR HELP "Memory-friendly and vector-like data structure" SOURCES @@ -246,7 +246,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME SUBSCRIBER HELP "Allows object to subscribe to the destructor of other objects" SOURCES @@ -254,14 +254,14 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME EVALUATORS_SUBCATEGORY HELP "Subcategory plugin for basic evaluators" SOURCES evaluators/subcategory ) -fast_downward_plugin( +create_fast_downward_library( NAME CONST_EVALUATOR HELP "The constant evaluator" SOURCES @@ -269,7 +269,7 @@ fast_downward_plugin( DEPENDS EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME G_EVALUATOR HELP "The g-evaluator" SOURCES @@ -277,7 +277,7 @@ fast_downward_plugin( DEPENDS EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME COMBINING_EVALUATOR HELP "The combining evaluator" SOURCES @@ -285,7 +285,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME MAX_EVALUATOR HELP "The max evaluator" SOURCES @@ -293,7 +293,7 @@ fast_downward_plugin( DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME PREF_EVALUATOR HELP "The pref evaluator" SOURCES @@ -301,7 +301,7 @@ fast_downward_plugin( DEPENDS EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME WEIGHTED_EVALUATOR HELP "The weighted evaluator" SOURCES @@ -309,7 +309,7 @@ fast_downward_plugin( DEPENDS EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME SUM_EVALUATOR HELP "The sum evaluator" SOURCES @@ -317,7 +317,7 @@ fast_downward_plugin( DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY ) -fast_downward_plugin( +create_fast_downward_library( NAME NULL_PRUNING_METHOD HELP "Pruning method that does nothing" SOURCES @@ -325,14 +325,14 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME LIMITED_PRUNING HELP "Method for limiting another pruning method" SOURCES pruning/limited_pruning ) -fast_downward_plugin( +create_fast_downward_library( NAME STUBBORN_SETS HELP "Base class for all stubborn set partial order reduction methods" SOURCES @@ -341,7 +341,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME STUBBORN_SETS_ACTION_CENTRIC HELP "Base class for all action-centric stubborn set partial order reduction methods" SOURCES @@ -350,7 +350,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME STUBBORN_SETS_ATOM_CENTRIC HELP "Atom-centric stubborn sets" SOURCES @@ -358,7 +358,7 @@ fast_downward_plugin( DEPENDS STUBBORN_SETS ) -fast_downward_plugin( +create_fast_downward_library( NAME STUBBORN_SETS_SIMPLE HELP "Stubborn sets simple" SOURCES @@ -366,7 +366,7 @@ fast_downward_plugin( DEPENDS STUBBORN_SETS_ACTION_CENTRIC ) -fast_downward_plugin( +create_fast_downward_library( NAME STUBBORN_SETS_EC HELP "Stubborn set method that dominates expansion core" SOURCES @@ -374,7 +374,7 @@ fast_downward_plugin( DEPENDS STUBBORN_SETS_ACTION_CENTRIC TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME SEARCH_COMMON HELP "Basic classes used for all search algorithms" SOURCES @@ -383,7 +383,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME EAGER_SEARCH HELP "Eager search" SOURCES @@ -392,7 +392,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_ASTAR HELP "A* search" SOURCES @@ -400,7 +400,7 @@ fast_downward_plugin( DEPENDS EAGER_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_EAGER HELP "Eager (i.e., normal) best-first search" SOURCES @@ -408,7 +408,7 @@ fast_downward_plugin( DEPENDS EAGER_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_EAGER_GREEDY HELP "Eager greedy best-first search" SOURCES @@ -416,7 +416,7 @@ fast_downward_plugin( DEPENDS EAGER_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_EAGER_WASTAR HELP "Weighted eager A* search" SOURCES @@ -424,7 +424,7 @@ fast_downward_plugin( DEPENDS EAGER_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_LAZY HELP "Best-first search with deferred evaluation (lazy)" SOURCES @@ -432,7 +432,7 @@ fast_downward_plugin( DEPENDS LAZY_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_LAZY_GREEDY HELP "Greedy best-first search with deferred evaluation (lazy)" SOURCES @@ -440,7 +440,7 @@ fast_downward_plugin( DEPENDS LAZY_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME PLUGIN_LAZY_WASTAR HELP "Weighted A* search with deferred evaluation (lazy)" SOURCES @@ -448,7 +448,7 @@ fast_downward_plugin( DEPENDS LAZY_SEARCH SEARCH_COMMON ) -fast_downward_plugin( +create_fast_downward_library( NAME ENFORCED_HILL_CLIMBING_SEARCH HELP "Lazy enforced hill-climbing search" SOURCES @@ -456,14 +456,14 @@ fast_downward_plugin( DEPENDS G_EVALUATOR ORDERED_SET PREF_EVALUATOR SEARCH_COMMON SUCCESSOR_GENERATOR ) -fast_downward_plugin( +create_fast_downward_library( NAME ITERATED_SEARCH HELP "Iterated search" SOURCES search_algorithms/iterated_search ) -fast_downward_plugin( +create_fast_downward_library( NAME LAZY_SEARCH HELP "Lazy search" SOURCES @@ -472,7 +472,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME LP_SOLVER HELP "Interface to an LP solver" SOURCES @@ -483,7 +483,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME RELAXATION_HEURISTIC HELP "The base class for relaxation heuristics" SOURCES @@ -492,7 +492,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME ADDITIVE_HEURISTIC HELP "The additive heuristic" SOURCES @@ -500,7 +500,7 @@ fast_downward_plugin( DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME BLIND_SEARCH_HEURISTIC HELP "The 'blind search' heuristic" SOURCES @@ -508,7 +508,7 @@ fast_downward_plugin( DEPENDS TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME CONTEXT_ENHANCED_ADDITIVE_HEURISTIC HELP "The context-enhanced additive heuristic" SOURCES @@ -516,7 +516,7 @@ fast_downward_plugin( DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME CG_HEURISTIC HELP "The causal graph heuristic" SOURCES heuristics/cg_heuristic @@ -524,7 +524,7 @@ fast_downward_plugin( DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME DOMAIN_TRANSITION_GRAPH HELP "DTGs used by cg and cea heuristic" SOURCES @@ -532,7 +532,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME FF_HEURISTIC HELP "The FF heuristic (an implementation of the RPG heuristic)" SOURCES @@ -540,14 +540,14 @@ fast_downward_plugin( DEPENDS ADDITIVE_HEURISTIC TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME GOAL_COUNT_HEURISTIC HELP "The goal-counting heuristic" SOURCES heuristics/goal_count_heuristic ) -fast_downward_plugin( +create_fast_downward_library( NAME HM_HEURISTIC HELP "The h^m heuristic" SOURCES @@ -555,7 +555,7 @@ fast_downward_plugin( DEPENDS TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME LANDMARK_CUT_HEURISTIC HELP "The LM-cut heuristic" SOURCES @@ -564,7 +564,7 @@ fast_downward_plugin( DEPENDS PRIORITY_QUEUES TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME MAX_HEURISTIC HELP "The Max heuristic" SOURCES @@ -572,17 +572,17 @@ fast_downward_plugin( DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC ) -fast_downward_plugin( +create_fast_downward_library( NAME CORE_TASKS HELP "Core task transformations" SOURCES tasks/cost_adapted_task tasks/delegating_task tasks/root_task - CORE_PLUGIN + CORE_LIBRARY ) -fast_downward_plugin( +create_fast_downward_library( NAME EXTRA_TASKS HELP "Non-core task transformations" SOURCES @@ -594,7 +594,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME CAUSAL_GRAPH HELP "Causal Graph" SOURCES @@ -602,7 +602,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME SAMPLING HELP "Sampling" SOURCES @@ -611,7 +611,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME SUCCESSOR_GENERATOR HELP "Successor generator" SOURCES @@ -622,7 +622,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME TASK_PROPERTIES HELP "Task properties" SOURCES @@ -630,7 +630,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME VARIABLE_ORDER_FINDER HELP "Variable order finder" SOURCES @@ -638,7 +638,7 @@ fast_downward_plugin( DEPENDENCY_ONLY ) -fast_downward_plugin( +create_fast_downward_library( NAME CEGAR HELP "Plugin containing the code for Cartesian CEGAR heuristics" SOURCES @@ -661,7 +661,7 @@ fast_downward_plugin( DEPENDS ADDITIVE_HEURISTIC DYNAMIC_BITSET EXTRA_TASKS LANDMARKS PRIORITY_QUEUES TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME MAS_HEURISTIC HELP "The Merge-and-Shrink heuristic" SOURCES @@ -704,7 +704,7 @@ fast_downward_plugin( DEPENDS PRIORITY_QUEUES EQUIVALENCE_RELATION SCCS TASK_PROPERTIES VARIABLE_ORDER_FINDER ) -fast_downward_plugin( +create_fast_downward_library( NAME LANDMARKS HELP "Plugin containing the code to reason with landmarks" SOURCES @@ -728,7 +728,7 @@ fast_downward_plugin( DEPENDS LP_SOLVER PRIORITY_QUEUES SUCCESSOR_GENERATOR TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME OPERATOR_COUNTING HELP "Plugin containing the code for operator-counting heuristics" SOURCES @@ -741,7 +741,7 @@ fast_downward_plugin( DEPENDS LP_SOLVER LANDMARK_CUT_HEURISTIC PDBS TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME PDBS HELP "Plugin containing the code for PDBs" SOURCES @@ -783,7 +783,7 @@ fast_downward_plugin( DEPENDS CAUSAL_GRAPH MAX_CLIQUES PRIORITY_QUEUES SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES VARIABLE_ORDER_FINDER ) -fast_downward_plugin( +create_fast_downward_library( NAME POTENTIALS HELP "Plugin containing the code for potential heuristics" SOURCES @@ -799,7 +799,7 @@ fast_downward_plugin( DEPENDS LP_SOLVER SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES ) -fast_downward_plugin( +create_fast_downward_library( NAME SCCS HELP "Algorithm to compute the strongly connected components (SCCs) of a " "directed graph." From 1de29044a829a566595994164f122a9e2e3aea28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Fri, 28 Jul 2023 13:54:22 +0200 Subject: [PATCH 22/79] Fix some code that still referenced plugin instead of library. --- build_configs.py | 2 +- misc/tests/test-dependencies.py | 34 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build_configs.py b/build_configs.py index 164d27f84f..8fa46cadc0 100644 --- a/build_configs.py +++ b/build_configs.py @@ -3,7 +3,7 @@ release_no_lp = ["-DCMAKE_BUILD_TYPE=Release", "-DUSE_LP=NO"] # USE_GLIBCXX_DEBUG is not compatible with USE_LP (see issue983). glibcxx_debug = ["-DCMAKE_BUILD_TYPE=Debug", "-DUSE_LP=NO", "-DUSE_GLIBCXX_DEBUG=YES"] -minimal = ["-DCMAKE_BUILD_TYPE=Release", "-DDISABLE_PLUGINS_BY_DEFAULT=YES"] +minimal = ["-DCMAKE_BUILD_TYPE=Release", "-DDISABLE_LIBRARIES_BY_DEFAULT=YES"] DEFAULT = "release" DEBUG = "debug" diff --git a/misc/tests/test-dependencies.py b/misc/tests/test-dependencies.py index 8f938ad3ee..0d09374fd0 100755 --- a/misc/tests/test-dependencies.py +++ b/misc/tests/test-dependencies.py @@ -29,35 +29,35 @@ def clean_up(paths_to_clean): content = d.readlines() content = [line for line in content if '#' not in line] -content = [line for line in content if 'NAME' in line or 'CORE_PLUGIN' in line or 'DEPENDENCY_ONLY' in line] +content = [line for line in content if 'NAME' in line or 'CORE_LIBRARY' in line or 'DEPENDENCY_ONLY' in line] -plugins_to_be_tested = [] +libraries_to_be_tested = [] for line in content: if 'NAME' in line: - plugins_to_be_tested.append(line.replace("NAME", "").strip()) - if 'CORE_PLUGIN' in line or 'DEPENDENCY_ONLY' in line: - plugins_to_be_tested.pop() + libraries_to_be_tested.append(line.replace("NAME", "").strip()) + if 'CORE_LIBRARY' in line or 'DEPENDENCY_ONLY' in line: + libraries_to_be_tested.pop() with open(TEST_BUILD_CONFIGS, "w") as f: - for plugin in plugins_to_be_tested: - lowercase = plugin.lower() - line = "{lowercase} = [\"-DCMAKE_BUILD_TYPE=Debug\", \"-DDISABLE_PLUGINS_BY_DEFAULT=YES\"," \ - " \"-DPLUGIN_{plugin}_ENABLED=True\"]\n".format(**locals()) + for library in libraries_to_be_tested: + lowercase = library.lower() + line = "{lowercase} = [\"-DCMAKE_BUILD_TYPE=Debug\", \"-DDISABLE_LIBRARIES_BY_DEFAULT=YES\"," \ + " \"-DLIBRARY_{library}_ENABLED=True\"]\n".format(**locals()) f.write(line) paths_to_clean.append(os.path.join(BUILDS, lowercase)) -plugins_failed_test = [] -for plugin in plugins_to_be_tested: +libraries_failed_test = [] +for library in libraries_to_be_tested: try: - subprocess.check_call([BUILD, plugin.lower()]) + subprocess.check_call([BUILD, library.lower()]) except subprocess.CalledProcessError: - plugins_failed_test.append(plugin) + libraries_failed_test.append(library) -if plugins_failed_test: +if libraries_failed_test: print("\nFailure:") - for plugin in plugins_failed_test: - print("{plugin} failed dependencies test".format(**locals())) + for library in libraries_failed_test: + print("{library} failed dependencies test".format(**locals())) sys.exit(1) else: - print("\nAll plugins have passed dependencies test") + print("\nAll libraries have passed dependencies test") clean_up(paths_to_clean) From 8a8a3b09734ad46269be76e43476f007c3175224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Fri, 28 Jul 2023 13:55:02 +0200 Subject: [PATCH 23/79] Rename interface and warning library and build it as soon as FastDownwardMacros is included. --- src/CMakeLists.txt | 2 - src/cmake_modules/FastDownwardMacros.cmake | 104 ++++++++++----------- 2 files changed, 51 insertions(+), 55 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cb55b474e2..e0ae679cb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,8 +36,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) project(fast-downward) -#TODO: Restructure so this is not a call to a macro -define_interface_library() fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. # This means that cmake has to be called twice for multi-config generators like Visual Studio. diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 9a215110ae..606e9cea04 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -1,58 +1,56 @@ include(CMakeParseArguments) -macro(define_interface_library) - add_library(fd_interface_library INTERFACE) - target_compile_features(fd_interface_library INTERFACE cxx_std_20) - - set(gcc_like_cxx "$") - set(gcc_cxx "$") - set(msvc_cxx "$") - set(gcc_like_release "$>") - set(gcc_like_debug "$>") - set(should_use_glibcxx_debug "$>") - - target_compile_options(fd_interface_library INTERFACE - "$<${gcc_like_cxx}:-O3;-g>") - target_compile_options(fd_interface_library INTERFACE - "$<${gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") - target_compile_definitions(fd_interface_library INTERFACE - "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") - # Enable exceptions for MSVC. - target_compile_options(fd_interface_library INTERFACE - "$<${msvc_cxx}:/EHsc>") - - add_library(fd_warnings INTERFACE) - target_compile_options(fd_warnings INTERFACE - "$<${gcc_like_cxx}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") - - ## We ignore the warning "restrict" because of a bug in GCC 12: - ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 - set(v12_or_later "$,12>") - set(before_v13 "$,13>") - set(bugged_gcc_cxx "$") - target_compile_options(fd_warnings INTERFACE - "$<${bugged_gcc_cxx}:-Wno-restrict>") - - # For MSVC, use warning level 4 (/W4) because /Wall currently detects too - # many warnings outside of our code to be useful. - target_compile_options(fd_warnings INTERFACE - "$<${msvc_cxx}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") - # Disable warnings that currently trigger in the code until we fix them. - # /wd4456: declaration hides previous local declaration - # /wd4458: declaration hides class member - # /wd4459: declaration hides global declaration - # /wd4244: conversion with possible loss of data - # /wd4267: conversion from size_t to int with possible loss of data - target_link_libraries(fd_interface_library INTERFACE fd_warnings) - - if(UNIX) - target_link_options(fd_interface_library INTERFACE "-g") - endif() -endmacro() - - +add_library(cxx_options INTERFACE) +target_compile_features(cxx_options INTERFACE cxx_std_20) + +set(gcc_like "$") +set(gcc "$") +set(msvc "$") +set(gcc_like_release "$>") +set(gcc_like_debug "$>") +set(should_use_glibcxx_debug "$>") + +target_compile_options(cxx_options INTERFACE + "$<${gcc_like}:-O3;-g>") +target_compile_options(cxx_options INTERFACE + "$<${gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") +target_compile_definitions(cxx_options INTERFACE + "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") +# Enable exceptions for MSVC. +target_compile_options(cxx_options INTERFACE + "$<${msvc}:/EHsc>") +if(UNIX) #TODO: Maybe we can also replace this with a generator expression? + target_link_options(cxx_options INTERFACE "-g") +endif() + +add_library(cxx_warnings INTERFACE) +target_compile_options(cxx_warnings INTERFACE + "$<${gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") + +## We ignore the warning "restrict" because of a bug in GCC 12: +## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 +set(v12_or_later "$,12>") +set(before_v13 "$,13>") +set(bugged_gcc "$") +target_compile_options(cxx_warnings INTERFACE + "$<${bugged_gcc}:-Wno-restrict>") + +# For MSVC, use warning level 4 (/W4) because /Wall currently detects too +# many warnings outside of our code to be useful. +target_compile_options(cxx_warnings INTERFACE + "$<${msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") + # Disable warnings that currently trigger in the code until we fix them. + # /wd4456: declaration hides previous local declaration + # /wd4458: declaration hides class member + # /wd4459: declaration hides global declaration + # /wd4244: conversion with possible loss of data + # /wd4267: conversion from size_t to int with possible loss of data +target_link_libraries(cxx_options INTERFACE cxx_warnings) + + +# TODO: Reopening the question whether we need it; Silvan could build in VS Code without it. macro(fast_downward_default_to_release_build) # Only for single-config generators (like Makefiles) that choose the build type at generation time. if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) @@ -126,13 +124,13 @@ function(create_fast_downward_library) endif() add_library(downward_${_LIBRARY_NAME} INTERFACE) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE fd_interface_library) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE cxx_options) target_sources(downward_${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() - if (_LIBRARY_CORE_LIBRARY OR PLUGIN_${_LIBRARY_NAME}_ENABLED) + if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME}_ENABLED) target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) endif() endfunction() From 0192d7c228acf60e000277e53a3bc54d31d37109 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 15:47:47 +0200 Subject: [PATCH 24/79] update documentation --- build.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index b4afd76c60..7437a9707b 100755 --- a/build.py +++ b/build.py @@ -35,14 +35,16 @@ def print_usage(): configs.append(name + "\n " + " ".join(args)) configs_string = "\n ".join(configs) cmake_name = os.path.basename(CMAKE) + generator_name = CMAKE_GENERATOR.lower() default_config_name = DEFAULT_CONFIG_NAME debug_config_name = DEBUG_CONFIG_NAME print(f"""Usage: {script_name} [BUILD [BUILD ...]] [--all] [--debug] [MAKE_OPTIONS] Build one or more predefined build configurations of Fast Downward. Each build -uses {cmake_name} compile the code. Build configurations differ in the -parameters they pass to {cmake_name}. By default, the build uses all available cores. -Use the "-j" option for {cmake_name} to override this default behaviour. +uses {cmake_name} to compile the code using {generator_name} . Build configurations +differ in the parameters they pass to {cmake_name}. By default, the build uses all +available cores if this number can be determined. Use the "-j" option for +{cmake_name} to override this default behaviour. Build configurations {configs_string} From d0fad92c03002cc5cec70ef79b3685b9ffcf7592 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Fri, 28 Jul 2023 17:08:09 +0200 Subject: [PATCH 25/79] Add project description, homepage, and languages. --- src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0ae679cb1..bbda429649 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,7 +35,10 @@ find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ PATHS ENV PATH NO_DEFAUL list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) -project(fast-downward) +project(fast-downward + DESCRIPTION "Fast Downward is a domain-independent classical planning system." + HOMEPAGE_URL https://www.fast-downward.org/ + LANGUAGES CXX) fast_downward_report_bitwidth() # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. # This means that cmake has to be called twice for multi-config generators like Visual Studio. From f0aa52d8a7d519e8a3752bc0e04bd223986b9868 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 17:39:23 +0200 Subject: [PATCH 26/79] check only compiler --- src/cmake_modules/FastDownwardMacros.cmake | 27 +++++++++++----------- src/search/DownwardFiles.cmake | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 606e9cea04..f6856df862 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -5,25 +5,24 @@ include(CMakeParseArguments) add_library(cxx_options INTERFACE) target_compile_features(cxx_options INTERFACE cxx_std_20) -set(gcc_like "$") -set(gcc "$") -set(msvc "$") -set(gcc_like_release "$>") -set(gcc_like_debug "$>") -set(should_use_glibcxx_debug "$>") +set(using_gcc_like "$") +set(using_gcc "$") +set(using_msvc "$") +set(using_gcc_like_release "$>") +set(using_gcc_like_debug "$>") +set(should_use_glibcxx_debug "$>") target_compile_options(cxx_options INTERFACE - "$<${gcc_like}:-O3;-g>") + "$<${using_gcc_like}:-O3;-g>") +target_link_options(cxx_options INTERFACE + "$<${using_gcc_like}:-g>") target_compile_options(cxx_options INTERFACE - "$<${gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") + "$<${using_gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") target_compile_definitions(cxx_options INTERFACE "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") # Enable exceptions for MSVC. target_compile_options(cxx_options INTERFACE - "$<${msvc}:/EHsc>") -if(UNIX) #TODO: Maybe we can also replace this with a generator expression? - target_link_options(cxx_options INTERFACE "-g") -endif() + "$<${using_msvc}:/EHsc>") add_library(cxx_warnings INTERFACE) target_compile_options(cxx_warnings INTERFACE @@ -33,14 +32,14 @@ target_compile_options(cxx_warnings INTERFACE ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 set(v12_or_later "$,12>") set(before_v13 "$,13>") -set(bugged_gcc "$") +set(bugged_gcc "$") target_compile_options(cxx_warnings INTERFACE "$<${bugged_gcc}:-Wno-restrict>") # For MSVC, use warning level 4 (/W4) because /Wall currently detects too # many warnings outside of our code to be useful. target_compile_options(cxx_warnings INTERFACE - "$<${msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") + "$<${using_msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") # Disable warnings that currently trigger in the code until we fix them. # /wd4456: declaration hides previous local declaration # /wd4458: declaration hides class member diff --git a/src/search/DownwardFiles.cmake b/src/search/DownwardFiles.cmake index 29f02bc6c3..0d7694fcb5 100644 --- a/src/search/DownwardFiles.cmake +++ b/src/search/DownwardFiles.cmake @@ -31,7 +31,7 @@ # enabled. If the dependency was not enabled before, this will be logged. # DEPENDENCY_ONLY disables the plugin unless it is needed as a dependency and # hides the option to enable the plugin in cmake GUIs like ccmake. -# CORE_LIBRARY always enables the plugin (even if DISABLE_LIBRARYS_BY_DEFAULT +# CORE_LIBRARY always enables the plugin (even if DISABLE_LIBRARIES_BY_DEFAULT # is used) and hides the option to disable it in CMake GUIs like ccmake. option( From 80396971d92a149572a4c61896ea2c451c1ddbd6 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 20:25:11 +0200 Subject: [PATCH 27/79] Fix build types and add some TODOs --- src/CMakeLists.txt | 10 +++++- src/cmake_modules/FastDownwardMacros.cmake | 36 ++++++++++++---------- src/search/CMakeLists.txt | 3 ++ 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbda429649..7dd954a115 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ cmake_minimum_required(VERSION 3.16) +# TODO: test if this is still needed on ony of the generators we care about. # Select a default compiler because CMake does not respect the PATH environment variable for some generators, # e.g. used by existing compute servers in Basel. # See https://stackoverflow.com/a/45934279 and https://issues.fast-downward.org/issue1031 for details. @@ -40,10 +41,17 @@ project(fast-downward HOMEPAGE_URL https://www.fast-downward.org/ LANGUAGES CXX) fast_downward_report_bitwidth() + +# TODO: test if this is still the case. It looks ok for multi-config ninja. # Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. # This means that cmake has to be called twice for multi-config generators like Visual Studio. -fast_downward_set_configuration_types() +fast_downward_set_up_build_types() +# TODO: can we get rid of this? The point was to prevent src/search/CMakeLists.txt +# from being used without the general setup happening in this file, but we move the +# relevant setup there, maybe it is OK to use it stand-alone? If we cannot make the +# nested CMakeLists.txt self-contained, comparing CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR +# might be an option that does not require this magic variable at the top level. set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index f6856df862..11a32fe38d 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -49,24 +49,28 @@ target_compile_options(cxx_warnings INTERFACE target_link_libraries(cxx_options INTERFACE cxx_warnings) -# TODO: Reopening the question whether we need it; Silvan could build in VS Code without it. -macro(fast_downward_default_to_release_build) - # Only for single-config generators (like Makefiles) that choose the build type at generation time. - if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - message(STATUS "Defaulting to release build.") - set(default_build_type "Release") +function(fast_downward_set_up_build_types) + set(allowedBuildTypes Debug Release) + + get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(isMultiConfig) + # Set the possible choices for multi-config generators like (like + # Visual Studio Projects) that choose the build type at build time. + set(CMAKE_CONFIGURATION_TYPES "${allowedBuildTypes}" + CACHE STRING "Supported build types: ${allowedBuildTypes}" FORCE) + else() + # Set the possible choices for programs like ccmake. + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowedBuildTypes}") + if(NOT CMAKE_BUILD_TYPE) + message(STATUS "Defaulting to release build.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE) + elseif(NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes) + message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}. " + "Supported build types: ${allowedBuildTypes}") + endif() endif() -endmacro() +endfunction() -# TODO: I cannot find out how to replace this set(CMAKE_* ...) call -macro(fast_downward_set_configuration_types) - # Only for multi-config generators (like Visual Studio Projects) that choose - # the build type at build time. - if(CMAKE_CONFIGURATION_TYPES) - set(CMAKE_CONFIGURATION_TYPES "Debug;Release" - CACHE STRING "Reset the configurations to what we need" FORCE) - endif() -endmacro() macro(fast_downward_report_bitwidth) if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 428561899a..ae64ee360d 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -28,6 +28,9 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") ## == Libraries == +# TODO the next two libraries should be dependencies of the (interface) library +# that actually uses the corresponding methods (probably the one containing system.h?). + # On Linux, find the rt library for clock_gettime(). if(UNIX AND NOT APPLE) target_link_libraries(downward PRIVATE rt) From 31e22b8a4662ca9c503a0bbba96e3cec4b0f8e7e Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 28 Jul 2023 20:56:53 +0200 Subject: [PATCH 28/79] reduce code affected by #ifdefs --- src/search/DownwardFiles.cmake | 14 ++++++-------- src/search/lp/cplex_solver_interface.cc | 2 -- src/search/lp/cplex_solver_interface.h | 2 -- src/search/lp/lp_solver.cc | 4 ++++ src/search/lp/soplex_solver_interface.cc | 4 ---- src/search/lp/soplex_solver_interface.h | 3 --- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/search/DownwardFiles.cmake b/src/search/DownwardFiles.cmake index 0d7694fcb5..f909d67bfe 100644 --- a/src/search/DownwardFiles.cmake +++ b/src/search/DownwardFiles.cmake @@ -9,7 +9,7 @@ # In that case, individual libraries can be enabled with # -DLIBRARY_FOO_ENABLED=TRUE # -# Defining a new plugin: +# Defining a new library: # create_fast_downward_library( # NAME # [ DISPLAY_NAME ] @@ -24,14 +24,14 @@ # defaults to lower case and is used to group files # in IDEs and for messages. # defaults to and is used to describe the cmake option. -# SOURCES lists the source files that are part of the plugin. Entries are +# SOURCES lists the source files that are part of the library. Entries are # listed without extension. For an entry , both .h and .cc # are added if the files exist. -# DEPENDS lists libraries that will be automatically enabled if this plugin is +# DEPENDS lists libraries that will be automatically enabled if this library is # enabled. If the dependency was not enabled before, this will be logged. -# DEPENDENCY_ONLY disables the plugin unless it is needed as a dependency and -# hides the option to enable the plugin in cmake GUIs like ccmake. -# CORE_LIBRARY always enables the plugin (even if DISABLE_LIBRARIES_BY_DEFAULT +# DEPENDENCY_ONLY disables the library unless it is needed as a dependency and +# hides the option to enable the library in cmake GUIs like ccmake. +# CORE_LIBRARY always enables the library (even if DISABLE_LIBRARIES_BY_DEFAULT # is used) and hides the option to disable it in CMake GUIs like ccmake. option( @@ -46,8 +46,6 @@ create_fast_downward_library( NAME CORE_SOURCES HELP "Core source files" SOURCES - planner - abstract_task axioms command_line diff --git a/src/search/lp/cplex_solver_interface.cc b/src/search/lp/cplex_solver_interface.cc index 3989fe3145..d6e3eb9617 100644 --- a/src/search/lp/cplex_solver_interface.cc +++ b/src/search/lp/cplex_solver_interface.cc @@ -1,5 +1,4 @@ #include "cplex_solver_interface.h" -#ifdef HAS_CPLEX #include "lp_solver.h" @@ -595,4 +594,3 @@ void CplexSolverInterface::print_statistics() const { utils::g_log << "LP non-zero entries: " << CPXgetnumnz(env, problem) << endl; } } -#endif diff --git a/src/search/lp/cplex_solver_interface.h b/src/search/lp/cplex_solver_interface.h index f16ee3e0c9..db8d7ad64e 100644 --- a/src/search/lp/cplex_solver_interface.h +++ b/src/search/lp/cplex_solver_interface.h @@ -1,6 +1,5 @@ #ifndef LP_CPLEX_SOLVER_INTERFACE_H #define LP_CPLEX_SOLVER_INTERFACE_H -#ifdef HAS_CPLEX #include "lp_solver.h" #include "solver_interface.h" @@ -226,4 +225,3 @@ class CplexSolverInterface : public SolverInterface { }; } #endif -#endif diff --git a/src/search/lp/lp_solver.cc b/src/search/lp/lp_solver.cc index 0ff45a9153..c0b9851638 100644 --- a/src/search/lp/lp_solver.cc +++ b/src/search/lp/lp_solver.cc @@ -1,7 +1,11 @@ #include "lp_solver.h" +#ifdef HAS_CPLEX #include "cplex_solver_interface.h" +#endif +#ifdef HAS_SOPLEX #include "soplex_solver_interface.h" +#endif #include "../plugins/plugin.h" diff --git a/src/search/lp/soplex_solver_interface.cc b/src/search/lp/soplex_solver_interface.cc index bf08d33578..a5e4dc7d10 100644 --- a/src/search/lp/soplex_solver_interface.cc +++ b/src/search/lp/soplex_solver_interface.cc @@ -4,8 +4,6 @@ #include "../utils/system.h" -#ifdef HAS_SOPLEX - using namespace std; using namespace soplex; @@ -228,5 +226,3 @@ void SoPlexSolverInterface::print_statistics() const { soplex.printStatistics(cout); } } - -#endif diff --git a/src/search/lp/soplex_solver_interface.h b/src/search/lp/soplex_solver_interface.h index 839561758a..50bc3fb75f 100644 --- a/src/search/lp/soplex_solver_interface.h +++ b/src/search/lp/soplex_solver_interface.h @@ -1,8 +1,6 @@ #ifndef LP_SOPLEX_SOLVER_INTERFACE_H #define LP_SOPLEX_SOLVER_INTERFACE_H -#ifdef HAS_SOPLEX - #include "solver_interface.h" #ifdef __GNUG__ @@ -66,4 +64,3 @@ class SoPlexSolverInterface : public SolverInterface { } #endif -#endif From 1490f5c1d7dedcf516be7e6d9aa6e3eeba707a61 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sat, 29 Jul 2023 14:23:21 +0200 Subject: [PATCH 29/79] Link soplex from cmake config package --- src/cmake_modules/FindSoPlex.cmake | 78 ------------------------------ src/search/CMakeLists.txt | 13 ++--- 2 files changed, 5 insertions(+), 86 deletions(-) delete mode 100644 src/cmake_modules/FindSoPlex.cmake diff --git a/src/cmake_modules/FindSoPlex.cmake b/src/cmake_modules/FindSoPlex.cmake deleted file mode 100644 index 9716055f2b..0000000000 --- a/src/cmake_modules/FindSoPlex.cmake +++ /dev/null @@ -1,78 +0,0 @@ -# - Find the SoPlex LP solver. -# This code defines the following variables: -# -# SOPLEX_FOUND - TRUE if SOPLEX was found. -# SOPLEX_INCLUDE_DIRS - Full paths to all include dirs. -# SOPLEX_LIBRARIES - Full paths to all libraries. -# -# Usage: -# find_package(soplex) -# -# The location of SoPlex can be specified using the environment variable -# or cmake parameter DOWNWARD_SOPLEX_ROOT. If different installations -# for release/debug versions of SOPLEX are available, they can be -# specified with -# DOWNWARD_SOPLEX_ROOT -# DOWNWARD_SOPLEX_ROOT_RELEASE -# DOWNWARD_SOPLEX_ROOT_DEBUG -# More specific paths are preferred over less specific ones when searching -# for libraries. -# -# Note that the standard FIND_PACKAGE features are supported -# (QUIET, REQUIRED, etc.). - -foreach(BUILDMODE "RELEASE" "DEBUG") - set(SOPLEX_HINT_PATHS_${BUILDMODE} - ${DOWNWARD_SOPLEX_ROOT_${BUILDMODE}} - $ENV{DOWNWARD_SOPLEX_ROOT_${BUILDMODE}} - ${DOWNWARD_SOPLEX_ROOT} - $ENV{DOWNWARD_SOPLEX_ROOT} - ) -endforeach() - -find_path(SOPLEX_INCLUDE_DIRS - NAMES - soplex.h - HINTS - ${SOPLEX_HINT_PATHS_RELEASE} - ${SOPLEX_HINT_PATHS_DEBUG} - PATH_SUFFIXES - include -) - -find_library(SOPLEX_LIBRARY_RELEASE - NAMES - soplex - HINTS - ${SOPLEX_HINT_PATHS_RELEASE} - PATH_SUFFIXES - lib -) - -find_library(SOPLEX_LIBRARY_DEBUG - NAMES - soplex - HINTS - ${SOPLEX_HINT_PATHS_DEBUG} - PATH_SUFFIXES - lib -) - -if(SOPLEX_LIBRARY_RELEASE OR SOPLEX_LIBRARY_DEBUG) - set(SOPLEX_LIBRARIES - optimized ${SOPLEX_LIBRARY_RELEASE} - debug ${SOPLEX_LIBRARY_DEBUG} - ) -endif() - -# Check if everything was found and set SOPLEX_FOUND. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - SoPlex - REQUIRED_VARS SOPLEX_INCLUDE_DIRS SOPLEX_LIBRARIES -) - -mark_as_advanced( - SOPLEX_INCLUDE_DIRS SOPLEX_LIBRARIES - SOPLEX_LIBRARY_RELEASE SOPLEX_LIBRARY_DEBUG -) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ae64ee360d..ab6a53a0e2 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -71,18 +71,15 @@ if(USE_LP) target_link_libraries(downward_LP_SOLVER INTERFACE downward_cplex_interface) endif() - find_package(SoPlex) + # TODO: we actually require a version greater than 6.0.3 but it is not released yet. + find_package(soplex 6.0.3) if (SOPLEX_FOUND) + message(STATUS "Found SoPlex: ${SOPLEX_INCLUDE_DIRS}") add_library(downward_soplex_interface INTERFACE) + target_link_libraries(downward_soplex_interface INTERFACE libsoplex) target_compile_definitions(downward_soplex_interface INTERFACE HAS_SOPLEX) - target_include_directories(downward_soplex_interface INTERFACE ${SOPLEX_INCLUDE_DIRS}) - target_link_libraries(downward_soplex_interface INTERFACE ${SOPLEX_LIBRARIES}) - find_package(ZLIB REQUIRED) - target_include_directories(downward_soplex_interface INTERFACE ${ZLIB_INCLUDE_DIRS}) - target_link_libraries(downward_soplex_interface INTERFACE ${ZLIB_LIBRARIES}) - find_library(GMP_LIBRARY gmp REQUIRED) - target_link_libraries(downward_soplex_interface INTERFACE ${GMP_LIBRARY}) target_sources(downward_soplex_interface INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) + target_link_libraries(downward_LP_SOLVER INTERFACE downward_soplex_interface) endif() From 451ab081999b1b6f42de3a1d9e901dd6cf8f32ed Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 30 Jul 2023 17:08:58 +0200 Subject: [PATCH 30/79] fix workflow for soplex --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index b1d3a0fc43..4ae57dcc66 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -31,7 +31,7 @@ jobs: CPLEX_URL: ${{ secrets.CPLEX2211_LINUX_URL }} DOWNWARD_CPLEX_ROOT: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex CPLEX_LIB: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex/bin/x86-64_linux/libcplex2211.so - DOWNWARD_SOPLEX_ROOT: /home/runner/lib/soplex-6.0.3x + soplex_DIR: /home/runner/lib/soplex-6.0.3x SOPLEX_LIB: /home/runner/lib/soplex-6.0.3x/lib/ SOPLEX_INCLUDE: /home/runner/lib/soplex-6.0.3x/include/ steps: From 818cb321002605c35d2351d51504fe8746840178 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 30 Jul 2023 17:13:39 +0200 Subject: [PATCH 31/79] fix workflow for soplex --- .github/workflows/ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 4ae57dcc66..357473b0d7 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -31,7 +31,7 @@ jobs: CPLEX_URL: ${{ secrets.CPLEX2211_LINUX_URL }} DOWNWARD_CPLEX_ROOT: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex CPLEX_LIB: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex/bin/x86-64_linux/libcplex2211.so - soplex_DIR: /home/runner/lib/soplex-6.0.3x + SOPLEX_DIR: /home/runner/lib/soplex-6.0.3x SOPLEX_LIB: /home/runner/lib/soplex-6.0.3x/lib/ SOPLEX_INCLUDE: /home/runner/lib/soplex-6.0.3x/include/ steps: @@ -76,7 +76,7 @@ jobs: cd .. cmake -S soplex -B build cmake --build build - cmake --install build --prefix "${DOWNWARD_SOPLEX_ROOT}" + cmake --install build --prefix "${SOPLEX_DIR}" rm -rf soplex build - name: Compile planner From defdd51160d51de606c7717cd74a372b4317f673 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 30 Jul 2023 17:19:01 +0200 Subject: [PATCH 32/79] fix tox setup --- misc/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tox.ini b/misc/tox.ini index 45fe839450..2ec9fa7e0a 100644 --- a/misc/tox.ini +++ b/misc/tox.ini @@ -30,7 +30,7 @@ commands = changedir = {toxinidir}/../ passenv = DOWNWARD_CPLEX_ROOT - DOWNWARD_SOPLEX_ROOT + SOPLEX_DIR commands = ./build.py ./build.py --debug From df21a2764f3ac37bf4eeb009f4aa3c553c0f5543 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 30 Jul 2023 17:24:47 +0200 Subject: [PATCH 33/79] fix case of soplex_DIR --- .github/workflows/ubuntu.yml | 4 ++-- misc/tox.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 357473b0d7..66a7ecb260 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -31,7 +31,7 @@ jobs: CPLEX_URL: ${{ secrets.CPLEX2211_LINUX_URL }} DOWNWARD_CPLEX_ROOT: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex CPLEX_LIB: /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex/bin/x86-64_linux/libcplex2211.so - SOPLEX_DIR: /home/runner/lib/soplex-6.0.3x + soplex_DIR: /home/runner/lib/soplex-6.0.3x SOPLEX_LIB: /home/runner/lib/soplex-6.0.3x/lib/ SOPLEX_INCLUDE: /home/runner/lib/soplex-6.0.3x/include/ steps: @@ -76,7 +76,7 @@ jobs: cd .. cmake -S soplex -B build cmake --build build - cmake --install build --prefix "${SOPLEX_DIR}" + cmake --install build --prefix "${soplex_DIR}" rm -rf soplex build - name: Compile planner diff --git a/misc/tox.ini b/misc/tox.ini index 2ec9fa7e0a..6bb6c225b2 100644 --- a/misc/tox.ini +++ b/misc/tox.ini @@ -30,7 +30,7 @@ commands = changedir = {toxinidir}/../ passenv = DOWNWARD_CPLEX_ROOT - SOPLEX_DIR + soplex_DIR commands = ./build.py ./build.py --debug From cc499bdd8849bb9c4cd24485f5a8488e5a96baaf Mon Sep 17 00:00:00 2001 From: Silvan Sievers Date: Mon, 31 Jul 2023 18:15:22 +0200 Subject: [PATCH 34/79] remove comment (no need for two cmake calls) --- src/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7dd954a115..5a2c0a5f5c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,9 +42,6 @@ project(fast-downward LANGUAGES CXX) fast_downward_report_bitwidth() -# TODO: test if this is still the case. It looks ok for multi-config ninja. -# Due to a bug in cmake, configuration types are only set up correctly on the second cmake run. -# This means that cmake has to be called twice for multi-config generators like Visual Studio. fast_downward_set_up_build_types() # TODO: can we get rid of this? The point was to prevent src/search/CMakeLists.txt From 12186f9d716656a5edae565db55b0fb83413414c Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Wed, 2 Aug 2023 11:08:44 +0200 Subject: [PATCH 35/79] Fix dependency test. --- misc/tests/test-dependencies.py | 105 +++++++++++++++++++------------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/misc/tests/test-dependencies.py b/misc/tests/test-dependencies.py index 0d09374fd0..3b18db7fee 100755 --- a/misc/tests/test-dependencies.py +++ b/misc/tests/test-dependencies.py @@ -1,58 +1,82 @@ #! /usr/bin/env python3 import os +import re import shutil import subprocess import sys DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) -DOWNWARD_FILES = os.path.join(REPO, "src", "search", "DownwardFiles.cmake") -TEST_BUILD_CONFIGS = os.path.join(REPO, "test_build_configs.py") -BUILD = os.path.join(REPO, "build.py") -BUILDS = os.path.join(REPO, "builds") -paths_to_clean = [TEST_BUILD_CONFIGS] - - -def clean_up(paths_to_clean): - print("\nCleaning up") - for path in paths_to_clean: - print("Removing {path}".format(**locals())) - if os.path.isfile(path): - os.remove(path) - if os.path.isdir(path): - shutil.rmtree(path) - print("Done cleaning") - - -with open(DOWNWARD_FILES) as d: - content = d.readlines() - -content = [line for line in content if '#' not in line] -content = [line for line in content if 'NAME' in line or 'CORE_LIBRARY' in line or 'DEPENDENCY_ONLY' in line] - -libraries_to_be_tested = [] -for line in content: - if 'NAME' in line: - libraries_to_be_tested.append(line.replace("NAME", "").strip()) - if 'CORE_LIBRARY' in line or 'DEPENDENCY_ONLY' in line: - libraries_to_be_tested.pop() - -with open(TEST_BUILD_CONFIGS, "w") as f: - for library in libraries_to_be_tested: - lowercase = library.lower() - line = "{lowercase} = [\"-DCMAKE_BUILD_TYPE=Debug\", \"-DDISABLE_LIBRARIES_BY_DEFAULT=YES\"," \ - " \"-DLIBRARY_{library}_ENABLED=True\"]\n".format(**locals()) - f.write(line) - paths_to_clean.append(os.path.join(BUILDS, lowercase)) +LIBRARY_DEFINITION_FILE = os.path.join(REPO, "src", "search", "DownwardFiles.cmake") +BUILDS = os.path.join(REPO, "builds/test-dependencies") + +# Find the closing bracket matching the opening bracket that occurred before start +def find_corresponding_closing_bracket(content, start): + nested_level = 1 + for index, character in enumerate(content[start:]): + if character == "(": + nested_level += 1 + if character == ")": + nested_level -= 1 + if nested_level == 0: + return index+start + +# Extract all "create_fast_downward_library(...)" blocks and if the library is +# not a core or depencency library, add its name to the return list. +def get_library_definitions(content): + libraries = [] + library_definition_string = "create_fast_downward_library\(" + pattern = re.compile(library_definition_string) + for library_match in pattern.finditer(content): + start = library_match.start()+len(library_definition_string) + end = find_corresponding_closing_bracket(content, start) + library_definition = content[start:end] + # we cannot manually en-/disable core and dependency only libraries + if any(s in library_definition for s in ["CORE_LIBRARY", "DEPENDENCY_ONLY"]): + continue + name_match = re.search("NAME (\S+)", library_definition) + assert(name_match) + name = name_match.group(1) + libraries.append(name) + return libraries + + +# Try to get the number of CPUs +try: + # Number of usable CPUs (Unix only) + NUM_CPUS = len(os.sched_getaffinity(0)) +except AttributeError: + # Number of available CPUs as a fall-back (may be None) + NUM_CPUS = os.cpu_count() + +# Read in the file where libraries are defined and extract the library names. +with open(LIBRARY_DEFINITION_FILE) as d: + content = d.read() +content = re.sub('#(.*)','', content) #Remove all comments +libraries = get_library_definitions(content) + +# Build each library and add it to libraries_failed_test if not successfull. libraries_failed_test = [] -for library in libraries_to_be_tested: +for library in libraries: + build_path = os.path.join(BUILDS, library.lower()) + config_args = [ + "cmake", "-S", os.path.join(REPO, "src"), "-B", build_path, + "-DCMAKE_BUILD_TYPE=Debug", "-DDISABLE_LIBRARIES_BY_DEFAULT=YES", + "-DLIBRARY_{library}_ENABLED=True\"]\n".format(**locals()) + ] + build_args = ["cmake", "--build", build_path] + if NUM_CPUS: + build_args += ["-j", f"{NUM_CPUS}"] + try: - subprocess.check_call([BUILD, library.lower()]) + subprocess.check_call(config_args) + subprocess.check_call(build_args) except subprocess.CalledProcessError: libraries_failed_test.append(library) +# Report the result of the test. if libraries_failed_test: print("\nFailure:") for library in libraries_failed_test: @@ -60,4 +84,3 @@ def clean_up(paths_to_clean): sys.exit(1) else: print("\nAll libraries have passed dependencies test") - clean_up(paths_to_clean) From 1a949c268051fcefea39d0dc952ef10617404fc6 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Wed, 2 Aug 2023 12:20:01 +0200 Subject: [PATCH 36/79] Fix style. --- misc/tests/test-dependencies.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/misc/tests/test-dependencies.py b/misc/tests/test-dependencies.py index 3b18db7fee..bac02159fb 100755 --- a/misc/tests/test-dependencies.py +++ b/misc/tests/test-dependencies.py @@ -27,7 +27,7 @@ def find_corresponding_closing_bracket(content, start): # not a core or depencency library, add its name to the return list. def get_library_definitions(content): libraries = [] - library_definition_string = "create_fast_downward_library\(" + library_definition_string = r"create_fast_downward_library\(" pattern = re.compile(library_definition_string) for library_match in pattern.finditer(content): start = library_match.start()+len(library_definition_string) @@ -36,8 +36,8 @@ def get_library_definitions(content): # we cannot manually en-/disable core and dependency only libraries if any(s in library_definition for s in ["CORE_LIBRARY", "DEPENDENCY_ONLY"]): continue - name_match = re.search("NAME (\S+)", library_definition) - assert(name_match) + name_match = re.search(r"NAME (\S+)", library_definition) + assert name_match name = name_match.group(1) libraries.append(name) return libraries @@ -54,7 +54,7 @@ def get_library_definitions(content): # Read in the file where libraries are defined and extract the library names. with open(LIBRARY_DEFINITION_FILE) as d: content = d.read() -content = re.sub('#(.*)','', content) #Remove all comments +content = re.sub(r"#(.*)", "", content) # Remove all comments libraries = get_library_definitions(content) # Build each library and add it to libraries_failed_test if not successfull. @@ -62,7 +62,7 @@ def get_library_definitions(content): for library in libraries: build_path = os.path.join(BUILDS, library.lower()) config_args = [ - "cmake", "-S", os.path.join(REPO, "src"), "-B", build_path, + "cmake", "-S", os.path.join(REPO, "src"), "-B", build_path, "-DCMAKE_BUILD_TYPE=Debug", "-DDISABLE_LIBRARIES_BY_DEFAULT=YES", "-DLIBRARY_{library}_ENABLED=True\"]\n".format(**locals()) ] From e87cc9729ad4bf8f0a7ae07aeaf17b34841c7202 Mon Sep 17 00:00:00 2001 From: Silvan Sievers Date: Wed, 2 Aug 2023 16:06:31 +0200 Subject: [PATCH 37/79] remove hack to explicitly look for cc variables and use gcc as fallback --- src/CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5a2c0a5f5c..4de0067d5a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,13 +25,6 @@ cmake_minimum_required(VERSION 3.16) -# TODO: test if this is still needed on ony of the generators we care about. -# Select a default compiler because CMake does not respect the PATH environment variable for some generators, -# e.g. used by existing compute servers in Basel. -# See https://stackoverflow.com/a/45934279 and https://issues.fast-downward.org/issue1031 for details. -find_program(CMAKE_C_COMPILER NAMES $ENV{CC} cc gcc PATHS ENV PATH NO_DEFAULT_PATH) -find_program(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ PATHS ENV PATH NO_DEFAULT_PATH) - # Path containing custom CMake modules list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) include(FastDownwardMacros) From f9067053b3ca792a3f3317efed3fc08f133c0077 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Wed, 2 Aug 2023 17:38:36 +0200 Subject: [PATCH 38/79] Fix rebase error. --- src/cmake_modules/FastDownwardMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 11a32fe38d..61c92659f4 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -26,7 +26,7 @@ target_compile_options(cxx_options INTERFACE add_library(cxx_warnings INTERFACE) target_compile_options(cxx_warnings INTERFACE - "$<${gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") + "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") ## We ignore the warning "restrict" because of a bug in GCC 12: ## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 From bc99df4e2aac92898308c56b337dbd7e28f88ec5 Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Wed, 2 Aug 2023 17:39:56 +0200 Subject: [PATCH 39/79] Suppress warning when soplex was not found. --- src/search/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ab6a53a0e2..ab115adab9 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -72,7 +72,7 @@ if(USE_LP) endif() # TODO: we actually require a version greater than 6.0.3 but it is not released yet. - find_package(soplex 6.0.3) + find_package(soplex 6.0.3 QUIET) if (SOPLEX_FOUND) message(STATUS "Found SoPlex: ${SOPLEX_INCLUDE_DIRS}") add_library(downward_soplex_interface INTERFACE) From 262da5804403b1d9fe5a05227cf204c11fc58d5a Mon Sep 17 00:00:00 2001 From: Salome Eriksson Date: Wed, 2 Aug 2023 17:48:39 +0200 Subject: [PATCH 40/79] Updated test-memory-leaks to take command line parameters for suppression files, removed writing out cxx compiler version in cmake. --- misc/tests/conftest.py | 8 +++++++ misc/tests/test-memory-leaks.py | 37 ++++++++++----------------------- src/CMakeLists.txt | 6 ------ 3 files changed, 19 insertions(+), 32 deletions(-) create mode 100644 misc/tests/conftest.py diff --git a/misc/tests/conftest.py b/misc/tests/conftest.py new file mode 100644 index 0000000000..5cd17c61d6 --- /dev/null +++ b/misc/tests/conftest.py @@ -0,0 +1,8 @@ +def pytest_addoption(parser): + parser.addoption("--suppress", action="append", default=[], + help="Suppression files used in test-memory-leaks.py. These files must be located in the folder valgrind.") + +def pytest_generate_tests(metafunc): + if "suppression_files" in metafunc.fixturenames: + tags = list(metafunc.config.option.suppress) + metafunc.parametrize("suppression_files", [tags], scope='session') diff --git a/misc/tests/test-memory-leaks.py b/misc/tests/test-memory-leaks.py index 44b75aa025..5769c1dfb6 100644 --- a/misc/tests/test-memory-leaks.py +++ b/misc/tests/test-memory-leaks.py @@ -17,8 +17,6 @@ DOWNWARD_BIN = os.path.join(BUILD_DIR, "bin", "downward") SAS_FILE = os.path.join(REPO, "test.sas") PLAN_FILE = os.path.join(REPO, "test.plan") -VALGRIND_GCC5_SUPPRESSION_FILE = os.path.join( - REPO, "misc", "tests", "valgrind", "gcc5.supp") DLOPEN_SUPPRESSION_FILE = os.path.join( REPO, "misc", "tests", "valgrind", "dlopen.supp") DL_CATCH_ERROR_SUPPRESSION_FILE = os.path.join( @@ -31,33 +29,20 @@ CONFIGS.update(configs.default_configs_optimal(core=True, extended=True)) CONFIGS.update(configs.default_configs_satisficing(core=True, extended=True)) - -def escape_list(l): - return " ".join(pipes.quote(x) for x in l) - - -def get_compiler_and_version(): - output = subprocess.check_output( - ["cmake", "-LA", "-N", "../../src/"], cwd=BUILD_DIR).decode("utf-8") - compiler = re.search( - "^DOWNWARD_CXX_COMPILER_ID:STRING=(.+)$", output, re.M).group(1) - version = re.search( - "^DOWNWARD_CXX_COMPILER_VERSION:STRING=(.+)$", output, re.M).group(1) - return compiler, version - - -COMPILER, COMPILER_VERSION = get_compiler_and_version() SUPPRESSION_FILES = [ DLOPEN_SUPPRESSION_FILE, DL_CATCH_ERROR_SUPPRESSION_FILE, ] -if COMPILER == "GNU" and COMPILER_VERSION.split(".")[0] == "5": - print("Using leak suppression file for GCC 5 " - "(see https://issues.fast-downward.org/issue703).") - SUPPRESSION_FILES.append(VALGRIND_GCC5_SUPPRESSION_FILE) + +def escape_list(l): + return " ".join(pipes.quote(x) for x in l) -def run_plan_script(task, config): +def run_plan_script(task, config, custom_suppression_files): + custom_suppression_files = [ + os.path.join(REPO, "misc", "tests", "valgrind", f) + for f in custom_suppression_files + ] assert "--alias" not in config, config cmd = [ "valgrind", @@ -66,7 +51,7 @@ def run_plan_script(task, config): "--show-leak-kinds=all", "--errors-for-leak-kinds=all", "--track-origins=yes"] - for suppression_file in SUPPRESSION_FILES: + for suppression_file in SUPPRESSION_FILES + custom_suppression_files: cmd.append("--suppressions={}".format(suppression_file)) cmd.extend([DOWNWARD_BIN] + config + ["--internal-plan-file", PLAN_FILE]) print("\nRun: {}".format(escape_list(cmd))) @@ -101,8 +86,8 @@ def setup_module(_module): @pytest.mark.parametrize("config", sorted(CONFIGS.values())) -def test_configs(config): - run_plan_script(SAS_FILE, config) +def test_configs(config, suppression_files): + run_plan_script(SAS_FILE, config, suppression_files) def teardown_module(_module): diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4de0067d5a..0930e65e00 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,12 +46,6 @@ set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -# Write compiler ID and version to the cache to allow retrieving this information -# with "cmake -LA" (see test-memory-leaks.py). -set(DOWNWARD_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID} CACHE STRING "") -set(DOWNWARD_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION} CACHE STRING "") -mark_as_advanced(DOWNWARD_CXX_COMPILER_ID DOWNWARD_CXX_COMPILER_VERSION) - # Add planner components as subprojects. # Copy the translator into the output directory. From 3f5a29eb5b2c36740e667aade15cd909f3f5bb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Thu, 3 Aug 2023 14:53:51 +0200 Subject: [PATCH 41/79] rt and psapi are now a dependency of the UTILS library. --- src/cmake_modules/FastDownwardMacros.cmake | 15 +++++++++++++++ src/search/CMakeLists.txt | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/cmake_modules/FastDownwardMacros.cmake index 61c92659f4..8bb17fa0b7 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/cmake_modules/FastDownwardMacros.cmake @@ -132,6 +132,21 @@ function(create_fast_downward_library) foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() + # TODO: This feels very hacky. I'd rather have the ability to specify + # external dependencies in DownwardFiles.cmake (i.e. new parameter + # DEPENDSEXTERNAL) but how to specify conditions there? + if (${_LIBRARY_NAME} STREQUAL "UTILS") + # On Linux, find the rt library for clock_gettime(). + if(UNIX AND NOT APPLE) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE rt) + endif() + + # On Windows, find the psapi library for determining peak memory. + if(WIN32) + cmake_policy(SET CMP0074 NEW) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE psapi) + endif() + endif() if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME}_ENABLED) target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ab115adab9..6603cc2073 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -28,20 +28,6 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") ## == Libraries == -# TODO the next two libraries should be dependencies of the (interface) library -# that actually uses the corresponding methods (probably the one containing system.h?). - -# On Linux, find the rt library for clock_gettime(). -if(UNIX AND NOT APPLE) - target_link_libraries(downward PRIVATE rt) -endif() - -# On Windows, find the psapi library for determining peak memory. -if(WIN32) - cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward PRIVATE psapi) -endif() - # If any enabled plugin requires an LP solver, compile with all # available LP solvers. If no solvers are installed, the planner will # still compile, but using heuristics that depend on an LP solver will From bb5d339775b21f3013b30b2fc2e5686ca6db37e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Thu, 3 Aug 2023 15:28:27 +0200 Subject: [PATCH 42/79] The cmake subdirectory search is now self-contained. --- src/CMakeLists.txt | 14 -------------- src/search/CMakeLists.txt | 13 ++++++------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0930e65e00..a0ed22d7c7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,24 +25,10 @@ cmake_minimum_required(VERSION 3.16) -# Path containing custom CMake modules -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) -include(FastDownwardMacros) - project(fast-downward DESCRIPTION "Fast Downward is a domain-independent classical planning system." HOMEPAGE_URL https://www.fast-downward.org/ LANGUAGES CXX) -fast_downward_report_bitwidth() - -fast_downward_set_up_build_types() - -# TODO: can we get rid of this? The point was to prevent src/search/CMakeLists.txt -# from being used without the general setup happening in this file, but we move the -# relevant setup there, maybe it is OK to use it stand-alone? If we cannot make the -# nested CMakeLists.txt self-contained, comparing CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR -# might be an option that does not require this magic variable at the top level. -set(FAST_DOWNWARD_MAIN_CMAKELISTS_READ TRUE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 6603cc2073..83ac548a53 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -1,18 +1,17 @@ cmake_minimum_required(VERSION 3.16) -if(NOT FAST_DOWNWARD_MAIN_CMAKELISTS_READ) - message( - FATAL_ERROR - "Run cmake on the CMakeLists.txt in the 'src' directory, " - "not the one in 'src/search'. Please delete CMakeCache.txt " - "from the current directory and restart cmake.") -endif() +# Path containing custom CMake modules +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules) +include(FastDownwardMacros) ## == Project == project(downward LANGUAGES CXX) +fast_downward_report_bitwidth() +fast_downward_set_up_build_types() + option( USE_GLIBCXX_DEBUG "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ From 80178515f58ab9792d8e1726f63e9a717f0211e9 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 6 Aug 2023 12:34:21 +0200 Subject: [PATCH 43/79] New find script for CPLEX --- .github/workflows/windows.yml | 2 + src/cmake_modules/FindCplex.cmake | 253 ++++++++++++++---------------- src/search/CMakeLists.txt | 22 ++- 3 files changed, 132 insertions(+), 145 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ea37cdc8e7..dcc16e152b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -78,6 +78,8 @@ jobs: echo "Copy the relevant directory to a location which is not magically protected against cmake" Xcopy /E /I ..\cplex_temp\cplex ..\cplex + tree ..\cplex /F + - name: Compile planner shell: cmd diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index 32848d7124..c450c1fc33 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -1,42 +1,23 @@ -# - Find the CPLEX LP solver. -# This code defines the following variables: -# -# CPLEX_FOUND - TRUE if CPLEX was found. -# CPLEX_INCLUDE_DIRS - Full paths to all include dirs. -# CPLEX_LIBRARIES - Full paths to all libraries. -# CPLEX_RUNTIME_LIBRARY - Full path to the dll file on windows +# Find the CPLEX LP solver and export the target cplex::cplex. # # Usage: # find_package(cplex) +# target_link_libraries( PRIVATE cplex::cplex) # # The location of CPLEX can be specified using the environment variable -# or cmake parameter DOWNWARD_CPLEX_ROOT. If different installations -# for release/debug versions of CPLEX are available,they can be -# specified with -# DOWNWARD_CPLEX_ROOT -# DOWNWARD_CPLEX_ROOT_RELEASE -# DOWNWARD_CPLEX_ROOT_DEBUG -# More specific paths are preferred over less specific ones when searching -# for libraries. +# or cmake parameter DOWNWARD_CPLEX_ROOT. # -# Note that the standard FIND_PACKAGE features are supported -# (QUIET, REQUIRED, etc.). - -foreach(BUILDMODE "RELEASE" "DEBUG") - set(CPLEX_HINT_PATHS_${BUILDMODE} - ${DOWNWARD_CPLEX_ROOT_${BUILDMODE}} - $ENV{DOWNWARD_CPLEX_ROOT_${BUILDMODE}} - ${DOWNWARD_CPLEX_ROOT} - $ENV{DOWNWARD_CPLEX_ROOT} - ) -endforeach() +# The standard FIND_PACKAGE features are supported (QUIET, REQUIRED, etc.). + +set(SUPPORTED_CONFIGURATIONS "Debug" "Release") + +set(HINT_PATHS ${DOWNWARD_CPLEX_ROOT} $ENV{DOWNWARD_CPLEX_ROOT}) find_path(CPLEX_INCLUDE_DIRS NAMES cplex.h HINTS - ${CPLEX_HINT_PATHS_RELEASE} - ${CPLEX_HINT_PATHS_DEBUG} + ${HINT_PATHS} PATH_SUFFIXES include/ilcplex ) @@ -58,136 +39,142 @@ if(CPLEX_INCLUDE_DIRS) endif() -if(APPLE) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32 - "lib/x86_osx/static_pic") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32 ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32}) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64 - "lib/x86-64_osx/static_pic") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64 ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64}) -elseif(UNIX) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32 - "lib/x86_sles10_4.1/static_pic" - "lib/x86_linux/static_pic") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32 ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32}) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64 - "bin/x86-64_linux/" - "lib/x86-64_sles10_4.1/static_pic" - "lib/x86-64_linux/static_pic") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64 ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64}) -elseif(MSVC) - # Note that the numbers are correct: Visual Studio 2011 is version 10. - if (MSVC10) - set(CPLEX_COMPILER_HINT "vs2011") - elseif(MSVC11) - set(CPLEX_COMPILER_HINT "vs2012") - elseif(MSVC12) - set(CPLEX_COMPILER_HINT "vs2013") - elseif(MSVC13) - set(CPLEX_COMPILER_HINT "vs2015") - elseif(MSVC14) - set(CPLEX_COMPILER_HINT "msvc14") - endif() +# CPLEX stores libraries under different paths of the form +# /lib/_[_]// +# /bin/_[_]// +# The hints have different options depending on the system and CPLEX version. +# We set up lists with all options and then multiply them out to set up +# possible paths where we should search for the library. - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32 "lib/x86_windows_${CPLEX_COMPILER_HINT}/stat_mda") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32 "lib/x86_windows_${CPLEX_COMPILER_HINT}/stat_mdd") - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64 - "lib/x86-64_windows_${CPLEX_COMPILER_HINT}/stat_mda" - "lib/x64_windows_${CPLEX_COMPILER_HINT}/stat_mda") - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64 - "lib/x86-64_windows_${CPLEX_COMPILER_HINT}/stat_mdd" - "lib/x64_windows_${CPLEX_COMPILER_HINT}/stat_mdd") +if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(BITWIDTH_HINTS "x86") +elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(BITWIDTH_HINTS "x86-64" "x64") +endif() +if(APPLE) + set(PLATFORM_HINTS "osx") +elseif(LINUX) + set(PLATFORM_HINTS "linux" "sles10_4.1") +elseif(WIN32) # Despite the name, WIN32 is also true on 64-bit systems. if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(CPLEX_RUNTIME_LIBRARY_HINT "bin/x86_win32") + set(PLATFORM_HINTS "windows" "win32") elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(CPLEX_RUNTIME_LIBRARY_HINT "bin/x64_win64") + set(PLATFORM_HINTS "windows" "win64") endif() endif() -if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32}) - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32}) -elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64}) - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64}) -else() - message(WARNING "Bitwidth could not be detected, preferring 32bit version of CPLEX") - set(CPLEX_LIBRARY_PATH_SUFFIX_RELEASE - ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32} - ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64} - ) - set(CPLEX_LIBRARY_PATH_SUFFIX_DEBUG - ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32} - ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64} - ) +set(COMPILER_HINTS) +if(MSVC10) + # Note that the numbers are correct: Visual Studio 2011 is version 10. + set(COMPILER_HINTS "vs2011" "msvc10") +elseif(MSVC11) + set(COMPILER_HINTS "vs2012" "msvc11") +elseif(MSVC12) + set(COMPILER_HINTS "vs2013" "msvc12") +elseif(MSVC13) + set(COMPILER_HINTS "vs2015" "msvc13") +elseif(MSVC14) + set(COMPILER_HINTS "vs2017" "msvc14") endif() -# CMake uses the first discovered library, searching in the order they -# are mentioned here. We prefer dynamic libraries over static ones -# (see issue925). -find_library(CPLEX_LIBRARY_RELEASE - NAMES - cplex${CPLEX_VERSION_NO_DOTS} - cplex - HINTS - ${CPLEX_HINT_PATHS_RELEASE} - PATH_SUFFIXES - ${CPLEX_LIBRARY_PATH_SUFFIX_RELEASE} -) +if(LINUX OR APPLE) + set(LIBRARY_TYPE_HINTS_RELEASE "static_pic") + set(LIBRARY_TYPE_HINTS_DEBUG "static_pic") +elseif(WIN32) + set(LIBRARY_TYPE_HINTS_RELEASE "stat_mda") + set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd") +endif() -# See above. -find_library(CPLEX_LIBRARY_DEBUG - NAMES - cplex${CPLEX_VERSION_NO_DOTS} - cplex - HINTS - ${CPLEX_HINT_PATHS_DEBUG} - PATH_SUFFIXES - ${CPLEX_LIBRARY_PATH_SUFFIX_DEBUG} +add_library(cplex::cplex IMPORTED SHARED) +target_include_directories(cplex::cplex INTERFACE ${CPLEX_INCLUDE_DIRS}) +set_target_properties(cplex::cplex PROPERTIES + IMPORTED_CONFIGURATIONS "${SUPPORTED_CONFIGURATIONS}" ) -if(CPLEX_LIBRARY_RELEASE OR CPLEX_LIBRARY_DEBUG) - find_package(Threads REQUIRED) +foreach(CONFIG_ORIG ${SUPPORTED_CONFIGURATIONS}) + # The configuration needs to be upper case in variable names like + # IMPORTED_LOCATION_${CONFIG}. + string(TOUPPER ${CONFIG_ORIG} CONFIG) + + # Collect possible suffixes. + foreach(BITWIDTH_HINT ${BITWIDTH_HINTS}) + foreach(PLATFORM_HINT ${PLATFORM_HINTS}) + foreach(LIBRARY_TYPE_HINT ${LIBRARY_TYPE_HINTS_${CONFIG}}) + list(APPEND SUFFIXES_${CONFIG} "${BITWIDTH_HINT}_${PLATFORM_HINT}/${LIBRARY_TYPE_HINT}") + foreach(COMPILER_HINT ${COMPILER_HINTS}) + list(APPEND SUFFIXES_${CONFIG} "${BITWIDTH_HINT}_${PLATFORM_HINT}_${COMPILER_HINT}/${LIBRARY_TYPE_HINT}") + endforeach() + endforeach() + endforeach() + endforeach() + + # CPLEX stores .so and .dll files in /bin + find_library(CPLEX_SHARED_LIBRARY_${CONFIG} + NAMES + cplex${CPLEX_VERSION_NO_DOTS} + HINTS + ${HINT_PATHS}/bin + PATH_SUFFIXES + ${SUFFIXES_${CONFIG}} + ) - set(CPLEX_LIBRARIES_COMMON ${CMAKE_THREAD_LIBS_INIT}) - if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) - set(CPLEX_LIBRARIES_COMMON ${CPLEX_LIBRARIES_COMMON} ${CMAKE_DL_LIBS}) - endif() + # Even though, we are defining a shared library, on windows, we require the + # implib (.lib or .dll.a) file as well, which is in /lib. On other systems + # this will find the static lib (.a) but the setting we use it for will be + # ignored. + find_library(CPLEX_IMPLIB_${CONFIG} + NAMES + cplex + HINTS + ${HINT_PATHS}/lib + PATH_SUFFIXES + ${SUFFIXES_${CONFIG}} + ) + + message(STATUS "HINTS: ${HINT_PATHS}/lib") + message(STATUS "SUFFIXES_${CONFIG}: ${SUFFIXES_${CONFIG}}") + message(STATUS "CPLEX_SHARED_LIBRARY_${CONFIG}: ${CPLEX_SHARED_LIBRARY_${CONFIG}}") + message(STATUS "CPLEX_IMPLIB_${CONFIG}: ${CPLEX_IMPLIB_${CONFIG}}") - set(CPLEX_LIBRARIES - optimized ${CPLEX_LIBRARY_RELEASE} ${CPLEX_LIBRARIES_COMMON} - debug ${CPLEX_LIBRARY_DEBUG} ${CPLEX_LIBRARIES_COMMON} + set_target_properties(cplex::cplex PROPERTIES + IMPORTED_LOCATION_${CONFIG} ${CPLEX_SHARED_LIBRARY_${CONFIG}} + IMPORTED_IMPLIB_${CONFIG} ${CPLEX_IMPLIB_${CONFIG}} ) +endforeach() + + +# Find dependencies + +set(FIND_OPTIONS) +if(${CPLEX_FIND_QUIETLY}) + list(APPEND FIND_OPTIONS "QUIET") +endif() +if(${CPLEX_FIND_REQUIRED}) + list(APPEND FIND_OPTIONS "REQUIRED") endif() +find_package(Threads ${FIND_OPTIONS}) -# HACK: there must be a better way to find the dll file. -find_path(CPLEX_RUNTIME_LIBRARY_PATH - NAMES - cplex${CPLEX_VERSION_NO_DOTS}.dll - HINTS - ${CPLEX_HINT_PATHS_RELEASE} - ${CPLEX_HINT_PATHS_DEBUG} - PATH_SUFFIXES - ${CPLEX_RUNTIME_LIBRARY_HINT} -) -if(CPLEX_RUNTIME_LIBRARY_PATH) - set(CPLEX_RUNTIME_LIBRARY "${CPLEX_RUNTIME_LIBRARY_PATH}/cplex${CPLEX_VERSION_NO_DOTS}.dll") +target_link_libraries(cplex::cplex INTERFACE Threads::Threads) +if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) + target_link_libraries(cplex::cplex INTERFACE ${CMAKE_DL_LIBS}) endif() # Check if everything was found and set CPLEX_FOUND. include(FindPackageHandleStandardArgs) find_package_handle_standard_args( Cplex - REQUIRED_VARS CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES + REQUIRED_VARS CPLEX_INCLUDE_DIRS CPLEX_SHARED_LIBRARY_RELEASE + CPLEX_SHARED_LIBRARY_DEBUG CPLEX_IMPLIB_RELEASE CPLEX_IMPLIB_DEBUG + THREADS_FOUND + VERSION_VAR CPLEX_VERSION ) mark_as_advanced( - CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES CPLEX_LIBRARIES_COMMON CPLEX_LIBRARY_PATH_SUFFIX - CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_32 CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_32 - CPLEX_LIBRARY_PATH_SUFFIX_RELEASE_64 CPLEX_LIBRARY_PATH_SUFFIX_DEBUG_64 - CPLEX_LIBRARY_PATH_SUFFIX_RELEASE CPLEX_LIBRARY_PATH_SUFFIX_DEBUG - CPLEX_LIBRARY_RELEASE CPLEX_LIBRARY_DEBUG CPLEX_RUNTIME_LIBRARY_PATH + SUPPORTED_CONFIGURATIONS HINT_PATHS CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES CPX_VERSION CPLEX_VERSION_MAJOR CPLEX_VERSION_MINOR CPLEX_VERSION_STR - CPLEX_VERSION_SUBMINOR CPLEX_VERSION_NO_DOTS + CPLEX_VERSION_SUBMINOR CPLEX_VERSION_NO_DOTS BITWIDTH_HINTS PLATFORM_HINTS + LIBRARY_TYPE_HINTS_RELEASE LIBRARY_TYPE_HINTS_DEBUG SUFFIXES_RELEASE + SUFFIXES_DEBUG FIND_OPTIONS COMPILER_HINTS COMPILER_HINT CPLEX_IMPLIB_DEBUG + CPLEX_IMPLIB_RELEASE CPLEX_SHARED_LIBRARY_DEBUG CPLEX_SHARED_LIBRARY_RELEASE ) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 83ac548a53..4e17897793 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -38,21 +38,13 @@ option( TRUE) if(USE_LP) - find_package(Cplex) + find_package(Cplex 12) if(CPLEX_FOUND) add_library(downward_cplex_interface INTERFACE) target_compile_definitions(downward_cplex_interface INTERFACE HAS_CPLEX) - target_include_directories(downward_cplex_interface INTERFACE ${CPLEX_INCLUDE_DIRS}) - target_link_libraries(downward_cplex_interface INTERFACE ${CPLEX_LIBRARIES}) - if(CPLEX_RUNTIME_LIBRARY) - add_custom_target(copy-cplex ALL) - add_custom_command(TARGET copy-cplex POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CPLEX_RUNTIME_LIBRARY} - $ - ) - endif() + target_link_libraries(downward_cplex_interface INTERFACE cplex::cplex) target_sources(downward_cplex_interface INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) + target_link_libraries(downward_LP_SOLVER INTERFACE downward_cplex_interface) endif() @@ -76,5 +68,11 @@ if(USE_LP) "not supported when an LP solver is used. See issue982 for details.") endif() endif() - endif() + +# On Windows we have to copy all DLLs next to the generated binary. +# https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS +add_custom_command(TARGET downward POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS +) From c7fcbcce24e5335466696aeb81f812d5be35261e Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 6 Aug 2023 13:03:58 +0200 Subject: [PATCH 44/79] Fix problems in find script for CPLEX --- .github/workflows/ubuntu.yml | 2 ++ src/cmake_modules/FindCplex.cmake | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 66a7ecb260..bee554a54f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -67,6 +67,8 @@ jobs: ./cplex_installer -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR="$(dirname "${DOWNWARD_CPLEX_ROOT}")" -i silent rm cplex_installer + cd /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex && find bin lib include | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/" + # Always install SoPlex - name: Install SoPlex run: | diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index c450c1fc33..5f9cb255ed 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -9,8 +9,9 @@ # # The standard FIND_PACKAGE features are supported (QUIET, REQUIRED, etc.). -set(SUPPORTED_CONFIGURATIONS "Debug" "Release") +include(FindPackageHandleStandardArgs) +set(SUPPORTED_CONFIGURATIONS "Debug" "Release") set(HINT_PATHS ${DOWNWARD_CPLEX_ROOT} $ENV{DOWNWARD_CPLEX_ROOT}) find_path(CPLEX_INCLUDE_DIRS @@ -36,12 +37,16 @@ if(CPLEX_INCLUDE_DIRS) set(CPLEX_VERSION_NO_DOTS "${CPLEX_VERSION_MAJOR}${CPLEX_VERSION_MINOR}${CPLEX_VERSION_SUBMINOR}") endif() +else() + # We use find_package_handle_standard_args to exit cleanly here and produce + # an appropriate error message. + find_package_handle_standard_args(Cplex REQUIRED_VARS CPLEX_INCLUDE_DIRS) endif() # CPLEX stores libraries under different paths of the form # /lib/_[_]// -# /bin/_[_]// +# /bin/_[_]/ # The hints have different options depending on the system and CPLEX version. # We set up lists with all options and then multiply them out to set up # possible paths where we should search for the library. @@ -79,11 +84,11 @@ elseif(MSVC14) endif() if(LINUX OR APPLE) - set(LIBRARY_TYPE_HINTS_RELEASE "static_pic") - set(LIBRARY_TYPE_HINTS_DEBUG "static_pic") + set(LIBRARY_TYPE_HINTS_RELEASE "static_pic" "") + set(LIBRARY_TYPE_HINTS_DEBUG "static_pic" "") elseif(WIN32) - set(LIBRARY_TYPE_HINTS_RELEASE "stat_mda") - set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd") + set(LIBRARY_TYPE_HINTS_RELEASE "stat_mda" "") + set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd" "") endif() add_library(cplex::cplex IMPORTED SHARED) @@ -119,13 +124,10 @@ foreach(CONFIG_ORIG ${SUPPORTED_CONFIGURATIONS}) ${SUFFIXES_${CONFIG}} ) - # Even though, we are defining a shared library, on windows, we require the - # implib (.lib or .dll.a) file as well, which is in /lib. On other systems - # this will find the static lib (.a) but the setting we use it for will be - # ignored. + # On Windows, we require the implib (.lib) file as well, which is in /lib. find_library(CPLEX_IMPLIB_${CONFIG} NAMES - cplex + cplex${CPLEX_VERSION_NO_DOTS} HINTS ${HINT_PATHS}/lib PATH_SUFFIXES From c511b8cb628ea11cf6f3a524d56092b733f5c7d3 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 6 Aug 2023 13:24:17 +0200 Subject: [PATCH 45/79] Fix problems in find script for CPLEX --- src/cmake_modules/FindCplex.cmake | 67 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index 5f9cb255ed..0ed06dfc62 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -9,11 +9,14 @@ # # The standard FIND_PACKAGE features are supported (QUIET, REQUIRED, etc.). -include(FindPackageHandleStandardArgs) - -set(SUPPORTED_CONFIGURATIONS "Debug" "Release") +set(IMPORTED_CONFIGURATIONS "Debug" "Release") set(HINT_PATHS ${DOWNWARD_CPLEX_ROOT} $ENV{DOWNWARD_CPLEX_ROOT}) +add_library(cplex::cplex IMPORTED SHARED) +set_target_properties(cplex::cplex PROPERTIES + IMPORTED_CONFIGURATIONS "${IMPORTED_CONFIGURATIONS}" +) + find_path(CPLEX_INCLUDE_DIRS NAMES cplex.h @@ -22,6 +25,7 @@ find_path(CPLEX_INCLUDE_DIRS PATH_SUFFIXES include/ilcplex ) +target_include_directories(cplex::cplex INTERFACE ${CPLEX_INCLUDE_DIRS}) if(CPLEX_INCLUDE_DIRS) # Parse CPLEX version. @@ -37,12 +41,27 @@ if(CPLEX_INCLUDE_DIRS) set(CPLEX_VERSION_NO_DOTS "${CPLEX_VERSION_MAJOR}${CPLEX_VERSION_MINOR}${CPLEX_VERSION_SUBMINOR}") endif() + + # Versions >= 12.8 depend on dl. + if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) + target_link_libraries(cplex::cplex INTERFACE ${CMAKE_DL_LIBS}) + endif() else() - # We use find_package_handle_standard_args to exit cleanly here and produce - # an appropriate error message. - find_package_handle_standard_args(Cplex REQUIRED_VARS CPLEX_INCLUDE_DIRS) + set(CPLEX_VERSION "CPLEX_VERSION-NOTFOUND") + set(CPLEX_VERSION_NO_DOTS "CPLEX_VERSION-NOTFOUND") endif() +# Find dependencies. +set(FIND_OPTIONS) +if(${CPLEX_FIND_QUIETLY}) + list(APPEND FIND_OPTIONS "QUIET") +endif() +if(${CPLEX_FIND_REQUIRED}) + list(APPEND FIND_OPTIONS "REQUIRED") +endif() +find_package(Threads ${FIND_OPTIONS}) +target_link_libraries(cplex::cplex INTERFACE Threads::Threads) + # CPLEX stores libraries under different paths of the form # /lib/_[_]// @@ -84,20 +103,14 @@ elseif(MSVC14) endif() if(LINUX OR APPLE) - set(LIBRARY_TYPE_HINTS_RELEASE "static_pic" "") - set(LIBRARY_TYPE_HINTS_DEBUG "static_pic" "") + set(LIBRARY_TYPE_HINTS_RELEASE "static_pic") + set(LIBRARY_TYPE_HINTS_DEBUG "static_pic") elseif(WIN32) - set(LIBRARY_TYPE_HINTS_RELEASE "stat_mda" "") - set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd" "") + set(LIBRARY_TYPE_HINTS_RELEASE "stat_mda") + set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd") endif() -add_library(cplex::cplex IMPORTED SHARED) -target_include_directories(cplex::cplex INTERFACE ${CPLEX_INCLUDE_DIRS}) -set_target_properties(cplex::cplex PROPERTIES - IMPORTED_CONFIGURATIONS "${SUPPORTED_CONFIGURATIONS}" -) - -foreach(CONFIG_ORIG ${SUPPORTED_CONFIGURATIONS}) +foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS}) # The configuration needs to be upper case in variable names like # IMPORTED_LOCATION_${CONFIG}. string(TOUPPER ${CONFIG_ORIG} CONFIG) @@ -105,6 +118,7 @@ foreach(CONFIG_ORIG ${SUPPORTED_CONFIGURATIONS}) # Collect possible suffixes. foreach(BITWIDTH_HINT ${BITWIDTH_HINTS}) foreach(PLATFORM_HINT ${PLATFORM_HINTS}) + list(APPEND SUFFIXES_${CONFIG} "${BITWIDTH_HINT}_${PLATFORM_HINT}") foreach(LIBRARY_TYPE_HINT ${LIBRARY_TYPE_HINTS_${CONFIG}}) list(APPEND SUFFIXES_${CONFIG} "${BITWIDTH_HINT}_${PLATFORM_HINT}/${LIBRARY_TYPE_HINT}") foreach(COMPILER_HINT ${COMPILER_HINTS}) @@ -145,23 +159,6 @@ foreach(CONFIG_ORIG ${SUPPORTED_CONFIGURATIONS}) ) endforeach() - -# Find dependencies - -set(FIND_OPTIONS) -if(${CPLEX_FIND_QUIETLY}) - list(APPEND FIND_OPTIONS "QUIET") -endif() -if(${CPLEX_FIND_REQUIRED}) - list(APPEND FIND_OPTIONS "REQUIRED") -endif() -find_package(Threads ${FIND_OPTIONS}) - -target_link_libraries(cplex::cplex INTERFACE Threads::Threads) -if(NOT (${CPLEX_VERSION} VERSION_LESS "12.8")) - target_link_libraries(cplex::cplex INTERFACE ${CMAKE_DL_LIBS}) -endif() - # Check if everything was found and set CPLEX_FOUND. include(FindPackageHandleStandardArgs) find_package_handle_standard_args( @@ -173,7 +170,7 @@ find_package_handle_standard_args( ) mark_as_advanced( - SUPPORTED_CONFIGURATIONS HINT_PATHS CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES + IMPORTED_CONFIGURATIONS HINT_PATHS CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES CPX_VERSION CPLEX_VERSION_MAJOR CPLEX_VERSION_MINOR CPLEX_VERSION_STR CPLEX_VERSION_SUBMINOR CPLEX_VERSION_NO_DOTS BITWIDTH_HINTS PLATFORM_HINTS LIBRARY_TYPE_HINTS_RELEASE LIBRARY_TYPE_HINTS_DEBUG SUFFIXES_RELEASE From 6e1605c4903b06d6bc43c744a3cad4db81d2c37d Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 6 Aug 2023 13:55:31 +0200 Subject: [PATCH 46/79] OS-specific find script for CPLEX --- src/cmake_modules/FindCplex.cmake | 72 +++++++++++++++++++------------ 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index 0ed06dfc62..c907f7f4b2 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -110,6 +110,7 @@ elseif(WIN32) set(LIBRARY_TYPE_HINTS_DEBUG "stat_mdd") endif() +set(REQUIRED_LIBRARIES) foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS}) # The configuration needs to be upper case in variable names like # IMPORTED_LOCATION_${CONFIG}. @@ -128,45 +129,60 @@ foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS}) endforeach() endforeach() - # CPLEX stores .so and .dll files in /bin - find_library(CPLEX_SHARED_LIBRARY_${CONFIG} - NAMES - cplex${CPLEX_VERSION_NO_DOTS} - HINTS - ${HINT_PATHS}/bin - PATH_SUFFIXES - ${SUFFIXES_${CONFIG}} - ) - - # On Windows, we require the implib (.lib) file as well, which is in /lib. - find_library(CPLEX_IMPLIB_${CONFIG} - NAMES - cplex${CPLEX_VERSION_NO_DOTS} - HINTS - ${HINT_PATHS}/lib - PATH_SUFFIXES - ${SUFFIXES_${CONFIG}} - ) + if (WIN32) + # On Windows, libraries consist of a .dll file and a .lib file. + # CPLEX stores the .dll file in /bin and the .lib file in /lib. + # Since likning is against the .lib file, find_library() does not find + # the dll and we have to use find_file() instead. + find_file(CPLEX_SHARED_LIBRARY_${CONFIG} + NAMES + cplex${CPLEX_VERSION_NO_DOTS}.dll + HINTS + ${HINT_PATHS}/bin + PATH_SUFFIXES + ${SUFFIXES_${CONFIG}} + ) + find_library(CPLEX_IMPLIB_${CONFIG} + NAMES + cplex${CPLEX_VERSION_NO_DOTS} + HINTS + ${HINT_PATHS}/lib + PATH_SUFFIXES + ${SUFFIXES_${CONFIG}} + ) + set_target_properties(cplex::cplex PROPERTIES + IMPORTED_LOCATION_${CONFIG} ${CPLEX_SHARED_LIBRARY_${CONFIG}} + IMPORTED_IMPLIB_${CONFIG} ${CPLEX_IMPLIB_${CONFIG}} + ) + list(APPEND REQUIRED_LIBRARIES CPLEX_SHARED_LIBRARY_${CONFIG} CPLEX_IMPLIB_${CONFIG}) + else() + # CPLEX stores .so files in /bin + find_library(CPLEX_SHARED_LIBRARY_${CONFIG} + NAMES + cplex${CPLEX_VERSION_NO_DOTS} + HINTS + ${HINT_PATHS}/bin + PATH_SUFFIXES + ${SUFFIXES_${CONFIG}} + ) + set_target_properties(cplex::cplex PROPERTIES + IMPORTED_LOCATION_${CONFIG} ${CPLEX_SHARED_LIBRARY_${CONFIG}} + ) + list(APPEND REQUIRED_LIBRARIES CPLEX_SHARED_LIBRARY_${CONFIG}) + endif() message(STATUS "HINTS: ${HINT_PATHS}/lib") message(STATUS "SUFFIXES_${CONFIG}: ${SUFFIXES_${CONFIG}}") message(STATUS "CPLEX_SHARED_LIBRARY_${CONFIG}: ${CPLEX_SHARED_LIBRARY_${CONFIG}}") message(STATUS "CPLEX_IMPLIB_${CONFIG}: ${CPLEX_IMPLIB_${CONFIG}}") - - set_target_properties(cplex::cplex PROPERTIES - IMPORTED_LOCATION_${CONFIG} ${CPLEX_SHARED_LIBRARY_${CONFIG}} - IMPORTED_IMPLIB_${CONFIG} ${CPLEX_IMPLIB_${CONFIG}} - ) endforeach() # Check if everything was found and set CPLEX_FOUND. include(FindPackageHandleStandardArgs) find_package_handle_standard_args( Cplex - REQUIRED_VARS CPLEX_INCLUDE_DIRS CPLEX_SHARED_LIBRARY_RELEASE - CPLEX_SHARED_LIBRARY_DEBUG CPLEX_IMPLIB_RELEASE CPLEX_IMPLIB_DEBUG - THREADS_FOUND - VERSION_VAR CPLEX_VERSION + REQUIRED_VARS CPLEX_INCLUDE_DIRS ${REQUIRED_LIBRARIES} + THREADS_FOUND VERSION_VAR CPLEX_VERSION ) mark_as_advanced( From 02237af1ab4f50dd8f216590f47da4d5f294d64f Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Sun, 6 Aug 2023 14:22:59 +0200 Subject: [PATCH 47/79] Remove debug output --- .github/workflows/ubuntu.yml | 2 -- .github/workflows/windows.yml | 2 -- src/cmake_modules/FindCplex.cmake | 7 +------ 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index bee554a54f..66a7ecb260 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -67,8 +67,6 @@ jobs: ./cplex_installer -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR="$(dirname "${DOWNWARD_CPLEX_ROOT}")" -i silent rm cplex_installer - cd /home/runner/lib/ibm/ILOG/CPLEX_Studio2211/cplex && find bin lib include | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/" - # Always install SoPlex - name: Install SoPlex run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index dcc16e152b..ea37cdc8e7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -78,8 +78,6 @@ jobs: echo "Copy the relevant directory to a location which is not magically protected against cmake" Xcopy /E /I ..\cplex_temp\cplex ..\cplex - tree ..\cplex /F - - name: Compile planner shell: cmd diff --git a/src/cmake_modules/FindCplex.cmake b/src/cmake_modules/FindCplex.cmake index c907f7f4b2..058c0132bc 100644 --- a/src/cmake_modules/FindCplex.cmake +++ b/src/cmake_modules/FindCplex.cmake @@ -170,12 +170,7 @@ foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS}) ) list(APPEND REQUIRED_LIBRARIES CPLEX_SHARED_LIBRARY_${CONFIG}) endif() - - message(STATUS "HINTS: ${HINT_PATHS}/lib") - message(STATUS "SUFFIXES_${CONFIG}: ${SUFFIXES_${CONFIG}}") - message(STATUS "CPLEX_SHARED_LIBRARY_${CONFIG}: ${CPLEX_SHARED_LIBRARY_${CONFIG}}") - message(STATUS "CPLEX_IMPLIB_${CONFIG}: ${CPLEX_IMPLIB_${CONFIG}}") -endforeach() + endforeach() # Check if everything was found and set CPLEX_FOUND. include(FindPackageHandleStandardArgs) From 1a7093733a7963a25798bd930e6d909ed8869881 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Tue, 12 Sep 2023 10:10:19 +0200 Subject: [PATCH 48/79] restructure cmake files --- src/CMakeLists.txt | 3 +- src/search/CMakeLists.txt | 850 +++++++++++++++++- .../cmake}/FindCplex.cmake | 0 src/search/cmake/cxx_options.cmake | 45 + .../cmake/macros.cmake} | 87 +- src/search/cmake/project_options.cmake | 37 + 6 files changed, 909 insertions(+), 113 deletions(-) rename src/{cmake_modules => search/cmake}/FindCplex.cmake (100%) create mode 100644 src/search/cmake/cxx_options.cmake rename src/{cmake_modules/FastDownwardMacros.cmake => search/cmake/macros.cmake} (52%) create mode 100644 src/search/cmake/project_options.cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0ed22d7c7..f4e01588c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,8 +27,7 @@ cmake_minimum_required(VERSION 3.16) project(fast-downward DESCRIPTION "Fast Downward is a domain-independent classical planning system." - HOMEPAGE_URL https://www.fast-downward.org/ - LANGUAGES CXX) + HOMEPAGE_URL https://www.fast-downward.org/) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 4e17897793..3b6ee0e92f 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -1,42 +1,503 @@ +# See https://www.fast-downward.org/ForDevelopers/AddingSourceFiles +# for general information on adding source files and CMake libraries. +# +# All libraries are enabled by default and users can disable them by specifying +# -DLIBRARY_FOO_ENABLED=FALSE +# The default behavior can be changed so all non-essential libraries are +# disabled by default by specifying +# -DDISABLE_LIBRARIES_BY_DEFAULT=TRUE +# In that case, individual libraries can be enabled with +# -DLIBRARY_FOO_ENABLED=TRUE +# +# Defining a new library: +# create_fast_downward_library( +# NAME +# [ DISPLAY_NAME ] +# [ HELP ] +# SOURCES +# [ ... ] +# [ DEPENDS [ ... ] ] +# [ DEPENDENCY_ONLY ] +# [ CORE_LIBRARY ] +# ) +# +# defaults to lower case and is used to group files +# in IDEs and for messages. +# defaults to and is used to describe the cmake option. +# SOURCES lists the source files that are part of the library. Entries are +# listed without extension. For an entry , both .h and .cc +# are added if the files exist. +# DEPENDS lists libraries that will be automatically enabled if this library is +# enabled. If the dependency was not enabled before, this will be logged. +# DEPENDENCY_ONLY disables the library unless it is needed as a dependency and +# hides the option to enable the library in cmake GUIs like ccmake. +# CORE_LIBRARY always enables the library (even if DISABLE_LIBRARIES_BY_DEFAULT +# is used) and hides the option to disable it in CMake GUIs like ccmake. + cmake_minimum_required(VERSION 3.16) # Path containing custom CMake modules -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules) -include(FastDownwardMacros) - +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include(macros) -## == Project == +report_bitwidth() +set_up_build_types("Debug;Release") +set_up_options() project(downward LANGUAGES CXX) +add_executable(downward planner.cc) -fast_downward_report_bitwidth() -fast_downward_set_up_build_types() +# On Windows we have to copy all DLLs next to the generated binary. +copy_dlls_to_binary_dir(downward) -option( - USE_GLIBCXX_DEBUG - "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ -systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks \ -come at a significant performance cost and should only be enabled in debug mode. \ -Enabling them makes the binary incompatible with libraries that are not compiled \ -with this flag, which can lead to hard-to-debug errors." - FALSE) +create_fast_downward_library( + NAME CORE_SOURCES + HELP "Core source files" + SOURCES + abstract_task + axioms + command_line + evaluation_context + evaluation_result + evaluator + evaluator_cache + heuristic + open_list + open_list_factory + operator_cost + operator_id + per_state_array + per_state_bitset + per_state_information + per_task_information + plan_manager + pruning_method + search_algorithm + search_node_info + search_progress + search_space + search_statistics + state_id + state_registry + task_id + task_proxy -add_executable(downward planner.cc) + DEPENDS CAUSAL_GRAPH INT_HASH_SET INT_PACKER ORDERED_SET SEGMENTED_VECTOR SUBSCRIBER SUCCESSOR_GENERATOR TASK_PROPERTIES + CORE_LIBRARY +) + +create_fast_downward_library( + NAME PLUGINS + HELP "Plugin definition" + SOURCES + plugins/any + plugins/bounds + plugins/doc_printer + plugins/options + plugins/plugin + plugins/plugin_info + plugins/raw_registry + plugins/registry + plugins/registry_types + plugins/types + CORE_LIBRARY +) + +create_fast_downward_library( + NAME PARSER + HELP "Option parsing" + SOURCES + parser/abstract_syntax_tree + parser/decorated_abstract_syntax_tree + parser/lexical_analyzer + parser/syntax_analyzer + parser/token_stream + CORE_LIBRARY +) + +create_fast_downward_library( + NAME UTILS + HELP "System utilities" + SOURCES + utils/collections + utils/countdown_timer + utils/exceptions + utils/hash + utils/language + utils/logging + utils/markup + utils/math + utils/memory + utils/rng + utils/rng_options + utils/strings + utils/system + utils/system_unix + utils/system_windows + utils/timer + CORE_LIBRARY +) +# On Linux, find the rt library for clock_gettime(). +if(UNIX AND NOT APPLE) + target_link_libraries(downward_UTILS INTERFACE rt) +endif() +# On Windows, find the psapi library for determining peak memory. +if(WIN32) + cmake_policy(SET CMP0074 NEW) + target_link_libraries(downward_UTILS INTERFACE psapi) +endif() + + +create_fast_downward_library( + NAME ALTERNATION_OPEN_LIST + HELP "Open list that alternates between underlying open lists in a round-robin manner" + SOURCES + open_lists/alternation_open_list +) + +create_fast_downward_library( + NAME BEST_FIRST_OPEN_LIST + HELP "Open list that selects the best element according to a single evaluation function" + SOURCES + open_lists/best_first_open_list +) + +create_fast_downward_library( + NAME EPSILON_GREEDY_OPEN_LIST + HELP "Open list that chooses an entry randomly with probability epsilon" + SOURCES + open_lists/epsilon_greedy_open_list +) + +create_fast_downward_library( + NAME PARETO_OPEN_LIST + HELP "Pareto open list" + SOURCES + open_lists/pareto_open_list +) + +create_fast_downward_library( + NAME TIEBREAKING_OPEN_LIST + HELP "Tiebreaking open list" + SOURCES + open_lists/tiebreaking_open_list +) + +create_fast_downward_library( + NAME TYPE_BASED_OPEN_LIST + HELP "Type-based open list" + SOURCES + open_lists/type_based_open_list +) + +create_fast_downward_library( + NAME DYNAMIC_BITSET + HELP "Poor man's version of boost::dynamic_bitset" + SOURCES + algorithms/dynamic_bitset + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME NAMED_VECTOR + HELP "Generic vector with associated name for each element" + SOURCES + algorithms/named_vector + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME EQUIVALENCE_RELATION + HELP "Equivalence relation over [1, ..., n] that can be iteratively refined" + SOURCES + algorithms/equivalence_relation + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME INT_HASH_SET + HELP "Hash set storing non-negative integers" + SOURCES + algorithms/int_hash_set + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME INT_PACKER + HELP "Greedy bin packing algorithm to pack integer variables with small domains tightly into memory" + SOURCES + algorithms/int_packer + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME MAX_CLIQUES + HELP "Implementation of the Max Cliques algorithm by Tomita et al." + SOURCES + algorithms/max_cliques + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME PRIORITY_QUEUES + HELP "Three implementations of priority queue: HeapQueue, BucketQueue and AdaptiveQueue" + SOURCES + algorithms/priority_queues + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME ORDERED_SET + HELP "Set of elements ordered by insertion time" + SOURCES + algorithms/ordered_set + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME SEGMENTED_VECTOR + HELP "Memory-friendly and vector-like data structure" + SOURCES + algorithms/segmented_vector + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME SUBSCRIBER + HELP "Allows object to subscribe to the destructor of other objects" + SOURCES + algorithms/subscriber + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME EVALUATORS_SUBCATEGORY + HELP "Subcategory plugin for basic evaluators" + SOURCES + evaluators/subcategory +) + +create_fast_downward_library( + NAME CONST_EVALUATOR + HELP "The constant evaluator" + SOURCES + evaluators/const_evaluator + DEPENDS EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME G_EVALUATOR + HELP "The g-evaluator" + SOURCES + evaluators/g_evaluator + DEPENDS EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME COMBINING_EVALUATOR + HELP "The combining evaluator" + SOURCES + evaluators/combining_evaluator + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME MAX_EVALUATOR + HELP "The max evaluator" + SOURCES + evaluators/max_evaluator + DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME PREF_EVALUATOR + HELP "The pref evaluator" + SOURCES + evaluators/pref_evaluator + DEPENDS EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME WEIGHTED_EVALUATOR + HELP "The weighted evaluator" + SOURCES + evaluators/weighted_evaluator + DEPENDS EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME SUM_EVALUATOR + HELP "The sum evaluator" + SOURCES + evaluators/sum_evaluator + DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY +) + +create_fast_downward_library( + NAME NULL_PRUNING_METHOD + HELP "Pruning method that does nothing" + SOURCES + pruning/null_pruning_method + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME LIMITED_PRUNING + HELP "Method for limiting another pruning method" + SOURCES + pruning/limited_pruning +) + +create_fast_downward_library( + NAME STUBBORN_SETS + HELP "Base class for all stubborn set partial order reduction methods" + SOURCES + pruning/stubborn_sets + DEPENDS TASK_PROPERTIES + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME STUBBORN_SETS_ACTION_CENTRIC + HELP "Base class for all action-centric stubborn set partial order reduction methods" + SOURCES + pruning/stubborn_sets_action_centric + DEPENDS STUBBORN_SETS + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME STUBBORN_SETS_ATOM_CENTRIC + HELP "Atom-centric stubborn sets" + SOURCES + pruning/stubborn_sets_atom_centric + DEPENDS STUBBORN_SETS +) + +create_fast_downward_library( + NAME STUBBORN_SETS_SIMPLE + HELP "Stubborn sets simple" + SOURCES + pruning/stubborn_sets_simple + DEPENDS STUBBORN_SETS_ACTION_CENTRIC +) -include("${CMAKE_CURRENT_SOURCE_DIR}/DownwardFiles.cmake") +create_fast_downward_library( + NAME STUBBORN_SETS_EC + HELP "Stubborn set method that dominates expansion core" + SOURCES + pruning/stubborn_sets_ec + DEPENDS STUBBORN_SETS_ACTION_CENTRIC TASK_PROPERTIES +) + +create_fast_downward_library( + NAME SEARCH_COMMON + HELP "Basic classes used for all search algorithms" + SOURCES + search_algorithms/search_common + DEPENDS ALTERNATION_OPEN_LIST G_EVALUATOR BEST_FIRST_OPEN_LIST SUM_EVALUATOR TIEBREAKING_OPEN_LIST WEIGHTED_EVALUATOR + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME EAGER_SEARCH + HELP "Eager search" + SOURCES + search_algorithms/eager_search + DEPENDS NULL_PRUNING_METHOD ORDERED_SET SUCCESSOR_GENERATOR + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME PLUGIN_ASTAR + HELP "A* search" + SOURCES + search_algorithms/plugin_astar + DEPENDS EAGER_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_EAGER + HELP "Eager (i.e., normal) best-first search" + SOURCES + search_algorithms/plugin_eager + DEPENDS EAGER_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_EAGER_GREEDY + HELP "Eager greedy best-first search" + SOURCES + search_algorithms/plugin_eager_greedy + DEPENDS EAGER_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_EAGER_WASTAR + HELP "Weighted eager A* search" + SOURCES + search_algorithms/plugin_eager_wastar + DEPENDS EAGER_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_LAZY + HELP "Best-first search with deferred evaluation (lazy)" + SOURCES + search_algorithms/plugin_lazy + DEPENDS LAZY_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_LAZY_GREEDY + HELP "Greedy best-first search with deferred evaluation (lazy)" + SOURCES + search_algorithms/plugin_lazy_greedy + DEPENDS LAZY_SEARCH SEARCH_COMMON +) + +create_fast_downward_library( + NAME PLUGIN_LAZY_WASTAR + HELP "Weighted A* search with deferred evaluation (lazy)" + SOURCES + search_algorithms/plugin_lazy_wastar + DEPENDS LAZY_SEARCH SEARCH_COMMON +) -## == Libraries == +create_fast_downward_library( + NAME ENFORCED_HILL_CLIMBING_SEARCH + HELP "Lazy enforced hill-climbing search" + SOURCES + search_algorithms/enforced_hill_climbing_search + DEPENDS G_EVALUATOR ORDERED_SET PREF_EVALUATOR SEARCH_COMMON SUCCESSOR_GENERATOR +) -# If any enabled plugin requires an LP solver, compile with all -# available LP solvers. If no solvers are installed, the planner will -# still compile, but using heuristics that depend on an LP solver will -# cause an error. This behavior can be overwritten by setting the -# option USE_LP to false. -option( - USE_LP - "Compile with support for all LP solvers installed on this system." - TRUE) +create_fast_downward_library( + NAME ITERATED_SEARCH + HELP "Iterated search" + SOURCES + search_algorithms/iterated_search +) +create_fast_downward_library( + NAME LAZY_SEARCH + HELP "Lazy search" + SOURCES + search_algorithms/lazy_search + DEPENDS ORDERED_SET SUCCESSOR_GENERATOR + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME LP_SOLVER + HELP "Interface to an LP solver" + SOURCES + lp/lp_internals + lp/lp_solver + lp/solver_interface + DEPENDS NAMED_VECTOR + DEPENDENCY_ONLY +) if(USE_LP) find_package(Cplex 12) if(CPLEX_FOUND) @@ -59,20 +520,329 @@ if(USE_LP) target_link_libraries(downward_LP_SOLVER INTERFACE downward_soplex_interface) endif() - - if(CPLEX_FOUND OR SOPLEX_FOUND) - if(USE_GLIBCXX_DEBUG) - message( - FATAL_ERROR - "To prevent incompatibilities, the option USE_GLIBCXX_DEBUG is " - "not supported when an LP solver is used. See issue982 for details.") - endif() - endif() endif() -# On Windows we have to copy all DLLs next to the generated binary. -# https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS -add_custom_command(TARGET downward POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy -t $ $ - COMMAND_EXPAND_LISTS +create_fast_downward_library( + NAME RELAXATION_HEURISTIC + HELP "The base class for relaxation heuristics" + SOURCES + heuristics/array_pool + heuristics/relaxation_heuristic + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME ADDITIVE_HEURISTIC + HELP "The additive heuristic" + SOURCES + heuristics/additive_heuristic + DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC TASK_PROPERTIES +) + +create_fast_downward_library( + NAME BLIND_SEARCH_HEURISTIC + HELP "The 'blind search' heuristic" + SOURCES + heuristics/blind_search_heuristic + DEPENDS TASK_PROPERTIES +) + +create_fast_downward_library( + NAME CONTEXT_ENHANCED_ADDITIVE_HEURISTIC + HELP "The context-enhanced additive heuristic" + SOURCES + heuristics/cea_heuristic + DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES +) + +create_fast_downward_library( + NAME CG_HEURISTIC + HELP "The causal graph heuristic" + SOURCES heuristics/cg_heuristic + heuristics/cg_cache + DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES +) + +create_fast_downward_library( + NAME DOMAIN_TRANSITION_GRAPH + HELP "DTGs used by cg and cea heuristic" + SOURCES + heuristics/domain_transition_graph + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME FF_HEURISTIC + HELP "The FF heuristic (an implementation of the RPG heuristic)" + SOURCES + heuristics/ff_heuristic + DEPENDS ADDITIVE_HEURISTIC TASK_PROPERTIES +) + +create_fast_downward_library( + NAME GOAL_COUNT_HEURISTIC + HELP "The goal-counting heuristic" + SOURCES + heuristics/goal_count_heuristic +) + +create_fast_downward_library( + NAME HM_HEURISTIC + HELP "The h^m heuristic" + SOURCES + heuristics/hm_heuristic + DEPENDS TASK_PROPERTIES +) + +create_fast_downward_library( + NAME LANDMARK_CUT_HEURISTIC + HELP "The LM-cut heuristic" + SOURCES + heuristics/lm_cut_heuristic + heuristics/lm_cut_landmarks + DEPENDS PRIORITY_QUEUES TASK_PROPERTIES +) + +create_fast_downward_library( + NAME MAX_HEURISTIC + HELP "The Max heuristic" + SOURCES + heuristics/max_heuristic + DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC +) + +create_fast_downward_library( + NAME CORE_TASKS + HELP "Core task transformations" + SOURCES + tasks/cost_adapted_task + tasks/delegating_task + tasks/root_task + CORE_LIBRARY +) + +create_fast_downward_library( + NAME EXTRA_TASKS + HELP "Non-core task transformations" + SOURCES + tasks/domain_abstracted_task + tasks/domain_abstracted_task_factory + tasks/modified_goals_task + tasks/modified_operator_costs_task + DEPENDS TASK_PROPERTIES + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME CAUSAL_GRAPH + HELP "Causal Graph" + SOURCES + task_utils/causal_graph + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME SAMPLING + HELP "Sampling" + SOURCES + task_utils/sampling + DEPENDS SUCCESSOR_GENERATOR TASK_PROPERTIES + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME SUCCESSOR_GENERATOR + HELP "Successor generator" + SOURCES + task_utils/successor_generator + task_utils/successor_generator_factory + task_utils/successor_generator_internals + DEPENDS TASK_PROPERTIES + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME TASK_PROPERTIES + HELP "Task properties" + SOURCES + task_utils/task_properties + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME VARIABLE_ORDER_FINDER + HELP "Variable order finder" + SOURCES + task_utils/variable_order_finder + DEPENDENCY_ONLY +) + +create_fast_downward_library( + NAME CEGAR + HELP "Plugin containing the code for Cartesian CEGAR heuristics" + SOURCES + cartesian_abstractions/abstraction + cartesian_abstractions/abstract_search + cartesian_abstractions/abstract_state + cartesian_abstractions/additive_cartesian_heuristic + cartesian_abstractions/cartesian_heuristic_function + cartesian_abstractions/cartesian_set + cartesian_abstractions/cegar + cartesian_abstractions/cost_saturation + cartesian_abstractions/refinement_hierarchy + cartesian_abstractions/split_selector + cartesian_abstractions/subtask_generators + cartesian_abstractions/transition + cartesian_abstractions/transition_system + cartesian_abstractions/types + cartesian_abstractions/utils + cartesian_abstractions/utils_landmarks + DEPENDS ADDITIVE_HEURISTIC DYNAMIC_BITSET EXTRA_TASKS LANDMARKS PRIORITY_QUEUES TASK_PROPERTIES +) + +create_fast_downward_library( + NAME MAS_HEURISTIC + HELP "The Merge-and-Shrink heuristic" + SOURCES + merge_and_shrink/distances + merge_and_shrink/factored_transition_system + merge_and_shrink/fts_factory + merge_and_shrink/label_reduction + merge_and_shrink/labels + merge_and_shrink/merge_and_shrink_algorithm + merge_and_shrink/merge_and_shrink_heuristic + merge_and_shrink/merge_and_shrink_representation + merge_and_shrink/merge_scoring_function + merge_and_shrink/merge_scoring_function_dfp + merge_and_shrink/merge_scoring_function_goal_relevance + merge_and_shrink/merge_scoring_function_miasm + merge_and_shrink/merge_scoring_function_miasm_utils + merge_and_shrink/merge_scoring_function_single_random + merge_and_shrink/merge_scoring_function_total_order + merge_and_shrink/merge_selector + merge_and_shrink/merge_selector_score_based_filtering + merge_and_shrink/merge_strategy + merge_and_shrink/merge_strategy_factory + merge_and_shrink/merge_strategy_factory_precomputed + merge_and_shrink/merge_strategy_factory_sccs + merge_and_shrink/merge_strategy_factory_stateless + merge_and_shrink/merge_strategy_precomputed + merge_and_shrink/merge_strategy_sccs + merge_and_shrink/merge_strategy_stateless + merge_and_shrink/merge_tree + merge_and_shrink/merge_tree_factory + merge_and_shrink/merge_tree_factory_linear + merge_and_shrink/shrink_bisimulation + merge_and_shrink/shrink_bucket_based + merge_and_shrink/shrink_fh + merge_and_shrink/shrink_random + merge_and_shrink/shrink_strategy + merge_and_shrink/transition_system + merge_and_shrink/types + merge_and_shrink/utils + DEPENDS PRIORITY_QUEUES EQUIVALENCE_RELATION SCCS TASK_PROPERTIES VARIABLE_ORDER_FINDER +) + +create_fast_downward_library( + NAME LANDMARKS + HELP "Plugin containing the code to reason with landmarks" + SOURCES + landmarks/exploration + landmarks/landmark + landmarks/landmark_cost_assignment + landmarks/landmark_cost_partitioning_heuristic + landmarks/landmark_factory + landmarks/landmark_factory_h_m + landmarks/landmark_factory_reasonable_orders_hps + landmarks/landmark_factory_merged + landmarks/landmark_factory_relaxation + landmarks/landmark_factory_rpg_exhaust + landmarks/landmark_factory_rpg_sasp + landmarks/landmark_factory_zhu_givan + landmarks/landmark_graph + landmarks/landmark_heuristic + landmarks/landmark_status_manager + landmarks/landmark_sum_heuristic + landmarks/util + DEPENDS LP_SOLVER PRIORITY_QUEUES SUCCESSOR_GENERATOR TASK_PROPERTIES +) + +create_fast_downward_library( + NAME OPERATOR_COUNTING + HELP "Plugin containing the code for operator-counting heuristics" + SOURCES + operator_counting/constraint_generator + operator_counting/delete_relaxation_constraints + operator_counting/lm_cut_constraints + operator_counting/operator_counting_heuristic + operator_counting/pho_constraints + operator_counting/state_equation_constraints + DEPENDS LP_SOLVER LANDMARK_CUT_HEURISTIC PDBS TASK_PROPERTIES +) + +create_fast_downward_library( + NAME PDBS + HELP "Plugin containing the code for PDBs" + SOURCES + pdbs/abstract_operator + pdbs/canonical_pdbs + pdbs/canonical_pdbs_heuristic + pdbs/cegar + pdbs/dominance_pruning + pdbs/incremental_canonical_pdbs + pdbs/match_tree + pdbs/max_cliques + pdbs/pattern_cliques + pdbs/pattern_collection_information + pdbs/pattern_collection_generator_combo + pdbs/pattern_collection_generator_disjoint_cegar + pdbs/pattern_collection_generator_genetic + pdbs/pattern_collection_generator_hillclimbing + pdbs/pattern_collection_generator_manual + pdbs/pattern_collection_generator_multiple_cegar + pdbs/pattern_collection_generator_multiple_random + pdbs/pattern_collection_generator_multiple + pdbs/pattern_collection_generator_systematic + pdbs/pattern_database_factory + pdbs/pattern_database + pdbs/pattern_generator_cegar + pdbs/pattern_generator_greedy + pdbs/pattern_generator_manual + pdbs/pattern_generator_random + pdbs/pattern_generator + pdbs/pattern_information + pdbs/pdb_heuristic + pdbs/random_pattern + pdbs/subcategory + pdbs/types + pdbs/utils + pdbs/validation + pdbs/zero_one_pdbs + pdbs/zero_one_pdbs_heuristic + DEPENDS CAUSAL_GRAPH MAX_CLIQUES PRIORITY_QUEUES SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES VARIABLE_ORDER_FINDER +) + +create_fast_downward_library( + NAME POTENTIALS + HELP "Plugin containing the code for potential heuristics" + SOURCES + potentials/diverse_potential_heuristics + potentials/potential_function + potentials/potential_heuristic + potentials/potential_max_heuristic + potentials/potential_optimizer + potentials/sample_based_potential_heuristics + potentials/single_potential_heuristics + potentials/subcategory + potentials/util + DEPENDS LP_SOLVER SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES +) + +create_fast_downward_library( + NAME SCCS + HELP "Algorithm to compute the strongly connected components (SCCs) of a " + "directed graph." + SOURCES + algorithms/sccs + DEPENDENCY_ONLY ) diff --git a/src/cmake_modules/FindCplex.cmake b/src/search/cmake/FindCplex.cmake similarity index 100% rename from src/cmake_modules/FindCplex.cmake rename to src/search/cmake/FindCplex.cmake diff --git a/src/search/cmake/cxx_options.cmake b/src/search/cmake/cxx_options.cmake new file mode 100644 index 0000000000..f5c68f89b2 --- /dev/null +++ b/src/search/cmake/cxx_options.cmake @@ -0,0 +1,45 @@ +add_library(cxx_options INTERFACE) +target_compile_features(cxx_options INTERFACE cxx_std_20) + +set(using_gcc_like "$") +set(using_gcc "$") +set(using_msvc "$") +set(using_gcc_like_release "$>") +set(using_gcc_like_debug "$>") +set(should_use_glibcxx_debug "$>") + +target_compile_options(cxx_options INTERFACE + "$<${using_gcc_like}:-O3;-g>") +target_link_options(cxx_options INTERFACE + "$<${using_gcc_like}:-g>") +target_compile_options(cxx_options INTERFACE + "$<${using_gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") +target_compile_definitions(cxx_options INTERFACE + "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") +# Enable exceptions for MSVC. +target_compile_options(cxx_options INTERFACE + "$<${using_msvc}:/EHsc>") + +add_library(cxx_warnings INTERFACE) +target_compile_options(cxx_warnings INTERFACE + "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") + +## We ignore the warning "restrict" because of a bug in GCC 12: +## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 +set(v12_or_later "$,12>") +set(before_v13 "$,13>") +set(bugged_gcc "$") +target_compile_options(cxx_warnings INTERFACE + "$<${bugged_gcc}:-Wno-restrict>") + +# For MSVC, use warning level 4 (/W4) because /Wall currently detects too +# many warnings outside of our code to be useful. +target_compile_options(cxx_warnings INTERFACE + "$<${using_msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") + # Disable warnings that currently trigger in the code until we fix them. + # /wd4456: declaration hides previous local declaration + # /wd4458: declaration hides class member + # /wd4459: declaration hides global declaration + # /wd4244: conversion with possible loss of data + # /wd4267: conversion from size_t to int with possible loss of data +target_link_libraries(cxx_options INTERFACE cxx_warnings) diff --git a/src/cmake_modules/FastDownwardMacros.cmake b/src/search/cmake/macros.cmake similarity index 52% rename from src/cmake_modules/FastDownwardMacros.cmake rename to src/search/cmake/macros.cmake index 8bb17fa0b7..b44387baa1 100644 --- a/src/cmake_modules/FastDownwardMacros.cmake +++ b/src/search/cmake/macros.cmake @@ -1,57 +1,10 @@ -include(CMakeParseArguments) - - - -add_library(cxx_options INTERFACE) -target_compile_features(cxx_options INTERFACE cxx_std_20) - -set(using_gcc_like "$") -set(using_gcc "$") -set(using_msvc "$") -set(using_gcc_like_release "$>") -set(using_gcc_like_debug "$>") -set(should_use_glibcxx_debug "$>") - -target_compile_options(cxx_options INTERFACE - "$<${using_gcc_like}:-O3;-g>") -target_link_options(cxx_options INTERFACE - "$<${using_gcc_like}:-g>") -target_compile_options(cxx_options INTERFACE - "$<${using_gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") -target_compile_definitions(cxx_options INTERFACE - "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") -# Enable exceptions for MSVC. -target_compile_options(cxx_options INTERFACE - "$<${using_msvc}:/EHsc>") - -add_library(cxx_warnings INTERFACE) -target_compile_options(cxx_warnings INTERFACE - "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") - -## We ignore the warning "restrict" because of a bug in GCC 12: -## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 -set(v12_or_later "$,12>") -set(before_v13 "$,13>") -set(bugged_gcc "$") -target_compile_options(cxx_warnings INTERFACE - "$<${bugged_gcc}:-Wno-restrict>") - -# For MSVC, use warning level 4 (/W4) because /Wall currently detects too -# many warnings outside of our code to be useful. -target_compile_options(cxx_warnings INTERFACE - "$<${using_msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") - # Disable warnings that currently trigger in the code until we fix them. - # /wd4456: declaration hides previous local declaration - # /wd4458: declaration hides class member - # /wd4459: declaration hides global declaration - # /wd4244: conversion with possible loss of data - # /wd4267: conversion from size_t to int with possible loss of data -target_link_libraries(cxx_options INTERFACE cxx_warnings) +include_guard(GLOBAL) +include(CMakeParseArguments) +include(cxx_options) +include(project_options) -function(fast_downward_set_up_build_types) - set(allowedBuildTypes Debug Release) - +function(set_up_build_types allowedBuildTypes) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(isMultiConfig) # Set the possible choices for multi-config generators like (like @@ -71,8 +24,7 @@ function(fast_downward_set_up_build_types) endif() endfunction() - -macro(fast_downward_report_bitwidth) +macro(report_bitwidth) if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) message(STATUS "Building for 32-bit.") elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) @@ -82,7 +34,7 @@ macro(fast_downward_report_bitwidth) endif() endmacro() -function(fast_downward_add_existing_sources_to_list _SOURCES_LIST_VAR) +function(add_existing_sources_to_list _SOURCES_LIST_VAR) set(_ALL_FILES) foreach(SOURCE_FILE ${${_SOURCES_LIST_VAR}}) get_filename_component(_SOURCE_FILE_DIR ${SOURCE_FILE} PATH) @@ -114,7 +66,7 @@ function(create_fast_downward_library) message(FATAL_ERROR "fast_downward_library: 'SOURCES' argument required.") endif() - fast_downward_add_existing_sources_to_list(_LIBRARY_SOURCES) + add_existing_sources_to_list(_LIBRARY_SOURCES) if (NOT _LIBRARY_CORE_LIBRARY AND NOT _LIBRARY_DEPENDENCY_ONLY) # Decide whether the plugin should be enabled by default. @@ -132,23 +84,16 @@ function(create_fast_downward_library) foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() - # TODO: This feels very hacky. I'd rather have the ability to specify - # external dependencies in DownwardFiles.cmake (i.e. new parameter - # DEPENDSEXTERNAL) but how to specify conditions there? - if (${_LIBRARY_NAME} STREQUAL "UTILS") - # On Linux, find the rt library for clock_gettime(). - if(UNIX AND NOT APPLE) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE rt) - endif() - - # On Windows, find the psapi library for determining peak memory. - if(WIN32) - cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE psapi) - endif() - endif() if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME}_ENABLED) target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) endif() endfunction() + +function(copy_dlls_to_binary_dir _TARGET_NAME) + # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:_TARGET_RUNTIME_DLLS + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS + ) +endfunction() diff --git a/src/search/cmake/project_options.cmake b/src/search/cmake/project_options.cmake new file mode 100644 index 0000000000..663995efbc --- /dev/null +++ b/src/search/cmake/project_options.cmake @@ -0,0 +1,37 @@ +include_guard(GLOBAL) + +function(set_up_options) + option( + USE_GLIBCXX_DEBUG + "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ +systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks \ +come at a significant performance cost and should only be enabled in debug mode. \ +Enabling them makes the binary incompatible with libraries that are not compiled \ +with this flag, which can lead to hard-to-debug errors." + FALSE) + + option( + USE_LP + "Compile with support for all LP solvers installed on this system. \ +If any enabled library requires an LP solver, compile with all \ +available LP solvers. If no solvers are installed, the planner will \ +still compile, but using heuristics that depend on an LP solver will \ +cause an error. This behavior can be overwritten by setting the \ +option USE_LP to false." + TRUE) + + if(USE_GLIBCXX_DEBUG AND USE_LP) + message( + FATAL_ERROR + "To prevent incompatibilities, the option USE_GLIBCXX_DEBUG is " + "not supported when an LP solver is used. See issue982 for details.") + endif() + + option( + DISABLE_LIBRARIES_BY_DEFAULT + "If set to YES only libraries that are specifically enabled will be compiled" + NO) + # This option should not show up in CMake GUIs like ccmake where all + # libraries are enabled or disabled manually. + mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) +endfunction() \ No newline at end of file From add0f7fc41ad4425c981e459a095fe3c9f9ffa85 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Tue, 12 Sep 2023 11:29:00 +0200 Subject: [PATCH 49/79] Remove displayname, lower case downward libraries --- src/search/CMakeLists.txt | 244 +++++++++++++++++----------------- src/search/cmake/macros.cmake | 5 +- 2 files changed, 125 insertions(+), 124 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 3b6ee0e92f..8387577a8d 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -12,7 +12,6 @@ # Defining a new library: # create_fast_downward_library( # NAME -# [ DISPLAY_NAME ] # [ HELP ] # SOURCES # [ ... ] @@ -21,9 +20,7 @@ # [ CORE_LIBRARY ] # ) # -# defaults to lower case and is used to group files -# in IDEs and for messages. -# defaults to and is used to describe the cmake option. +# is used to describe the cmake option, for example in ccmake. # SOURCES lists the source files that are part of the library. Entries are # listed without extension. For an entry , both .h and .cc # are added if the files exist. @@ -50,8 +47,11 @@ add_executable(downward planner.cc) # On Windows we have to copy all DLLs next to the generated binary. copy_dlls_to_binary_dir(downward) +# In the following, we include all source files, grouped into libraries with +# dependencies among each other. + create_fast_downward_library( - NAME CORE_SOURCES + NAME core_sources HELP "Core source files" SOURCES abstract_task @@ -82,12 +82,12 @@ create_fast_downward_library( task_id task_proxy - DEPENDS CAUSAL_GRAPH INT_HASH_SET INT_PACKER ORDERED_SET SEGMENTED_VECTOR SUBSCRIBER SUCCESSOR_GENERATOR TASK_PROPERTIES + DEPENDS causal_graph int_hash_set int_packer ordered_set segmented_vector subscriber successor_generator task_properties CORE_LIBRARY ) create_fast_downward_library( - NAME PLUGINS + NAME plugins HELP "Plugin definition" SOURCES plugins/any @@ -104,7 +104,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME PARSER + NAME parser HELP "Option parsing" SOURCES parser/abstract_syntax_tree @@ -116,7 +116,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME UTILS + NAME utils HELP "System utilities" SOURCES utils/collections @@ -139,59 +139,59 @@ create_fast_downward_library( ) # On Linux, find the rt library for clock_gettime(). if(UNIX AND NOT APPLE) - target_link_libraries(downward_UTILS INTERFACE rt) + target_link_libraries(downward_utils INTERFACE rt) endif() # On Windows, find the psapi library for determining peak memory. if(WIN32) cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward_UTILS INTERFACE psapi) + target_link_libraries(downward_utils INTERFACE psapi) endif() create_fast_downward_library( - NAME ALTERNATION_OPEN_LIST + NAME alternation_open_list HELP "Open list that alternates between underlying open lists in a round-robin manner" SOURCES open_lists/alternation_open_list ) create_fast_downward_library( - NAME BEST_FIRST_OPEN_LIST + NAME best_first_open_list HELP "Open list that selects the best element according to a single evaluation function" SOURCES open_lists/best_first_open_list ) create_fast_downward_library( - NAME EPSILON_GREEDY_OPEN_LIST + NAME epsilon_greedy_open_list HELP "Open list that chooses an entry randomly with probability epsilon" SOURCES open_lists/epsilon_greedy_open_list ) create_fast_downward_library( - NAME PARETO_OPEN_LIST + NAME pareto_open_list HELP "Pareto open list" SOURCES open_lists/pareto_open_list ) create_fast_downward_library( - NAME TIEBREAKING_OPEN_LIST + NAME tiebreaking_open_list HELP "Tiebreaking open list" SOURCES open_lists/tiebreaking_open_list ) create_fast_downward_library( - NAME TYPE_BASED_OPEN_LIST + NAME type_based_open_list HELP "Type-based open list" SOURCES open_lists/type_based_open_list ) create_fast_downward_library( - NAME DYNAMIC_BITSET + NAME dynamic_bitset HELP "Poor man's version of boost::dynamic_bitset" SOURCES algorithms/dynamic_bitset @@ -199,7 +199,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME NAMED_VECTOR + NAME named_vector HELP "Generic vector with associated name for each element" SOURCES algorithms/named_vector @@ -207,7 +207,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME EQUIVALENCE_RELATION + NAME equivalence_relation HELP "Equivalence relation over [1, ..., n] that can be iteratively refined" SOURCES algorithms/equivalence_relation @@ -215,7 +215,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME INT_HASH_SET + NAME int_hash_set HELP "Hash set storing non-negative integers" SOURCES algorithms/int_hash_set @@ -223,7 +223,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME INT_PACKER + NAME int_packer HELP "Greedy bin packing algorithm to pack integer variables with small domains tightly into memory" SOURCES algorithms/int_packer @@ -231,7 +231,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME MAX_CLIQUES + NAME max_cliques HELP "Implementation of the Max Cliques algorithm by Tomita et al." SOURCES algorithms/max_cliques @@ -239,7 +239,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME PRIORITY_QUEUES + NAME priority_queues HELP "Three implementations of priority queue: HeapQueue, BucketQueue and AdaptiveQueue" SOURCES algorithms/priority_queues @@ -247,7 +247,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME ORDERED_SET + NAME ordered_set HELP "Set of elements ordered by insertion time" SOURCES algorithms/ordered_set @@ -255,7 +255,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME SEGMENTED_VECTOR + NAME segmented_vector HELP "Memory-friendly and vector-like data structure" SOURCES algorithms/segmented_vector @@ -263,7 +263,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME SUBSCRIBER + NAME subscriber HELP "Allows object to subscribe to the destructor of other objects" SOURCES algorithms/subscriber @@ -271,30 +271,30 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME EVALUATORS_SUBCATEGORY + NAME evaluators_subcategory HELP "Subcategory plugin for basic evaluators" SOURCES evaluators/subcategory ) create_fast_downward_library( - NAME CONST_EVALUATOR + NAME const_evaluator HELP "The constant evaluator" SOURCES evaluators/const_evaluator - DEPENDS EVALUATORS_SUBCATEGORY + DEPENDS evaluators_subcategory ) create_fast_downward_library( - NAME G_EVALUATOR + NAME g_evaluator HELP "The g-evaluator" SOURCES evaluators/g_evaluator - DEPENDS EVALUATORS_SUBCATEGORY + DEPENDS evaluators_subcategory ) create_fast_downward_library( - NAME COMBINING_EVALUATOR + NAME combining_evaluator HELP "The combining evaluator" SOURCES evaluators/combining_evaluator @@ -302,39 +302,39 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME MAX_EVALUATOR + NAME max_evaluator HELP "The max evaluator" SOURCES evaluators/max_evaluator - DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY + DEPENDS combining_evaluator evaluators_subcategory ) create_fast_downward_library( - NAME PREF_EVALUATOR + NAME pref_evaluator HELP "The pref evaluator" SOURCES evaluators/pref_evaluator - DEPENDS EVALUATORS_SUBCATEGORY + DEPENDS evaluators_subcategory ) create_fast_downward_library( - NAME WEIGHTED_EVALUATOR + NAME weighted_evaluator HELP "The weighted evaluator" SOURCES evaluators/weighted_evaluator - DEPENDS EVALUATORS_SUBCATEGORY + DEPENDS evaluators_subcategory ) create_fast_downward_library( - NAME SUM_EVALUATOR + NAME sum_evaluator HELP "The sum evaluator" SOURCES evaluators/sum_evaluator - DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY + DEPENDS combining_evaluator evaluators_subcategory ) create_fast_downward_library( - NAME NULL_PRUNING_METHOD + NAME null_pruning_method HELP "Pruning method that does nothing" SOURCES pruning/null_pruning_method @@ -342,160 +342,160 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME LIMITED_PRUNING + NAME limited_pruning HELP "Method for limiting another pruning method" SOURCES pruning/limited_pruning ) create_fast_downward_library( - NAME STUBBORN_SETS + NAME stubborn_sets HELP "Base class for all stubborn set partial order reduction methods" SOURCES pruning/stubborn_sets - DEPENDS TASK_PROPERTIES + DEPENDS task_properties DEPENDENCY_ONLY ) create_fast_downward_library( - NAME STUBBORN_SETS_ACTION_CENTRIC + NAME stubborn_sets_action_centric HELP "Base class for all action-centric stubborn set partial order reduction methods" SOURCES pruning/stubborn_sets_action_centric - DEPENDS STUBBORN_SETS + DEPENDS stubborn_sets DEPENDENCY_ONLY ) create_fast_downward_library( - NAME STUBBORN_SETS_ATOM_CENTRIC + NAME stubborn_sets_atom_centric HELP "Atom-centric stubborn sets" SOURCES pruning/stubborn_sets_atom_centric - DEPENDS STUBBORN_SETS + DEPENDS stubborn_sets ) create_fast_downward_library( - NAME STUBBORN_SETS_SIMPLE + NAME stubborn_sets_simple HELP "Stubborn sets simple" SOURCES pruning/stubborn_sets_simple - DEPENDS STUBBORN_SETS_ACTION_CENTRIC + DEPENDS stubborn_sets_action_centric ) create_fast_downward_library( - NAME STUBBORN_SETS_EC + NAME stubborn_sets_ec HELP "Stubborn set method that dominates expansion core" SOURCES pruning/stubborn_sets_ec - DEPENDS STUBBORN_SETS_ACTION_CENTRIC TASK_PROPERTIES + DEPENDS stubborn_sets_action_centric task_properties ) create_fast_downward_library( - NAME SEARCH_COMMON + NAME search_common HELP "Basic classes used for all search algorithms" SOURCES search_algorithms/search_common - DEPENDS ALTERNATION_OPEN_LIST G_EVALUATOR BEST_FIRST_OPEN_LIST SUM_EVALUATOR TIEBREAKING_OPEN_LIST WEIGHTED_EVALUATOR + DEPENDS alternation_open_list g_evaluator best_first_open_list sum_evaluator tiebreaking_open_list weighted_evaluator DEPENDENCY_ONLY ) create_fast_downward_library( - NAME EAGER_SEARCH + NAME eager_search HELP "Eager search" SOURCES search_algorithms/eager_search - DEPENDS NULL_PRUNING_METHOD ORDERED_SET SUCCESSOR_GENERATOR + DEPENDS null_pruning_method ordered_set successor_generator DEPENDENCY_ONLY ) create_fast_downward_library( - NAME PLUGIN_ASTAR + NAME plugin_astar HELP "A* search" SOURCES search_algorithms/plugin_astar - DEPENDS EAGER_SEARCH SEARCH_COMMON + DEPENDS eager_search search_common ) create_fast_downward_library( - NAME PLUGIN_EAGER + NAME plugin_eager HELP "Eager (i.e., normal) best-first search" SOURCES search_algorithms/plugin_eager - DEPENDS EAGER_SEARCH SEARCH_COMMON + DEPENDS eager_search search_common ) create_fast_downward_library( - NAME PLUGIN_EAGER_GREEDY + NAME plugin_eager_greedy HELP "Eager greedy best-first search" SOURCES search_algorithms/plugin_eager_greedy - DEPENDS EAGER_SEARCH SEARCH_COMMON + DEPENDS eager_search search_common ) create_fast_downward_library( - NAME PLUGIN_EAGER_WASTAR + NAME plugin_eager_wastar HELP "Weighted eager A* search" SOURCES search_algorithms/plugin_eager_wastar - DEPENDS EAGER_SEARCH SEARCH_COMMON + DEPENDS eager_search search_common ) create_fast_downward_library( - NAME PLUGIN_LAZY + NAME plugin_lazy HELP "Best-first search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy - DEPENDS LAZY_SEARCH SEARCH_COMMON + DEPENDS lazy_search search_common ) create_fast_downward_library( - NAME PLUGIN_LAZY_GREEDY + NAME plugin_lazy_greedy HELP "Greedy best-first search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy_greedy - DEPENDS LAZY_SEARCH SEARCH_COMMON + DEPENDS lazy_search search_common ) create_fast_downward_library( - NAME PLUGIN_LAZY_WASTAR + NAME plugin_lazy_wastar HELP "Weighted A* search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy_wastar - DEPENDS LAZY_SEARCH SEARCH_COMMON + DEPENDS lazy_search search_common ) create_fast_downward_library( - NAME ENFORCED_HILL_CLIMBING_SEARCH + NAME enforced_hill_climbing_search HELP "Lazy enforced hill-climbing search" SOURCES search_algorithms/enforced_hill_climbing_search - DEPENDS G_EVALUATOR ORDERED_SET PREF_EVALUATOR SEARCH_COMMON SUCCESSOR_GENERATOR + DEPENDS g_evaluator ordered_set pref_evaluator search_common successor_generator ) create_fast_downward_library( - NAME ITERATED_SEARCH + NAME iterated_search HELP "Iterated search" SOURCES search_algorithms/iterated_search ) create_fast_downward_library( - NAME LAZY_SEARCH + NAME lazy_search HELP "Lazy search" SOURCES search_algorithms/lazy_search - DEPENDS ORDERED_SET SUCCESSOR_GENERATOR + DEPENDS ordered_set successor_generator DEPENDENCY_ONLY ) create_fast_downward_library( - NAME LP_SOLVER + NAME lp_solver HELP "Interface to an LP solver" SOURCES lp/lp_internals lp/lp_solver lp/solver_interface - DEPENDS NAMED_VECTOR + DEPENDS named_vector DEPENDENCY_ONLY ) if(USE_LP) @@ -506,7 +506,7 @@ if(USE_LP) target_link_libraries(downward_cplex_interface INTERFACE cplex::cplex) target_sources(downward_cplex_interface INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) - target_link_libraries(downward_LP_SOLVER INTERFACE downward_cplex_interface) + target_link_libraries(downward_lp_solver INTERFACE downward_cplex_interface) endif() # TODO: we actually require a version greater than 6.0.3 but it is not released yet. @@ -518,12 +518,12 @@ if(USE_LP) target_compile_definitions(downward_soplex_interface INTERFACE HAS_SOPLEX) target_sources(downward_soplex_interface INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) - target_link_libraries(downward_LP_SOLVER INTERFACE downward_soplex_interface) + target_link_libraries(downward_lp_solver INTERFACE downward_soplex_interface) endif() endif() create_fast_downward_library( - NAME RELAXATION_HEURISTIC + NAME relaxation_heuristic HELP "The base class for relaxation heuristics" SOURCES heuristics/array_pool @@ -532,39 +532,39 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME ADDITIVE_HEURISTIC + NAME additive_heuristic HELP "The additive heuristic" SOURCES heuristics/additive_heuristic - DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC TASK_PROPERTIES + DEPENDS priority_queues relaxation_heuristic task_properties ) create_fast_downward_library( - NAME BLIND_SEARCH_HEURISTIC + NAME blind_search_heuristic HELP "The 'blind search' heuristic" SOURCES heuristics/blind_search_heuristic - DEPENDS TASK_PROPERTIES + DEPENDS task_properties ) create_fast_downward_library( - NAME CONTEXT_ENHANCED_ADDITIVE_HEURISTIC + NAME context_enhanced_additive_heuristic HELP "The context-enhanced additive heuristic" SOURCES heuristics/cea_heuristic - DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES + DEPENDS domain_transition_graph priority_queues task_properties ) create_fast_downward_library( - NAME CG_HEURISTIC + NAME cg_heuristic HELP "The causal graph heuristic" SOURCES heuristics/cg_heuristic heuristics/cg_cache - DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES + DEPENDS domain_transition_graph priority_queues task_properties ) create_fast_downward_library( - NAME DOMAIN_TRANSITION_GRAPH + NAME domain_transition_graph HELP "DTGs used by cg and cea heuristic" SOURCES heuristics/domain_transition_graph @@ -572,47 +572,47 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME FF_HEURISTIC + NAME ff_heuristic HELP "The FF heuristic (an implementation of the RPG heuristic)" SOURCES heuristics/ff_heuristic - DEPENDS ADDITIVE_HEURISTIC TASK_PROPERTIES + DEPENDS additive_heuristic task_properties ) create_fast_downward_library( - NAME GOAL_COUNT_HEURISTIC + NAME goal_count_heuristic HELP "The goal-counting heuristic" SOURCES heuristics/goal_count_heuristic ) create_fast_downward_library( - NAME HM_HEURISTIC + NAME hm_heuristic HELP "The h^m heuristic" SOURCES heuristics/hm_heuristic - DEPENDS TASK_PROPERTIES + DEPENDS task_properties ) create_fast_downward_library( - NAME LANDMARK_CUT_HEURISTIC + NAME landmark_cut_heuristic HELP "The LM-cut heuristic" SOURCES heuristics/lm_cut_heuristic heuristics/lm_cut_landmarks - DEPENDS PRIORITY_QUEUES TASK_PROPERTIES + DEPENDS priority_queues task_properties ) create_fast_downward_library( - NAME MAX_HEURISTIC + NAME max_heuristic HELP "The Max heuristic" SOURCES heuristics/max_heuristic - DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC + DEPENDS priority_queues relaxation_heuristic ) create_fast_downward_library( - NAME CORE_TASKS + NAME core_tasks HELP "Core task transformations" SOURCES tasks/cost_adapted_task @@ -622,19 +622,19 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME EXTRA_TASKS + NAME extra_tasks HELP "Non-core task transformations" SOURCES tasks/domain_abstracted_task tasks/domain_abstracted_task_factory tasks/modified_goals_task tasks/modified_operator_costs_task - DEPENDS TASK_PROPERTIES + DEPENDS task_properties DEPENDENCY_ONLY ) create_fast_downward_library( - NAME CAUSAL_GRAPH + NAME causal_graph HELP "Causal Graph" SOURCES task_utils/causal_graph @@ -642,27 +642,27 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME SAMPLING + NAME sampling HELP "Sampling" SOURCES task_utils/sampling - DEPENDS SUCCESSOR_GENERATOR TASK_PROPERTIES + DEPENDS successor_generator task_properties DEPENDENCY_ONLY ) create_fast_downward_library( - NAME SUCCESSOR_GENERATOR + NAME successor_generator HELP "Successor generator" SOURCES task_utils/successor_generator task_utils/successor_generator_factory task_utils/successor_generator_internals - DEPENDS TASK_PROPERTIES + DEPENDS task_properties DEPENDENCY_ONLY ) create_fast_downward_library( - NAME TASK_PROPERTIES + NAME task_properties HELP "Task properties" SOURCES task_utils/task_properties @@ -670,7 +670,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME VARIABLE_ORDER_FINDER + NAME variable_order_finder HELP "Variable order finder" SOURCES task_utils/variable_order_finder @@ -678,7 +678,7 @@ create_fast_downward_library( ) create_fast_downward_library( - NAME CEGAR + NAME cegar HELP "Plugin containing the code for Cartesian CEGAR heuristics" SOURCES cartesian_abstractions/abstraction @@ -697,11 +697,11 @@ create_fast_downward_library( cartesian_abstractions/types cartesian_abstractions/utils cartesian_abstractions/utils_landmarks - DEPENDS ADDITIVE_HEURISTIC DYNAMIC_BITSET EXTRA_TASKS LANDMARKS PRIORITY_QUEUES TASK_PROPERTIES + DEPENDS additive_heuristic dynamic_bitset extra_tasks landmarks priority_queues task_properties ) create_fast_downward_library( - NAME MAS_HEURISTIC + NAME mas_heuristic HELP "The Merge-and-Shrink heuristic" SOURCES merge_and_shrink/distances @@ -740,11 +740,11 @@ create_fast_downward_library( merge_and_shrink/transition_system merge_and_shrink/types merge_and_shrink/utils - DEPENDS PRIORITY_QUEUES EQUIVALENCE_RELATION SCCS TASK_PROPERTIES VARIABLE_ORDER_FINDER + DEPENDS priority_queues equivalence_relation sccs task_properties variable_order_finder ) create_fast_downward_library( - NAME LANDMARKS + NAME landmarks HELP "Plugin containing the code to reason with landmarks" SOURCES landmarks/exploration @@ -764,11 +764,11 @@ create_fast_downward_library( landmarks/landmark_status_manager landmarks/landmark_sum_heuristic landmarks/util - DEPENDS LP_SOLVER PRIORITY_QUEUES SUCCESSOR_GENERATOR TASK_PROPERTIES + DEPENDS lp_solver priority_queues successor_generator task_properties ) create_fast_downward_library( - NAME OPERATOR_COUNTING + NAME operator_counting HELP "Plugin containing the code for operator-counting heuristics" SOURCES operator_counting/constraint_generator @@ -777,11 +777,11 @@ create_fast_downward_library( operator_counting/operator_counting_heuristic operator_counting/pho_constraints operator_counting/state_equation_constraints - DEPENDS LP_SOLVER LANDMARK_CUT_HEURISTIC PDBS TASK_PROPERTIES + DEPENDS lp_solver landmark_cut_heuristic pdbs task_properties ) create_fast_downward_library( - NAME PDBS + NAME pdbs HELP "Plugin containing the code for PDBs" SOURCES pdbs/abstract_operator @@ -819,11 +819,11 @@ create_fast_downward_library( pdbs/validation pdbs/zero_one_pdbs pdbs/zero_one_pdbs_heuristic - DEPENDS CAUSAL_GRAPH MAX_CLIQUES PRIORITY_QUEUES SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES VARIABLE_ORDER_FINDER + DEPENDS causal_graph max_cliques priority_queues sampling successor_generator task_properties variable_order_finder ) create_fast_downward_library( - NAME POTENTIALS + NAME potentials HELP "Plugin containing the code for potential heuristics" SOURCES potentials/diverse_potential_heuristics @@ -835,11 +835,11 @@ create_fast_downward_library( potentials/single_potential_heuristics potentials/subcategory potentials/util - DEPENDS LP_SOLVER SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES + DEPENDS lp_solver sampling successor_generator task_properties ) create_fast_downward_library( - NAME SCCS + NAME sccs HELP "Algorithm to compute the strongly connected components (SCCs) of a " "directed graph." SOURCES diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index b44387baa1..de7b11e9b5 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -55,7 +55,7 @@ endfunction() function(create_fast_downward_library) set(_OPTIONS DEPENDENCY_ONLY CORE_LIBRARY) - set(_ONE_VALUE_ARGS NAME DISPLAY_NAME HELP) + set(_ONE_VALUE_ARGS NAME HELP) set(_MULTI_VALUE_ARGS SOURCES DEPENDS) cmake_parse_arguments(_LIBRARY "${_OPTIONS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN}) # Check mandatory arguments. @@ -75,7 +75,8 @@ function(create_fast_downward_library) else() set(_OPTION_DEFAULT TRUE) endif() - option(LIBRARY_${_LIBRARY_NAME}_ENABLED ${_LIBRARY_HELP} ${_OPTION_DEFAULT}) + string(TOUPPER ${_LIBRARY_NAME} _LIBRARY_NAME_UPPER) + option(LIBRARY_${_LIBRARY_NAME_UPPER}_ENABLED ${_LIBRARY_HELP} ${_OPTION_DEFAULT}) endif() add_library(downward_${_LIBRARY_NAME} INTERFACE) From c1bb73c198cfab9293c5fe80c6c79228091f1086 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Tue, 12 Sep 2023 12:08:56 +0200 Subject: [PATCH 50/79] renaming and cleanup --- src/search/CMakeLists.txt | 32 ++++++++---------- src/search/cmake/cxx_options.cmake | 45 -------------------------- src/search/cmake/macros.cmake | 8 ++--- src/search/cmake/project_options.cmake | 37 --------------------- 4 files changed, 17 insertions(+), 105 deletions(-) delete mode 100644 src/search/cmake/cxx_options.cmake delete mode 100644 src/search/cmake/project_options.cmake diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 8387577a8d..ed9f7f52eb 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -22,14 +22,14 @@ # # is used to describe the cmake option, for example in ccmake. # SOURCES lists the source files that are part of the library. Entries are -# listed without extension. For an entry , both .h and .cc -# are added if the files exist. -# DEPENDS lists libraries that will be automatically enabled if this library is -# enabled. If the dependency was not enabled before, this will be logged. +# listed without extension. For an entry , both .h and .cc +# are added if the files exist. +# DEPENDS lists libraries that will be compiled as dependendies if this library +# is enabled. # DEPENDENCY_ONLY disables the library unless it is needed as a dependency and -# hides the option to enable the library in cmake GUIs like ccmake. +# hides the option to enable the library in cmake GUIs like ccmake. # CORE_LIBRARY always enables the library (even if DISABLE_LIBRARIES_BY_DEFAULT -# is used) and hides the option to disable it in CMake GUIs like ccmake. +# is used) and hides the option to disable it in CMake GUIs like ccmake. cmake_minimum_required(VERSION 3.16) @@ -45,7 +45,7 @@ project(downward LANGUAGES CXX) add_executable(downward planner.cc) # On Windows we have to copy all DLLs next to the generated binary. -copy_dlls_to_binary_dir(downward) +copy_dlls_to_binary_dir_after_build(downward) # In the following, we include all source files, grouped into libraries with # dependencies among each other. @@ -501,24 +501,18 @@ create_fast_downward_library( if(USE_LP) find_package(Cplex 12) if(CPLEX_FOUND) - add_library(downward_cplex_interface INTERFACE) - target_compile_definitions(downward_cplex_interface INTERFACE HAS_CPLEX) - target_link_libraries(downward_cplex_interface INTERFACE cplex::cplex) - target_sources(downward_cplex_interface INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) - - target_link_libraries(downward_lp_solver INTERFACE downward_cplex_interface) + target_compile_definitions(downward_lp_solver INTERFACE HAS_CPLEX) + target_link_libraries(downward_lp_solver INTERFACE cplex::cplex) + target_sources(downward_lp_solver INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) endif() # TODO: we actually require a version greater than 6.0.3 but it is not released yet. find_package(soplex 6.0.3 QUIET) if (SOPLEX_FOUND) message(STATUS "Found SoPlex: ${SOPLEX_INCLUDE_DIRS}") - add_library(downward_soplex_interface INTERFACE) - target_link_libraries(downward_soplex_interface INTERFACE libsoplex) - target_compile_definitions(downward_soplex_interface INTERFACE HAS_SOPLEX) - target_sources(downward_soplex_interface INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) - - target_link_libraries(downward_lp_solver INTERFACE downward_soplex_interface) + target_link_libraries(downward_lp_solver INTERFACE libsoplex) + target_compile_definitions(downward_lp_solver INTERFACE HAS_SOPLEX) + target_sources(downward_lp_solver INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) endif() endif() diff --git a/src/search/cmake/cxx_options.cmake b/src/search/cmake/cxx_options.cmake deleted file mode 100644 index f5c68f89b2..0000000000 --- a/src/search/cmake/cxx_options.cmake +++ /dev/null @@ -1,45 +0,0 @@ -add_library(cxx_options INTERFACE) -target_compile_features(cxx_options INTERFACE cxx_std_20) - -set(using_gcc_like "$") -set(using_gcc "$") -set(using_msvc "$") -set(using_gcc_like_release "$>") -set(using_gcc_like_debug "$>") -set(should_use_glibcxx_debug "$>") - -target_compile_options(cxx_options INTERFACE - "$<${using_gcc_like}:-O3;-g>") -target_link_options(cxx_options INTERFACE - "$<${using_gcc_like}:-g>") -target_compile_options(cxx_options INTERFACE - "$<${using_gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") -target_compile_definitions(cxx_options INTERFACE - "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") -# Enable exceptions for MSVC. -target_compile_options(cxx_options INTERFACE - "$<${using_msvc}:/EHsc>") - -add_library(cxx_warnings INTERFACE) -target_compile_options(cxx_warnings INTERFACE - "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") - -## We ignore the warning "restrict" because of a bug in GCC 12: -## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 -set(v12_or_later "$,12>") -set(before_v13 "$,13>") -set(bugged_gcc "$") -target_compile_options(cxx_warnings INTERFACE - "$<${bugged_gcc}:-Wno-restrict>") - -# For MSVC, use warning level 4 (/W4) because /Wall currently detects too -# many warnings outside of our code to be useful. -target_compile_options(cxx_warnings INTERFACE - "$<${using_msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") - # Disable warnings that currently trigger in the code until we fix them. - # /wd4456: declaration hides previous local declaration - # /wd4458: declaration hides class member - # /wd4459: declaration hides global declaration - # /wd4244: conversion with possible loss of data - # /wd4267: conversion from size_t to int with possible loss of data -target_link_libraries(cxx_options INTERFACE cxx_warnings) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index de7b11e9b5..8a58555f02 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -1,8 +1,8 @@ include_guard(GLOBAL) include(CMakeParseArguments) -include(cxx_options) -include(project_options) +include(common_cxx_flags) +include(options) function(set_up_build_types allowedBuildTypes) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -80,7 +80,7 @@ function(create_fast_downward_library) endif() add_library(downward_${_LIBRARY_NAME} INTERFACE) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE cxx_options) + target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE common_cxx_flags) target_sources(downward_${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) @@ -91,7 +91,7 @@ function(create_fast_downward_library) endif() endfunction() -function(copy_dlls_to_binary_dir _TARGET_NAME) +function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:_TARGET_RUNTIME_DLLS add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -t $ $ diff --git a/src/search/cmake/project_options.cmake b/src/search/cmake/project_options.cmake deleted file mode 100644 index 663995efbc..0000000000 --- a/src/search/cmake/project_options.cmake +++ /dev/null @@ -1,37 +0,0 @@ -include_guard(GLOBAL) - -function(set_up_options) - option( - USE_GLIBCXX_DEBUG - "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ -systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks \ -come at a significant performance cost and should only be enabled in debug mode. \ -Enabling them makes the binary incompatible with libraries that are not compiled \ -with this flag, which can lead to hard-to-debug errors." - FALSE) - - option( - USE_LP - "Compile with support for all LP solvers installed on this system. \ -If any enabled library requires an LP solver, compile with all \ -available LP solvers. If no solvers are installed, the planner will \ -still compile, but using heuristics that depend on an LP solver will \ -cause an error. This behavior can be overwritten by setting the \ -option USE_LP to false." - TRUE) - - if(USE_GLIBCXX_DEBUG AND USE_LP) - message( - FATAL_ERROR - "To prevent incompatibilities, the option USE_GLIBCXX_DEBUG is " - "not supported when an LP solver is used. See issue982 for details.") - endif() - - option( - DISABLE_LIBRARIES_BY_DEFAULT - "If set to YES only libraries that are specifically enabled will be compiled" - NO) - # This option should not show up in CMake GUIs like ccmake where all - # libraries are enabled or disabled manually. - mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) -endfunction() \ No newline at end of file From 7d6da788e4e7ded53f81cff416bc41e253cf34ff Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Tue, 12 Sep 2023 12:10:29 +0200 Subject: [PATCH 51/79] forgot to add renamed files --- src/search/cmake/common_cxx_flags.cmake | 45 +++++++++++++++++++++++++ src/search/cmake/options.cmake | 37 ++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/search/cmake/common_cxx_flags.cmake create mode 100644 src/search/cmake/options.cmake diff --git a/src/search/cmake/common_cxx_flags.cmake b/src/search/cmake/common_cxx_flags.cmake new file mode 100644 index 0000000000..cf8284c3ab --- /dev/null +++ b/src/search/cmake/common_cxx_flags.cmake @@ -0,0 +1,45 @@ +add_library(common_cxx_flags INTERFACE) +target_compile_features(common_cxx_flags INTERFACE cxx_std_20) + +set(using_gcc_like "$") +set(using_gcc "$") +set(using_msvc "$") +set(using_gcc_like_release "$>") +set(using_gcc_like_debug "$>") +set(should_use_glibcxx_debug "$>") + +target_compile_options(common_cxx_flags INTERFACE + "$<${using_gcc_like}:-O3;-g>") +target_link_options(common_cxx_flags INTERFACE + "$<${using_gcc_like}:-g>") +target_compile_options(common_cxx_flags INTERFACE + "$<${using_gcc_like_release}:-DNDEBUG;-fomit-frame-pointer>") +target_compile_definitions(common_cxx_flags INTERFACE + "$<${should_use_glibcxx_debug}:_GLIBCXX_DEBUG>") +# Enable exceptions for MSVC. +target_compile_options(common_cxx_flags INTERFACE + "$<${using_msvc}:/EHsc>") + +add_library(common_cxx_warnings INTERFACE) +target_compile_options(common_cxx_warnings INTERFACE + "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") + +## We ignore the warning "restrict" because of a bug in GCC 12: +## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 +set(v12_or_later "$,12>") +set(before_v13 "$,13>") +set(bugged_gcc "$") +target_compile_options(common_cxx_warnings INTERFACE + "$<${bugged_gcc}:-Wno-restrict>") + +# For MSVC, use warning level 4 (/W4) because /Wall currently detects too +# many warnings outside of our code to be useful. +target_compile_options(common_cxx_warnings INTERFACE + "$<${using_msvc}:/W4;/wd4456;/wd4458;/wd4459;/wd4244;/wd4267>") + # Disable warnings that currently trigger in the code until we fix them. + # /wd4456: declaration hides previous local declaration + # /wd4458: declaration hides class member + # /wd4459: declaration hides global declaration + # /wd4244: conversion with possible loss of data + # /wd4267: conversion from size_t to int with possible loss of data +target_link_libraries(common_cxx_flags INTERFACE common_cxx_warnings) diff --git a/src/search/cmake/options.cmake b/src/search/cmake/options.cmake new file mode 100644 index 0000000000..663995efbc --- /dev/null +++ b/src/search/cmake/options.cmake @@ -0,0 +1,37 @@ +include_guard(GLOBAL) + +function(set_up_options) + option( + USE_GLIBCXX_DEBUG + "Enable the libstdc++ debug mode that does additional safety checks. (On Linux \ +systems, g++ and clang++ usually use libstdc++ for the C++ library.) The checks \ +come at a significant performance cost and should only be enabled in debug mode. \ +Enabling them makes the binary incompatible with libraries that are not compiled \ +with this flag, which can lead to hard-to-debug errors." + FALSE) + + option( + USE_LP + "Compile with support for all LP solvers installed on this system. \ +If any enabled library requires an LP solver, compile with all \ +available LP solvers. If no solvers are installed, the planner will \ +still compile, but using heuristics that depend on an LP solver will \ +cause an error. This behavior can be overwritten by setting the \ +option USE_LP to false." + TRUE) + + if(USE_GLIBCXX_DEBUG AND USE_LP) + message( + FATAL_ERROR + "To prevent incompatibilities, the option USE_GLIBCXX_DEBUG is " + "not supported when an LP solver is used. See issue982 for details.") + endif() + + option( + DISABLE_LIBRARIES_BY_DEFAULT + "If set to YES only libraries that are specifically enabled will be compiled" + NO) + # This option should not show up in CMake GUIs like ccmake where all + # libraries are enabled or disabled manually. + mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) +endfunction() \ No newline at end of file From bb56ab709f02f14e0abf4ca26c90edcc3053cc37 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Tue, 12 Sep 2023 15:11:45 +0200 Subject: [PATCH 52/79] Fix cmake copy command and comment out artifact deletion. --- .github/workflows/ubuntu.yml | 8 ++++---- src/search/CMakeLists.txt | 4 +++- src/search/cmake/macros.cmake | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 66a7ecb260..6d643c3519 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -123,10 +123,10 @@ jobs: with: name: compiled-planner-${{ matrix.version.ubuntu }} - - name: Delete artifact - uses: geekyeggo/delete-artifact@v2 - with: - name: compiled-planner-${{ matrix.version.ubuntu }} + #- name: Delete artifact + # uses: geekyeggo/delete-artifact@v2 + # with: + # name: compiled-planner-${{ matrix.version.ubuntu }} - name: Install Python uses: actions/setup-python@v4 diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index ed9f7f52eb..fc96bfc76b 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -45,7 +45,9 @@ project(downward LANGUAGES CXX) add_executable(downward planner.cc) # On Windows we have to copy all DLLs next to the generated binary. -copy_dlls_to_binary_dir_after_build(downward) +if (WIN32) + copy_dlls_to_binary_dir_after_build(downward) +endif() # In the following, we include all source files, grouped into libraries with # dependencies among each other. diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 8a58555f02..833230e714 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -94,7 +94,7 @@ endfunction() function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:_TARGET_RUNTIME_DLLS add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ COMMAND_EXPAND_LISTS ) endfunction() From b5d6129b89f2168e21ec7c4cc2f5b409ba519fa8 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Tue, 12 Sep 2023 16:00:55 +0200 Subject: [PATCH 53/79] Use uppercase library name, remove redundant DownwardFiles.cmake, and revert ubuntu workflow. --- .github/workflows/ubuntu.yml | 8 +- src/search/DownwardFiles.cmake | 807 --------------------------------- src/search/cmake/macros.cmake | 2 +- 3 files changed, 5 insertions(+), 812 deletions(-) delete mode 100644 src/search/DownwardFiles.cmake diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6d643c3519..66a7ecb260 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -123,10 +123,10 @@ jobs: with: name: compiled-planner-${{ matrix.version.ubuntu }} - #- name: Delete artifact - # uses: geekyeggo/delete-artifact@v2 - # with: - # name: compiled-planner-${{ matrix.version.ubuntu }} + - name: Delete artifact + uses: geekyeggo/delete-artifact@v2 + with: + name: compiled-planner-${{ matrix.version.ubuntu }} - name: Install Python uses: actions/setup-python@v4 diff --git a/src/search/DownwardFiles.cmake b/src/search/DownwardFiles.cmake deleted file mode 100644 index f909d67bfe..0000000000 --- a/src/search/DownwardFiles.cmake +++ /dev/null @@ -1,807 +0,0 @@ -# See https://www.fast-downward.org/ForDevelopers/AddingSourceFiles -# for general information on adding source files and CMake libraries. -# -# All libraries are enabled by default and users can disable them by specifying -# -DLIBRARY_FOO_ENABLED=FALSE -# The default behavior can be changed so all non-essential libraries are -# disabled by default by specifying -# -DDISABLE_LIBRARIES_BY_DEFAULT=TRUE -# In that case, individual libraries can be enabled with -# -DLIBRARY_FOO_ENABLED=TRUE -# -# Defining a new library: -# create_fast_downward_library( -# NAME -# [ DISPLAY_NAME ] -# [ HELP ] -# SOURCES -# [ ... ] -# [ DEPENDS [ ... ] ] -# [ DEPENDENCY_ONLY ] -# [ CORE_LIBRARY ] -# ) -# -# defaults to lower case and is used to group files -# in IDEs and for messages. -# defaults to and is used to describe the cmake option. -# SOURCES lists the source files that are part of the library. Entries are -# listed without extension. For an entry , both .h and .cc -# are added if the files exist. -# DEPENDS lists libraries that will be automatically enabled if this library is -# enabled. If the dependency was not enabled before, this will be logged. -# DEPENDENCY_ONLY disables the library unless it is needed as a dependency and -# hides the option to enable the library in cmake GUIs like ccmake. -# CORE_LIBRARY always enables the library (even if DISABLE_LIBRARIES_BY_DEFAULT -# is used) and hides the option to disable it in CMake GUIs like ccmake. - -option( - DISABLE_LIBRARIES_BY_DEFAULT - "If set to YES only libraries that are specifically enabled will be compiled" - NO) -# This option should not show up in CMake GUIs like ccmake where all -# libraries are enabled or disabled manually. -mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) - -create_fast_downward_library( - NAME CORE_SOURCES - HELP "Core source files" - SOURCES - abstract_task - axioms - command_line - evaluation_context - evaluation_result - evaluator - evaluator_cache - heuristic - open_list - open_list_factory - operator_cost - operator_id - per_state_array - per_state_bitset - per_state_information - per_task_information - plan_manager - pruning_method - search_algorithm - search_node_info - search_progress - search_space - search_statistics - state_id - state_registry - task_id - task_proxy - - DEPENDS CAUSAL_GRAPH INT_HASH_SET INT_PACKER ORDERED_SET SEGMENTED_VECTOR SUBSCRIBER SUCCESSOR_GENERATOR TASK_PROPERTIES - CORE_LIBRARY -) - -create_fast_downward_library( - NAME PLUGINS - HELP "Plugin definition" - SOURCES - plugins/any - plugins/bounds - plugins/doc_printer - plugins/options - plugins/plugin - plugins/plugin_info - plugins/raw_registry - plugins/registry - plugins/registry_types - plugins/types - CORE_LIBRARY -) - -create_fast_downward_library( - NAME PARSER - HELP "Option parsing" - SOURCES - parser/abstract_syntax_tree - parser/decorated_abstract_syntax_tree - parser/lexical_analyzer - parser/syntax_analyzer - parser/token_stream - CORE_LIBRARY -) - -create_fast_downward_library( - NAME UTILS - HELP "System utilities" - SOURCES - utils/collections - utils/countdown_timer - utils/exceptions - utils/hash - utils/language - utils/logging - utils/markup - utils/math - utils/memory - utils/rng - utils/rng_options - utils/strings - utils/system - utils/system_unix - utils/system_windows - utils/timer - CORE_LIBRARY -) - -create_fast_downward_library( - NAME ALTERNATION_OPEN_LIST - HELP "Open list that alternates between underlying open lists in a round-robin manner" - SOURCES - open_lists/alternation_open_list -) - -create_fast_downward_library( - NAME BEST_FIRST_OPEN_LIST - HELP "Open list that selects the best element according to a single evaluation function" - SOURCES - open_lists/best_first_open_list -) - -create_fast_downward_library( - NAME EPSILON_GREEDY_OPEN_LIST - HELP "Open list that chooses an entry randomly with probability epsilon" - SOURCES - open_lists/epsilon_greedy_open_list -) - -create_fast_downward_library( - NAME PARETO_OPEN_LIST - HELP "Pareto open list" - SOURCES - open_lists/pareto_open_list -) - -create_fast_downward_library( - NAME TIEBREAKING_OPEN_LIST - HELP "Tiebreaking open list" - SOURCES - open_lists/tiebreaking_open_list -) - -create_fast_downward_library( - NAME TYPE_BASED_OPEN_LIST - HELP "Type-based open list" - SOURCES - open_lists/type_based_open_list -) - -create_fast_downward_library( - NAME DYNAMIC_BITSET - HELP "Poor man's version of boost::dynamic_bitset" - SOURCES - algorithms/dynamic_bitset - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME NAMED_VECTOR - HELP "Generic vector with associated name for each element" - SOURCES - algorithms/named_vector - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME EQUIVALENCE_RELATION - HELP "Equivalence relation over [1, ..., n] that can be iteratively refined" - SOURCES - algorithms/equivalence_relation - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME INT_HASH_SET - HELP "Hash set storing non-negative integers" - SOURCES - algorithms/int_hash_set - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME INT_PACKER - HELP "Greedy bin packing algorithm to pack integer variables with small domains tightly into memory" - SOURCES - algorithms/int_packer - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME MAX_CLIQUES - HELP "Implementation of the Max Cliques algorithm by Tomita et al." - SOURCES - algorithms/max_cliques - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME PRIORITY_QUEUES - HELP "Three implementations of priority queue: HeapQueue, BucketQueue and AdaptiveQueue" - SOURCES - algorithms/priority_queues - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME ORDERED_SET - HELP "Set of elements ordered by insertion time" - SOURCES - algorithms/ordered_set - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME SEGMENTED_VECTOR - HELP "Memory-friendly and vector-like data structure" - SOURCES - algorithms/segmented_vector - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME SUBSCRIBER - HELP "Allows object to subscribe to the destructor of other objects" - SOURCES - algorithms/subscriber - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME EVALUATORS_SUBCATEGORY - HELP "Subcategory plugin for basic evaluators" - SOURCES - evaluators/subcategory -) - -create_fast_downward_library( - NAME CONST_EVALUATOR - HELP "The constant evaluator" - SOURCES - evaluators/const_evaluator - DEPENDS EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME G_EVALUATOR - HELP "The g-evaluator" - SOURCES - evaluators/g_evaluator - DEPENDS EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME COMBINING_EVALUATOR - HELP "The combining evaluator" - SOURCES - evaluators/combining_evaluator - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME MAX_EVALUATOR - HELP "The max evaluator" - SOURCES - evaluators/max_evaluator - DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME PREF_EVALUATOR - HELP "The pref evaluator" - SOURCES - evaluators/pref_evaluator - DEPENDS EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME WEIGHTED_EVALUATOR - HELP "The weighted evaluator" - SOURCES - evaluators/weighted_evaluator - DEPENDS EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME SUM_EVALUATOR - HELP "The sum evaluator" - SOURCES - evaluators/sum_evaluator - DEPENDS COMBINING_EVALUATOR EVALUATORS_SUBCATEGORY -) - -create_fast_downward_library( - NAME NULL_PRUNING_METHOD - HELP "Pruning method that does nothing" - SOURCES - pruning/null_pruning_method - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME LIMITED_PRUNING - HELP "Method for limiting another pruning method" - SOURCES - pruning/limited_pruning -) - -create_fast_downward_library( - NAME STUBBORN_SETS - HELP "Base class for all stubborn set partial order reduction methods" - SOURCES - pruning/stubborn_sets - DEPENDS TASK_PROPERTIES - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME STUBBORN_SETS_ACTION_CENTRIC - HELP "Base class for all action-centric stubborn set partial order reduction methods" - SOURCES - pruning/stubborn_sets_action_centric - DEPENDS STUBBORN_SETS - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME STUBBORN_SETS_ATOM_CENTRIC - HELP "Atom-centric stubborn sets" - SOURCES - pruning/stubborn_sets_atom_centric - DEPENDS STUBBORN_SETS -) - -create_fast_downward_library( - NAME STUBBORN_SETS_SIMPLE - HELP "Stubborn sets simple" - SOURCES - pruning/stubborn_sets_simple - DEPENDS STUBBORN_SETS_ACTION_CENTRIC -) - -create_fast_downward_library( - NAME STUBBORN_SETS_EC - HELP "Stubborn set method that dominates expansion core" - SOURCES - pruning/stubborn_sets_ec - DEPENDS STUBBORN_SETS_ACTION_CENTRIC TASK_PROPERTIES -) - -create_fast_downward_library( - NAME SEARCH_COMMON - HELP "Basic classes used for all search algorithms" - SOURCES - search_algorithms/search_common - DEPENDS ALTERNATION_OPEN_LIST G_EVALUATOR BEST_FIRST_OPEN_LIST SUM_EVALUATOR TIEBREAKING_OPEN_LIST WEIGHTED_EVALUATOR - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME EAGER_SEARCH - HELP "Eager search" - SOURCES - search_algorithms/eager_search - DEPENDS NULL_PRUNING_METHOD ORDERED_SET SUCCESSOR_GENERATOR - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME PLUGIN_ASTAR - HELP "A* search" - SOURCES - search_algorithms/plugin_astar - DEPENDS EAGER_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_EAGER - HELP "Eager (i.e., normal) best-first search" - SOURCES - search_algorithms/plugin_eager - DEPENDS EAGER_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_EAGER_GREEDY - HELP "Eager greedy best-first search" - SOURCES - search_algorithms/plugin_eager_greedy - DEPENDS EAGER_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_EAGER_WASTAR - HELP "Weighted eager A* search" - SOURCES - search_algorithms/plugin_eager_wastar - DEPENDS EAGER_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_LAZY - HELP "Best-first search with deferred evaluation (lazy)" - SOURCES - search_algorithms/plugin_lazy - DEPENDS LAZY_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_LAZY_GREEDY - HELP "Greedy best-first search with deferred evaluation (lazy)" - SOURCES - search_algorithms/plugin_lazy_greedy - DEPENDS LAZY_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME PLUGIN_LAZY_WASTAR - HELP "Weighted A* search with deferred evaluation (lazy)" - SOURCES - search_algorithms/plugin_lazy_wastar - DEPENDS LAZY_SEARCH SEARCH_COMMON -) - -create_fast_downward_library( - NAME ENFORCED_HILL_CLIMBING_SEARCH - HELP "Lazy enforced hill-climbing search" - SOURCES - search_algorithms/enforced_hill_climbing_search - DEPENDS G_EVALUATOR ORDERED_SET PREF_EVALUATOR SEARCH_COMMON SUCCESSOR_GENERATOR -) - -create_fast_downward_library( - NAME ITERATED_SEARCH - HELP "Iterated search" - SOURCES - search_algorithms/iterated_search -) - -create_fast_downward_library( - NAME LAZY_SEARCH - HELP "Lazy search" - SOURCES - search_algorithms/lazy_search - DEPENDS ORDERED_SET SUCCESSOR_GENERATOR - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME LP_SOLVER - HELP "Interface to an LP solver" - SOURCES - lp/lp_internals - lp/lp_solver - lp/solver_interface - DEPENDS NAMED_VECTOR - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME RELAXATION_HEURISTIC - HELP "The base class for relaxation heuristics" - SOURCES - heuristics/array_pool - heuristics/relaxation_heuristic - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME ADDITIVE_HEURISTIC - HELP "The additive heuristic" - SOURCES - heuristics/additive_heuristic - DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC TASK_PROPERTIES -) - -create_fast_downward_library( - NAME BLIND_SEARCH_HEURISTIC - HELP "The 'blind search' heuristic" - SOURCES - heuristics/blind_search_heuristic - DEPENDS TASK_PROPERTIES -) - -create_fast_downward_library( - NAME CONTEXT_ENHANCED_ADDITIVE_HEURISTIC - HELP "The context-enhanced additive heuristic" - SOURCES - heuristics/cea_heuristic - DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES -) - -create_fast_downward_library( - NAME CG_HEURISTIC - HELP "The causal graph heuristic" - SOURCES heuristics/cg_heuristic - heuristics/cg_cache - DEPENDS DOMAIN_TRANSITION_GRAPH PRIORITY_QUEUES TASK_PROPERTIES -) - -create_fast_downward_library( - NAME DOMAIN_TRANSITION_GRAPH - HELP "DTGs used by cg and cea heuristic" - SOURCES - heuristics/domain_transition_graph - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME FF_HEURISTIC - HELP "The FF heuristic (an implementation of the RPG heuristic)" - SOURCES - heuristics/ff_heuristic - DEPENDS ADDITIVE_HEURISTIC TASK_PROPERTIES -) - -create_fast_downward_library( - NAME GOAL_COUNT_HEURISTIC - HELP "The goal-counting heuristic" - SOURCES - heuristics/goal_count_heuristic -) - -create_fast_downward_library( - NAME HM_HEURISTIC - HELP "The h^m heuristic" - SOURCES - heuristics/hm_heuristic - DEPENDS TASK_PROPERTIES -) - -create_fast_downward_library( - NAME LANDMARK_CUT_HEURISTIC - HELP "The LM-cut heuristic" - SOURCES - heuristics/lm_cut_heuristic - heuristics/lm_cut_landmarks - DEPENDS PRIORITY_QUEUES TASK_PROPERTIES -) - -create_fast_downward_library( - NAME MAX_HEURISTIC - HELP "The Max heuristic" - SOURCES - heuristics/max_heuristic - DEPENDS PRIORITY_QUEUES RELAXATION_HEURISTIC -) - -create_fast_downward_library( - NAME CORE_TASKS - HELP "Core task transformations" - SOURCES - tasks/cost_adapted_task - tasks/delegating_task - tasks/root_task - CORE_LIBRARY -) - -create_fast_downward_library( - NAME EXTRA_TASKS - HELP "Non-core task transformations" - SOURCES - tasks/domain_abstracted_task - tasks/domain_abstracted_task_factory - tasks/modified_goals_task - tasks/modified_operator_costs_task - DEPENDS TASK_PROPERTIES - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME CAUSAL_GRAPH - HELP "Causal Graph" - SOURCES - task_utils/causal_graph - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME SAMPLING - HELP "Sampling" - SOURCES - task_utils/sampling - DEPENDS SUCCESSOR_GENERATOR TASK_PROPERTIES - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME SUCCESSOR_GENERATOR - HELP "Successor generator" - SOURCES - task_utils/successor_generator - task_utils/successor_generator_factory - task_utils/successor_generator_internals - DEPENDS TASK_PROPERTIES - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME TASK_PROPERTIES - HELP "Task properties" - SOURCES - task_utils/task_properties - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME VARIABLE_ORDER_FINDER - HELP "Variable order finder" - SOURCES - task_utils/variable_order_finder - DEPENDENCY_ONLY -) - -create_fast_downward_library( - NAME CEGAR - HELP "Plugin containing the code for Cartesian CEGAR heuristics" - SOURCES - cartesian_abstractions/abstraction - cartesian_abstractions/abstract_search - cartesian_abstractions/abstract_state - cartesian_abstractions/additive_cartesian_heuristic - cartesian_abstractions/cartesian_heuristic_function - cartesian_abstractions/cartesian_set - cartesian_abstractions/cegar - cartesian_abstractions/cost_saturation - cartesian_abstractions/refinement_hierarchy - cartesian_abstractions/split_selector - cartesian_abstractions/subtask_generators - cartesian_abstractions/transition - cartesian_abstractions/transition_system - cartesian_abstractions/types - cartesian_abstractions/utils - cartesian_abstractions/utils_landmarks - DEPENDS ADDITIVE_HEURISTIC DYNAMIC_BITSET EXTRA_TASKS LANDMARKS PRIORITY_QUEUES TASK_PROPERTIES -) - -create_fast_downward_library( - NAME MAS_HEURISTIC - HELP "The Merge-and-Shrink heuristic" - SOURCES - merge_and_shrink/distances - merge_and_shrink/factored_transition_system - merge_and_shrink/fts_factory - merge_and_shrink/label_reduction - merge_and_shrink/labels - merge_and_shrink/merge_and_shrink_algorithm - merge_and_shrink/merge_and_shrink_heuristic - merge_and_shrink/merge_and_shrink_representation - merge_and_shrink/merge_scoring_function - merge_and_shrink/merge_scoring_function_dfp - merge_and_shrink/merge_scoring_function_goal_relevance - merge_and_shrink/merge_scoring_function_miasm - merge_and_shrink/merge_scoring_function_miasm_utils - merge_and_shrink/merge_scoring_function_single_random - merge_and_shrink/merge_scoring_function_total_order - merge_and_shrink/merge_selector - merge_and_shrink/merge_selector_score_based_filtering - merge_and_shrink/merge_strategy - merge_and_shrink/merge_strategy_factory - merge_and_shrink/merge_strategy_factory_precomputed - merge_and_shrink/merge_strategy_factory_sccs - merge_and_shrink/merge_strategy_factory_stateless - merge_and_shrink/merge_strategy_precomputed - merge_and_shrink/merge_strategy_sccs - merge_and_shrink/merge_strategy_stateless - merge_and_shrink/merge_tree - merge_and_shrink/merge_tree_factory - merge_and_shrink/merge_tree_factory_linear - merge_and_shrink/shrink_bisimulation - merge_and_shrink/shrink_bucket_based - merge_and_shrink/shrink_fh - merge_and_shrink/shrink_random - merge_and_shrink/shrink_strategy - merge_and_shrink/transition_system - merge_and_shrink/types - merge_and_shrink/utils - DEPENDS PRIORITY_QUEUES EQUIVALENCE_RELATION SCCS TASK_PROPERTIES VARIABLE_ORDER_FINDER -) - -create_fast_downward_library( - NAME LANDMARKS - HELP "Plugin containing the code to reason with landmarks" - SOURCES - landmarks/exploration - landmarks/landmark - landmarks/landmark_cost_assignment - landmarks/landmark_cost_partitioning_heuristic - landmarks/landmark_factory - landmarks/landmark_factory_h_m - landmarks/landmark_factory_reasonable_orders_hps - landmarks/landmark_factory_merged - landmarks/landmark_factory_relaxation - landmarks/landmark_factory_rpg_exhaust - landmarks/landmark_factory_rpg_sasp - landmarks/landmark_factory_zhu_givan - landmarks/landmark_graph - landmarks/landmark_heuristic - landmarks/landmark_status_manager - landmarks/landmark_sum_heuristic - landmarks/util - DEPENDS LP_SOLVER PRIORITY_QUEUES SUCCESSOR_GENERATOR TASK_PROPERTIES -) - -create_fast_downward_library( - NAME OPERATOR_COUNTING - HELP "Plugin containing the code for operator-counting heuristics" - SOURCES - operator_counting/constraint_generator - operator_counting/delete_relaxation_constraints - operator_counting/lm_cut_constraints - operator_counting/operator_counting_heuristic - operator_counting/pho_constraints - operator_counting/state_equation_constraints - DEPENDS LP_SOLVER LANDMARK_CUT_HEURISTIC PDBS TASK_PROPERTIES -) - -create_fast_downward_library( - NAME PDBS - HELP "Plugin containing the code for PDBs" - SOURCES - pdbs/abstract_operator - pdbs/canonical_pdbs - pdbs/canonical_pdbs_heuristic - pdbs/cegar - pdbs/dominance_pruning - pdbs/incremental_canonical_pdbs - pdbs/match_tree - pdbs/max_cliques - pdbs/pattern_cliques - pdbs/pattern_collection_information - pdbs/pattern_collection_generator_combo - pdbs/pattern_collection_generator_disjoint_cegar - pdbs/pattern_collection_generator_genetic - pdbs/pattern_collection_generator_hillclimbing - pdbs/pattern_collection_generator_manual - pdbs/pattern_collection_generator_multiple_cegar - pdbs/pattern_collection_generator_multiple_random - pdbs/pattern_collection_generator_multiple - pdbs/pattern_collection_generator_systematic - pdbs/pattern_database_factory - pdbs/pattern_database - pdbs/pattern_generator_cegar - pdbs/pattern_generator_greedy - pdbs/pattern_generator_manual - pdbs/pattern_generator_random - pdbs/pattern_generator - pdbs/pattern_information - pdbs/pdb_heuristic - pdbs/random_pattern - pdbs/subcategory - pdbs/types - pdbs/utils - pdbs/validation - pdbs/zero_one_pdbs - pdbs/zero_one_pdbs_heuristic - DEPENDS CAUSAL_GRAPH MAX_CLIQUES PRIORITY_QUEUES SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES VARIABLE_ORDER_FINDER -) - -create_fast_downward_library( - NAME POTENTIALS - HELP "Plugin containing the code for potential heuristics" - SOURCES - potentials/diverse_potential_heuristics - potentials/potential_function - potentials/potential_heuristic - potentials/potential_max_heuristic - potentials/potential_optimizer - potentials/sample_based_potential_heuristics - potentials/single_potential_heuristics - potentials/subcategory - potentials/util - DEPENDS LP_SOLVER SAMPLING SUCCESSOR_GENERATOR TASK_PROPERTIES -) - -create_fast_downward_library( - NAME SCCS - HELP "Algorithm to compute the strongly connected components (SCCs) of a " - "directed graph." - SOURCES - algorithms/sccs - DEPENDENCY_ONLY -) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 833230e714..7a864a0d17 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -86,7 +86,7 @@ function(create_fast_downward_library) target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) endforeach() - if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME}_ENABLED) + if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME_UPPER}_ENABLED) target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) endif() endfunction() From 7330af3a53ddb841d00ce10bd9e0e1834c53e9eb Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Tue, 12 Sep 2023 16:11:40 +0200 Subject: [PATCH 54/79] Move includes from macros to CMakeLists. --- src/search/CMakeLists.txt | 2 ++ src/search/cmake/macros.cmake | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index fc96bfc76b..377e3ea061 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -35,7 +35,9 @@ cmake_minimum_required(VERSION 3.16) # Path containing custom CMake modules list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include(common_cxx_flags) include(macros) +include(options) report_bitwidth() set_up_build_types("Debug;Release") diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 7a864a0d17..1330195d04 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -1,8 +1,6 @@ include_guard(GLOBAL) include(CMakeParseArguments) -include(common_cxx_flags) -include(options) function(set_up_build_types allowedBuildTypes) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) From 35c915caffae7a2b8ce7a8d1af7ed05212ff57c3 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 14:38:59 +0200 Subject: [PATCH 55/79] Fix dependency test. --- misc/tests/test-dependencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/tests/test-dependencies.py b/misc/tests/test-dependencies.py index bac02159fb..061eeb80d1 100755 --- a/misc/tests/test-dependencies.py +++ b/misc/tests/test-dependencies.py @@ -8,7 +8,7 @@ DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) -LIBRARY_DEFINITION_FILE = os.path.join(REPO, "src", "search", "DownwardFiles.cmake") +LIBRARY_DEFINITION_FILE = os.path.join(REPO, "src", "search", "CMakeLists.txt") BUILDS = os.path.join(REPO, "builds/test-dependencies") @@ -64,7 +64,7 @@ def get_library_definitions(content): config_args = [ "cmake", "-S", os.path.join(REPO, "src"), "-B", build_path, "-DCMAKE_BUILD_TYPE=Debug", "-DDISABLE_LIBRARIES_BY_DEFAULT=YES", - "-DLIBRARY_{library}_ENABLED=True\"]\n".format(**locals()) + f"-DLIBRARY_{library.upper()}_ENABLED=True" ] build_args = ["cmake", "--build", build_path] if NUM_CPUS: From 2a7408b023d4a9040d61ebc4e3f9db96db8ed361 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 14:43:02 +0200 Subject: [PATCH 56/79] Fix typos and add include guard. --- src/search/cmake/FindCplex.cmake | 2 +- src/search/cmake/common_cxx_flags.cmake | 2 ++ src/search/cmake/macros.cmake | 4 ++-- src/search/cmake/options.cmake | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/search/cmake/FindCplex.cmake b/src/search/cmake/FindCplex.cmake index 058c0132bc..3e91affcdc 100644 --- a/src/search/cmake/FindCplex.cmake +++ b/src/search/cmake/FindCplex.cmake @@ -132,7 +132,7 @@ foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS}) if (WIN32) # On Windows, libraries consist of a .dll file and a .lib file. # CPLEX stores the .dll file in /bin and the .lib file in /lib. - # Since likning is against the .lib file, find_library() does not find + # Since linking is against the .lib file, find_library() does not find # the dll and we have to use find_file() instead. find_file(CPLEX_SHARED_LIBRARY_${CONFIG} NAMES diff --git a/src/search/cmake/common_cxx_flags.cmake b/src/search/cmake/common_cxx_flags.cmake index cf8284c3ab..62f2e1cd73 100644 --- a/src/search/cmake/common_cxx_flags.cmake +++ b/src/search/cmake/common_cxx_flags.cmake @@ -1,3 +1,5 @@ +include_guard(GLOBAL) + add_library(common_cxx_flags INTERFACE) target_compile_features(common_cxx_flags INTERFACE cxx_std_20) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 1330195d04..929c7b9ae9 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -5,8 +5,8 @@ include(CMakeParseArguments) function(set_up_build_types allowedBuildTypes) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(isMultiConfig) - # Set the possible choices for multi-config generators like (like - # Visual Studio Projects) that choose the build type at build time. + # Set the possible choices for multi-config generators (like Visual + # Studio Projects) that choose the build type at build time. set(CMAKE_CONFIGURATION_TYPES "${allowedBuildTypes}" CACHE STRING "Supported build types: ${allowedBuildTypes}" FORCE) else() diff --git a/src/search/cmake/options.cmake b/src/search/cmake/options.cmake index 663995efbc..3bfbeca018 100644 --- a/src/search/cmake/options.cmake +++ b/src/search/cmake/options.cmake @@ -34,4 +34,4 @@ option USE_LP to false." # This option should not show up in CMake GUIs like ccmake where all # libraries are enabled or disabled manually. mark_as_advanced(DISABLE_LIBRARIES_BY_DEFAULT) -endfunction() \ No newline at end of file +endfunction() From cd132b7ed5e0a734c72d8f0b91e4c2deef342263 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 14:43:22 +0200 Subject: [PATCH 57/79] Reformat dependencies. --- src/search/CMakeLists.txt | 167 +++++++++++++++++++++++++++++--------- 1 file changed, 129 insertions(+), 38 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 377e3ea061..be946465d3 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -286,7 +286,8 @@ create_fast_downward_library( HELP "The constant evaluator" SOURCES evaluators/const_evaluator - DEPENDS evaluators_subcategory + DEPENDS + evaluators_subcategory ) create_fast_downward_library( @@ -310,7 +311,9 @@ create_fast_downward_library( HELP "The max evaluator" SOURCES evaluators/max_evaluator - DEPENDS combining_evaluator evaluators_subcategory + DEPENDS + combining_evaluator + evaluators_subcategory ) create_fast_downward_library( @@ -318,7 +321,8 @@ create_fast_downward_library( HELP "The pref evaluator" SOURCES evaluators/pref_evaluator - DEPENDS evaluators_subcategory + DEPENDS + evaluators_subcategory ) create_fast_downward_library( @@ -326,7 +330,8 @@ create_fast_downward_library( HELP "The weighted evaluator" SOURCES evaluators/weighted_evaluator - DEPENDS evaluators_subcategory + DEPENDS + evaluators_subcategory ) create_fast_downward_library( @@ -334,7 +339,9 @@ create_fast_downward_library( HELP "The sum evaluator" SOURCES evaluators/sum_evaluator - DEPENDS combining_evaluator evaluators_subcategory + DEPENDS + combining_evaluator + evaluators_subcategory ) create_fast_downward_library( @@ -357,7 +364,8 @@ create_fast_downward_library( HELP "Base class for all stubborn set partial order reduction methods" SOURCES pruning/stubborn_sets - DEPENDS task_properties + DEPENDS + task_properties DEPENDENCY_ONLY ) @@ -366,7 +374,8 @@ create_fast_downward_library( HELP "Base class for all action-centric stubborn set partial order reduction methods" SOURCES pruning/stubborn_sets_action_centric - DEPENDS stubborn_sets + DEPENDS + stubborn_sets DEPENDENCY_ONLY ) @@ -375,7 +384,8 @@ create_fast_downward_library( HELP "Atom-centric stubborn sets" SOURCES pruning/stubborn_sets_atom_centric - DEPENDS stubborn_sets + DEPENDS + stubborn_sets ) create_fast_downward_library( @@ -383,7 +393,8 @@ create_fast_downward_library( HELP "Stubborn sets simple" SOURCES pruning/stubborn_sets_simple - DEPENDS stubborn_sets_action_centric + DEPENDS + stubborn_sets_action_centric ) create_fast_downward_library( @@ -391,7 +402,9 @@ create_fast_downward_library( HELP "Stubborn set method that dominates expansion core" SOURCES pruning/stubborn_sets_ec - DEPENDS stubborn_sets_action_centric task_properties + DEPENDS + stubborn_sets_action_centric + task_properties ) create_fast_downward_library( @@ -399,7 +412,13 @@ create_fast_downward_library( HELP "Basic classes used for all search algorithms" SOURCES search_algorithms/search_common - DEPENDS alternation_open_list g_evaluator best_first_open_list sum_evaluator tiebreaking_open_list weighted_evaluator + DEPENDS + alternation_open_list + g_evaluator + best_first_open_list + sum_evaluator + tiebreaking_open_list + weighted_evaluator DEPENDENCY_ONLY ) @@ -408,7 +427,10 @@ create_fast_downward_library( HELP "Eager search" SOURCES search_algorithms/eager_search - DEPENDS null_pruning_method ordered_set successor_generator + DEPENDS + null_pruning_method + ordered_set + successor_generator DEPENDENCY_ONLY ) @@ -417,7 +439,9 @@ create_fast_downward_library( HELP "A* search" SOURCES search_algorithms/plugin_astar - DEPENDS eager_search search_common + DEPENDS + eager_search + search_common ) create_fast_downward_library( @@ -425,7 +449,9 @@ create_fast_downward_library( HELP "Eager (i.e., normal) best-first search" SOURCES search_algorithms/plugin_eager - DEPENDS eager_search search_common + DEPENDS + eager_search + search_common ) create_fast_downward_library( @@ -433,7 +459,9 @@ create_fast_downward_library( HELP "Eager greedy best-first search" SOURCES search_algorithms/plugin_eager_greedy - DEPENDS eager_search search_common + DEPENDS + eager_search + search_common ) create_fast_downward_library( @@ -441,7 +469,9 @@ create_fast_downward_library( HELP "Weighted eager A* search" SOURCES search_algorithms/plugin_eager_wastar - DEPENDS eager_search search_common + DEPENDS + eager_search + search_common ) create_fast_downward_library( @@ -449,7 +479,9 @@ create_fast_downward_library( HELP "Best-first search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy - DEPENDS lazy_search search_common + DEPENDS + lazy_search + search_common ) create_fast_downward_library( @@ -457,7 +489,9 @@ create_fast_downward_library( HELP "Greedy best-first search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy_greedy - DEPENDS lazy_search search_common + DEPENDS + lazy_search + search_common ) create_fast_downward_library( @@ -465,7 +499,9 @@ create_fast_downward_library( HELP "Weighted A* search with deferred evaluation (lazy)" SOURCES search_algorithms/plugin_lazy_wastar - DEPENDS lazy_search search_common + DEPENDS + lazy_search + search_common ) create_fast_downward_library( @@ -473,7 +509,12 @@ create_fast_downward_library( HELP "Lazy enforced hill-climbing search" SOURCES search_algorithms/enforced_hill_climbing_search - DEPENDS g_evaluator ordered_set pref_evaluator search_common successor_generator + DEPENDS + g_evaluator + ordered_set + pref_evaluator + search_common + successor_generator ) create_fast_downward_library( @@ -488,7 +529,9 @@ create_fast_downward_library( HELP "Lazy search" SOURCES search_algorithms/lazy_search - DEPENDS ordered_set successor_generator + DEPENDS + ordered_set + successor_generator DEPENDENCY_ONLY ) @@ -499,7 +542,8 @@ create_fast_downward_library( lp/lp_internals lp/lp_solver lp/solver_interface - DEPENDS named_vector + DEPENDS + named_vector DEPENDENCY_ONLY ) if(USE_LP) @@ -534,7 +578,10 @@ create_fast_downward_library( HELP "The additive heuristic" SOURCES heuristics/additive_heuristic - DEPENDS priority_queues relaxation_heuristic task_properties + DEPENDS + priority_queues + relaxation_heuristic + task_properties ) create_fast_downward_library( @@ -542,7 +589,8 @@ create_fast_downward_library( HELP "The 'blind search' heuristic" SOURCES heuristics/blind_search_heuristic - DEPENDS task_properties + DEPENDS + task_properties ) create_fast_downward_library( @@ -550,7 +598,10 @@ create_fast_downward_library( HELP "The context-enhanced additive heuristic" SOURCES heuristics/cea_heuristic - DEPENDS domain_transition_graph priority_queues task_properties + DEPENDS + domain_transition_graph + priority_queues + task_properties ) create_fast_downward_library( @@ -558,7 +609,10 @@ create_fast_downward_library( HELP "The causal graph heuristic" SOURCES heuristics/cg_heuristic heuristics/cg_cache - DEPENDS domain_transition_graph priority_queues task_properties + DEPENDS + domain_transition_graph + priority_queues + task_properties ) create_fast_downward_library( @@ -574,7 +628,9 @@ create_fast_downward_library( HELP "The FF heuristic (an implementation of the RPG heuristic)" SOURCES heuristics/ff_heuristic - DEPENDS additive_heuristic task_properties + DEPENDS + additive_heuristic + task_properties ) create_fast_downward_library( @@ -589,7 +645,8 @@ create_fast_downward_library( HELP "The h^m heuristic" SOURCES heuristics/hm_heuristic - DEPENDS task_properties + DEPENDS + task_properties ) create_fast_downward_library( @@ -598,7 +655,9 @@ create_fast_downward_library( SOURCES heuristics/lm_cut_heuristic heuristics/lm_cut_landmarks - DEPENDS priority_queues task_properties + DEPENDS + priority_queues + task_properties ) create_fast_downward_library( @@ -606,7 +665,9 @@ create_fast_downward_library( HELP "The Max heuristic" SOURCES heuristics/max_heuristic - DEPENDS priority_queues relaxation_heuristic + DEPENDS + priority_queues + relaxation_heuristic ) create_fast_downward_library( @@ -627,7 +688,8 @@ create_fast_downward_library( tasks/domain_abstracted_task_factory tasks/modified_goals_task tasks/modified_operator_costs_task - DEPENDS task_properties + DEPENDS + task_properties DEPENDENCY_ONLY ) @@ -644,7 +706,9 @@ create_fast_downward_library( HELP "Sampling" SOURCES task_utils/sampling - DEPENDS successor_generator task_properties + DEPENDS + successor_generator + task_properties DEPENDENCY_ONLY ) @@ -655,7 +719,8 @@ create_fast_downward_library( task_utils/successor_generator task_utils/successor_generator_factory task_utils/successor_generator_internals - DEPENDS task_properties + DEPENDS + task_properties DEPENDENCY_ONLY ) @@ -695,7 +760,13 @@ create_fast_downward_library( cartesian_abstractions/types cartesian_abstractions/utils cartesian_abstractions/utils_landmarks - DEPENDS additive_heuristic dynamic_bitset extra_tasks landmarks priority_queues task_properties + DEPENDS + additive_heuristic + dynamic_bitset + extra_tasks + landmarks + priority_queues + task_properties ) create_fast_downward_library( @@ -738,7 +809,12 @@ create_fast_downward_library( merge_and_shrink/transition_system merge_and_shrink/types merge_and_shrink/utils - DEPENDS priority_queues equivalence_relation sccs task_properties variable_order_finder + DEPENDS + priority_queues + equivalence_relation + sccs + task_properties + variable_order_finder ) create_fast_downward_library( @@ -762,7 +838,11 @@ create_fast_downward_library( landmarks/landmark_status_manager landmarks/landmark_sum_heuristic landmarks/util - DEPENDS lp_solver priority_queues successor_generator task_properties + DEPENDS + lp_solver + priority_queues + successor_generator + task_properties ) create_fast_downward_library( @@ -817,7 +897,14 @@ create_fast_downward_library( pdbs/validation pdbs/zero_one_pdbs pdbs/zero_one_pdbs_heuristic - DEPENDS causal_graph max_cliques priority_queues sampling successor_generator task_properties variable_order_finder + DEPENDS + causal_graph + max_cliques + priority_queues + sampling + successor_generator + task_properties + variable_order_finder ) create_fast_downward_library( @@ -833,7 +920,11 @@ create_fast_downward_library( potentials/single_potential_heuristics potentials/subcategory potentials/util - DEPENDS lp_solver sampling successor_generator task_properties + DEPENDS + lp_solver + sampling + successor_generator + task_properties ) create_fast_downward_library( From c40b38647e5cc3c493aa98b6aa6bb2c052e1953e Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 14:56:11 +0200 Subject: [PATCH 58/79] Remove downward_ prefix from Fast Downward interface library names. --- src/search/CMakeLists.txt | 16 ++++++++-------- src/search/cmake/macros.cmake | 15 ++++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index be946465d3..9a2b7b433b 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -143,12 +143,12 @@ create_fast_downward_library( ) # On Linux, find the rt library for clock_gettime(). if(UNIX AND NOT APPLE) - target_link_libraries(downward_utils INTERFACE rt) + target_link_libraries(utils INTERFACE rt) endif() # On Windows, find the psapi library for determining peak memory. if(WIN32) cmake_policy(SET CMP0074 NEW) - target_link_libraries(downward_utils INTERFACE psapi) + target_link_libraries(utils INTERFACE psapi) endif() @@ -549,18 +549,18 @@ create_fast_downward_library( if(USE_LP) find_package(Cplex 12) if(CPLEX_FOUND) - target_compile_definitions(downward_lp_solver INTERFACE HAS_CPLEX) - target_link_libraries(downward_lp_solver INTERFACE cplex::cplex) - target_sources(downward_lp_solver INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) + target_compile_definitions(lp_solver INTERFACE HAS_CPLEX) + target_link_libraries(lp_solver INTERFACE cplex::cplex) + target_sources(lp_solver INTERFACE lp/cplex_solver_interface.h lp/cplex_solver_interface.cc) endif() # TODO: we actually require a version greater than 6.0.3 but it is not released yet. find_package(soplex 6.0.3 QUIET) if (SOPLEX_FOUND) message(STATUS "Found SoPlex: ${SOPLEX_INCLUDE_DIRS}") - target_link_libraries(downward_lp_solver INTERFACE libsoplex) - target_compile_definitions(downward_lp_solver INTERFACE HAS_SOPLEX) - target_sources(downward_lp_solver INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) + target_link_libraries(lp_solver INTERFACE libsoplex) + target_compile_definitions(lp_solver INTERFACE HAS_SOPLEX) + target_sources(lp_solver INTERFACE lp/soplex_solver_interface.h lp/soplex_solver_interface.cc) endif() endif() diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 929c7b9ae9..7f912e8f79 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -77,15 +77,16 @@ function(create_fast_downward_library) option(LIBRARY_${_LIBRARY_NAME_UPPER}_ENABLED ${_LIBRARY_HELP} ${_OPTION_DEFAULT}) endif() - add_library(downward_${_LIBRARY_NAME} INTERFACE) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE common_cxx_flags) - target_sources(downward_${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) - foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) - target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) - endforeach() + add_library(${_LIBRARY_NAME} INTERFACE) + target_link_libraries(${_LIBRARY_NAME} INTERFACE common_cxx_flags) + target_sources(${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) + target_link_libraries(${_LIBRARY_NAME} INTERFACE ${_LIBRARY_DEPENDS}) + #foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) + # target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) + #endforeach() if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME_UPPER}_ENABLED) - target_link_libraries(downward PUBLIC downward_${_LIBRARY_NAME}) + target_link_libraries(downward PUBLIC ${_LIBRARY_NAME}) endif() endfunction() From bf407c67ea6cdbb1d5fa0ffe7c18a52448b68ea5 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 16:01:32 +0200 Subject: [PATCH 59/79] Remove commented-out code. --- src/search/cmake/macros.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 7f912e8f79..b4446b79ca 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -81,9 +81,6 @@ function(create_fast_downward_library) target_link_libraries(${_LIBRARY_NAME} INTERFACE common_cxx_flags) target_sources(${_LIBRARY_NAME} INTERFACE ${_LIBRARY_SOURCES}) target_link_libraries(${_LIBRARY_NAME} INTERFACE ${_LIBRARY_DEPENDS}) - #foreach(DEPENDENCY ${_LIBRARY_DEPENDS}) - # target_link_libraries(downward_${_LIBRARY_NAME} INTERFACE downward_${DEPENDENCY}) - #endforeach() if (_LIBRARY_CORE_LIBRARY OR LIBRARY_${_LIBRARY_NAME_UPPER}_ENABLED) target_link_libraries(downward PUBLIC ${_LIBRARY_NAME}) From 92dc5dffbecce2f5ceee9d0dd6637f8ec365525c Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 16:23:17 +0200 Subject: [PATCH 60/79] Add debug functions. --- src/search/CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 9a2b7b433b..94cf83ebf0 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -935,3 +935,41 @@ create_fast_downward_library( algorithms/sccs DEPENDENCY_ONLY ) + +# Get all propreties that cmake supports +if(NOT CMAKE_PROPERTY_LIST) + execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) + + # Convert command output into a CMake list + string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") + string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") + list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST) +endif() + +function(print_properties) + message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") +endfunction() + +function(print_target_properties target) + if(NOT TARGET ${target}) + message(STATUS "There is no target named '${target}'") + return() + endif() + + foreach(property ${CMAKE_PROPERTY_LIST}) + string(REPLACE "" "${CMAKE_BUILD_TYPE}" property ${property}) + + # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i + if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$") + continue() + endif() + + get_property(was_set TARGET ${target} PROPERTY ${property} SET) + if(was_set) + get_target_property(value ${target} ${property}) + message("${target} ${property} = ${value}") + endif() + endforeach() +endfunction() + +print_target_properties(downward) From ba3a805151446c7382da4147aafed6eaaab02d4a Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 16:29:26 +0200 Subject: [PATCH 61/79] Debug print cplex::cplex. --- src/search/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 94cf83ebf0..1b1b40130d 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -972,4 +972,4 @@ function(print_target_properties target) endforeach() endfunction() -print_target_properties(downward) +print_target_properties(cplex::cplex) From 86519264888e2f7fe356cf72fb181bcb50c98936 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 16:41:46 +0200 Subject: [PATCH 62/79] Print location variable. --- src/search/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 1b1b40130d..15f2cfd072 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -973,3 +973,5 @@ function(print_target_properties target) endfunction() print_target_properties(cplex::cplex) +message(WARNING "upper: debug: ${IMPORTED_LOCATION_DEBUG}, release: ${IMPORTED_LOCATION_RELEASE}") +message(WARNING "camel: debug: ${IMPORTED_LOCATION_Debug}, release: ${IMPORTED_LOCATION_Release}") From accf431485c1d302fa34ed6e94be31dcfdb77faa Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 16:53:56 +0200 Subject: [PATCH 63/79] New and improved debug printing. --- src/search/CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 15f2cfd072..9185190dbc 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -972,6 +972,18 @@ function(print_target_properties target) endforeach() endfunction() +function(my_print target property) + get_property(was_set TARGET ${target} PROPERTY ${property} SET) + if(was_set) + get_target_property(value ${target} ${property}) + message("${target} ${property} = ${value}") + else() + message("${property} not set!") + endif() +endfunction() + +my_print(cplex::cplex IMPORTED_LOCATION_DEBUG) +my_print(cplex::cplex IMPORTED_LOCATION_Debug) +my_print(cplex::cplex IMPORTED_LOCATION_RELEASE) +my_print(cplex::cplex IMPORTED_LOCATION_Release) print_target_properties(cplex::cplex) -message(WARNING "upper: debug: ${IMPORTED_LOCATION_DEBUG}, release: ${IMPORTED_LOCATION_RELEASE}") -message(WARNING "camel: debug: ${IMPORTED_LOCATION_Debug}, release: ${IMPORTED_LOCATION_Release}") From b6bf7f81d2f6dc5ebe5b9fea360d6749220edd3d Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 17:16:55 +0200 Subject: [PATCH 64/79] Copy DLL in a stupid way. --- src/search/cmake/macros.cmake | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index b4446b79ca..6c1bc474ae 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -88,9 +88,27 @@ function(create_fast_downward_library) endfunction() function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) + # Once we require CMake version >=3.21, we can use the code below instead. # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:_TARGET_RUNTIME_DLLS - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND_EXPAND_LISTS - ) + # add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + # COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + # COMMAND_EXPAND_LISTS + # ) + if(TARGET cplex::cplex) + foreach(CONFIG "DEBUG;RELEASE") + get_property(was_set TARGET cplex::cplex PROPERTY IMPORTED_LOCATION_${CONFIG} SET) + if(was_set) + get_target_property(imported_location_${CONFIG} cplex::cplex IMPORTED_LOCATION_${CONFIG}) + endif() + endforeach() + if(was_set) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + $<$:${imported_location_RELEASE}> + $<$:${imported_location_DEBUG}> + $ + COMMAND_EXPAND_LISTS + ) + endif() + endif() endfunction() From 93daeb51392e128a5569755daae3d017a6e034d0 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 17:23:54 +0200 Subject: [PATCH 65/79] Add debug prints to windows workflow. --- .github/workflows/windows.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ea37cdc8e7..a86261126c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -86,6 +86,11 @@ jobs: set CXXFLAGS=/WX python build.py release python build.py debug + echo "release directory" + dir builds\release\bin + echo "debug directory" + dir builds\debug\bin + echo %PATH% - name: Install tox run: | From e371a7e26cd66503ae47ae0ad8c9aefe7840777c Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 18:02:55 +0200 Subject: [PATCH 66/79] Add CMake echos. --- src/search/cmake/macros.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 6c1bc474ae..a5556b470e 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -102,10 +102,16 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) endif() endforeach() if(was_set) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo + $<$:${imported_location_RELEASE}> + $<$:${imported_location_DEBUG}> + $ + ) add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - $<$:${imported_location_RELEASE}> - $<$:${imported_location_DEBUG}> + $<$:${imported_location_RELEASE}> + $<$:${imported_location_DEBUG}> $ COMMAND_EXPAND_LISTS ) From 38b722ddeb57df2b91085f08acedd88b43b60d39 Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Wed, 13 Sep 2023 19:16:09 +0200 Subject: [PATCH 67/79] Fix CPLEX find script. --- src/search/cmake/FindCplex.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search/cmake/FindCplex.cmake b/src/search/cmake/FindCplex.cmake index 3e91affcdc..dd7ba34d8e 100644 --- a/src/search/cmake/FindCplex.cmake +++ b/src/search/cmake/FindCplex.cmake @@ -78,7 +78,7 @@ endif() if(APPLE) set(PLATFORM_HINTS "osx") -elseif(LINUX) +elseif(UNIX AND NOT APPLE) # starting from CMake >=3.25, use LINUX instead. set(PLATFORM_HINTS "linux" "sles10_4.1") elseif(WIN32) # Despite the name, WIN32 is also true on 64-bit systems. if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) @@ -102,7 +102,7 @@ elseif(MSVC14) set(COMPILER_HINTS "vs2017" "msvc14") endif() -if(LINUX OR APPLE) +if(UNIX) set(LIBRARY_TYPE_HINTS_RELEASE "static_pic") set(LIBRARY_TYPE_HINTS_DEBUG "static_pic") elseif(WIN32) From 6504d794b09555b0db560efc1c332a7588cd442b Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 13 Sep 2023 22:56:13 +0200 Subject: [PATCH 68/79] check if CPLEX is a target after adding it --- src/search/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 9185190dbc..48da97df99 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -46,11 +46,6 @@ set_up_options() project(downward LANGUAGES CXX) add_executable(downward planner.cc) -# On Windows we have to copy all DLLs next to the generated binary. -if (WIN32) - copy_dlls_to_binary_dir_after_build(downward) -endif() - # In the following, we include all source files, grouped into libraries with # dependencies among each other. @@ -987,3 +982,10 @@ my_print(cplex::cplex IMPORTED_LOCATION_Debug) my_print(cplex::cplex IMPORTED_LOCATION_RELEASE) my_print(cplex::cplex IMPORTED_LOCATION_Release) print_target_properties(cplex::cplex) + + +# On Windows we have to copy all DLLs next to the generated binary. +if (WIN32) + copy_dlls_to_binary_dir_after_build(downward) +endif() + From 403b5e536fd4ee6e0f5c02ad581770aa7321f641 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 13 Sep 2023 22:58:19 +0200 Subject: [PATCH 69/79] add more debug output --- src/search/CMakeLists.txt | 2 ++ src/search/cmake/macros.cmake | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 48da97df99..7f7002a486 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -987,5 +987,7 @@ print_target_properties(cplex::cplex) # On Windows we have to copy all DLLs next to the generated binary. if (WIN32) copy_dlls_to_binary_dir_after_build(downward) +else() + message("Not on Windows. Not adding DLL copy command") endif() diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index a5556b470e..699ebb55aa 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -102,6 +102,7 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) endif() endforeach() if(was_set) + message("Adding DLL copy command") add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo $<$:${imported_location_RELEASE}> @@ -115,6 +116,10 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) $ COMMAND_EXPAND_LISTS ) + else() + message("Property was not set. Not adding DLL copy command") endif() + else() + message("cplex target does not exist. Not adding DLL copy command") endif() endfunction() From 9a7defdfc3f0b63336036b8bd9d7cba14207f4aa Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Wed, 13 Sep 2023 23:47:51 +0200 Subject: [PATCH 70/79] add more debug output --- src/search/cmake/macros.cmake | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 699ebb55aa..18cc413f16 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -96,19 +96,27 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # ) if(TARGET cplex::cplex) foreach(CONFIG "DEBUG;RELEASE") - get_property(was_set TARGET cplex::cplex PROPERTY IMPORTED_LOCATION_${CONFIG} SET) + get_property(was_set TARGET cplex::cplex PROPERTY "IMPORTED_LOCATION_${CONFIG}" SET) if(was_set) get_target_property(imported_location_${CONFIG} cplex::cplex IMPORTED_LOCATION_${CONFIG}) endif() endforeach() + + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "IMPORTED_LOCATION_RELEASE $" + ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "TARGET_FILE_DIR $" + ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$:${imported_location_RELEASE}>" + ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$:${imported_location_DEBUG}>" + ) + if(was_set) message("Adding DLL copy command") - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo - $<$:${imported_location_RELEASE}> - $<$:${imported_location_DEBUG}> - $ - ) add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<$:${imported_location_RELEASE}> From bc0afd0feb9aab5185cbbff85d80e900fb85411c Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Thu, 14 Sep 2023 00:29:14 +0200 Subject: [PATCH 71/79] try with generator expressions --- src/search/cmake/macros.cmake | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 18cc413f16..02b3431870 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -103,30 +103,30 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) endforeach() add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "IMPORTED_LOCATION_RELEASE $" + COMMAND ${CMAKE_COMMAND} -E echo "IMPORTED_LOCATION_RELEASE " ) add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "TARGET_FILE_DIR $" ) + + + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$:$>" + ) add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$:${imported_location_RELEASE}>" + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$:$>" ) add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$:${imported_location_DEBUG}>" + COMMAND ${CMAKE_COMMAND} -E echo "imported_location $<$:$,$>" ) - if(was_set) - message("Adding DLL copy command") - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - $<$:${imported_location_RELEASE}> - $<$:${imported_location_DEBUG}> - $ - COMMAND_EXPAND_LISTS - ) - else() - message("Property was not set. Not adding DLL copy command") - endif() + message("Adding DLL copy command") + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + $<$:$,$> + $ + COMMAND_EXPAND_LISTS + ) else() message("cplex target does not exist. Not adding DLL copy command") endif() From 40fb8d40417ec7b09cfa209d427d94b1e9a876ab Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Thu, 14 Sep 2023 00:54:31 +0200 Subject: [PATCH 72/79] try with more generator expressions --- src/search/cmake/macros.cmake | 55 ++++++++++++----------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 02b3431870..da252336b8 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -93,41 +93,24 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD # COMMAND ${CMAKE_COMMAND} -E copy -t $ $ # COMMAND_EXPAND_LISTS - # ) - if(TARGET cplex::cplex) - foreach(CONFIG "DEBUG;RELEASE") - get_property(was_set TARGET cplex::cplex PROPERTY "IMPORTED_LOCATION_${CONFIG}" SET) - if(was_set) - get_target_property(imported_location_${CONFIG} cplex::cplex IMPORTED_LOCATION_${CONFIG}) - endif() - endforeach() + # ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$,$>:$>" + ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$,$>:$>" + ) + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "imported_location + $<$,$>:$> + $<$,$>:$>" + ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "IMPORTED_LOCATION_RELEASE " - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "TARGET_FILE_DIR $" - ) - - - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$:$>" - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$:$>" - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location $<$:$,$>" - ) - - message("Adding DLL copy command") - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - $<$:$,$> - $ - COMMAND_EXPAND_LISTS - ) - else() - message("cplex target does not exist. Not adding DLL copy command") - endif() + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + $<$,$>:$> + $<$,$>:$> + $ + COMMAND_EXPAND_LISTS + ) endfunction() From 0b007a7895643a0aa514d24862a07891326063fe Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Thu, 14 Sep 2023 01:38:05 +0200 Subject: [PATCH 73/79] remove debug code --- .github/workflows/windows.yml | 5 --- src/search/CMakeLists.txt | 66 +++-------------------------------- src/search/cmake/macros.cmake | 12 ------- 3 files changed, 5 insertions(+), 78 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a86261126c..ea37cdc8e7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -86,11 +86,6 @@ jobs: set CXXFLAGS=/WX python build.py release python build.py debug - echo "release directory" - dir builds\release\bin - echo "debug directory" - dir builds\debug\bin - echo %PATH% - name: Install tox run: | diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 7f7002a486..9a2b7b433b 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -46,6 +46,11 @@ set_up_options() project(downward LANGUAGES CXX) add_executable(downward planner.cc) +# On Windows we have to copy all DLLs next to the generated binary. +if (WIN32) + copy_dlls_to_binary_dir_after_build(downward) +endif() + # In the following, we include all source files, grouped into libraries with # dependencies among each other. @@ -930,64 +935,3 @@ create_fast_downward_library( algorithms/sccs DEPENDENCY_ONLY ) - -# Get all propreties that cmake supports -if(NOT CMAKE_PROPERTY_LIST) - execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) - - # Convert command output into a CMake list - string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") - string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") - list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST) -endif() - -function(print_properties) - message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") -endfunction() - -function(print_target_properties target) - if(NOT TARGET ${target}) - message(STATUS "There is no target named '${target}'") - return() - endif() - - foreach(property ${CMAKE_PROPERTY_LIST}) - string(REPLACE "" "${CMAKE_BUILD_TYPE}" property ${property}) - - # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i - if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$") - continue() - endif() - - get_property(was_set TARGET ${target} PROPERTY ${property} SET) - if(was_set) - get_target_property(value ${target} ${property}) - message("${target} ${property} = ${value}") - endif() - endforeach() -endfunction() - -function(my_print target property) - get_property(was_set TARGET ${target} PROPERTY ${property} SET) - if(was_set) - get_target_property(value ${target} ${property}) - message("${target} ${property} = ${value}") - else() - message("${property} not set!") - endif() -endfunction() - -my_print(cplex::cplex IMPORTED_LOCATION_DEBUG) -my_print(cplex::cplex IMPORTED_LOCATION_Debug) -my_print(cplex::cplex IMPORTED_LOCATION_RELEASE) -my_print(cplex::cplex IMPORTED_LOCATION_Release) -print_target_properties(cplex::cplex) - - -# On Windows we have to copy all DLLs next to the generated binary. -if (WIN32) - copy_dlls_to_binary_dir_after_build(downward) -else() - message("Not on Windows. Not adding DLL copy command") -endif() - diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index da252336b8..9d525193c5 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -94,18 +94,6 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # COMMAND ${CMAKE_COMMAND} -E copy -t $ $ # COMMAND_EXPAND_LISTS # ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_RELEASE $<$,$>:$>" - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location_DEBUG $<$,$>:$>" - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "imported_location - $<$,$>:$> - $<$,$>:$>" - ) - add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<$,$>:$> From 9ad0103dbccc06c240e7ee815998a39c3eaf965b Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Thu, 14 Sep 2023 08:39:52 +0200 Subject: [PATCH 74/79] fix copy command for cases on windows without cplex --- src/search/cmake/macros.cmake | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 9d525193c5..3cdffbb052 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -93,11 +93,30 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD # COMMAND ${CMAKE_COMMAND} -E copy -t $ $ # COMMAND_EXPAND_LISTS - # ) + # ) + set(_has_cplex_target "$") + + set(_is_release_build "$") + set(_release_dll "$") + set(_has_release_dll "$") + set(_should_copy_release_dll "$") + + set(_is_debug_build "$") + set(_debug_dll "$") + set(_has_debug_dll "$") + set(_should_copy_debug_dll "$") + + # In case no DLL file has to be copied, the copy command below would get an + # empty list of files to copy, and it would crash. We cannot use an "if" + # because the result of the generator expressions will only be known at + # build time. We thus always also copy the target to its own location. + set(_dummy "$") + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - $<$,$>:$> - $<$,$>:$> + $<${_should_copy_release_dll}:${_release_dll}> + $<${_should_copy_debug_dll}:${_debug_dll}> + ${_dummy} $ COMMAND_EXPAND_LISTS ) From 87a61c5d320f05692e85bd1bf8a6ac64fe18e28d Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Thu, 14 Sep 2023 16:45:50 +0200 Subject: [PATCH 75/79] evaluate the option USE_GLIBCXX_DEBUG --- src/search/cmake/common_cxx_flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search/cmake/common_cxx_flags.cmake b/src/search/cmake/common_cxx_flags.cmake index 62f2e1cd73..383d578322 100644 --- a/src/search/cmake/common_cxx_flags.cmake +++ b/src/search/cmake/common_cxx_flags.cmake @@ -8,7 +8,7 @@ set(using_gcc "$") set(using_msvc "$") set(using_gcc_like_release "$>") set(using_gcc_like_debug "$>") -set(should_use_glibcxx_debug "$>") +set(should_use_glibcxx_debug "$>") target_compile_options(common_cxx_flags INTERFACE "$<${using_gcc_like}:-O3;-g>") From a9697e3e74ba28a8287f9a7eaa3788ed677b08fb Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Fri, 15 Sep 2023 11:28:26 +0200 Subject: [PATCH 76/79] Minor cleanups. --- src/CMakeLists.txt | 3 ++- src/search/CMakeLists.txt | 1 - src/search/cmake/common_cxx_flags.cmake | 4 ++-- src/search/cmake/macros.cmake | 9 ++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f4e01588c1..dcde6cec4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,7 @@ project(fast-downward set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -# Add planner components as subprojects. +# Add planner components. # Copy the translator into the output directory. add_custom_target(translate ALL) @@ -41,4 +41,5 @@ add_custom_command(TARGET translate POST_BUILD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/translate COMMENT "Copying translator module into output directory") +# Add search component as a subproject. add_subdirectory(search) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 9a2b7b433b..726a9027bb 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -151,7 +151,6 @@ if(WIN32) target_link_libraries(utils INTERFACE psapi) endif() - create_fast_downward_library( NAME alternation_open_list HELP "Open list that alternates between underlying open lists in a round-robin manner" diff --git a/src/search/cmake/common_cxx_flags.cmake b/src/search/cmake/common_cxx_flags.cmake index 383d578322..5d5cbd777d 100644 --- a/src/search/cmake/common_cxx_flags.cmake +++ b/src/search/cmake/common_cxx_flags.cmake @@ -26,8 +26,8 @@ add_library(common_cxx_warnings INTERFACE) target_compile_options(common_cxx_warnings INTERFACE "$<${using_gcc_like}:-Wall;-Wextra;-Wpedantic;-Wnon-virtual-dtor;-Wfloat-conversion;-Wmissing-declarations;-Wzero-as-null-pointer-constant>") -## We ignore the warning "restrict" because of a bug in GCC 12: -## https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 +# We ignore the warning "restrict" because of a bug in GCC 12: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651 set(v12_or_later "$,12>") set(before_v13 "$,13>") set(bugged_gcc "$") diff --git a/src/search/cmake/macros.cmake b/src/search/cmake/macros.cmake index 3cdffbb052..edd6e95db5 100644 --- a/src/search/cmake/macros.cmake +++ b/src/search/cmake/macros.cmake @@ -67,7 +67,7 @@ function(create_fast_downward_library) add_existing_sources_to_list(_LIBRARY_SOURCES) if (NOT _LIBRARY_CORE_LIBRARY AND NOT _LIBRARY_DEPENDENCY_ONLY) - # Decide whether the plugin should be enabled by default. + # Decide whether the library should be enabled by default. if (DISABLE_LIBRARIES_BY_DEFAULT) set(_OPTION_DEFAULT FALSE) else() @@ -89,11 +89,14 @@ endfunction() function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # Once we require CMake version >=3.21, we can use the code below instead. - # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:_TARGET_RUNTIME_DLLS + # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS # add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD # COMMAND ${CMAKE_COMMAND} -E copy -t $ $ # COMMAND_EXPAND_LISTS # ) + # On top of making the variables and dummy hack below obsolete, this + # solution will also automatically detect all DLLs our executable depends + # on, so we won't have to handle CPLEX explicitly anymore. set(_has_cplex_target "$") set(_is_release_build "$") @@ -111,7 +114,7 @@ function(copy_dlls_to_binary_dir_after_build _TARGET_NAME) # because the result of the generator expressions will only be known at # build time. We thus always also copy the target to its own location. set(_dummy "$") - + add_custom_command(TARGET ${_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<${_should_copy_release_dll}:${_release_dll}> From 9d7bf2fa3645a11edeebe5397c50a53d500461b8 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 15 Sep 2023 12:10:31 +0200 Subject: [PATCH 77/79] rename some variables in test --- misc/tests/test-dependencies.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/misc/tests/test-dependencies.py b/misc/tests/test-dependencies.py index 061eeb80d1..17a566ea00 100755 --- a/misc/tests/test-dependencies.py +++ b/misc/tests/test-dependencies.py @@ -36,7 +36,7 @@ def get_library_definitions(content): # we cannot manually en-/disable core and dependency only libraries if any(s in library_definition for s in ["CORE_LIBRARY", "DEPENDENCY_ONLY"]): continue - name_match = re.search(r"NAME (\S+)", library_definition) + name_match = re.search(r"NAME\s+(\S+)", library_definition) assert name_match name = name_match.group(1) libraries.append(name) @@ -61,18 +61,18 @@ def get_library_definitions(content): libraries_failed_test = [] for library in libraries: build_path = os.path.join(BUILDS, library.lower()) - config_args = [ + config_cmd = [ "cmake", "-S", os.path.join(REPO, "src"), "-B", build_path, "-DCMAKE_BUILD_TYPE=Debug", "-DDISABLE_LIBRARIES_BY_DEFAULT=YES", f"-DLIBRARY_{library.upper()}_ENABLED=True" ] - build_args = ["cmake", "--build", build_path] + build_cmd = ["cmake", "--build", build_path] if NUM_CPUS: - build_args += ["-j", f"{NUM_CPUS}"] + build_cmd += ["-j", f"{NUM_CPUS}"] try: - subprocess.check_call(config_args) - subprocess.check_call(build_args) + subprocess.check_call(config_cmd) + subprocess.check_call(build_cmd) except subprocess.CalledProcessError: libraries_failed_test.append(library) From c08f6bedde3b03d68705339cb427cb96c6a1bcbc Mon Sep 17 00:00:00 2001 From: Remo Christen Date: Fri, 15 Sep 2023 12:22:57 +0200 Subject: [PATCH 78/79] (C)Make last remaining single-line DEPENDS into multi-line. --- src/search/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 726a9027bb..9d26b1c3f5 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -85,8 +85,15 @@ create_fast_downward_library( state_registry task_id task_proxy - - DEPENDS causal_graph int_hash_set int_packer ordered_set segmented_vector subscriber successor_generator task_properties + DEPENDS + causal_graph + int_hash_set + int_packer + ordered_set + segmented_vector + subscriber + successor_generator + task_properties CORE_LIBRARY ) From 69f2e32016fd765849fc86e5ff93cde7ca6d992d Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Fri, 15 Sep 2023 12:54:11 +0200 Subject: [PATCH 79/79] simplify and document --suppress option in memory leak tests --- misc/tests/conftest.py | 10 +++++++--- misc/tests/test-memory-leaks.py | 8 +++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/misc/tests/conftest.py b/misc/tests/conftest.py index 5cd17c61d6..46dfbf94ba 100644 --- a/misc/tests/conftest.py +++ b/misc/tests/conftest.py @@ -1,8 +1,12 @@ +# This file is read by pytest before running the tests to set them up. +# We use it to add the option '--suppress' to the tests that is used by +# memory leak tests to ignore compiler-specific false positives. + def pytest_addoption(parser): parser.addoption("--suppress", action="append", default=[], - help="Suppression files used in test-memory-leaks.py. These files must be located in the folder valgrind.") + help="Suppression files used in test-memory-leaks.py.") def pytest_generate_tests(metafunc): if "suppression_files" in metafunc.fixturenames: - tags = list(metafunc.config.option.suppress) - metafunc.parametrize("suppression_files", [tags], scope='session') + supression_files = list(metafunc.config.option.suppress) + metafunc.parametrize("suppression_files", [supression_files], scope='session') diff --git a/misc/tests/test-memory-leaks.py b/misc/tests/test-memory-leaks.py index 5769c1dfb6..cf20cb0cb9 100644 --- a/misc/tests/test-memory-leaks.py +++ b/misc/tests/test-memory-leaks.py @@ -5,6 +5,7 @@ import subprocess import sys +from pathlib import Path import pytest import configs @@ -39,10 +40,6 @@ def escape_list(l): def run_plan_script(task, config, custom_suppression_files): - custom_suppression_files = [ - os.path.join(REPO, "misc", "tests", "valgrind", f) - for f in custom_suppression_files - ] assert "--alias" not in config, config cmd = [ "valgrind", @@ -51,7 +48,8 @@ def run_plan_script(task, config, custom_suppression_files): "--show-leak-kinds=all", "--errors-for-leak-kinds=all", "--track-origins=yes"] - for suppression_file in SUPPRESSION_FILES + custom_suppression_files: + suppression_files = SUPPRESSION_FILES + custom_suppression_files + for suppression_file in [Path(p).absolute() for p in suppression_files]: cmd.append("--suppressions={}".format(suppression_file)) cmd.extend([DOWNWARD_BIN] + config + ["--internal-plan-file", PLAN_FILE]) print("\nRun: {}".format(escape_list(cmd)))