changeset 19:e85455ff6039

standalon
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Jul 2012 10:17:12 +0200
parents f3551378e8f3
children a56b6a8b89ba
files CMakeLists.txt NEWS PalantirServer/PalantirInitialization.cpp PalantirServer/main.cpp
diffstat 4 files changed, 26 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Jul 24 10:03:17 2012 +0200
+++ b/CMakeLists.txt	Tue Jul 24 10:17:12 2012 +0200
@@ -6,9 +6,13 @@
 include(CheckIncludeFiles)
 
 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
-SET(RELEASE_BUILD OFF CACHE BOOL "Release build")
+SET(STANDALONE_BUILD OFF CACHE BOOL "Standalone build (necessary for cross-compilation or binary releases)")
 
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (${CMAKE_CROSSCOMPILING})
+  SET(STANDALONE_BUILD ON)
+endif()
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
   CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H)
 else()
   CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
@@ -85,9 +89,9 @@
   add_definitions(-DPALANTIR_STATIC=0)
 endif()
 
-if (${RELEASE_BUILD})
+if (${STANDALONE_BUILD})
   add_definitions(
-    -DPALANTIR_RELEASE=1
+    -DPALANTIR_STANDALONE=1
     )
 
   EmbedResources(
@@ -97,7 +101,7 @@
 
 else()
   add_definitions(
-    -DPALANTIR_RELEASE=0
+    -DPALANTIR_STANDALONE=0
     -DPALANTIR_PATH=\"${CMAKE_SOURCE_DIR}\"
     )
 
--- a/NEWS	Tue Jul 24 10:03:17 2012 +0200
+++ b/NEWS	Tue Jul 24 10:17:12 2012 +0200
@@ -2,6 +2,7 @@
 ===============
 
 * Licensing of the "Core/SQLite" folder
+* Standalone build for cross-compilation
 
 
 Version 0.1.1 (2012/07/20)
--- a/PalantirServer/PalantirInitialization.cpp	Tue Jul 24 10:03:17 2012 +0200
+++ b/PalantirServer/PalantirInitialization.cpp	Tue Jul 24 10:17:12 2012 +0200
@@ -48,14 +48,22 @@
     }
     else
     {
-#if PALANTIR_RELEASE == 0
-      boost::filesystem::path p = PALANTIR_PATH;
-      p /= "Resources";
-      p /= CONFIGURATION_FILE;
-      Toolbox::ReadFile(content, p.string());
+      try
+      {
+#if PALANTIR_STANDALONE == 0
+        boost::filesystem::path p = PALANTIR_PATH;
+        p /= "Resources";
+        p /= CONFIGURATION_FILE;
+        Toolbox::ReadFile(content, p.string());
 #else
-      Toolbox::ReadFile(content, CONFIGURATION_FILE);
+        Toolbox::ReadFile(content, CONFIGURATION_FILE);
 #endif
+      }
+      catch (PalantirException&)
+      {
+        // No configuration file found, give up with empty configuration
+        return;
+      }
     }
 
     Json::Reader reader;
--- a/PalantirServer/main.cpp	Tue Jul 24 10:03:17 2012 +0200
+++ b/PalantirServer/main.cpp	Tue Jul 24 10:17:12 2012 +0200
@@ -107,7 +107,7 @@
 
   try
   {
-	std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "PalantirStorage");
+    std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "PalantirStorage");
     ServerIndex index(storageDirectory);
     MyDicomStoreFactory storeScp(index, storageDirectory);
 
@@ -123,7 +123,7 @@
       MongooseServer httpServer;
       httpServer.SetPort(GetGlobalIntegerParameter("HttpPort", 8000));
 
-#if PALANTIR_RELEASE == 1
+#if PALANTIR_STANDALONE == 1
       httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::PALANTIR_EXPLORER));
 #else
       httpServer.RegisterHandler(new FilesystemHttpHandler("/app", PALANTIR_PATH "/PalantirExplorer"));