Skip to content

Commit

Permalink
Native: fix the clean target
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Jan 27, 2024
1 parent 2a24784 commit b4d3a44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/msbuild2cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function(check_msys output)
set(${output} FALSE PARENT_SCOPE)
endfunction()

function(clean_project name path build_dir)
function(clean_project build_dir)
if(EXISTS ${build_dir})
message(STATUS "Removing ${build_dir}")
file(REMOVE_RECURSE ${build_dir})
Expand Down
26 changes: 17 additions & 9 deletions src/Native/reko.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ list(INSERT CMAKE_MODULE_PATH 0 "${REKO_SRC}/../cmake")

include(msbuild2cmake)

message(STATUS "Building native libraries")
invoke_cmake(
BUILD_DIR ${CMAKE_BINARY_DIR}/build/${REKO_PLATFORM}/${CMAKE_BUILD_TYPE}
DIRECTORY ${CMAKE_SOURCE_DIR}
GENERATOR ${REKO_COMPILER}
EXTRA_ARGUMENTS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DREKO_PLATFORM=${REKO_PLATFORM}
)
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")
invoke_cmake(
BUILD_DIR ${BUILD_DIR}
DIRECTORY ${CMAKE_SOURCE_DIR}
GENERATOR ${REKO_COMPILER}
EXTRA_ARGUMENTS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DREKO_PLATFORM=${REKO_PLATFORM}
)
endif()

0 comments on commit b4d3a44

Please sign in to comment.