]> git.cworth.org Git - apitrace/commitdiff
Don't install in per-architecture wrapper directories.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 2 Mar 2012 10:31:19 +0000 (10:31 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 8 Mar 2012 09:20:03 +0000 (10:20 +0100)
CMAKE_SYSTEM_PROCESSOR is unreliable and its all a big mess.

Assume for now that people will use an apitrace suited to what they wanna
trace.

CMakeLists.txt
TODO.markdown
common/trace_resource.cpp
common/trace_tools_trace.cpp

index 0dc805a104f3b61d2af02446045db1faea960e81..39afc05d63461ea2e8ebe3342ba580964ef53356 100755 (executable)
@@ -215,22 +215,14 @@ if (WIN32 OR APPLE)
     # On Windows/MacOSX, applications are usually installed on a directory of
     # their own
     set (DOC_INSTALL_DIR doc)
+    set (LIB_INSTALL_DIR lib)
 else ()
     set (DOC_INSTALL_DIR share/doc/${CMAKE_PROJECT_NAME})
-endif ()
-
-set (LIB_INSTALL_DIR lib/apitrace)
-
-if (APPLE)
-    # MacOSX uses fat binaries, so no need to have per-architecture wrapper
-    # directories
-    set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR})
-else ()
-    set (LIB_ARCH_INSTALL_DIR ${LIB_INSTALL_DIR}/${CMAKE_SYSTEM_PROCESSOR})
+    set (LIB_INSTALL_DIR lib/${CMAKE_PROJECT_NAME})
 endif ()
 
 set(SCRIPTS_INSTALL_DIR ${LIB_INSTALL_DIR}/scripts)
-set(WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers)
+set(WRAPPER_INSTALL_DIR ${LIB_INSTALL_DIR}/wrappers)
 
 # Expose the binary/install directories to source
 #
index e59668768ed1e12cbfb7406d23afe6ce01e63b88..0d6eaa72ab57d9f34d2843dac762752401ec1001 100644 (file)
@@ -7,6 +7,9 @@ Things To Do
 Tracing
 -------
 
+* Better multi-arch support on Windows/Linux -- allow one set of binaries to
+  trace both 32/64 bits applications.
+
 * Allow clamping to a GL version or a number of extensions.
 
 * Put (de)compression in a separate thread.
index 31827b9b1af689be916fd7a9d5d56fd0aa9fbf8d..35d2b1a73cc6a9464b3bee03720ee1cd85a4df23 100644 (file)
@@ -69,41 +69,46 @@ findFile(const char *relPath,
 
 
 os::String
-findScript(const char *name)
+findScript(const char *scriptFilename)
 {
-    os::String path;
-
-#if defined(APITRACE_SOURCE_DIR)
-    // Try the absolute source  path -- useful for development or quick
-    // experiment.  Relative paths don't quite work here due to out of source
-    // trees.
-    path = APITRACE_SOURCE_DIR "/scripts";
-    path.join(name);
-    if (path.exists()) {
-        return path;
+    os::String scriptPath;
+
+    os::String processDir = os::getProcessName();
+    processDir.trimFilename();
+
+    // Try relative build directory
+    // XXX: Just make build and install directory layout match
+    scriptPath = processDir;
+    scriptPath.join("scripts");
+    scriptPath.join(scriptFilename);
+    if (scriptPath.exists()) {
+        return scriptPath;
     }
-#endif
 
+    // Try relative install directory
+    scriptPath = processDir;
 #if defined(_WIN32)
-    // Windows has no standard installation path, so find it relatively to the
-    // process name, which is assumed to be in a bin subdirectory.
-    path = os::getProcessName();
-    path.trimFilename();
-    path.join("..\\lib\\apitrace\\scripts");
-    path.join(name);
-    if (path.exists()) {
-        return path;
-    }
+    scriptPath.join("..\\lib\\scripts");
+#elif defined(__APPLE__)
+    scriptPath.join("../lib/scripts");
 #else
-    // Assume a predefined installation path on Unices
-    path = APITRACE_INSTALL_PREFIX "/lib/apitrace/scripts";
-    path.join(name);
-    if (path.exists()) {
-        return path;
+    scriptPath.join("../lib/apitrace/scripts");
+#endif
+    scriptPath.join(scriptFilename);
+    if (scriptPath.exists()) {
+        return scriptPath;
+    }
+
+#ifndef _WIN32
+    // Try absolute install directory
+    scriptPath = APITRACE_WRAPPER_INSTALL_DIR;
+    scriptPath.join(scriptFilename);
+    if (scriptPath.exists()) {
+        return scriptPath;
     }
 #endif
 
-    std::cerr << "error: cannot find " << name << " script\n";
+    std::cerr << "error: cannot find " << scriptFilename << " script\n";
 
     return "";
 }
index fe6b3e2d4500acb8d30963163f9f8b81ae149735..36fe735466e104c98fcb4a5afe5902c0ed2a793d 100644 (file)
@@ -70,8 +70,10 @@ findWrapper(const char *wrapperFilename)
 
     // Try relative install directory
     wrapperPath = processDir;
-#ifdef _WIN32
-    wrapperPath.join("..\\lib\\apitrace\\wrappers");
+#if defined(_WIN32)
+    wrapperPath.join("..\\lib\\wrappers");
+#elif defined(__APPLE__)
+    wrapperPath.join("../lib/wrappers");
 #else
     wrapperPath.join("../lib/apitrace/wrappers");
 #endif