← Back to team overview

kicad-developers team mailing list archive

Re: CMake installation support

 

>>
>>
>> Solution B:
>> ===========
>>
>> // Path list for KiCad data files
>> static wxString    s_KicadDataPathList[] = {
>> #ifdef __WINDOWS__
>>     wxT( "c:/kicad/share/" ),
>>     wxT( "d:/kicad/share/" ),
>>     wxT( "c:/kicad/" ),
>>     wxT( "d:/kicad/" ),
>>     wxT( "c:/Program Files/kicad/share/" ),
>>     wxT( "d:/Program Files/kicad/share/" ),
>>     wxT( "c:/Program Files/kicad/" ),
>>     wxT( "d:/Program Files/kicad/" ),
>> #else
>>     wxT( "/usr/share/kicad/" ),
>>     wxT( "/usr/local/share/kicad/" ),
>>     wxT( "/usr/local/kicad/share/" ),   // default data path for "universal
>>                                         // tarballs" and build for a server
>>                                         // (new)
>>     wxT( "/usr/local/kicad/" ),         // default data path for "universal
>>                                         // tarballs" and build for a server
>>                                         // (old)
>> #endif
>>     wxT( "end_list" )                   // End of list symbol, do not change
>> };
>>
>>
>> Scrap the above in gestfich.cpp.
>>
>> Go instead to a CMake "datapath" variable, something like CMAKE_INSTALL_PREFIX, but data
>> specific.  (Must we always assume that application code and application data are tied
>> together, please no.)  And generate the correct path from from a cmakedefine in
>> config.h.in.  Then simply hard code that path in your code now, rather than guesstimating
>> it.
> 
> This will work when installing from source and probably work well for
> developers.  The downside to this is the NSIS windows installer allows
> you to change the default install path to where ever the user chooses.
> So hard coding the path will be problematic on Windows.  The other
> option is to have the NSIS installer set KISYSMOD to the install path
> for all users. 


Indeed, you are correct on NSIS.  I think I've solved this issue optimally in my own
software products, after 30 years.

I think last minute install redirects ala NSIS are important like this.  One way to do
this is through configuration files, since if we house them at known locations, they in
turn can tell us anything.  (In my software you can pass the known location on the command
line to override a default, but this is overkill for this discussion.)  The configuration
file can tell us anything we want to listen to.


To have a meaningful conversation we have to encompass a lot more than KISYSMOD, so let me
broaden just a litte and address some needs:


a) KISYSMOD is deliberately an environment variable, because the FP LIB TABLE can handle
*any* number of environment variables, and we don't want to lose that feature.  However,
KISYSMOD is a special environment variable:  Iff not set in the environment at program
startup, just this one environment variable could be read from a configuration file
setting, which is otherwise ignored if not set in the environment already.  CMake install
and NSIS both, can establish the initial setting in the the configuration file, if that
setting is to be used in the event the setting is not in the environment at program startup.


b) Any other environment variable can be used in the two FP LIB TABLEs without us knowing
about it a priori.


c) The actual *initial* global fp lib table can be built ahead of time, with a text
editor, one copy for *all* platforms, and in theory it will be the same for any platform.
 Just assume the user has a complete install of the existing repo within our library
branch.  And you are done.

As of today, it is attached: fp_global_table
And the script to generate it at any time is also attached: make_global_table.sh


If you like a), then simply read the variable out of the config file, and we have to
augment our installers, both NSIS and CMake to set it.




> The guesstimating was for existing installations.  Since
> the library search path is already valid and is one of the entries in
> the library search list, on the surface it made sense to find the path
> with the most libraries and use that path for KISYSMOD if it wasn't
> already set.  Certainly a hard coded path would make my job a lot easier.
> 
>>
>> On the unrelated subject of CMAKE_INSTALL_PREFIX, what we have now is the possibility that
>> someone sets CMAKE_INSTALL_PREFIX into a wild blue yonder, and that the wild blue yonder
>> dir is not in the list above, not even in "end_list", although it seems everyone should
>> have an "end_list", just for good luck.   Also, the poor guy who installs on drive G: in
>> windows is hosed, of course that is another way of saying wild blue yonder.
> 
> I thought everybody installed their files in "end_list" :)  This list is
> not the complete list used to define the library search paths.  The
> executable path, several platform specific paths, and the KICAD
> environment variable and several paths relative to these paths are added
> the list of paths above at run time and then all of the paths that do no
> exist are removed from the search list.  While I agree this is less than
> optimal, we will have to keep this in order to convert existing projects
> over to the new footprint library table.

I can probably stuff an entry into the first of the table, so users can install in wild
blue yonder.  I really don't see how kicad can currently be installed on linux without
being root, and that is one of my goals in this next bit of work.


But eventually these tables have to be re-thought.  Maybe again, configuration file
entries can deal with this also.


Dick





> 
>>
>>
>> The installation system in CMake on Linux is actually at the top of my work queue now.
>> Promise.  I am one of those guys that does not benefit from linux packages, so the
>> install() statements in CMakeLists.txt have greater ramifications for me than most.  It
>> would be nice to have the notion of a datapath and a codepath.  I read about that
>> somewhere.  CMAKE_INSTALL_PREFIX can only serve one of those needs.
>>
>>
>> I have two excellent sets of patches to look over, and this should happen in the next 10
>> days.  I can give this option B some more thought at that time also, at least the
>> cmakedefine.   Your choice to use it is something for you to think about.
>>
>>
>> Dick
>>
> 
> <<<snipped>>>
> 
> 

# Global FP LIB TABLE
(fp_lib_table
 (lib (name Allegro_ACS754_ACS755_ACS756_HallCurrentSensor_RevA)(type Legacy)(uri ${KISYSMOD}/Allegro_ACS754_ACS755_ACS756_HallCurrentSensor_RevA.mod)(options "")(descr ""))
 (lib (name capacitors)(type Legacy)(uri ${KISYSMOD}/capacitors.mod)(options "")(descr ""))
 (lib (name Capacitors_SMD_RevA)(type Legacy)(uri ${KISYSMOD}/Capacitors_SMD_RevA.mod)(options "")(descr ""))
 (lib (name connect)(type Legacy)(uri ${KISYSMOD}/connect.mod)(options "")(descr ""))
 (lib (name connectors_molex_serial_53047-A123)(type Legacy)(uri ${KISYSMOD}/connectors_molex_serial_53047-A123.mod)(options "")(descr ""))
 (lib (name Crystals_RevB_20Apr2013)(type Legacy)(uri ${KISYSMOD}/Crystals_RevB_20Apr2013.mod)(options "")(descr ""))
 (lib (name DCDC-ACDC-Converter_RevC_20Jul2012)(type Legacy)(uri ${KISYSMOD}/DCDC-ACDC-Converter_RevC_20Jul2012.mod)(options "")(descr ""))
 (lib (name Dioden_SMD_RevA_31May2013)(type Legacy)(uri ${KISYSMOD}/Dioden_SMD_RevA_31May2013.mod)(options "")(descr ""))
 (lib (name Dioden_ThroughHole_RevC)(type Legacy)(uri ${KISYSMOD}/Dioden_ThroughHole_RevC.mod)(options "")(descr ""))
 (lib (name dip_sockets)(type Legacy)(uri ${KISYSMOD}/dip_sockets.mod)(options "")(descr ""))
 (lib (name discret)(type Legacy)(uri ${KISYSMOD}/discret.mod)(options "")(descr ""))
 (lib (name display)(type Legacy)(uri ${KISYSMOD}/display.mod)(options "")(descr ""))
 (lib (name divers)(type Legacy)(uri ${KISYSMOD}/divers.mod)(options "")(descr ""))
 (lib (name Elko_ThroughHole_RevB-3_30Dec2011)(type Legacy)(uri ${KISYSMOD}/Elko_ThroughHole_RevB-3_30Dec2011.mod)(options "")(descr ""))
 (lib (name EuroBoardoutline_RevC)(type Legacy)(uri ${KISYSMOD}/EuroBoardoutline_RevC.mod)(options "")(descr ""))
 (lib (name Fiducials_RevC_04Aug2012)(type Legacy)(uri ${KISYSMOD}/Fiducials_RevC_04Aug2012.mod)(options "")(descr ""))
 (lib (name Footprint-Symbols_RevD_28Aug2012)(type Legacy)(uri ${KISYSMOD}/Footprint-Symbols_RevD_28Aug2012.mod)(options "")(descr ""))
 (lib (name FuseholderAndFuses_RevD_28Aug2012)(type Legacy)(uri ${KISYSMOD}/FuseholderAndFuses_RevD_28Aug2012.mod)(options "")(descr ""))
 (lib (name Heatsinks_RevC)(type Legacy)(uri ${KISYSMOD}/Heatsinks_RevC.mod)(options "")(descr ""))
 (lib (name inductors)(type Legacy)(uri ${KISYSMOD}/inductors.mod)(options "")(descr ""))
 (lib (name IR-directFET_Packages_RevB)(type Legacy)(uri ${KISYSMOD}/IR-directFET_Packages_RevB.mod)(options "")(descr ""))
 (lib (name iut)(type Legacy)(uri ${KISYSMOD}/iut.mod)(options "")(descr ""))
 (lib (name Label_RevA_21Mar2011)(type Legacy)(uri ${KISYSMOD}/Label_RevA_21Mar2011.mod)(options "")(descr ""))
 (lib (name led)(type Legacy)(uri ${KISYSMOD}/led.mod)(options "")(descr ""))
 (lib (name libcms)(type Legacy)(uri ${KISYSMOD}/libcms.mod)(options "")(descr ""))
 (lib (name Measurement_Point_RevA)(type Legacy)(uri ${KISYSMOD}/Measurement_Point_RevA.mod)(options "")(descr ""))
 (lib (name Measurement-Scala_RevA)(type Legacy)(uri ${KISYSMOD}/Measurement-Scala_RevA.mod)(options "")(descr ""))
 (lib (name Mechanical_Socket-Plug_DIN41612-Stuff_RevA)(type Legacy)(uri ${KISYSMOD}/Mechanical_Socket-Plug_DIN41612-Stuff_RevA.mod)(options "")(descr ""))
 (lib (name MiniUniversalMate-N-LokSockets_13Aug2012)(type Legacy)(uri ${KISYSMOD}/MiniUniversalMate-N-LokSockets_13Aug2012.mod)(options "")(descr ""))
 (lib (name MountingHole_RevA)(type Legacy)(uri ${KISYSMOD}/MountingHole_RevA.mod)(options "")(descr ""))
 (lib (name muonde)(type Legacy)(uri ${KISYSMOD}/muonde.mod)(options "")(descr ""))
 (lib (name Neosid_Air-Coil_SML_HAMxx31A_HDMxx31A_RevA_25Apr2012)(type Legacy)(uri ${KISYSMOD}/Neosid_Air-Coil_SML_HAMxx31A_HDMxx31A_RevA_25Apr2012.mod)(options "")(descr ""))
 (lib (name Neosid_Filter_HF-Coil_25Apr2012)(type Legacy)(uri ${KISYSMOD}/Neosid_Filter_HF-Coil_25Apr2012.mod)(options "")(descr ""))
 (lib (name Neosid_Inductor_21Apr2012)(type Legacy)(uri ${KISYSMOD}/Neosid_Inductor_21Apr2012.mod)(options "")(descr ""))
 (lib (name NF-Transformer_ETAL_RevA_28Aug2012)(type Legacy)(uri ${KISYSMOD}/NF-Transformer_ETAL_RevA_28Aug2012.mod)(options "")(descr ""))
 (lib (name Oddities_RevA_10Mar2011)(type Legacy)(uri ${KISYSMOD}/Oddities_RevA_10Mar2011.mod)(options "")(descr ""))
 (lib (name Opto-Devices_RevC_03Oct2012)(type Legacy)(uri ${KISYSMOD}/Opto-Devices_RevC_03Oct2012.mod)(options "")(descr ""))
 (lib (name Oscillator-Modul_RevA)(type Legacy)(uri ${KISYSMOD}/Oscillator-Modul_RevA.mod)(options "")(descr ""))
 (lib (name Pentawatt_RevB_30Apr2011)(type Legacy)(uri ${KISYSMOD}/Pentawatt_RevB_30Apr2011.mod)(options "")(descr ""))
 (lib (name pga_sockets)(type Legacy)(uri ${KISYSMOD}/pga_sockets.mod)(options "")(descr ""))
 (lib (name pin_array)(type Legacy)(uri ${KISYSMOD}/pin_array.mod)(options "")(descr ""))
 (lib (name Potentiometer_RevB_02Aug2010)(type Legacy)(uri ${KISYSMOD}/Potentiometer_RevB_02Aug2010.mod)(options "")(descr ""))
 (lib (name powerint)(type Legacy)(uri ${KISYSMOD}/powerint.mod)(options "")(descr ""))
 (lib (name Printtrafo_CHK_RevA_04Aug2010)(type Legacy)(uri ${KISYSMOD}/Printtrafo_CHK_RevA_04Aug2010.mod)(options "")(descr ""))
 (lib (name Relay_ThroughHole_RevB)(type Legacy)(uri ${KISYSMOD}/Relay_ThroughHole_RevB.mod)(options "")(descr ""))
 (lib (name Resistor_SMD_RevA)(type Legacy)(uri ${KISYSMOD}/Resistor_SMD_RevA.mod)(options "")(descr ""))
 (lib (name Resistor_ThroughHole_RevB_22Apr2011)(type Legacy)(uri ${KISYSMOD}/Resistor_ThroughHole_RevB_22Apr2011.mod)(options "")(descr ""))
 (lib (name Resistor_Universal-Experimental_RevA)(type Legacy)(uri ${KISYSMOD}/Resistor_Universal-Experimental_RevA.mod)(options "")(descr ""))
 (lib (name SI570_SI571_Oscillator_RevA_11Jun2012)(type Legacy)(uri ${KISYSMOD}/SI570_SI571_Oscillator_RevA_11Jun2012.mod)(options "")(descr ""))
 (lib (name SIP9_Housing_14Jun2013)(type Legacy)(uri ${KISYSMOD}/SIP9_Housing_14Jun2013.mod)(options "")(descr ""))
 (lib (name smd_capacitors)(type Legacy)(uri ${KISYSMOD}/smd_capacitors.mod)(options "")(descr ""))
 (lib (name smd_crystal&oscillator)(type Legacy)(uri ${KISYSMOD}/smd_crystal&oscillator.mod)(options "")(descr ""))
 (lib (name smd_resistors)(type Legacy)(uri ${KISYSMOD}/smd_resistors.mod)(options "")(descr ""))
 (lib (name smd_soic_packages)(type Legacy)(uri ${KISYSMOD}/smd_soic_packages.mod)(options "")(descr ""))
 (lib (name smd_ssop_packages)(type Legacy)(uri ${KISYSMOD}/smd_ssop_packages.mod)(options "")(descr ""))
 (lib (name smd_transistors)(type Legacy)(uri ${KISYSMOD}/smd_transistors.mod)(options "")(descr ""))
 (lib (name Socket_MOLEX-KK-System)(type Legacy)(uri ${KISYSMOD}/Socket_MOLEX-KK-System.mod)(options "")(descr ""))
 (lib (name sockets)(type Legacy)(uri ${KISYSMOD}/sockets.mod)(options "")(descr ""))
 (lib (name Socket_WAGO734_RevA)(type Legacy)(uri ${KISYSMOD}/Socket_WAGO734_RevA.mod)(options "")(descr ""))
 (lib (name SOT126_SOT32_Housings_RevA_22Oct2012)(type Legacy)(uri ${KISYSMOD}/SOT126_SOT32_Housings_RevA_22Oct2012.mod)(options "")(descr ""))
 (lib (name SOT23_SOT143_SOT143R_TSOT6_MK06A_SC70-6_Housing_26Jul2012)(type Legacy)(uri ${KISYSMOD}/SOT23_SOT143_SOT143R_TSOT6_MK06A_SC70-6_Housing_26Jul2012.mod)(options "")(descr ""))
 (lib (name SOT89-3_SOT89-5_Housing_RevA_02Sep2012)(type Legacy)(uri ${KISYSMOD}/SOT89-3_SOT89-5_Housing_RevA_02Sep2012.mod)(options "")(descr ""))
 (lib (name TerminalBlock_WAGO236-RM5mm_RevA2-cache)(type Legacy)(uri ${KISYSMOD}/TerminalBlock_WAGO236-RM5mm_RevA2-cache.mod)(options "")(descr ""))
 (lib (name TO-50_Housings_RevA_21Apr2013)(type Legacy)(uri ${KISYSMOD}/TO-50_Housings_RevA_21Apr2013.mod)(options "")(descr ""))
 (lib (name TO-78_Housing_RevA_04Jun2013)(type Legacy)(uri ${KISYSMOD}/TO-78_Housing_RevA_04Jun2013.mod)(options "")(descr ""))
 (lib (name TO-92_Housings_06Jun2013)(type Legacy)(uri ${KISYSMOD}/TO-92_Housings_06Jun2013.mod)(options "")(descr ""))
 (lib (name TransformerSMPS_ThroughHole_RevA)(type Legacy)(uri ${KISYSMOD}/TransformerSMPS_ThroughHole_RevA.mod)(options "")(descr ""))
 (lib (name Transistor_TO-220_RevB_03Sep2012)(type Legacy)(uri ${KISYSMOD}/Transistor_TO-220_RevB_03Sep2012.mod)(options "")(descr ""))
 (lib (name Transistor_TO-247_RevC)(type Legacy)(uri ${KISYSMOD}/Transistor_TO-247_RevC.mod)(options "")(descr ""))
 (lib (name valves)(type Legacy)(uri ${KISYSMOD}/valves.mod)(options "")(descr ""))
 (lib (name VML0806_Housing_Rohm_RevA_26Oct2012)(type Legacy)(uri ${KISYSMOD}/VML0806_Housing_Rohm_RevA_26Oct2012.mod)(options "")(descr ""))
 (lib (name WireConnections-Bridges_RevA)(type Legacy)(uri ${KISYSMOD}/WireConnections-Bridges_RevA.mod)(options "")(descr ""))
 (lib (name WirePads_RevA_15Jun2010)(type Legacy)(uri ${KISYSMOD}/WirePads_RevA_15Jun2010.mod)(options "")(descr ""))
)

Attachment: make_global_table.sh
Description: Bourne shell script


Follow ups

References