Explorar o código

windows compat

Nicolas Winkler %!s(int64=6) %!d(string=hai) anos
pai
achega
b624451b4c
Modificáronse 4 ficheiros con 38 adicións e 11 borrados
  1. 25 2
      src/CMakeLists.txt
  2. 1 1
      src/some.qlw
  3. 10 7
      src/util/Path.cpp
  4. 2 1
      src/util/Path.h

+ 25 - 2
src/CMakeLists.txt

@@ -72,10 +72,33 @@ endif()
 #explicit_llvm_config(${PROJECT_NAME} STATIC_LIBRARY)
 llvm_config(${PROJECT_NAME})
 
-llvm_map_components_to_libnames(llvm_libs X86 passes)
+if (${BUILD_STATIC})
+    llvm_map_components_to_libnames(llvm_libs X86 passes)
+#    set(LLVM_LINK_COMPONENTS
+#      BitWriter
+#      BitReader
+#      AsmParser
+#      Analysis
+#      TransformUtils
+#      ScalarOpts
+#      Target
+#      Core
+#      IRReader
+#      Linker
+#      Support
+#      X86Disassembler
+#      X86AsmParser
+#      X86CodeGen
+#      Global
+#    )
+    target_link_libraries(${PROJECT_NAME} ${llvm_libs})
+else()
+    target_link_libraries(${PROJECT_NAME} LLVM)
+endif()
+
 
 #message( ${llvm_libs} )
-target_link_libraries(${PROJECT_NAME} LLVM) # ${llvm_libs})
+target_link_libraries(${PROJECT_NAME} ${llvm_libs})
 
 
 #    MIRParser

+ 1 - 1
src/some.qlw

@@ -6,7 +6,7 @@ fast_fibonacci(i: Integer): Integer do
     temp: Integer
     count: Integer
     count := i 
-    a := 0 // sdfsfaf
+    a := 0
     b := 1
     while count != 0 do
         temp := a

+ 10 - 7
src/util/Path.cpp

@@ -3,16 +3,18 @@
 using qlow::util::Path;
 
 #ifdef QLOW_TARGET_WINDOWS
-const std::string Path::dirSeparator = "\\";
+const std::string Path::dirSeparators = "\\/";
+const std::string Path::defaultDirSeparator = "\\";
 #else
-const std::string Path::dirSeparator = "/";
+const std::string Path::dirSeparators = "/";
+const std::string Path::defaultDirSeparator = "/";
 #endif
 
 
 void Path::append(const Path& other)
 {
     if (!endsWithSeparator())
-        path += dirSeparator;
+        path += defaultDirSeparator;
     path += other.path;
 }
 
@@ -21,7 +23,7 @@ Path Path::parentPath(void) const
 {
     Path parent = *this;
 
-    if (parent.path == dirSeparator)
+    if (parent.path == defaultDirSeparator)
         return parent;
 
     if (parent.endsWithSeparator()) {
@@ -33,7 +35,7 @@ Path Path::parentPath(void) const
         parent.path.pop_back();
     }
 
-    if (parent.path.size() > dirSeparator.size() && parent.endsWithSeparator())
+    if (parent.path.size() >= 2 && parent.endsWithSeparator())
         parent.path.pop_back();
 
     return parent;
@@ -68,6 +70,7 @@ const char* Path::c_str(void) const
 
 bool Path::endsWithSeparator(void) const
 {
-    return path.size() >= dirSeparator.size() &&
-        std::equal(dirSeparator.rbegin(), dirSeparator.rend(), path.rbegin());
+    return !path.empty() && dirSeparators.find(path[path.size() - 1]) != std::string::npos;
+    /*return path.size() >= dirSeparator.size() &&
+        std::equal(dirSeparator.rbegin(), dirSeparator.rend(), path.rbegin());*/
 }

+ 2 - 1
src/util/Path.h

@@ -14,7 +14,8 @@ class qlow::util::Path
 {
     std::string path;
 
-    static const std::string dirSeparator;
+    static const std::string dirSeparators;
+    static const std::string defaultDirSeparator;
 
 public: