Skip to content

Commit

Permalink
test+fix(ci/macos): rename all underscored file names like _types.h t…
Browse files Browse the repository at this point in the history
…o types.h to prevent possible compilation pitfall
  • Loading branch information
Ziqi-Yang committed Aug 4, 2024
1 parent e67fe83 commit d53e4cb
Show file tree
Hide file tree
Showing 33 changed files with 58 additions and 57 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

include_directories(${CMAKE_SOURCE_DIR}/src/llvm)
include_directories(${CMAKE_SOURCE_DIR}/src/llvm/_types)
include_directories(${CMAKE_SOURCE_DIR}/src/llvm/types)
include_directories(${CMAKE_SOURCE_DIR}/src/llvm/Core)
include_directories(${LLVM_INCLUDE_DIRS})

Expand Down Expand Up @@ -80,14 +80,14 @@ nanobind_add_module(
src/llvm/Utils.cpp
src/llvm/Support.cpp

src/llvm/_types/PyModule.cpp
src/llvm/_types/PyContext.cpp
src/llvm/_types/PyMetadataEntries.cpp
src/llvm/_types/PyModuleFlagEntries.cpp
src/llvm/_types/PyOperandBundle.cpp
src/llvm/_types/PyPassManagerBase.cpp
src/llvm/_types/PyMemoryBuffer.cpp
src/llvm/_types/PyModuleProvider.cpp
src/llvm/types/PyModule.cpp
src/llvm/types/PyContext.cpp
src/llvm/types/PyMetadataEntries.cpp
src/llvm/types/PyModuleFlagEntries.cpp
src/llvm/types/PyOperandBundle.cpp
src/llvm/types/PyPassManagerBase.cpp
src/llvm/types/PyMemoryBuffer.cpp
src/llvm/types/PyModuleProvider.cpp

${LLVM_INCLUDE_DIRS}
)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ environment = { SKBUILD_CMAKE_ARGS="-DLLVM_DIR=D:/a/llvmpym/llvmpym/llvm-build/l

[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "14.0"
# PATH="/opt/homebrew/opt/llvm/bin:$PATH"
PATH="/opt/homebrew/opt/llvm/bin:$PATH"
LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib -lunwind"
CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
SKBUILD_CMAKE_ARGS="-DLLVM_DIR=/opt/homebrew/opt/llvm/lib/cmake/llvm"
# SKBUILD_CMAKE_ARGS="-DLLVM_DIR=/opt/homebrew/opt/llvm/lib/cmake/llvm"



4 changes: 2 additions & 2 deletions src/llvm/Core.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Core.h"
#include "_types.h"
#include "_utils.h"
#include "types.h"
#include "utils.h"

#include "Core/utils.h"
#include "Core/enum.h"
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/Core/enum.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "enum.h"
#include <llvm-c/Core.h>
#include "../_types.h"
#include "../types.h"

namespace nb = nanobind;

Expand Down
2 changes: 2 additions & 0 deletions src/llvm/Core/globalFunc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "globalFunc.h"
#include <llvm-c/Core.h>
#include <llvm-c/Core.h>
#include "../types.h"

namespace nb = nanobind;
using namespace nb::literals;
Expand Down
2 changes: 0 additions & 2 deletions src/llvm/Core/globalFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#define LLVMPYM_CORE_GLOBALFUNC_H

#include <nanobind/nanobind.h>
#include <llvm-c/Core.h>
#include "../_types.h"

void bindGlobalFunctions(nanobind::module_ &m);

Expand Down
3 changes: 1 addition & 2 deletions src/llvm/Core/iterator.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "iterator.h"

#include "../_types.h"
#include "../types.h"

namespace nb = nanobind;
using namespace nb::literals;
Expand Down
4 changes: 2 additions & 2 deletions src/llvm/Core/miscClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <fmt/core.h>
#include <optional>
#include <stdexcept>
#include "../_types.h"
#include "../_utils.h"
#include "../types.h"
#include "../utils.h"
#include "utils.h"

namespace nb = nanobind;
Expand Down
4 changes: 2 additions & 2 deletions src/llvm/Core/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <llvm-c/Core.h>
#include <fmt/core.h>
#include <optional>
#include "../_types.h"
#include "../_utils.h"
#include "../types.h"
#include "../utils.h"
#include "utils.h"

namespace nb = nanobind;
Expand Down
4 changes: 2 additions & 2 deletions src/llvm/Core/type.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM_CORE_TYPES_H
#define LLVMPYM_CORE_TYPES_H
#ifndef LLVMPYM_CORE_TYPE_H
#define LLVMPYM_CORE_TYPE_H

#include <nanobind/nanobind.h>

Expand Down
2 changes: 1 addition & 1 deletion src/llvm/Core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <nanobind/nanobind.h>
#include <llvm-c/Core.h>
#include "../_types.h"
#include "../types.h"
#include <fmt/core.h>
#include <string>

Expand Down
4 changes: 2 additions & 2 deletions src/llvm/Core/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <nanobind/stl/tuple.h>
#include <fmt/core.h>
#include <optional>
#include "../_types.h"
#include "../_utils.h"
#include "../types.h"
#include "../utils.h"
#include "utils.h"

namespace nb = nanobind;
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <llvm-c/Core.h>
#include <nanobind/stl/string.h>
#include "Utils.h"
#include "_types.h"
#include "types.h"
#include "Core/utils.h"

namespace nb = nanobind;
Expand Down
21 changes: 11 additions & 10 deletions src/llvm/_types.h → src/llvm/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// ====================================

// note the flag has extra underscore
#ifndef LLVMPYM__TYPES_H
#define LLVMPYM__TYPES_H

Expand All @@ -13,16 +14,16 @@
#include <unordered_map>
#include <mutex>

#include "_types/PyModule.h"
#include "_types/PyContext.h"
#include "_types/PyMetadataEntries.h"
#include "_types/PyModuleFlagEntries.h"
#include "_types/PyOperandBundle.h"
#include "_types/PyPassManagerBase.h"
#include "_types/PyMemoryBuffer.h"
#include "_types/PyModuleProvider.h"
#include "_types/PyLLVMObject.h"
#include "_types/PyLLVMObject.h"
#include "types/PyModule.h"
#include "types/PyContext.h"
#include "types/PyMetadataEntries.h"
#include "types/PyModuleFlagEntries.h"
#include "types/PyOperandBundle.h"
#include "types/PyPassManagerBase.h"
#include "types/PyMemoryBuffer.h"
#include "types/PyModuleProvider.h"
#include "types/PyLLVMObject.h"
#include "types/PyLLVMObject.h"


#define DEFINE_PY_WRAPPER_CLASS(ClassName, UnderlyingType) \
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/llvm/_types/PyContext.h → src/llvm/types/PyContext.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYCONTEXT_H
#define LLVMPYM__TYPES_PYCONTEXT_H
#ifndef LLVMPYM_TYPES_PYCONTEXT_H
#define LLVMPYM_TYPES_PYCONTEXT_H

#include <llvm-c/Core.h>
#include <stdexcept>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PYLLVMOBJECT_H
#define PYLLVMOBJECT_H
#ifndef LLVMPYM_TYPES_PYLLVMOBJECT_H
#define LLVMPYM_TYPES_PYLLVMOBJECT_H

#include <iostream>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYMEMORYBUFFER_H
#define LLVMPYM__TYPES_PYMEMORYBUFFER_H
#ifndef LLVMPYM_TYPES_PYMEMORYBUFFER_H
#define LLVMPYM_TYPES_PYMEMORYBUFFER_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYMETADATAENTRIES_H
#define LLVMPYM__TYPES_PYMETADATAENTRIES_H
#ifndef LLVMPYM_TYPES_PYMETADATAENTRIES_H
#define LLVMPYM_TYPES_PYMETADATAENTRIES_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/llvm/_types/PyModule.h → src/llvm/types/PyModule.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYMODULE_H
#define LLVMPYM__TYPES_PYMODULE_H
#ifndef LLVMPYM_TYPES_PYMODULE_H
#define LLVMPYM_TYPES_PYMODULE_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYMODULEFLAGENTRIES_H
#define LLVMPYM__TYPES_PYMODULEFLAGENTRIES_H
#ifndef LLVMPYM_TYPES_PYMODULEFLAGENTRIES_H
#define LLVMPYM_TYPES_PYMODULEFLAGENTRIES_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYMODULEPROVIDER_H
#define LLVMPYM__TYPES_PYMODULEPROVIDER_H
#ifndef LLVMPYM_TYPES_PYMODULEPROVIDER_H
#define LLVMPYM_TYPES_PYMODULEPROVIDER_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PYOPERANDBUNDLE_H
#define PYOPERANDBUNDLE_H
#ifndef LLVMPYM_TYPES_PYOPERANDBUNDLE_H
#define LLVMPYM_TYPES_PYOPERANDBUNDLE_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LLVMPYM__TYPES_PYPASSMANAGERBASE_H
#define LLVMPYM__TYPES_PYPASSMANAGERBASE_H
#ifndef LLVMPYM_TYPES_PYPASSMANAGERBASE_H
#define LLVMPYM_TYPES_PYPASSMANAGERBASE_H

#include <llvm-c/Core.h>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions src/llvm/_utils.h → src/llvm/utils.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// note the flag has extra underscore
#ifndef LLVMPYM__UTILS_H
#define LLVMPYM__UTILS_H

Expand Down
2 changes: 1 addition & 1 deletion src/llvmpym_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "llvm/ErrorHandling.h"
#include "llvm/Utils.h"
#include "llvm/Support.h"
#include "llvm/_types.h"
#include "llvm/types.h"

namespace nb = nanobind;
using namespace nb::literals;
Expand Down

0 comments on commit d53e4cb

Please sign in to comment.