diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8492617e314c9e914318e4ea678817fab46d6ac..0b5085c54eaea7cef1cf86b86cfd94eb5c342c97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -332,7 +332,7 @@ ubu-gm-fullsimlight-customxercesc-builtinjson: XERCESC_VERSION: 3.2.3 CMAKE_ARGS: ${CMAKE_BASE_ARGS} CMAKE_CONFIG_FLAGS: -DGEOMODEL_BUILD_FULLSIMLIGHT=TRUE - CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_JSON=TRUE -DXercesC_INCLUDE_DIR=./install/xerces-c-${XERCESC_VERSION}/include -DXercesC_LIBRARY=./install/xerces-c-${XERCESC_VERSION}/lib/libxerces-c.dylib + CMAKE_EXTRA_FLAGS: -DGEOMODEL_USE_BUILTIN_JSON=TRUE -DXercesC_INCLUDE_DIR=../install/xerces-c-${XERCESC_VERSION}/include -DXercesC_LIBRARY=../install/xerces-c-${XERCESC_VERSION}/lib/libxerces-c.dylib allow_failure: true diff --git a/FullSimLight/CMakeLists.txt b/FullSimLight/CMakeLists.txt index 067a352275d5bec6bf371924907a2a2f4ba8e93d..5e461496f09a42aab447df201aaf87228b265cba 100644 --- a/FullSimLight/CMakeLists.txt +++ b/FullSimLight/CMakeLists.txt @@ -19,8 +19,12 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) "Framework finding behaviour on macOS" ) # Set up how the project handle some of its dependenices. Either by picking them # up from the environment, or building them itself. - include( SetupJSON ) - include( SetupXercesC ) + if( NOT TARGET JSONExt ) + include( SetupJSON ) + endif() + if( NOT TARGET XercesCBuiltIn ) + include( SetupXercesC ) + endif() # Find the base GeoModel packages, which must be installed on the target system already find_package( GeoModelCore REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder find_package( GeoModelIO REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder @@ -97,7 +101,7 @@ add_executable(gmtogdml geoModeltoGDML.cc ${sources} ${headers}) if(Pythia_FOUND) target_compile_definitions(fullSimLight PRIVATE USE_PYTHIA) - target_link_libraries(fullSimLight Pythia::Pythia) + target_link_libraries(fullSimLight PRIVATE Pythia::Pythia) endif() #---------------------------------------------------------------------------- diff --git a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index 3214b428fbf354a9701fd9d2cf9d4496c664093b..6c4733c8326d55a8df0e70b29533c2de189c4d96 100644 --- a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h +++ b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h @@ -1,12 +1,11 @@ // author: Riccardo.Maria.Bianchi@cern.ch - 2017 -// major updates: Aug 2018 +// major updates: +// - Aug 2018, R.M.Bianchi +// - Nov 2020, R.M.Bianchi #ifndef GMDBManager_H #define GMDBManager_H -// include SQLite -#include <sqlite3.h> - // include C++ #include <iostream> #include <unordered_map> @@ -14,6 +13,7 @@ #include <string> #include <typeindex> // std::type_index, needs C++11 + /** * \class GMDBManager * @@ -169,6 +169,7 @@ public: * @note The 'suffix' parameter is optional. If not provided, the records will be saved in the default table. */ bool addListOfPublishedAlignableTransforms(const std::vector<std::vector<std::string>> &records, std::string suffix = ""); + /** * @brief Save the list of 'published' GeoVFullPhysVol nodes to the DB. * @details The method gets a list of records and stores them in the default table 'PublishedFullPhysVols". @@ -237,10 +238,6 @@ private: std::string getTableNameFromNodeType(const std::string &nodeType); - sqlite3_stmt* selectAllFromTable(std::string tableName) const; - sqlite3_stmt* selectAllFromTableSortBy(std::string tableName, std::string sortColumn="") const; - sqlite3_stmt* selectAllFromTableChildrenPositions() const; - void storeTableColumnNames(std::vector<std::string> input); std::vector<std::string> getTableColumnNames(const std::string &tableName); @@ -251,20 +248,11 @@ private: bool storeRootVolume(const unsigned int &id, const std::string &nodeType); -// void showError(const QSqlError &err) const; - std::string m_dbpath; -// QSqlDatabase m_db; - /// Pointer to SQLite connection - sqlite3* m_dbSqlite; - /// Variable to store error messages from SQLite - char *m_SQLiteErrMsg; + bool m_dbIsOK; - - bool m_dbIsOK; - - bool m_debug; + bool m_debug; std::unordered_map<std::string, std::vector<std::string>> m_tableNames; /// stores the column names for each table std::unordered_map<std::string, std::string> m_childType_tableName; @@ -274,6 +262,12 @@ private: std::unordered_map<unsigned int, std::string> m_cache_tableId_nodeType; /// cache for tableID-->nodeType std::unordered_map<std::string, std::string> m_cache_nodeType_tableName; /// cache for nodeType-->tableName std::unordered_map<std::string, unsigned int> m_cache_nodeType_tableID; /// cache for nodeType-->tableID + +protected: + class Imp; + Imp * m_d; + }; + #endif // GMDBManager_H diff --git a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp index f0256010d77b74ee84b15546713c1bba7e28563f..b61b686aaf64698c52c2d7b03bae650b67a08df4 100644 --- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp @@ -17,6 +17,9 @@ #define FMT_HEADER_ONLY 1 // to use 'fmt' header-only #include "fmt/format.h" +// include SQLite +#include <sqlite3.h> + // C++ includes #include <stdlib.h> /* exit, EXIT_FAILURE */ #include <sstream> @@ -58,7 +61,29 @@ std::string joinVectorStrings(std::vector<std::string> vec, std::string sep="") } -GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbSqlite(nullptr), m_SQLiteErrMsg(0), m_dbIsOK(false), m_debug(false) + +class GMDBManager::Imp { +public: + // constructor + Imp (GMDBManager* dbm) + : theManager(dbm), m_dbSqlite(nullptr), m_SQLiteErrMsg(0) {} + + // The class + GMDBManager* theManager; + + // Pointer to SQLite connection + sqlite3* m_dbSqlite; + + /// Variable to store error messages from SQLite + char *m_SQLiteErrMsg; + + sqlite3_stmt* selectAllFromTable(std::string tableName) const; + sqlite3_stmt* selectAllFromTableSortBy(std::string tableName, std::string sortColumn="") const; + sqlite3_stmt* selectAllFromTableChildrenPositions() const; + +}; + +GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbIsOK(false), m_debug(false), m_d(new Imp(this)) { // Check if the user asked for running in serial or multi-threading mode if ( "" != getEnvVar("GEOMODEL_ENV_IO_DBMANAGER_DEBUG")) { @@ -70,14 +95,14 @@ GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbSqlite(n // FIXME: TODO: we should check the existence of the file, otherwise SQLite will create a new file from scratch // Save the connection result - int exit = sqlite3_open(path.c_str(), &m_dbSqlite); + int exit = sqlite3_open(path.c_str(), &m_d->m_dbSqlite); // Test if there was an error if (exit == SQLITE_OK) { std::cout << "The Geometry Database '"<< path << "' has been opened successfully!" << std::endl; m_dbIsOK = true; } else { - std::cout << "DB Open Error: " << sqlite3_errmsg(m_dbSqlite) << std::endl; + std::cout << "DB Open Error: " << sqlite3_errmsg(m_d->m_dbSqlite) << std::endl; m_dbIsOK = false; } @@ -95,8 +120,11 @@ GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbSqlite(n GMDBManager::~GMDBManager() { - sqlite3_close(m_dbSqlite); - m_dbSqlite = nullptr; + sqlite3_close(m_d->m_dbSqlite); + delete m_d->m_dbSqlite; + m_d->m_dbSqlite = nullptr; + delete m_d; + m_d = nullptr; } @@ -220,10 +248,10 @@ std::vector<std::vector<std::string>> GMDBManager::getTableRecords(std::string t // get the query statetement ready to be executed sqlite3_stmt* stmt = nullptr; if ("ChildrenPositions" == tableName) { - stmt = selectAllFromTableChildrenPositions(); + stmt = m_d->selectAllFromTableChildrenPositions(); } else { - stmt = selectAllFromTable(tableName); + stmt = m_d->selectAllFromTable(tableName); } // execute the query and loop over all rows and all columuns if ( stmt ) @@ -247,7 +275,7 @@ std::vector<std::vector<std::string>> GMDBManager::getTableRecords(std::string t if ( res == SQLITE_DONE || res==SQLITE_ERROR) { if (res == SQLITE_ERROR) { - std::string errmsg(sqlite3_errmsg(m_dbSqlite)); + std::string errmsg(sqlite3_errmsg(m_d->m_dbSqlite)); sqlite3_finalize(stmt); throw errmsg; } @@ -592,15 +620,15 @@ void GMDBManager::addDBversion(std::string version) sqlite3_stmt * st = nullptr; int rc = -1; std::string sql = "INSERT INTO dbversion(version) VALUES(?)"; - rc = sqlite3_prepare_v2( m_dbSqlite, sql.c_str(), -1, &st, NULL); + rc = sqlite3_prepare_v2( m_d->m_dbSqlite, sql.c_str(), -1, &st, NULL); if (rc != SQLITE_OK) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } rc = sqlite3_bind_text(st, 1, version.c_str(), version.length(), SQLITE_TRANSIENT); rc = sqlite3_step( st ); if (rc != SQLITE_DONE) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } // finalize @@ -610,7 +638,7 @@ void GMDBManager::addDBversion(std::string version) bool GMDBManager::checkIsDBOpen() const { - if(m_dbSqlite != nullptr) { + if(m_d->m_dbSqlite != nullptr) { return true; } else { std::cout << "ERROR! The SQLite DB is not accessible! Exiting..." << std::endl; @@ -645,9 +673,9 @@ std::vector<std::string> GMDBManager::getItemFromTableName(std::string tableName // prepare the query sqlite3_stmt * stmt = nullptr; int rc = -1; - rc = sqlite3_prepare_v2( m_dbSqlite, sql.c_str(), -1, &stmt, NULL); + rc = sqlite3_prepare_v2( m_d->m_dbSqlite, sql.c_str(), -1, &stmt, NULL); if (rc != SQLITE_OK) { - printf( "[SQLite ERR] 'prepare' (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] 'prepare' (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } // bind the parameters @@ -671,7 +699,7 @@ std::vector<std::string> GMDBManager::getItemFromTableName(std::string tableName if ( res == SQLITE_DONE || res==SQLITE_ERROR) { if (res == SQLITE_ERROR) { - std::string errmsg(sqlite3_errmsg(m_dbSqlite)); + std::string errmsg(sqlite3_errmsg(m_d->m_dbSqlite)); sqlite3_finalize(stmt); throw errmsg; } @@ -681,7 +709,7 @@ std::vector<std::string> GMDBManager::getItemFromTableName(std::string tableName } // TODO: do we need that error check here?? // if (rc != SQLITE_DONE) { -// printf( "[SQLite ERR] 'step' (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); +// printf( "[SQLite ERR] 'step' (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); //// exit(EXIT_FAILURE); // } // finalize @@ -730,9 +758,9 @@ int GMDBManager::loadGeoNodeTypesAndBuildCache() std::string nodeType = ""; std::string tableName = ""; // prepare the query - rc = sqlite3_prepare_v2( m_dbSqlite, sql.c_str(), -1, &st, NULL); + rc = sqlite3_prepare_v2( m_d->m_dbSqlite, sql.c_str(), -1, &st, NULL); if (rc != SQLITE_OK) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } // execute the statement until all selected records are processed @@ -749,7 +777,7 @@ int GMDBManager::loadGeoNodeTypesAndBuildCache() m_cache_nodeType_tableID.insert( std::pair<std::string, unsigned int>(nodeType, id)); } if (rc != SQLITE_DONE) { - std::string errmsg(sqlite3_errmsg(m_dbSqlite)); + std::string errmsg(sqlite3_errmsg(m_d->m_dbSqlite)); sqlite3_finalize(st); throw errmsg; } @@ -781,15 +809,15 @@ std::unordered_map<std::string, unsigned int> GMDBManager::getAll_NodeTypesTable -sqlite3_stmt* GMDBManager::selectAllFromTable(std::string tableName) const +sqlite3_stmt* GMDBManager::Imp::selectAllFromTable(std::string tableName) const { return selectAllFromTableSortBy(tableName, "id"); } -sqlite3_stmt* GMDBManager::selectAllFromTableSortBy(std::string tableName, std::string sortColumn) const +sqlite3_stmt* GMDBManager::Imp::selectAllFromTableSortBy(std::string tableName, std::string sortColumn) const { - checkIsDBOpen(); + theManager->checkIsDBOpen(); if ("" == sortColumn || 0 == sortColumn.size()) { sortColumn = "id"; } @@ -807,9 +835,9 @@ sqlite3_stmt* GMDBManager::selectAllFromTableSortBy(std::string tableName, std:: } -sqlite3_stmt* GMDBManager::selectAllFromTableChildrenPositions() const +sqlite3_stmt* GMDBManager::Imp::selectAllFromTableChildrenPositions() const { - checkIsDBOpen(); + theManager->checkIsDBOpen(); sqlite3_stmt * st = nullptr; int rc = -1; //set the SQL query string @@ -856,9 +884,9 @@ void GMDBManager::getAllDBTables() std::string queryStr = "SELECT name FROM sqlite_master WHERE type ='table' AND name NOT LIKE 'sqlite_%';"; // prepare the query with the query string sqlite3_stmt *stmt; - int rc = sqlite3_prepare_v2(m_dbSqlite, queryStr.c_str(), -1, &stmt, NULL); + int rc = sqlite3_prepare_v2(m_d->m_dbSqlite, queryStr.c_str(), -1, &stmt, NULL); if (rc != SQLITE_OK) { - throw std::string(sqlite3_errmsg(m_dbSqlite)); + throw std::string(sqlite3_errmsg(m_d->m_dbSqlite)); } // execute the statement until all selected records are processed while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) { @@ -867,7 +895,7 @@ void GMDBManager::getAllDBTables() tables.push_back(tableName); } if (rc != SQLITE_DONE) { - std::string errmsg(sqlite3_errmsg(m_dbSqlite)); + std::string errmsg(sqlite3_errmsg(m_d->m_dbSqlite)); sqlite3_finalize(stmt); throw errmsg; } @@ -1211,13 +1239,13 @@ int GMDBManager::execQuery(std::string queryStr) if(m_debug) std::cout << "queryStr to execute: " << queryStr << std::endl; // debug checkIsDBOpen(); int result = -1; - if( (result = sqlite3_exec(m_dbSqlite, queryStr.c_str(), NULL, 0, &m_SQLiteErrMsg)) ) + if( (result = sqlite3_exec(m_d->m_dbSqlite, queryStr.c_str(), NULL, 0, &m_d->m_SQLiteErrMsg)) ) { printf( "[ERR] : \t> CMD: %s , Error: %d\n" , queryStr.c_str() , result ); - if ( m_SQLiteErrMsg ) + if ( m_d->m_SQLiteErrMsg ) { - printf( "[ERR] : Error msg: %s\n", m_SQLiteErrMsg ); - sqlite3_free(m_SQLiteErrMsg); + printf( "[ERR] : Error msg: %s\n", m_d->m_SQLiteErrMsg ); + sqlite3_free(m_d->m_SQLiteErrMsg); } } return result; @@ -1249,9 +1277,9 @@ void GMDBManager::storeNodeType(std::string nodeType, std::string tableName) int rc = -1; // preparing the SQL query std::string sql = "INSERT INTO GeoNodesTypes(nodeType, tableName) VALUES(?, ?)"; - rc = sqlite3_prepare_v2( m_dbSqlite, sql.c_str(), -1, &st, NULL); + rc = sqlite3_prepare_v2( m_d->m_dbSqlite, sql.c_str(), -1, &st, NULL); if (rc != SQLITE_OK) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } if(m_debug) std::cout << "storeNodeType - Query string:" << sql << std::endl; // debug @@ -1261,7 +1289,7 @@ void GMDBManager::storeNodeType(std::string nodeType, std::string tableName) // execute the query rc = sqlite3_step( st ); if (rc != SQLITE_DONE) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } // finalize @@ -1314,9 +1342,9 @@ bool GMDBManager::storeRootVolume(const unsigned int &id, const std::string &nod // preparing the SQL query sqlite3_stmt * st = nullptr; int rc = -1; - rc = sqlite3_prepare_v2( m_dbSqlite, sql.c_str(), -1, &st, NULL); + rc = sqlite3_prepare_v2( m_d->m_dbSqlite, sql.c_str(), -1, &st, NULL); if (rc != SQLITE_OK) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); // TODO: add __func__ to all error messages, as I did here + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); // TODO: add __func__ to all error messages, as I did here exit(EXIT_FAILURE); } if(m_debug) std::cout << "Query string:" << sql << std::endl; // debug @@ -1326,7 +1354,7 @@ bool GMDBManager::storeRootVolume(const unsigned int &id, const std::string &nod // execute the query rc = sqlite3_step( st ); if (rc != SQLITE_DONE) { - printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_dbSqlite) ); + printf( "[SQLite ERR] (%s) : Error msg: %s\n", __func__, sqlite3_errmsg(m_d->m_dbSqlite) ); exit(EXIT_FAILURE); } // finalize @@ -1343,7 +1371,7 @@ bool GMDBManager::storeRootVolume(const unsigned int &id, const std::string &nod std::vector<std::string> GMDBManager::getRootPhysVol() { // get the ID of the ROOT vol from the table "RootVolume" - sqlite3_stmt* stmt = selectAllFromTable("RootVolume"); + sqlite3_stmt* stmt = m_d->selectAllFromTable("RootVolume"); // declare the data we want to fetch unsigned int id; unsigned int typeId; @@ -1356,7 +1384,7 @@ std::vector<std::string> GMDBManager::getRootPhysVol() // TODO: fill a cache } if (rc != SQLITE_DONE) { - std::string errmsg(sqlite3_errmsg(m_dbSqlite)); + std::string errmsg(sqlite3_errmsg(m_d->m_dbSqlite)); sqlite3_finalize(stmt); throw errmsg; } diff --git a/GeoModelVisualization/CMakeLists.txt b/GeoModelVisualization/CMakeLists.txt index 52f5200f76f19a17f9e0d16c8b578737ef896c51..866019e355ab49027ad91381c980a0aae9d491ee 100644 --- a/GeoModelVisualization/CMakeLists.txt +++ b/GeoModelVisualization/CMakeLists.txt @@ -19,9 +19,11 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) include( configure_cpp_options ) set( CMAKE_FIND_FRAMEWORK "LAST" CACHE STRING "Framework finding behaviour on macOS" ) - # Set up how the project handle some of its dependenices. Either by picking them - # up from the environment, or building them itself. - include( SetupJSON ) + if( NOT TARGET JSONExt ) + # Set up how the project handle some of its dependenices. Either by picking them + # up from the environment, or building them itself. + include( SetupJSON ) + endif() # Find the base GeoModel packages, which must be installed on the target system already find_package( GeoModelCore REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder find_package( GeoModelIO REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder @@ -35,9 +37,6 @@ endif() # Use the GNU install directory names. include( GNUInstallDirs ) -# External dependencies. -# find_package( nlohmann_json REQUIRED ) - # Set sub-packages to build. add_subdirectory(VP1GeometryPlugin) add_subdirectory(VP1GeometrySystems) diff --git a/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt b/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt index f2d0f47a7522404aa69050a300a51a8eb36ff427..b2d42e493280228003203f52aefeda271c1d6b2e 100644 --- a/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt +++ b/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt @@ -13,7 +13,7 @@ if ( APPLE ) endif() find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) find_package(nlohmann_json QUIET) @@ -48,7 +48,7 @@ if( GEOMODEL_USE_BUILTIN_JSON ) include_directories (${install_dir}/include) endif() -target_link_libraries (GXClashPointSystems PRIVATE SoQt::SoQt Coin::Coin ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) +target_link_libraries (GXClashPointSystems PRIVATE SoQt::SoQt ${COIN3D_LIBRARIES} ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) # We link to `nlohmann_json` only if we use a version of nlohmann_json # that provides a CMake config file (i.e., either built from source, or also diff --git a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt index 863eeda04cfabb9297930d0107e28f57c33bdb69..c2a40f036de9a52ea0d97e254ccf54de2d54a62d 100644 --- a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt +++ b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt @@ -5,7 +5,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "gmex" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) if ( APPLE ) diff --git a/GeoModelVisualization/VP1Base/CMakeLists.txt b/GeoModelVisualization/VP1Base/CMakeLists.txt index ac0a616b66e8f58ccdbb872096d31d3c9a2743cf..9ef716de0a79485b18d1af2f46cb43f71b9fbf7c 100644 --- a/GeoModelVisualization/VP1Base/CMakeLists.txt +++ b/GeoModelVisualization/VP1Base/CMakeLists.txt @@ -40,7 +40,7 @@ if ( APPLE ) set( extra_libs ${OPENGL_LIBRARIES} ) target_link_directories (GXBase PUBLIC ${Coin_LIB_DIR} ) endif() -target_link_libraries (GXBase PUBLIC Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets Qt5::PrintSupport GXHEPVis SoQt::SoQt Coin::Coin ${COIN3D_LIBRARIES} ${extra_libs} ) +target_link_libraries (GXBase PUBLIC Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets Qt5::PrintSupport GXHEPVis SoQt::SoQt ${COIN3D_LIBRARIES} ${COIN3D_LIBRARIES} ${extra_libs} ) target_include_directories( GXBase PUBLIC ${COIN3D_INCLUDE_DIRS} ) diff --git a/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt b/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt index ce2ccd5cf6a7a274d441a829fc4a283e427fa951..5e11881e2140732bcef65cce5bd61f088568da8c 100644 --- a/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt +++ b/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt @@ -8,7 +8,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXGeometryPlugin" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) find_package( Qt5 COMPONENTS Core Gui Widgets Sql PrintSupport ) if( APPLE ) @@ -55,7 +55,7 @@ else() # if built as a part of GeoModel target_link_libraries( GXGeometryPlugin PUBLIC GeoModelKernel ) target_link_libraries( GXGeometryPlugin PUBLIC GeoModelRead GeoModelDBManager TFPersistification GeoGenericFunctions GeoModelKernel ) endif() -target_link_libraries (GXGeometryPlugin PUBLIC GXGeometrySystems GXGuideLineSystems GXClashPointSystems GXGui GXBase GXHEPVis SoQt::SoQt Coin::Coin Qt5::Gui Qt5::Core Qt5::Widgets Qt5::PrintSupport ) +target_link_libraries (GXGeometryPlugin PUBLIC GXGeometrySystems GXGuideLineSystems GXClashPointSystems GXGui GXBase GXHEPVis SoQt::SoQt ${COIN3D_LIBRARIES} Qt5::Gui Qt5::Core Qt5::Widgets Qt5::PrintSupport ) install(TARGETS GXGeometryPlugin LIBRARY diff --git a/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt b/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt index 41d7ff832ca57a577ce46afaec59ba7ee0594def..d8a51567c685d1448599a254d165e89199cfce1f 100644 --- a/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt +++ b/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt @@ -9,7 +9,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXGeometrySystems" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) # find_package( Eigen3 REQUIRED ) find_package(nlohmann_json QUIET) @@ -70,7 +70,7 @@ else() # if built as a part of GeoModel target_link_libraries( GXGeometrySystems PUBLIC GeoModelKernel ) target_link_libraries( GXGeometrySystems PUBLIC GeoModelRead GeoModelWrite ) endif() -target_link_libraries (GXGeometrySystems PUBLIC SoQt::SoQt Coin::Coin Qt5::Core +target_link_libraries (GXGeometrySystems PUBLIC SoQt::SoQt ${COIN3D_LIBRARIES} Qt5::Core GXGui GXBase GXHEPVis Qt5::Gui Qt5::Widgets Qt5::PrintSupport ) if ( APPLE ) target_link_directories (GXGeometrySystems PUBLIC ${Coin_LIB_DIR} ) diff --git a/GeoModelVisualization/VP1Gui/CMakeLists.txt b/GeoModelVisualization/VP1Gui/CMakeLists.txt index ead331147a20fa5d83cd2e3b012abb57666f8ed6..40b6970311b2e62b943453c3265ab506f4c63289 100644 --- a/GeoModelVisualization/VP1Gui/CMakeLists.txt +++ b/GeoModelVisualization/VP1Gui/CMakeLists.txt @@ -5,7 +5,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXGui" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) if ( APPLE ) @@ -39,7 +39,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../VP1HEPVis") include_directories ("${PROJECT_SOURCE_DIR}/../VP1Base") add_library ( GXGui SHARED ${SOURCES} ${HEADERS} ${UI_HDRS} ${UI_RESOURCES_RCC} ) -target_link_libraries (GXGui ${Qt5Core_LIBRARIES} GXBase GXHEPVis SoQt::SoQt Coin::Coin ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) +target_link_libraries (GXGui ${Qt5Core_LIBRARIES} GXBase GXHEPVis SoQt::SoQt ${COIN3D_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) install(TARGETS GXGui LIBRARY diff --git a/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt b/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt index ac7db8e5ec3b6f645863dc8671cec6eff29dfbf3..979420af877cdb245c9ff9ec5235131931df1dae 100644 --- a/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt +++ b/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt @@ -8,7 +8,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXGuideLineSystems" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( SoQt REQUIRED ) if ( APPLE ) find_package(OpenGL REQUIRED) @@ -48,7 +48,7 @@ if (${VISUALIZATION_INDIVIDUAL_BUILD}) # if built individually else() # if built as a part of GeoModel target_link_libraries( GXGuideLineSystems PUBLIC GeoModelKernel ) endif() -target_link_libraries (GXGuideLineSystems PUBLIC SoQt::SoQt Coin::Coin Qt5::Core GXGui GXBase GXHEPVis Qt5::Gui Qt5::Widgets Qt5::PrintSupport ) +target_link_libraries (GXGuideLineSystems PUBLIC SoQt::SoQt ${COIN3D_LIBRARIES} Qt5::Core GXGui GXBase GXHEPVis Qt5::Gui Qt5::Widgets Qt5::PrintSupport ) if ( APPLE ) target_link_directories (GXGuideLineSystems PUBLIC ${Coin_LIB_DIR} ) endif() diff --git a/GeoModelVisualization/VP1HEPVis/CMakeLists.txt b/GeoModelVisualization/VP1HEPVis/CMakeLists.txt index ca6e4f2080ede99d8429edd2a47ac1acc9ff9d30..3a056088778abdfdcc7a6738229516d12c6a9c23 100644 --- a/GeoModelVisualization/VP1HEPVis/CMakeLists.txt +++ b/GeoModelVisualization/VP1HEPVis/CMakeLists.txt @@ -5,7 +5,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXHEPVis" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -find_package( Coin REQUIRED ) +find_package( Coin3D REQUIRED ) find_package( OpenGL REQUIRED ) @@ -28,7 +28,7 @@ if (${VISUALIZATION_INDIVIDUAL_BUILD}) # if built individually else() # if built as a part of GeoModel target_link_libraries( GXHEPVis PUBLIC GeoModelKernel ) endif() -target_link_libraries( GXHEPVis PUBLIC Coin::Coin ) +target_link_libraries( GXHEPVis PUBLIC ${COIN3D_LIBRARIES} ) if ( APPLE ) target_link_libraries (GXHEPVis PUBLIC ${OPENGL_LIBRARIES} ) endif() diff --git a/documentation/docs/dev/index.md b/documentation/docs/dev/index.md index 295368b553d0d526e9e45f1cb1d1d094a14f2880..80dd8d274c61c3f36f0b8a6c51479be07b9f91ae 100644 --- a/documentation/docs/dev/index.md +++ b/documentation/docs/dev/index.md @@ -111,7 +111,19 @@ There are several options offered to the user to selectively build the optional ##### Build the dependencies for 3D graphics -###### Simage +###### macOS + +On macOS, you can install the needed graphics dependencies with `brew`: + +``` +brew tap atlas/geomodel https://gitlab.cern.ch/GeoModelDev/packaging/homebrew-geomodel.git +brew install simage coin-bb soqt-bb +``` + + +####### Other platforms + +######## Simage On all platforms except for Centos7, you can build Simage by follwoing these instructions: @@ -141,7 +153,7 @@ make install cd .. ``` -###### Coin3D & SoQt +######## Coin3D & SoQt Now, you should build Coin3D (the 3D graphics engine) and SoQt (the glue package between the 3D graphics engine, Coin, and the windowing system, Qt5):