diff --git a/.github/workflows/compile-check.yml b/.github/workflows/compile-check.yml index 3dced860..f0f7ea0b 100644 --- a/.github/workflows/compile-check.yml +++ b/.github/workflows/compile-check.yml @@ -51,7 +51,7 @@ jobs: key: tools_libs path: | toolchain/bin - toolchain/include + toolchain/libcxx-include toolchain/cache-version-url.txt - name: Run setup run: tools/setup.py smo-main.nso diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index f23de386..7b5980dc 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -26,7 +26,7 @@ jobs: key: tools_libs path: | toolchain/bin - toolchain/include + toolchain/libcxx-include toolchain/cache-version-url.txt - name: Run simplified setup run: tools/setup.py --project diff --git a/.gitignore b/.gitignore index f6f07459..04159a26 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,8 @@ perf.data.old # Tooling /toolchain/clang-* +!/toolchain/clang-include +toolchain/libcxx-include toolchain/include toolchain/cache-version-url.txt tools/check diff --git a/toolchain/ToolchainNX64.cmake b/toolchain/ToolchainNX64.cmake index c48c708f..4d9c9dec 100644 --- a/toolchain/ToolchainNX64.cmake +++ b/toolchain/ToolchainNX64.cmake @@ -47,6 +47,13 @@ add_compile_options(-fPIC) # Helps with matching as this causes Clang to emit debug type info even for dynamic classes # with undefined vtables. add_compile_options(-fstandalone-debug) +# avoids reading system-wide headers on later clang versions (for example linter's libclang) +add_compile_options(--gcc-toolchain=/nonexistant) +# after all other includes, use fallback clang headers +# => applied only when building this project normally, using system-wide (lib-)clang will use its own +add_compile_options(-idirafter ${CMAKE_CURRENT_LIST_DIR}/clang-include) +# custom libc++, provided in combination with clang-3.9.1 +include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/libcxx-include) add_definitions(-D SWITCH) add_definitions(-D NNSDK) @@ -56,5 +63,3 @@ add_link_options(-stdlib=libc++ -nostdlib) add_link_options(-fPIC -Wl,-Bsymbolic-functions -shared) # Use lld for performance reasons (and because we don't want a dependency on GNU tools) add_link_options(-fuse-ld=${ODYSSEY_CLANG_LLD}) - -include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/include) diff --git a/lib/aarch64/arm_neon.h b/toolchain/clang-include/arm_neon.h similarity index 100% rename from lib/aarch64/arm_neon.h rename to toolchain/clang-include/arm_neon.h diff --git a/tools/setup.py b/tools/setup.py index 328835b3..7adb0bcf 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -126,14 +126,18 @@ def setup_project_tools(tools_from_source): os.symlink(f"{get_repo_root()}/toolchain/bin/listsym", f"{get_repo_root()}/tools/listsym") with tempfile.TemporaryDirectory() as tmpdir: - if not exists_toolchain_file("include/__config"): + if exists_toolchain_file("include/__config"): # old path to libcxx headers => moved to `libcxx-include` + print("Removing old libc++ headers...") + shutil.rmtree(f"{get_repo_root()}/toolchain/include") + + if not exists_toolchain_file("libcxx-include/__config"): print(">>> Downloading llvm-3.9 libc++ headers...") path = tmpdir + "/libcxx-3.9.1.src.tar.xz" urllib.request.urlretrieve(LIBCXX_SRC_URL, path) print(">>> Extracting libc++ headers...") with tarfile.open(path) as f: f.extractall(tmpdir, filter='tar') - shutil.copytree(f"{tmpdir}/libcxx-3.9.1.src/include", f"{get_repo_root()}/toolchain/include", dirs_exist_ok=True) + shutil.copytree(f"{tmpdir}/libcxx-3.9.1.src/include", f"{get_repo_root()}/toolchain/libcxx-include", dirs_exist_ok=True) if not exists_tool("check") or not exists_tool("decompme") or not exists_tool("listsym") or not exists_toolchain_file("bin/clang") or not exists_toolchain_file("bin/ld.lld"):