Skip to content

Commit

Permalink
Workaround for issue #3653.
Browse files Browse the repository at this point in the history
  • Loading branch information
geektoni committed Feb 27, 2017
1 parent 1560b3b commit 4209786
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
6 changes: 6 additions & 0 deletions examples/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,19 @@ FOREACH(META_EXAMPLE ${META_EXAMPLES})
SET(EXAMPLE_LISTINGS)
SET(BASENAME ${EXAMPLE_REL_DIR}/${EXAMPLE_NAME})
LIST(APPEND EXAMPLE_LISTINGS ${CMAKE_CURRENT_BINARY_DIR}/cpp/${BASENAME}.cpp)

# FIXME
# Hack to avoid generation of scala meta examples dependencies that will
# not be generated by generate.py script (since there is no scala.json)
LIST(REMOVE_ITEM AVAILABLE_INTERFACES "ScalaModular")
FOREACH(interface ${AVAILABLE_INTERFACES})
list(FIND DISABLED_INTERFACES ${interface} disabled)
if (${disabled} STREQUAL "-1")
GET_INTERFACE_VARS(${interface} DIRECTORY EXTENSION)
LIST(APPEND EXAMPLE_LISTINGS ${CMAKE_CURRENT_BINARY_DIR}/${DIRECTORY}/${BASENAME}.${EXTENSION})
endif()
ENDFOREACH()
LIST(APPEND AVAILABLE_INTERFACES "ScalaModular")

# Set generate.py flags
SET(GENERATOR_FLAGS
Expand Down
23 changes: 11 additions & 12 deletions examples/meta/scala/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ SET(JAVA_LIB_PATH "${JAVA_MODULAR_BUILD_DIR}")
# (not generated yet so have to fake filenames from META_EXAMPLES list)
FOREACH(META_EXAMPLE ${META_EXAMPLES})
# assume a structure <target_language>/<category>/listing.sg
get_filename_component(EXAMPLE_NAME ${META_EXAMPLE} NAME_WE)
IF(${CMAKE_VERSION} VERSION_LESS 2.8.12)
get_filename_component(FULL_DIR ${META_EXAMPLE} PATH)
ELSE()
# only supported from >2.8.11
get_filename_component(FULL_DIR ${META_EXAMPLE} DIRECTORY)
ENDIF()
get_filename_component(EXAMPLE_REL_DIR ${FULL_DIR} NAME)
set(EXAMPLE_NAME_WITH_DIR "${EXAMPLE_REL_DIR}-${EXAMPLE_NAME}")
set(SCALA_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_REL_DIR}")
GET_META_EXAMPLE_VARS(${META_EXAMPLE} EXAMPLE_NAME EXAMPLE_REL_DIR EXAMPLE_NAME_WITH_DIR)
set(SCALA_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_REL_DIR}")

file(MAKE_DIRECTORY ${SCALA_FOLDER})
# Disabled, since we are not creating any code.
# file(MAKE_DIRECTORY ${SCALA_FOLDER})

add_test(NAME generated_scala-${EXAMPLE_NAME_WITH_DIR}
add_test(NAME generated_scala-${EXAMPLE_NAME_WITH_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_REL_DIR}
COMMAND ${Scala_SCALA_EXECUTABLE}
-cp ${CLASSPATH}:${CMAKE_JAVA_DIR}/${EXAMPLE_REL_DIR}
-Djava.library.path=${JAVA_LIB_PATH} ${EXAMPLE_NAME})

ENDFOREACH()

# Set up this target to be consistent
# with all the other meta example targets.
add_custom_target(build_scala_meta_examples ALL
DEPENDS build_java_meta_examples
COMMENT "Compiled java meta examples to be used with scala")

0 comments on commit 4209786

Please sign in to comment.