diff --git a/cmake/msbuild2cmake.cmake b/cmake/msbuild2cmake.cmake
index 25928aaf3c..e98814799d 100644
--- a/cmake/msbuild2cmake.cmake
+++ b/cmake/msbuild2cmake.cmake
@@ -168,6 +168,7 @@ message("=> Build Type: ${CMAKE_BUILD_TYPE}")
message("=> Generator : ${REKO_COMPILER}")
message("=> Platform : ${REKO_PLATFORM}")
message("=> Target : ${TARGET}")
+message("=> Action : ${ACTION}")
message("")
set(REKO_SRC ${CMAKE_CURRENT_LIST_DIR}/../src)
\ No newline at end of file
diff --git a/src/BuildTargets/BuildTargets.csproj b/src/BuildTargets/BuildTargets.csproj
index eaf8036a74..98aa9737a5 100644
--- a/src/BuildTargets/BuildTargets.csproj
+++ b/src/BuildTargets/BuildTargets.csproj
@@ -9,11 +9,14 @@
+
$([System.IO.Path]::Combine($(ProjectDir), ..\reko.cmake))
+ $([System.IO.Path]::Combine($(ProjectDir), ..\distclean.cmake))
+
$([System.IO.Path]::Combine($(VSAPPIDDIR), CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe))
cmake
@@ -86,14 +89,9 @@
-
-
-
-
-
-
-
+
+
@@ -105,4 +103,9 @@
+
+
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e47ac36c3d..22a0146eb4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -380,26 +380,11 @@ elseif("${TARGET}" STREQUAL "gen_c2xml_sysv")
add_c2xml_target_sysv(gen_c2xml_sysv libc.so)
add_c2xml_target_sysv(gen_c2xml_sysv Xlib)
add_c2xml_target_sysv(gen_c2xml_sysv opengl)
-elseif("${TARGET}" STREQUAL "nativeproxy_clean")
- #
- # Create a new target to clean NativeProxy
- #
- add_custom_target(nativeproxy_clean
- COMMENT "Cleaning NativeProxy..."
- WORKING_DIRECTORY ${REKO_SRC}/Native
- COMMAND ${CMAKE_COMMAND}
- -DREKO_SRC=${REKO_SRC}
- -DREKO_ROOT=${REKO_SRC}/../
- -DREKO_PLATFORM=${REKO_PLATFORM}
- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
- -DACTION=clean
- -P ${REKO_SRC}/Native/reko.cmake
- )
-elseif("${TARGET}" STREQUAL "nativeproxy_build")
+elseif("${TARGET}" STREQUAL "nativeproxy")
#
# Create a new target to build NativeProxy
#
- add_custom_target(nativeproxy_build
+ add_custom_target(nativeproxy
COMMENT "Building NativeProxy ..."
WORKING_DIRECTORY ${REKO_SRC}/Native
COMMAND ${CMAKE_COMMAND}
@@ -409,6 +394,7 @@ elseif("${TARGET}" STREQUAL "nativeproxy_build")
-DREKO_ROOT=${REKO_SRC}/../
-DREKO_PLATFORM=${REKO_PLATFORM}
-DREKO_COMPILER=${REKO_COMPILER}
+ -DACTION=${ACTION}
-P ${REKO_SRC}/Native/reko.cmake
)
elseif("${TARGET}" STREQUAL "git_hash")
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index c4142b7c5d..0af87aa6c7 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -36,8 +36,25 @@
-
-
+
+
+
+
+
+
+ $(ProjectDir)..\BuildTargets\BuildTargets.csproj
+ git_hash
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Environments/OS2/OS2.csproj b/src/Environments/OS2/OS2.csproj
index b8e16a12fd..6159367e55 100644
--- a/src/Environments/OS2/OS2.csproj
+++ b/src/Environments/OS2/OS2.csproj
@@ -14,7 +14,23 @@
-
-
+
+
+
+
+
+ $(ProjectDir)..\..\BuildTargets\BuildTargets.csproj
+ gen_c2xml_os2
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Environments/SysV/SysV.csproj b/src/Environments/SysV/SysV.csproj
index 3c3e087c56..3bd3104b20 100644
--- a/src/Environments/SysV/SysV.csproj
+++ b/src/Environments/SysV/SysV.csproj
@@ -17,7 +17,23 @@
-
-
+
+
+
+
+
+ $(ProjectDir)..\..\BuildTargets\BuildTargets.csproj
+ gen_c2xml_sysv
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Environments/Windows/Windows.csproj b/src/Environments/Windows/Windows.csproj
index 9f1028eba2..bf51675251 100644
--- a/src/Environments/Windows/Windows.csproj
+++ b/src/Environments/Windows/Windows.csproj
@@ -20,7 +20,23 @@
-
-
+
+
+
+
+
+ $(ProjectDir)..\..\BuildTargets\BuildTargets.csproj
+ gen_c2xml_windows
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Installers/Runtime/Runtime.csproj b/src/Installers/Runtime/Runtime.csproj
index c452353ed1..56c3710757 100644
--- a/src/Installers/Runtime/Runtime.csproj
+++ b/src/Installers/Runtime/Runtime.csproj
@@ -23,8 +23,24 @@
-
+
+
+
+
+
+ $(ProjectDir)..\..\BuildTargets\BuildTargets.csproj
+ update_runtime_nuspec
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/Native/NativeProxy.csproj b/src/Native/NativeProxy.csproj
index 765bc9df41..a7fefc621f 100755
--- a/src/Native/NativeProxy.csproj
+++ b/src/Native/NativeProxy.csproj
@@ -16,15 +16,31 @@
-
-
+
+
+
+
+
+ $(ProjectDir)..\BuildTargets\BuildTargets.csproj
+ gen_c2xml_sysv
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
diff --git a/src/Native/reko.cmake b/src/Native/reko.cmake
index 150bbacdfa..e9011daad6 100644
--- a/src/Native/reko.cmake
+++ b/src/Native/reko.cmake
@@ -6,8 +6,6 @@ include(msbuild2cmake)
set(BUILD_DIR ${CMAKE_BINARY_DIR}/build/${REKO_PLATFORM}/${CMAKE_BUILD_TYPE})
if(ACTION STREQUAL "clean")
- message(STATUS "Cleaning native libraries")
- message(STATUS "deleting ${BUILD_DIR}")
clean_project(${BUILD_DIR})
else()
message(STATUS "Building native libraries")
diff --git a/src/distclean.cmake b/src/distclean.cmake
new file mode 100644
index 0000000000..061df52272
--- /dev/null
+++ b/src/distclean.cmake
@@ -0,0 +1,34 @@
+set(REKO_SRC ${CMAKE_CURRENT_LIST_DIR})
+list(INSERT CMAKE_MODULE_PATH 0 "${REKO_SRC}/../cmake")
+include(FindDotNet)
+
+macro(rmrf path)
+ message("=> rm -r ${path}")
+ file(REMOVE_RECURSE "${path}")
+endmacro()
+
+execute_process(
+ COMMAND ${DOTNET_EXE} clean
+ COMMAND_ERROR_IS_FATAL ANY
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+)
+
+file(GLOB_RECURSE CANDIDATES
+ LIST_DIRECTORIES TRUE
+ ${REKO_SRC}/**/bin
+ ${REKO_SRC}/**/obj
+)
+
+foreach(p IN LISTS CANDIDATES)
+ if(NOT IS_DIRECTORY "${p}"
+ OR NOT p MATCHES "/(bin|obj)$")
+ continue()
+ endif()
+ rmrf("${p}")
+endforeach()
+
+set(REKO_CMAKE_BUILD_TARGETS ${REKO_SRC}/BuildTargets/build)
+
+if(IS_DIRECTORY ${REKO_CMAKE_BUILD_TARGETS})
+ rmrf(${REKO_CMAKE_BUILD_TARGETS})
+endif()
\ No newline at end of file
diff --git a/src/reko.cmake b/src/reko.cmake
index e0008de3e2..2ca4b72c8c 100644
--- a/src/reko.cmake
+++ b/src/reko.cmake
@@ -18,11 +18,17 @@ if("${TARGET}" STREQUAL "git_hash")
endif()
-invoke_cmake(
- BUILD_DIR ${CMAKE_BINARY_DIR}/build/${TARGET}
- DIRECTORY ${REKO_SRC}/../
- TARGET ${TARGET}
- GENERATOR ${REKO_COMPILER}
- # variables needed by CMakeLists.txt, that must be forwarded
- EXTRA_ARGUMENTS ${cmake_arguments}
-)
\ No newline at end of file
+set(BUILD_DIR ${CMAKE_BINARY_DIR}/build/${TARGET})
+
+if(ACTION STREQUAL clean)
+ clean_project(${BUILD_DIR})
+else()
+ invoke_cmake(
+ BUILD_DIR ${BUILD_DIR}
+ DIRECTORY ${REKO_SRC}/../
+ TARGET ${TARGET}
+ GENERATOR ${REKO_COMPILER}
+ # variables needed by CMakeLists.txt, that must be forwarded
+ EXTRA_ARGUMENTS ${cmake_arguments}
+ )
+endif()
\ No newline at end of file