view Resources/CMake/Utilities.cmake @ 466:5055031f4a06 bgo-commands-codegen

- Added browserify to build. This allows using require calls for modules that work with tsc compiler. - removed older stuff related to Protocol Buffers and Flatbuffers - changed triple-slash references to import statements - module prefixes are now added at call sites - added cmake module for filename handling - switched to Ninja for sample build - Added virtual dtor in ICommand
author bgo-osimis
date Mon, 11 Feb 2019 16:00:04 +0100
parents
children dc5acb03ad93
line wrap: on
line source



macro(GetFilenameFromPath TargetVariable Path)
#message(STATUS "GetFilenameFromPath (1): Path = ${Path} TargetVariable = ${${TargetVariable}}")
string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
#message(STATUS "GetFilenameFromPath (2): Path = ${Path} Path = ${PathWithFwdSlashes} TargetVariable = ${TargetVariable}")
endmacro()

macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
#message(STATUS "GetFileNameWithoutLastExtension: FilePath = ${FilePath} TargetVariable = ${${TargetVariable}}")
endmacro()

macro(Test_GetFilePathWithoutLastExtension)
set(tmp "/prout/zi/goui.goui.cpp")
GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
if(NOT ("${TargetVariable}" STREQUAL "/prout/zi/goui.goui"))
  message(FATAL_ERROR "Test_GetFilePathWithoutLastExtension failed (1)")
else()
  #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
endif()
endmacro()

Test_GetFilePathWithoutLastExtension()

macro(Test_GetFilenameFromPath)
set(tmp "/prout/../../dada/zi/goui.goui.cpp")
GetFilenameFromPath(TargetVariable "${tmp}")
if(NOT ("${TargetVariable}" STREQUAL "goui.goui.cpp"))
  message(FATAL_ERROR "Test_GetFilenameFromPath failed")
else()
  #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
endif()
endmacro()

Test_GetFilenameFromPath()