Add Layouts directory to the search path for BaseMap and PartialMap

Oh. And reformat part of the file because tabs are of the devil.
This commit is contained in:
Eryn Wells 2016-04-30 13:22:39 -07:00
parent ccfe28a1d7
commit 1585940b80

View file

@ -20,22 +20,22 @@ if ( "${MacroModule}" STREQUAL "PartialMap" )
# #
if ( NOT EXISTS "${PROJECT_SOURCE_DIR}/kll/kll.py" ) if ( NOT EXISTS "${PROJECT_SOURCE_DIR}/kll/kll.py" )
message ( STATUS "Downloading latest kll version:" ) message ( STATUS "Downloading latest kll version:" )
# Make sure git is available # Make sure git is available
find_package ( Git REQUIRED ) find_package ( Git REQUIRED )
# Clone kll git repo # Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} clone https://github.com/kiibohd/kll.git execute_process ( COMMAND ${GIT_EXECUTABLE} clone https://github.com/kiibohd/kll.git
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
) )
elseif ( REFRESH_KLL ) # Otherwise attempt to update the repo elseif ( REFRESH_KLL ) # Otherwise attempt to update the repo
message ( STATUS "Checking for latest kll version:" ) message ( STATUS "Checking for latest kll version:" )
# Clone kll git repo # Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} pull --rebase execute_process ( COMMAND ${GIT_EXECUTABLE} pull --rebase
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/kll WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/kll
) )
endif () # kll/kll.py exists endif () # kll/kll.py exists
@ -48,8 +48,8 @@ endif () # kll/kll.py exists
#| Add each of the detected capabilities.kll #| Add each of the detected capabilities.kll
foreach ( filename ${ScanModule_KLL} ${MacroModule_KLL} ${OutputModule_KLL} ${DebugModule_KLL} ) foreach ( filename ${ScanModule_KLL} ${MacroModule_KLL} ${OutputModule_KLL} ${DebugModule_KLL} )
set ( BaseMap_Args ${BaseMap_Args} ${filename} ) set ( BaseMap_Args ${BaseMap_Args} ${filename} )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${filename} ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${filename} )
endforeach () endforeach ()
#| If set BaseMap cannot be found, use default map #| If set BaseMap cannot be found, use default map
@ -57,65 +57,71 @@ set ( pathname "${PROJECT_SOURCE_DIR}/${ScanModulePath}" )
string ( REPLACE " " ";" MAP_LIST ${BaseMap} ) # Change spaces to semicolons string ( REPLACE " " ";" MAP_LIST ${BaseMap} ) # Change spaces to semicolons
foreach ( MAP ${MAP_LIST} ) foreach ( MAP ${MAP_LIST} )
# Only check the Scan Module for BaseMap .kll files, default to defaultMap.kll # Only check the Scan Module for BaseMap .kll files, default to defaultMap.kll
if ( NOT EXISTS ${pathname}/${MAP}.kll ) if ( NOT EXISTS ${pathname}/${MAP}.kll )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll ) set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll )
elseif ( EXISTS "${pathname}/${MAP}.kll" ) elseif ( EXISTS "${pathname}/${MAP}.kll" )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll ) set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll )
else () else ()
message ( FATAL " Could not find '${MAP}.kll' BaseMap in Scan module directory" ) message ( FATAL " Could not find '${MAP}.kll' BaseMap in Scan module directory" )
endif () endif ()
endforeach () endforeach ()
#| Configure DefaultMap if specified #| Configure DefaultMap if specified
if ( NOT "${DefaultMap}" STREQUAL "" ) if ( NOT "${DefaultMap}" STREQUAL "" )
set ( DefaultMap_Args -d ) set ( DefaultMap_Args -d )
string ( REPLACE " " ";" MAP_LIST ${DefaultMap} ) # Change spaces to semicolons string ( REPLACE " " ";" MAP_LIST ${DefaultMap} ) # Change spaces to semicolons
foreach ( MAP ${MAP_LIST} ) foreach ( MAP ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory # Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP}.kll" ) if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${MAP}.kll ) set ( DefaultMap_Args ${DefaultMap_Args} ${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP}.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll" ) elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll ) set ( DefaultMap_Args ${DefaultMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
else () elseif ( EXISTS "${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll" )
message ( FATAL " Could not find '${MAP}.kll' DefaultMap" ) set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll )
endif () set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll )
endforeach () else ()
message ( FATAL " Could not find '${MAP}.kll' DefaultMap" )
endif ()
endforeach ()
endif () endif ()
#| Configure PartialMaps if specified #| Configure PartialMaps if specified
if ( NOT "${PartialMaps}" STREQUAL "" ) if ( NOT "${PartialMaps}" STREQUAL "" )
# For each partial layer # For each partial layer
foreach ( MAP ${PartialMaps} ) foreach ( MAP ${PartialMaps} )
set ( PartialMap_Args ${PartialMap_Args} -p ) set ( PartialMap_Args ${PartialMap_Args} -p )
# Combine each layer # Combine each layer
string ( REPLACE " " ";" MAP_LIST ${MAP} ) # Change spaces to semicolons string ( REPLACE " " ";" MAP_LIST ${MAP} ) # Change spaces to semicolons
foreach ( MAP_PART ${MAP_LIST} ) foreach ( MAP_PART ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory # Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP_PART}.kll" ) if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${MAP_PART}.kll ) set ( PartialMap_Args ${PartialMap_Args} ${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP_PART}.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP_PART}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll" ) elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll ) set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
else () elseif ( EXISTS "${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll" )
message ( FATAL " Could not find '${MAP_PART}.kll' PartialMap" ) set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll )
endif () set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll )
endforeach () else ()
endforeach () message ( FATAL " Could not find '${MAP_PART}.kll' PartialMap" )
endif ()
endforeach ()
endforeach ()
endif () endif ()
#| Print list of layout sources used #| Print list of layout sources used
message ( STATUS "Detected Layout Files:" ) message ( STATUS "Detected Layout Files:" )
foreach ( filename ${KLL_DEPENDS} ) foreach ( filename ${KLL_DEPENDS} )
message ( "${filename}" ) message ( "${filename}" )
endforeach () endforeach ()
@ -133,15 +139,15 @@ set ( kll_output --outputs ${kll_outputname} )
#| KLL Cmd #| KLL Cmd
set ( kll_cmd ${PROJECT_SOURCE_DIR}/kll/kll.py ${BaseMap_Args} ${DefaultMap_Args} ${PartialMap_Args} ${kll_backend} ${kll_template} ${kll_output} ) set ( kll_cmd ${PROJECT_SOURCE_DIR}/kll/kll.py ${BaseMap_Args} ${DefaultMap_Args} ${PartialMap_Args} ${kll_backend} ${kll_template} ${kll_output} )
add_custom_command ( OUTPUT ${kll_outputname} add_custom_command ( OUTPUT ${kll_outputname}
COMMAND ${kll_cmd} COMMAND ${kll_cmd}
DEPENDS ${KLL_DEPENDS} DEPENDS ${KLL_DEPENDS}
COMMENT "Generating KLL Layout" COMMENT "Generating KLL Layout"
) )
#| KLL Regen Convenience Target #| KLL Regen Convenience Target
add_custom_target ( kll_regen add_custom_target ( kll_regen
COMMAND ${kll_cmd} COMMAND ${kll_cmd}
COMMENT "Re-generating KLL Layout" COMMENT "Re-generating KLL Layout"
) )
#| Append generated file to required sources so it becomes a dependency in the main build #| Append generated file to required sources so it becomes a dependency in the main build