Commit 3c1a78ea authored by Alex Tereschenko's avatar Alex Tereschenko Committed by Anas Nashif
Browse files

cmake: replace PROJECT_SOURCE_DIR with ZEPHYR_BASE



Both variables were used (with the same value) interchangeably
throughout CMake files and per the discussion in GH issue,
ZEPHYR_BASE is preferred.

Also add a comment with explanation of one vs. the other.

Tested by building hello_world for several boards ensuring no errors.

Fixes #7173.

Signed-off-by: default avatarAlex Tereschenko <alext.mkrs@gmail.com>
parent 7688f490
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -341,9 +341,9 @@ add_custom_target(syscall_macros_h_target DEPENDS ${syscall_macros_h})
add_custom_command(                       OUTPUT  ${syscall_macros_h}
  COMMAND
  ${PYTHON_EXECUTABLE}
  ${PROJECT_SOURCE_DIR}/scripts/gen_syscall_header.py
  ${ZEPHYR_BASE}/scripts/gen_syscall_header.py
  > ${syscall_macros_h}
  DEPENDS ${PROJECT_SOURCE_DIR}/scripts/gen_syscall_header.py
  DEPENDS ${ZEPHYR_BASE}/scripts/gen_syscall_header.py
  )


@@ -365,8 +365,8 @@ set(syscalls_subdirs_trigger ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/syscalls
execute_process(
  COMMAND
  ${PYTHON_EXECUTABLE}
  ${PROJECT_SOURCE_DIR}/scripts/subfolder_list.py
  --directory        ${PROJECT_SOURCE_DIR}/include # Walk this directory
  ${ZEPHYR_BASE}/scripts/subfolder_list.py
  --directory        ${ZEPHYR_BASE}/include  # Walk this directory
  --out-file         ${syscalls_subdirs_txt} # Write this file
  )
file(STRINGS ${syscalls_subdirs_txt} PARSE_SYSCALLS_PATHS_DEPENDS)
@@ -378,7 +378,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Windows)

  # Also On Windows each header file must be monitored as file modifications are not reflected
  # on directory level.
  file(GLOB_RECURSE PARSE_SYSCALLS_HEADER_DEPENDS ${PROJECT_SOURCE_DIR}/include/*.h)
  file(GLOB_RECURSE PARSE_SYSCALLS_HEADER_DEPENDS ${ZEPHYR_BASE}/include/*.h)
else()
  # The syscall parsing depends on the folders in order to detect add/removed/modified files.
  # When a folder is removed, CMake will try to find a target that creates that dependency.
@@ -396,8 +396,8 @@ else()
    ${syscalls_subdirs_txt}
    COMMAND
    ${PYTHON_EXECUTABLE}
    ${PROJECT_SOURCE_DIR}/scripts/subfolder_list.py
    --directory        ${PROJECT_SOURCE_DIR}/include # Walk this directory
    ${ZEPHYR_BASE}/scripts/subfolder_list.py
    --directory        ${ZEPHYR_BASE}/include      # Walk this directory
    --out-file         ${syscalls_subdirs_txt}     # Write this file
    --trigger          ${syscalls_subdirs_trigger} # Trigger file that will result in CMake rerun
    DEPENDS ${PARSE_SYSCALLS_PATHS_DEPENDS}
@@ -420,8 +420,8 @@ add_custom_command(
  ${syscalls_json}
  COMMAND
  ${PYTHON_EXECUTABLE}
  ${PROJECT_SOURCE_DIR}/scripts/parse_syscalls.py
  --include          ${PROJECT_SOURCE_DIR}/include        # Read files from this dir
  ${ZEPHYR_BASE}/scripts/parse_syscalls.py
  --include          ${ZEPHYR_BASE}/include # Read files from this dir
  --json-file        ${syscalls_json}       # Write this file
  DEPENDS ${syscalls_subdirs_txt} ${PARSE_SYSCALLS_HEADER_DEPENDS}
  )
@@ -431,7 +431,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
  # Also, some files are written to include/generated/syscalls/
  COMMAND
  ${PYTHON_EXECUTABLE}
  ${PROJECT_SOURCE_DIR}/scripts/gen_syscalls.py
  ${ZEPHYR_BASE}/scripts/gen_syscalls.py
  --json-file        ${syscalls_json}                     # Read this file
  --base-output      include/generated/syscalls           # Write to this dir
  --syscall-dispatch include/generated/syscall_dispatch.c # Write this file
+2 −2
Original line number Diff line number Diff line
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
zephyr_include_directories(${PROJECT_SOURCE_DIR}/arch/x86/soc/intel_quark)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_include_directories(${ZEPHYR_BASE}/arch/x86/soc/intel_quark)

zephyr_cc_option(-mcpu=quarkse_em -mno-sdata)

+1 −1
Original line number Diff line number Diff line
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

zephyr_cc_option(-mcpu=${GCC_M_CPU})
zephyr_cc_option(-mno-sdata -mdiv-rem -mswap -mnorm)
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ zephyr_compile_options(
  -MMD
  -MP
  ${ARCH_FLAG}
  -include ${PROJECT_SOURCE_DIR}/arch/posix/include/posix_cheats.h
  -include ${ZEPHYR_BASE}/arch/posix/include/posix_cheats.h
  )

zephyr_compile_options_ifdef(CONFIG_COVERAGE
+3 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ else()
  set(GENIDT_EXTRA_ARGS "")
endif()

set(GENIDT ${PROJECT_SOURCE_DIR}/scripts/gen_idt.py)
set(GENIDT ${ZEPHYR_BASE}/scripts/gen_idt.py)

define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH BRIEF_DOCS " " FULL_DOCS " ")
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "i386")
@@ -134,7 +134,7 @@ if(CONFIG_X86_MMU)
    OUTPUT mmu_tables.bin
    COMMAND
    ${PYTHON_EXECUTABLE}
    ${PROJECT_SOURCE_DIR}/scripts/gen_mmu_x86.py
    ${ZEPHYR_BASE}/scripts/gen_mmu_x86.py
    -i mmulist.bin
    -k $<TARGET_FILE:zephyr_prebuilt>
    -o mmu_tables.bin
@@ -174,7 +174,7 @@ if(CONFIG_GDT_DYNAMIC)
    OUTPUT gdt.bin
    COMMAND
    ${PYTHON_EXECUTABLE}
    ${PROJECT_SOURCE_DIR}/scripts/gen_gdt.py
    ${ZEPHYR_BASE}/scripts/gen_gdt.py
    --kernel $<TARGET_FILE:zephyr_prebuilt>
    --output-gdt gdt.bin
    $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
Loading