summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2021-09-22 13:49:41 +0000
committerArne H Juul <arnej@yahooinc.com>2021-09-22 13:49:41 +0000
commit1548e86d63ca9bbccf60bfdb9520cb7f7e158c24 (patch)
treef9d364521c52c19036f2c18af9b02b39685f470a
parent7152f98c1c47dafe856d2e74c7191a126dd48277 (diff)
simplify config generation cmake setup
-rw-r--r--functions.cmake17
1 files changed, 4 insertions, 13 deletions
diff --git a/functions.cmake b/functions.cmake
index fe59cc3aaa9..3d192552be5 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -125,17 +125,13 @@ function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
get_filename_component(CONFIG_NAME ${RELATIVE_CONFIG_DEF_PATH} NAME_WE)
endif()
- # configgen.jar takes the parent dir of the destination dir and the destination dirname as separate parameters
- # so it can produce the correct include statements within the generated .cpp-file (silent cry)
# Make config path an absolute_path
set(CONFIG_DEF_PATH ${CMAKE_CURRENT_LIST_DIR}/${RELATIVE_CONFIG_DEF_PATH})
- # Config destination is the
+ # Config destination is the current source directory (or parallel in build tree)
+ # configgen.jar takes the destination dirname as a property parameter
set(CONFIG_DEST_DIR ${CMAKE_CURRENT_BINARY_DIR})
- # Get parent of destination directory
- set(CONFIG_DEST_PARENT_DIR ${CONFIG_DEST_DIR}/..)
-
# Get destination dirname
get_filename_component(CONFIG_DEST_DIRNAME ${CMAKE_CURRENT_BINARY_DIR} NAME)
@@ -144,8 +140,8 @@ function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
add_custom_command(
OUTPUT ${CONFIG_H_PATH} ${CONFIG_CPP_PATH}
- COMMAND java -Dconfig.spec=${CONFIG_DEF_PATH} -Dconfig.dest=${CONFIG_DEST_PARENT_DIR} -Dconfig.lang=cpp -Dconfig.subdir=${CONFIG_DEST_DIRNAME} -Dconfig.dumpTree=false -Xms64m -Xmx64m -jar ${PROJECT_SOURCE_DIR}/configgen/target/configgen.jar
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
+ COMMAND java -Dconfig.spec=${CONFIG_DEF_PATH} -Dconfig.dest=${CONFIG_DEST_DIR} -Dconfig.lang=cpp -Dconfig.dumpTree=false -Xms64m -Xmx64m -jar ${PROJECT_SOURCE_DIR}/configgen/target/configgen.jar
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating cpp config for ${CONFIG_NAME} in ${CMAKE_CURRENT_SOURCE_DIR}"
MAIN_DEPENDENCY ${CONFIG_DEF_PATH}
)
@@ -157,11 +153,6 @@ function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
# Add generated to sources for target
target_sources(${TARGET} PRIVATE ${CONFIG_H_PATH} ${CONFIG_CPP_PATH})
- # Needed to be able to do a #include <CONFIG_DEST_DIRNAME/config-<name>.h> for this target
- # This is used within the generated config-<name>.cpp
- # TODO: Should modify configgen to use #include <vespa/<modulename>/config-<name>.h> instead
- target_include_directories(${TARGET} PRIVATE ${CONFIG_DEST_PARENT_DIR})
-
# Needed to be able to do a #include <config-<name>.h> for this target
# This is used within some unit tests
target_include_directories(${TARGET} PRIVATE ${CONFIG_DEST_DIR})