1111class VolumeViewer (ConanFile ):
1212 """Class to package the plugin using conan
1313
14- Packages both RELEASE and DEBUG .
15- Uses rules_support (github.com/hdps /rulessupport) to derive
14+ Packages both RELEASE and RELWITHDEBINFO .
15+ Uses rules_support (github.com/ManiVaultStudio /rulessupport) to derive
1616 versioninfo based on the branch naming convention
1717 as described in https://github.com/ManiVaultStudio/core/wiki/Branch-naming-rules
1818 """
@@ -42,10 +42,13 @@ class VolumeViewer(ConanFile):
4242 }
4343
4444 def __get_git_path (self ):
45- path = load (
46- pathlib .Path (pathlib .Path (__file__ ).parent .resolve (), "__gitpath.txt" )
47- )
48- print (f"git info from { path } " )
45+ if pathlib .Path (".git" ).exists ():
46+ path = pathlib .Path .cwd ()
47+ else :
48+ path = load (
49+ pathlib .Path (pathlib .Path (__file__ ).parent .resolve (), "__gitpath.txt" )
50+ )
51+ print (f"Loaded path { path } " )
4952 return path
5053
5154 def export (self ):
@@ -84,25 +87,26 @@ def generate(self):
8487 generator = "Xcode"
8588 if self .settings .os == "Linux" :
8689 generator = "Ninja Multi-Config"
90+
91+ tc = CMakeToolchain (self , generator = generator )
92+
93+ tc .variables ["CMAKE_CXX_STANDARD_REQUIRED" ] = "ON"
94+
8795 # Use the Qt provided .cmake files
88- qtpath = pathlib .Path (self .deps_cpp_info ["qt" ].rootpath )
89- qt_root = str (list (qtpath .glob ("**/Qt6Config.cmake" ))[0 ].parents [3 ].as_posix ())
96+ qt_path = pathlib .Path (self .deps_cpp_info ["qt" ].rootpath )
97+ qt_cfg = list (qt_path .glob ("**/Qt6Config.cmake" ))[0 ]
98+ qt_dir = qt_cfg .parents [0 ].as_posix ()
9099
91- tc = CMakeToolchain (self , generator = generator )
92- if self .settings .os == "Windows" and self .options .shared :
93- tc .variables ["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS" ] = True
94- if self .settings .os == "Linux" or self .settings .os == "Macos" :
95- tc .variables ["CMAKE_CXX_STANDARD_REQUIRED" ] = "ON"
96- tc .variables ["CMAKE_PREFIX_PATH" ] = qt_root
100+ tc .variables ["Qt6_DIR" ] = qt_dir
97101
98- # Set the installation directory for ManiVault based on the MV_INSTALL_DIR environment variable
99- # or if none is specified, set it to the build/install dir.
100- if not os . environ . get ( "MV_INSTALL_DIR " , None ):
101- os . environ [ "MV_INSTALL_DIR" ] = os . path . join ( self . build_folder , "install" )
102- print ( "MV_INSTALL_DIR: " , os . environ [ "MV_INSTALL_DIR" ])
103- self . install_dir = pathlib . Path ( os . environ [ "MV_INSTALL_DIR" ]). as_posix ()
104- # Give the installation directory to CMake
105- tc .variables ["MV_INSTALL_DIR " ] = self . install_dir
102+ # Use the ManiVault .cmake file to find ManiVault with find_package
103+ mv_core_root = self . deps_cpp_info [ "hdps-core" ]. rootpath
104+ manivault_dir = pathlib . Path ( mv_core_root , "cmake " , "mv" ). as_posix ()
105+ print ( "ManiVault_DIR: " , manivault_dir )
106+ tc . variables [ "ManiVault_DIR" ] = manivault_dir
107+
108+ # Set some build options
109+ tc .variables ["MV_UNITY_BUILD " ] = "ON"
106110
107111 tc .generate ()
108112
@@ -113,33 +117,26 @@ def _configure_cmake(self):
113117 return cmake
114118
115119 def build (self ):
116- print ("Build OS is : " , self .settings .os )
117-
118- # The BinNIO plugins expect the HDPS package to be in this install dir
119- hdps_pkg_root = self .deps_cpp_info ["hdps-core" ].rootpath
120- print ("Install dir type: " , self .install_dir )
121- shutil .copytree (hdps_pkg_root , self .install_dir )
120+ print ("Build OS is: " , self .settings .os )
122121
123122 cmake = self ._configure_cmake ()
124- cmake .build (build_type = "Debug" )
125- cmake .install (build_type = "Debug" )
126-
127- # cmake_release = self._configure_cmake()
123+ cmake .build (build_type = "RelWithDebInfo" )
128124 cmake .build (build_type = "Release" )
129- cmake .install (build_type = "Release" )
130125
131126 def package (self ):
132- package_dir = os .path .join (self .build_folder , "package" )
127+ package_dir = pathlib .Path (self .build_folder , "package" )
128+ relWithDebInfo_dir = package_dir / "RelWithDebInfo"
129+ release_dir = package_dir / "Release"
133130 print ("Packaging install dir: " , package_dir )
134131 subprocess .run (
135132 [
136133 "cmake" ,
137134 "--install" ,
138135 self .build_folder ,
139136 "--config" ,
140- "Debug " ,
137+ "RelWithDebInfo " ,
141138 "--prefix" ,
142- os . path . join ( package_dir , "Debug" ) ,
139+ relWithDebInfo_dir ,
143140 ]
144141 )
145142 subprocess .run (
@@ -150,19 +147,15 @@ def package(self):
150147 "--config" ,
151148 "Release" ,
152149 "--prefix" ,
153- os . path . join ( package_dir , "Release" ) ,
150+ release_dir ,
154151 ]
155152 )
156153 self .copy (pattern = "*" , src = package_dir )
157- # Add the debug support files to the package
158- # (*.pdb) if building the Visual Studio version
159- if self .settings .compiler == "Visual Studio" :
160- self .copy ("*.pdb" , dst = "Debug/Plugins" , keep_path = False )
161154
162155 def package_info (self ):
163- self .cpp_info .debug .libdirs = ["Debug /lib" ]
164- self .cpp_info .debug .bindirs = ["Debug /Plugins" , "Debug " ]
165- self .cpp_info .debug .includedirs = ["Debug /include" , "Debug " ]
156+ self .cpp_info .relwithdebinfo .libdirs = ["RelWithDebInfo /lib" ]
157+ self .cpp_info .relwithdebinfo .bindirs = ["RelWithDebInfo /Plugins" , "RelWithDebInfo " ]
158+ self .cpp_info .relwithdebinfo .includedirs = ["RelWithDebInfo /include" , "RelWithDebInfo " ]
166159 self .cpp_info .release .libdirs = ["Release/lib" ]
167160 self .cpp_info .release .bindirs = ["Release/Plugins" , "Release" ]
168161 self .cpp_info .release .includedirs = ["Release/include" , "Release" ]
0 commit comments