2008-03-11 15:57:54 +00:00
|
|
|
project(kicad)
|
2008-01-06 21:56:45 +00:00
|
|
|
|
2011-06-17 13:24:22 +00:00
|
|
|
# The minimum CMake version requirement could be different under unix, OSX, or Windows
|
2008-09-07 19:32:07 +00:00
|
|
|
if(WIN32)
|
2011-06-17 13:24:22 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) # win32 and win64
|
|
|
|
elseif(APPLE)
|
|
|
|
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) # OSX
|
2013-02-14 13:12:54 +00:00
|
|
|
else()
|
2011-06-17 13:24:22 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) # Linux, Unix, and everything else.
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2008-01-06 21:56:45 +00:00
|
|
|
|
2008-03-31 01:32:15 +00:00
|
|
|
# Path to local CMake modules.
|
2008-03-11 15:57:54 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
2007-11-08 07:17:37 +00:00
|
|
|
|
2011-10-05 18:26:22 +00:00
|
|
|
#
|
2011-10-07 14:41:30 +00:00
|
|
|
# KiCad build options should be added below.
|
2011-10-05 18:26:22 +00:00
|
|
|
#
|
|
|
|
# If you add a new build option, please add it's state to the CopyVersionInfoToClipboard()
|
2012-10-16 01:42:50 +00:00
|
|
|
# function in common/basicframe.cpp so that build option settings can be included in bug
|
2011-10-05 18:26:22 +00:00
|
|
|
# reports.
|
|
|
|
#
|
|
|
|
|
2012-04-01 20:51:56 +00:00
|
|
|
option(USE_PCBNEW_NANOMETRES
|
2013-02-14 13:12:54 +00:00
|
|
|
"Use nanometers for Pcbnew internal units instead of deci-mils (default ON)." ON)
|
2011-12-07 05:28:49 +00:00
|
|
|
|
2010-02-02 07:18:40 +00:00
|
|
|
# Russian GOST patch
|
2008-11-05 11:41:15 +00:00
|
|
|
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
|
2009-05-05 17:32:07 +00:00
|
|
|
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
|
2008-11-05 11:41:15 +00:00
|
|
|
|
2010-10-22 15:02:11 +00:00
|
|
|
#for those who bored with uppercase
|
|
|
|
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected")
|
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
option(USE_WX_GRAPHICS_CONTEXT
|
2013-02-14 13:12:54 +00:00
|
|
|
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2010-10-09 08:08:29 +00:00
|
|
|
option(USE_WX_OVERLAY
|
2013-02-14 13:12:54 +00:00
|
|
|
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental")
|
2010-10-09 08:08:29 +00:00
|
|
|
|
2011-04-09 18:53:39 +00:00
|
|
|
#One of these 2 option *must* be set to ON:
|
|
|
|
option(KICAD_STABLE_VERSION
|
2013-02-14 13:12:54 +00:00
|
|
|
"set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)"
|
|
|
|
)
|
2011-04-09 18:53:39 +00:00
|
|
|
|
|
|
|
option(KICAD_TESTING_VERSION
|
2013-04-03 16:16:26 +00:00
|
|
|
"set this option to ON to build the testing version of KICAD. mainly used to set version ID (default OFF)"
|
2013-02-14 13:12:54 +00:00
|
|
|
)
|
2011-04-09 18:53:39 +00:00
|
|
|
|
2012-03-17 15:17:13 +00:00
|
|
|
option(KICAD_SCRIPTING
|
2013-02-14 13:12:54 +00:00
|
|
|
"set this option ON to build the scripting support inside kicad binaries"
|
|
|
|
)
|
2012-03-17 15:17:13 +00:00
|
|
|
|
|
|
|
option(KICAD_SCRIPTING_MODULES
|
2013-02-14 13:12:54 +00:00
|
|
|
"set this option ON to build kicad modules that can be used from scripting languages"
|
|
|
|
)
|
2012-08-04 11:47:24 +00:00
|
|
|
|
2012-08-02 17:24:53 +00:00
|
|
|
option(KICAD_SCRIPTING_WXPYTHON
|
2013-02-14 13:12:54 +00:00
|
|
|
"set this option ON to build wxpython implementation for wx interface building in python and py.shell"
|
|
|
|
)
|
2012-08-04 11:47:24 +00:00
|
|
|
|
2012-09-30 17:50:17 +00:00
|
|
|
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
|
|
|
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
|
|
|
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
|
|
|
# when not defined by user, the default is python.exe under Windows and python2 for others
|
2013-02-11 00:41:49 +00:00
|
|
|
# python binary file should be is exec path.
|
2012-09-30 17:50:17 +00:00
|
|
|
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2013-02-23 19:30:43 +00:00
|
|
|
option(USE_FP_LIB_TABLE "Use the new footprint library table implementation. (default OFF)")
|
|
|
|
|
2011-04-09 18:53:39 +00:00
|
|
|
#Set version option (stable or testing)
|
|
|
|
|
2013-02-11 00:41:49 +00:00
|
|
|
if(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION )
|
|
|
|
message(FATAL_ERROR "Only one KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION can be set to ON")
|
2013-02-27 07:19:42 +00:00
|
|
|
elseif(NOT KICAD_STABLE_VERSION AND NOT KICAD_TESTING_VERSION)
|
2013-02-11 00:41:49 +00:00
|
|
|
message(FATAL_ERROR "Either KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be set to ON")
|
2013-02-27 07:19:42 +00:00
|
|
|
elseif(KICAD_STABLE_VERSION)
|
2011-04-09 18:53:39 +00:00
|
|
|
add_definitions(-DKICAD_STABLE_VERSION)
|
2013-02-11 00:41:49 +00:00
|
|
|
message( "Build stable version of KiCad")
|
2013-02-14 13:12:54 +00:00
|
|
|
else()
|
2013-02-11 00:41:49 +00:00
|
|
|
add_definitions(-DKICAD_TESTING_VERSION)
|
|
|
|
message("Build testing (unstable) version of KiCad")
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2011-04-09 18:53:39 +00:00
|
|
|
|
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
2008-03-31 01:32:15 +00:00
|
|
|
# Set flags for GCC.
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
|
|
|
|
2008-03-11 15:57:54 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2013-02-14 13:12:54 +00:00
|
|
|
|
2012-10-16 01:42:50 +00:00
|
|
|
set(KICAD_GCC_RELEASE_BUILD_FLAGS "-O2")
|
|
|
|
set(KICAD_GCC_RELEASE_DEBUG_FLAGS "")
|
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
|
|
|
OUTPUT_VARIABLE GCC_VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
2012-10-07 15:37:25 +00:00
|
|
|
# Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when
|
|
|
|
# compiling with GCC 4.7. This appears to be caused by and int to unsigned
|
|
|
|
# conversion in the Boost polygon library. At some point in the future when
|
|
|
|
# Boost is updated to the next version, -Wno-narrowing should be removed to
|
|
|
|
# see if the problem has been resolved. Wayne.
|
2012-10-14 16:57:11 +00:00
|
|
|
#
|
|
|
|
# Also note the optimization level is -O1 instead of the usual -O2 level
|
|
|
|
# because boost::polygon has a function (inflate polygon) broken by
|
|
|
|
# the -O2 level with GCC 4.7 (works fine with with GCC 4.6).
|
|
|
|
# This lower optimization level does not have a significant change on the speed.
|
|
|
|
#
|
2012-10-16 01:42:50 +00:00
|
|
|
# As newer versions of GCC and/or Boost are released, this code needs reviewed to
|
|
|
|
# determine if the problems above have been fixed either in Boost or GCC.
|
|
|
|
if(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
|
|
|
|
set(KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1")
|
|
|
|
set(KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
message(STATUS
|
2013-02-14 13:12:54 +00:00
|
|
|
"Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"")
|
|
|
|
else()
|
2012-10-16 01:42:50 +00:00
|
|
|
message(STATUS
|
2013-02-14 13:12:54 +00:00
|
|
|
"Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"")
|
|
|
|
endif()
|
2012-10-16 01:42:50 +00:00
|
|
|
|
2013-02-14 15:31:56 +00:00
|
|
|
if(MINGW)
|
|
|
|
# According to some sources, under Windows -fPIC option is not needed:
|
|
|
|
# http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html
|
|
|
|
|
2012-07-16 14:48:51 +00:00
|
|
|
# Set default flags for Release build.
|
2012-10-16 01:42:50 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG")
|
2013-01-24 18:46:42 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++")
|
2012-07-16 14:48:51 +00:00
|
|
|
|
|
|
|
# Set default flags for Debug build.
|
2012-10-16 01:42:50 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG")
|
2013-01-24 18:46:42 +00:00
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows
|
2013-01-04 23:02:10 +00:00
|
|
|
|
2013-02-14 13:12:54 +00:00
|
|
|
else()
|
2013-02-14 15:31:56 +00:00
|
|
|
# We build DLL/DSOs from static libraries, so create position independent code
|
|
|
|
# for all cases, since we do not have DLL/DSO specific static libraries.
|
|
|
|
# This flag could be localized to any object file going into a DLL/DSO in the future.
|
|
|
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
|
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
|
|
|
|
|
2013-01-04 23:02:10 +00:00
|
|
|
# Thou shalt not link vaporware and tell us it's a valid DSO:
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined") # needed by SWIG macros on linux
|
|
|
|
|
2012-07-16 14:48:51 +00:00
|
|
|
# Set default flags for Release build.
|
2013-02-14 13:12:54 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG")
|
2012-07-16 14:48:51 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
|
|
|
|
|
|
|
|
# Set default flags for Debug build.
|
2013-02-14 13:12:54 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG")
|
|
|
|
endif()
|
2011-09-10 17:48:35 +00:00
|
|
|
|
2008-03-11 15:57:54 +00:00
|
|
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
2007-11-08 07:17:37 +00:00
|
|
|
|
2008-11-05 11:41:15 +00:00
|
|
|
if(wxUSE_UNICODE)
|
|
|
|
add_definitions(-DwxUSE_UNICODE)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2008-11-05 11:41:15 +00:00
|
|
|
|
|
|
|
if(KICAD_GOST)
|
|
|
|
add_definitions(-DKICAD_GOST)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2008-11-05 11:41:15 +00:00
|
|
|
|
2010-10-22 15:02:11 +00:00
|
|
|
if(KICAD_KEEPCASE)
|
|
|
|
add_definitions(-DKICAD_KEEPCASE)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2010-10-22 15:02:11 +00:00
|
|
|
|
2010-10-09 08:08:29 +00:00
|
|
|
if(USE_WX_OVERLAY OR APPLE)
|
|
|
|
add_definitions(-DUSE_WX_OVERLAY)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2010-10-09 08:08:29 +00:00
|
|
|
|
2012-07-22 12:15:38 +00:00
|
|
|
if(KICAD_SCRIPTING)
|
|
|
|
add_definitions(-DKICAD_SCRIPTING)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2012-07-22 12:15:38 +00:00
|
|
|
|
|
|
|
if(KICAD_SCRIPTING_MODULES)
|
|
|
|
add_definitions(-DKICAD_SCRIPTING_MODULES)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2012-08-01 11:54:20 +00:00
|
|
|
|
2012-08-02 17:24:53 +00:00
|
|
|
if(KICAD_SCRIPTING_WXPYTHON)
|
|
|
|
add_definitions(-DKICAD_SCRIPTING_WXPYTHON)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2010-10-09 08:08:29 +00:00
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
if(USE_WX_GRAPHICS_CONTEXT)
|
|
|
|
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
# Allow user to override the default settings for adding images to menu items. By default
|
2012-10-16 01:42:50 +00:00
|
|
|
# images in menu items are enabled on all platforms except OSX. This can be over ridden by
|
2011-08-29 19:50:05 +00:00
|
|
|
# defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior.
|
|
|
|
if(NOT DEFINED USE_IMAGES_IN_MENUS)
|
|
|
|
if(NOT APPLE)
|
|
|
|
set(USE_IMAGES_IN_MENUS ON)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2011-08-29 19:50:05 +00:00
|
|
|
if(USE_IMAGES_IN_MENUS)
|
|
|
|
set(USE_IMAGES_IN_MENUS ON)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2007-12-25 20:48:58 +00:00
|
|
|
# Locations for install targets.
|
2008-08-11 11:45:29 +00:00
|
|
|
set(KICAD_BIN bin
|
|
|
|
CACHE PATH "Location of KiCad binaries.")
|
2008-03-05 07:16:43 +00:00
|
|
|
|
2008-03-11 15:57:54 +00:00
|
|
|
if(UNIX)
|
2008-06-15 16:31:32 +00:00
|
|
|
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
2008-08-11 11:45:29 +00:00
|
|
|
set(KICAD_PLUGINS lib/kicad/plugins
|
|
|
|
CACHE PATH "Location of KiCad plugins.")
|
|
|
|
set(KICAD_DATA share/kicad
|
|
|
|
CACHE PATH "Location of KiCad data files.")
|
|
|
|
set(KICAD_DOCS share/doc/kicad
|
|
|
|
CACHE PATH "Location of KiCad documentation files.")
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2007-11-08 12:46:02 +00:00
|
|
|
|
2013-02-14 13:12:54 +00:00
|
|
|
if(MINGW)
|
2008-01-30 09:42:19 +00:00
|
|
|
# Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
|
2008-09-07 19:32:07 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX c:/kicad
|
|
|
|
CACHE PATH "")
|
2008-03-31 01:32:15 +00:00
|
|
|
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
2008-09-07 19:32:07 +00:00
|
|
|
set(KICAD_PLUGINS ${KICAD_BIN}/plugins
|
|
|
|
CACHE PATH "Location of KiCad plugins.")
|
|
|
|
set(KICAD_DATA share
|
|
|
|
CACHE PATH "Location of KiCad data files.")
|
|
|
|
set(KICAD_DOCS doc
|
|
|
|
CACHE PATH "Location of KiCad documentation files.")
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2008-03-11 15:57:54 +00:00
|
|
|
|
2008-09-07 19:32:07 +00:00
|
|
|
set(KICAD_DEMOS ${KICAD_DATA}/demos
|
2008-08-11 11:45:29 +00:00
|
|
|
CACHE PATH "Location of KiCad demo files.")
|
|
|
|
set(KICAD_TEMPLATE ${KICAD_DATA}/template
|
|
|
|
CACHE PATH "Location of KiCad template files.")
|
|
|
|
|
2008-09-07 19:32:07 +00:00
|
|
|
mark_as_advanced(KICAD_BIN
|
2013-02-14 13:12:54 +00:00
|
|
|
KICAD_PLUGINS
|
|
|
|
KICAD_DATA
|
|
|
|
KICAD_DOCS
|
|
|
|
KICAD_DEMOS
|
|
|
|
KICAD_TEMPLATE)
|
2008-03-31 01:32:15 +00:00
|
|
|
|
2010-12-27 16:49:39 +00:00
|
|
|
include(Functions)
|
2008-03-11 15:57:54 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
2008-04-13 14:00:01 +00:00
|
|
|
# Find libraries that are needed to build KiCad.
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
2008-04-13 14:00:01 +00:00
|
|
|
include(CheckFindPackageResult)
|
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#######################
|
|
|
|
# Find OpenGL library #
|
|
|
|
#######################
|
2008-09-07 19:32:07 +00:00
|
|
|
find_package(OpenGL QUIET)
|
2008-04-13 14:00:01 +00:00
|
|
|
check_find_package_result(OPENGL_FOUND "OpenGL")
|
2008-03-11 15:57:54 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
######################
|
|
|
|
# Find Boost library #
|
|
|
|
######################
|
2009-10-01 18:28:56 +00:00
|
|
|
# kicad now includes needed boost files.
|
|
|
|
# the two next lines can be uncommented to use the native boost lib.
|
|
|
|
# but this is not a good idea
|
|
|
|
#find_package(Boost 1.36 QUIET)
|
|
|
|
#check_find_package_result(Boost_FOUND "Boost")
|
2008-01-30 09:42:19 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
##########################
|
|
|
|
# Find wxWidgets library #
|
|
|
|
##########################
|
2008-01-06 12:03:13 +00:00
|
|
|
# Here you can define what libraries of wxWidgets you need for your
|
|
|
|
# application. You can figure out what libraries you need here;
|
|
|
|
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2010-01-26 11:05:30 +00:00
|
|
|
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
|
|
|
|
if(APPLE)
|
2010-07-30 21:41:55 +00:00
|
|
|
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET)
|
2010-01-26 11:05:30 +00:00
|
|
|
else(APPLE)
|
2010-07-30 21:41:55 +00:00
|
|
|
find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET)
|
2010-01-26 11:05:30 +00:00
|
|
|
endif(APPLE)
|
2008-04-13 14:00:01 +00:00
|
|
|
check_find_package_result(wxWidgets_FOUND "wxWidgets")
|
2007-11-08 12:46:02 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
|
2008-01-06 12:03:13 +00:00
|
|
|
# Include wxWidgets macros.
|
2008-03-11 15:57:54 +00:00
|
|
|
include(${wxWidgets_USE_FILE})
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2008-04-13 19:07:32 +00:00
|
|
|
# Include MinGW resource compiler.
|
|
|
|
include(MinGWResourceCompiler)
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
# Generate build system specific header file.
|
|
|
|
include(PerformFeatureChecks)
|
|
|
|
perform_feature_checks()
|
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
# Find GDI+ on windows if wxGraphicsContext is available.
|
2013-02-14 13:12:54 +00:00
|
|
|
if(MINGW AND USE_WX_GRAPHICS_CONTEXT)
|
2010-02-08 18:15:42 +00:00
|
|
|
find_package(GdiPlus)
|
|
|
|
check_find_package_result(GDI_PLUS_FOUND "GDI+")
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2012-08-02 07:47:30 +00:00
|
|
|
# Find Python and other scripting resources
|
2013-02-11 00:41:49 +00:00
|
|
|
if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
|
|
|
set(PythonInterp_FIND_VERSION)
|
|
|
|
find_package(PythonInterp)
|
|
|
|
check_find_package_result(PYTHONINTERP_FOUND "Python Interpreter")
|
|
|
|
|
|
|
|
# Get the correct Python site package install path from the Python interpreter found by
|
|
|
|
# FindPythonInterp unless the user specifically defined a custom path.
|
|
|
|
if(NOT PYTHON_SITE_PACKAGE_PATH)
|
|
|
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
|
|
|
|
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT PYTHON_SITE_PACKAGE_PATH)
|
|
|
|
message(FATAL_ERROR "Error occurred while attemping to find the Python site library path.")
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2013-02-11 00:41:49 +00:00
|
|
|
|
|
|
|
set(PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path.")
|
|
|
|
mark_as_advanced(PYTHON_DEST)
|
|
|
|
message( STATUS "Python module install path: ${PYTHON_DEST}")
|
|
|
|
find_package(PythonLibs)
|
|
|
|
include_directories(${PYTHON_INCLUDE_PATH}
|
|
|
|
./scripting)
|
2012-08-02 07:47:30 +00:00
|
|
|
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-06-06 12:39:00 +00:00
|
|
|
# Automagically create version header file.
|
2010-04-21 12:25:16 +00:00
|
|
|
include(CreateBzrVersionHeader)
|
|
|
|
create_bzr_version_header()
|
2008-05-05 13:26:46 +00:00
|
|
|
|
2008-08-29 14:06:19 +00:00
|
|
|
if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h)
|
2008-09-07 19:32:07 +00:00
|
|
|
# This file may exist (created by an alternate process to the svn test above),
|
|
|
|
# e.g. could be created by a checkout script that produces a source tar file.
|
|
|
|
# This directive means the about box will have the svn date & revision in it,
|
|
|
|
# but the hard coded release date (program version) will be preserved.
|
|
|
|
add_definitions(-DHAVE_SVN_REVISION)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
2008-08-29 14:06:19 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
# For include_directories(BEFORE ...), which _reverses_
|
|
|
|
# the order during insertion, so put first wanted last, which is
|
|
|
|
# ${CMAKE_SOURCE_DIR/include. Use '.' for current source dir since
|
|
|
|
# we don't want expansion here and now, and don't need expansion of
|
|
|
|
# ${CMAKE_CURRENT_SOURCE_DIR}, '.' will work for any source directory.
|
|
|
|
set(INC_BEFORE
|
|
|
|
.
|
|
|
|
${CMAKE_SOURCE_DIR}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
set(INC_AFTER
|
|
|
|
#include <config.h>
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
)
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
|
|
|
# Let CMake look in these directories for nested
|
|
|
|
# 'CMakeLists.txt' files to process
|
|
|
|
#================================================
|
|
|
|
|
|
|
|
############
|
|
|
|
# Binaries #
|
|
|
|
############
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2012-04-07 11:09:57 +00:00
|
|
|
add_subdirectory(bitmaps_png)
|
2008-03-31 01:32:15 +00:00
|
|
|
add_subdirectory(common)
|
2012-04-05 18:27:56 +00:00
|
|
|
add_subdirectory(3d-viewer)
|
2008-03-11 15:57:54 +00:00
|
|
|
add_subdirectory(cvpcb)
|
|
|
|
add_subdirectory(eeschema)
|
|
|
|
add_subdirectory(gerbview)
|
|
|
|
add_subdirectory(kicad)
|
|
|
|
add_subdirectory(pcbnew)
|
2012-12-29 09:54:25 +00:00
|
|
|
add_subdirectory(pcbnew/pcad2kicadpcb_plugin)
|
2008-03-11 15:57:54 +00:00
|
|
|
add_subdirectory(polygon)
|
2010-06-10 18:43:12 +00:00
|
|
|
add_subdirectory(potrace)
|
|
|
|
add_subdirectory(bitmap2component)
|
2011-08-05 19:53:42 +00:00
|
|
|
add_subdirectory(pcb_calculator)
|
2012-04-30 02:57:48 +00:00
|
|
|
add_subdirectory(tools)
|
2010-12-20 06:06:34 +00:00
|
|
|
#add_subdirectory(new)
|
2008-08-11 11:45:29 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#############
|
|
|
|
# Resources #
|
|
|
|
#############
|
2008-03-11 15:57:54 +00:00
|
|
|
add_subdirectory(demos)
|
|
|
|
add_subdirectory(template)
|
2008-03-18 21:16:49 +00:00
|
|
|
|
2010-06-13 04:10:16 +00:00
|
|
|
#================================================
|
|
|
|
# Doxygen Output
|
|
|
|
#================================================
|
|
|
|
find_package(Doxygen)
|
|
|
|
if(DOXYGEN_FOUND)
|
2011-12-10 05:33:24 +00:00
|
|
|
add_custom_target( doxygen-docs
|
|
|
|
${CMAKE_COMMAND} -E remove_directory Documentation/doxygen
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE}
|
2010-06-13 04:10:16 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2011-12-10 05:33:24 +00:00
|
|
|
DEPENDS Doxyfile
|
|
|
|
COMMENT "building doxygen docs into directory Documentation/doxygen/html"
|
|
|
|
)
|
2013-02-14 13:12:54 +00:00
|
|
|
else()
|
2010-06-13 04:10:16 +00:00
|
|
|
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
|
|
|
|
endif()
|
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
|
2010-10-12 10:20:28 +00:00
|
|
|
#================================================
|
|
|
|
# make uninstall rules
|
|
|
|
#================================================
|
2010-10-12 18:42:29 +00:00
|
|
|
configure_file(
|
|
|
|
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
|
2010-10-12 10:20:28 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
2010-10-12 18:42:29 +00:00
|
|
|
add_custom_target(uninstall
|
2010-10-12 10:20:28 +00:00
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
|
|
|
|
|
|
|
|
2008-08-11 11:45:29 +00:00
|
|
|
#================================================
|
|
|
|
# Installation parameters
|
|
|
|
#================================================
|
2008-12-20 08:14:33 +00:00
|
|
|
install(FILES INSTALL.txt
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${KICAD_DOCS}
|
|
|
|
COMPONENT resources)
|
|
|
|
|
2009-10-15 18:44:06 +00:00
|
|
|
install(FILES resources/freeroute.jnlp
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${KICAD_BIN}
|
|
|
|
COMPONENT resources)
|
|
|
|
|
2009-06-02 19:18:09 +00:00
|
|
|
###
|
|
|
|
# Install scripts
|
|
|
|
###
|
|
|
|
if(UNIX)
|
2009-06-21 13:37:27 +00:00
|
|
|
install(DIRECTORY scripts
|
|
|
|
DESTINATION ${KICAD_DOCS}
|
|
|
|
COMPONENT resources
|
|
|
|
PATTERN ".svn" EXCLUDE)
|
2013-02-14 13:12:54 +00:00
|
|
|
endif()
|
|
|
|
|
2009-06-02 13:51:57 +00:00
|
|
|
###
|
|
|
|
# FreeDesktop .desktop and MIME resources
|
|
|
|
###
|
2008-03-18 21:16:49 +00:00
|
|
|
if(UNIX)
|
2009-06-21 13:37:27 +00:00
|
|
|
# Set paths
|
|
|
|
set(UNIX_MIME_DIR resources/linux/mime)
|
|
|
|
set(UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk)
|
|
|
|
set(UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime)
|
|
|
|
set(UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons)
|
|
|
|
set(UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications)
|
|
|
|
|
|
|
|
# Install Mimelnk directory
|
|
|
|
install(DIRECTORY ${UNIX_MIMELNK_FILES}
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
|
|
|
COMPONENT resources
|
|
|
|
PATTERN ".svn" EXCLUDE)
|
2009-06-21 13:37:27 +00:00
|
|
|
|
|
|
|
# Install Mime directory
|
|
|
|
install(DIRECTORY ${UNIX_ICONS_FILES}
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
|
|
|
COMPONENT resources
|
|
|
|
PATTERN ".svn" EXCLUDE)
|
2009-06-21 13:37:27 +00:00
|
|
|
|
|
|
|
# Install Icons
|
|
|
|
install(DIRECTORY ${UNIX_MIME_FILES}
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
|
|
|
COMPONENT resources
|
|
|
|
PATTERN ".svn" EXCLUDE)
|
2009-06-21 13:37:27 +00:00
|
|
|
|
|
|
|
# Install Applications directory (.desktop files)
|
|
|
|
install(DIRECTORY ${UNIX_APPLICATIONS_FILES}
|
2013-02-14 13:12:54 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
|
|
|
COMPONENT resources
|
|
|
|
PATTERN ".svn" EXCLUDE)
|
|
|
|
endif()
|
2010-02-12 23:12:00 +00:00
|
|
|
|
|
|
|
include(CTest)
|