From 7a65708459572ea9653442dd7bb995b8fa882591 Mon Sep 17 00:00:00 2001 From: f3nix Date: Thu, 8 Nov 2007 12:46:02 +0000 Subject: [PATCH] CMake build: preliminary support for install targets under linux. --- CMake.TODO | 3 ++- CMakeLists.txt | 27 ++++++++++++++++++++++++++- cvpcb/CMakeLists.txt | 2 +- eeschema/CMakeLists.txt | 2 +- eeschema/plugins/CMakeLists.txt | 2 +- gerbview/CMakeLists.txt | 2 +- internat/CMakeLists.txt | 3 +++ kicad/CMakeLists.txt | 2 +- kicad/minizip/CMakeLists.txt | 2 +- library/CMakeLists.txt | 7 +++++++ modules/CMakeLists.txt | 12 ++++++++++++ pcbnew/CMakeLists.txt | 2 +- template/CMakeLists.txt | 2 ++ 13 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 internat/CMakeLists.txt create mode 100644 library/CMakeLists.txt create mode 100644 modules/CMakeLists.txt create mode 100644 template/CMakeLists.txt diff --git a/CMake.TODO b/CMake.TODO index 8fcc0ba547..af06aad845 100644 --- a/CMake.TODO +++ b/CMake.TODO @@ -1,7 +1,8 @@ TODO: * Fix kicad/minizip. * Fix eeschema/plugins. -* Add install targets for binaries, docs, translations, libraries. +* Add install targets for binaries, docs, translations, libraries (Windows, Mac). + Linux version has a preliminary support. * Add DEBUG target. * Testing under Windows and Mac. * More testing ... diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f3bb0ae66..0c580754c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(kicad) -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR) #SET(CMAKE_VERBOSE_MAKEFILE ON) @@ -8,6 +8,26 @@ SET(wxWidgets_USE_LIBS base core adv gl html net) FIND_PACKAGE(wxWidgets REQUIRED) +#Locations for install targets +IF(UNIX) + #SET(CMAKE_INSTALL_PATH /usr/local) + SET(KICAD_BIN bin CACHE PATH "Location of KiCad binaries.") + SET(KICAD_PLUGINS lib/kicad/plugins CACHE PATH "Location of KiCad plugins.") + SET(KICAD_DOCS share/doc/kicad CACHE PATH "Location of KiCad documentation files.") + SET(KICAD_DATA share/kicad CACHE PATH "Location of KiCad data files.") + SET(KICAD_MODULES ${KICAD_DATA}/modules) + SET(KICAD_LIBRARY ${KICAD_DATA}/library) + SET(KICAD_INTERNAT ${KICAD_DATA}/internat) + SET(KICAD_TEMPLATE ${KICAD_DATA}/template) +ENDIF(UNIX) + +IF(WIN32) +ENDIF(WIN32) + +#Should this go to IF(UNIX)? +IF(APPLE) +ENDIF(APPLE) + IF(wxWidgets_FOUND) MESSAGE("-- wxWidgets found") @@ -27,3 +47,8 @@ IF(wxWidgets_FOUND) ELSE(wxWidgets_FOUND) MESSAGE("wxWidgets is required to build KiCad!") ENDIF(wxWidgets_FOUND) + +ADD_SUBDIRECTORY(internat) +ADD_SUBDIRECTORY(library) +ADD_SUBDIRECTORY(modules) +ADD_SUBDIRECTORY(template) diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 109665b019..302edc1c04 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -65,4 +65,4 @@ ADD_EXECUTABLE(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_EXTRA_SRCS} ${CVP TARGET_LINK_LIBRARIES(cvpcb common 3d-viewer ${wxWidgets_LIBRARIES}) -INSTALL(PROGRAMS cvpcb DESTINATION /bin) +INSTALL(TARGETS cvpcb RUNTIME DESTINATION ${KICAD_BIN}) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 6608f9fb9a..132b598112 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -120,6 +120,6 @@ ADD_EXECUTABLE(eeschema WIN32 MACOSX_BUNDLE ${EESCHEMA_SRCS} ${EESCHEMA_EXTRA_SR TARGET_LINK_LIBRARIES(eeschema common ${wxWidgets_LIBRARIES}) -INSTALL(PROGRAMS eeschema DESTINATION /bin) +INSTALL(TARGETS eeschema RUNTIME DESTINATION ${KICAD_BIN}) #ADD_SUBDIRECTORY(plugins) diff --git a/eeschema/plugins/CMakeLists.txt b/eeschema/plugins/CMakeLists.txt index d1d4e632a3..488fce03c9 100644 --- a/eeschema/plugins/CMakeLists.txt +++ b/eeschema/plugins/CMakeLists.txt @@ -4,5 +4,5 @@ CHECK_FUNCTION_EXISTS(stricmp HAVE_STRICMP) IF(HAVE_STRICMP) ADD_EXECUTABLE(netlist_form_pads-pcb netlist_form_pads-pcb.cpp) - INSTALL(PROGRAMS netlist_form_pads-pcb DESTINATION /bin) + INSTALL(TARGETS netlist_form_pads-pcb RUNTIME DESTINATION ${KICAD_PLUGINS}) ENDIF(HAVE_STRICMP) diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 9ed80c5173..921114039f 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -66,4 +66,4 @@ ADD_EXECUTABLE(gerbview WIN32 MACOSX_BUNDLE ${GERBVIEW_SRCS} ${GERBVIEW_EXTRA_SR TARGET_LINK_LIBRARIES(gerbview common 3d-viewer ${wxWidgets_LIBRARIES}) -INSTALL(PROGRAMS gerbview DESTINATION /bin) +INSTALL(TARGETS gerbview RUNTIME DESTINATION ${KICAD_BIN}) diff --git a/internat/CMakeLists.txt b/internat/CMakeLists.txt new file mode 100644 index 0000000000..3722c26bd3 --- /dev/null +++ b/internat/CMakeLists.txt @@ -0,0 +1,3 @@ +INSTALL(DIRECTORY ca cs de es fr hu it ko pl pt ru sl + DESTINATION ${KICAD_INTERNAT} + PATTERN ".svn" EXCLUDE) diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index e0889897f7..fc868e9049 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -27,6 +27,6 @@ ADD_EXECUTABLE(kicad WIN32 MACOSX_BUNDLE ${KICAD_SRCS} ${KICAD_EXTRA_SRCS} ${KIC TARGET_LINK_LIBRARIES(kicad common ${wxWidgets_LIBRARIES}) -INSTALL(PROGRAMS kicad DESTINATION /bin) +INSTALL(TARGETS kicad RUNTIME DESTINATION ${KICAD_BIN}) #ADD_SUBDIRECTORY(minizip) diff --git a/kicad/minizip/CMakeLists.txt b/kicad/minizip/CMakeLists.txt index 199ebf913d..db3212fce8 100644 --- a/kicad/minizip/CMakeLists.txt +++ b/kicad/minizip/CMakeLists.txt @@ -8,4 +8,4 @@ SET(MINIZIP_SRCS ADD_EXECUTABLE(minizip ${MINIZIP_SRCS}) -INSTALL(PROGRAMS minizip DESTINATION /bin) +INSTALL(TARGETS minizip RUNTIME DESTINATION bin) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt new file mode 100644 index 0000000000..1b41cd0af3 --- /dev/null +++ b/library/CMakeLists.txt @@ -0,0 +1,7 @@ +FILE(GLOB dcm_files "*.dcm") +FILE(GLOB lib_files "*.lib") +FILE(GLOB sym_files "*.sym") + +INSTALL(FILES ${dcm_files} DESTINATION ${KICAD_LIBRARY}) +INSTALL(FILES ${lib_files} DESTINATION ${KICAD_LIBRARY}) +INSTALL(FILES ${sym_files} DESTINATION ${KICAD_LIBRARY}) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000000..936f5275d9 --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,12 @@ +FILE(GLOB brd_files "*.brd") +FILE(GLOB equ_files "*.equ") +FILE(GLOB mdc_files "*.mdc") +FILE(GLOB mod_files "*.mod") + +INSTALL(FILES ${brd_files} DESTINATION ${KICAD_MODULES}) +INSTALL(FILES ${equ_files} DESTINATION ${KICAD_MODULES}) +INSTALL(FILES ${mdc_files} DESTINATION ${KICAD_MODULES}) +INSTALL(FILES ${mod_files} DESTINATION ${KICAD_MODULES}) + +INSTALL(DIRECTORY packages3d DESTINATION ${KICAD_MODULES} + PATTERN ".svn" EXCLUDE) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 6c1f030311..5db856dbe8 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -145,4 +145,4 @@ ADD_EXECUTABLE(pcbnew WIN32 MACOSX_BUNDLE ${PCBNEW_SRCS} ${PCBNEW_EXTRA_SRCS} ${ TARGET_LINK_LIBRARIES(pcbnew common 3d-viewer ${wxWidgets_LIBRARIES}) -INSTALL(PROGRAMS pcbnew DESTINATION /bin) +INSTALL(TARGETS pcbnew RUNTIME DESTINATION ${KICAD_BIN}) diff --git a/template/CMakeLists.txt b/template/CMakeLists.txt new file mode 100644 index 0000000000..02a06b4849 --- /dev/null +++ b/template/CMakeLists.txt @@ -0,0 +1,2 @@ +INSTALL(FILES kicad.pro + DESTINATION ${KICAD_TEMPLATE})