Commit 4274f2d5 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Fix config.h default data install path assignment during configuration.

* Remove redundant definition of KICAD_DATA_PATH since DEFAULT_INSTALL_PATH
  was already defined.
* Use DEFAULT_INSTALL_PATH as the substitution for the default environment
  variable paths.
* Add option to define DEFAULT_INSTALL_PATH during CMake configuration with
  fall back to CMAKE_INSTALL_PREFIX if not not defined.
* Developer note: this change is primarily for package builders where
  CMAKE_INSTALL_PATH is the path where the package builder temporarily
  installs the build output before creating the package.  When building
  packages, DEFAULT_INSTALL_PATH should be set to the path where the
  package will be installed by default.
parent 0d77a860
...@@ -94,7 +94,7 @@ set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this bu ...@@ -94,7 +94,7 @@ set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this bu
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." ) CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
#Add option to add user directories for linker, if any # Add option to add user directories for linker, if any
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} ) LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
if( UNIX ) if( UNIX )
...@@ -104,6 +104,16 @@ elseif( MINGW ) ...@@ -104,6 +104,16 @@ elseif( MINGW )
endif() endif()
mark_as_advanced( KICAD_USER_CONFIG_DIR ) mark_as_advanced( KICAD_USER_CONFIG_DIR )
# Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
# CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
# used in the source code to define the base path for kicad search paths and environment
# variables.
if( NOT DEFAULT_INSTALL_PATH )
set( DEFAULT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
CACHE
PATH
"Location of KiCad data files." )
endif()
#================================================ #================================================
# Set flags for GCC, or treat llvm as GCC # Set flags for GCC, or treat llvm as GCC
......
...@@ -58,17 +58,8 @@ ...@@ -58,17 +58,8 @@
/// The legacy file format revision of the *.brd file created by this build /// The legacy file format revision of the *.brd file created by this build
#define LEGACY_BOARD_FILE_VERSION 2 #define LEGACY_BOARD_FILE_VERSION 2
/// The install prefix defined in CMAKE_INSTALL_PREFIX. /// The install prefix defined during CMake configuration or fall back to CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@" #define DEFAULT_INSTALL_PATH "@DEFAULT_INSTALL_PATH@"
/// The install prefix used for KiCad's libraries.
/// These paths are only intended to be reasonable default values that work if
/// the user installs KiCad in the default path for a given platform.
#if defined( __APPLE__ )
#define KICAD_DATA_PATH "/Library/Application Support/kicad"
#else
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
#endif
/// The wxPython version found during configuration. /// The wxPython version found during configuration.
#if defined( KICAD_SCRIPTING_WXPYTHON ) #if defined( KICAD_SCRIPTING_WXPYTHON )
......
...@@ -423,7 +423,7 @@ bool PGM_BASE::initPgm() ...@@ -423,7 +423,7 @@ bool PGM_BASE::initPgm()
m_local_env_vars[ envVarName ] = envVarItem; m_local_env_vars[ envVarName ] = envVarItem;
wxFileName tmpFileName; wxFileName tmpFileName;
tmpFileName.AssignDir( wxString( wxT( KICAD_DATA_PATH ) ) ); tmpFileName.AssignDir( wxString( wxT( DEFAULT_INSTALL_PATH ) ) );
tmpFileName.AppendDir( wxT( "modules" ) ); tmpFileName.AppendDir( wxT( "modules" ) );
envVarName = wxT( "KISYSMOD" ); envVarName = wxT( "KISYSMOD" );
envVarItem.SetValue( tmpFileName.GetPath() ); envVarItem.SetValue( tmpFileName.GetPath() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment