See Dick make CMake files.
Can you CMake any sense of this?
http://www.vtk.org/Wiki/CMake_FAQ
I find it easier to get work done in CMake than in any other build
system that I have used.
I am not a CMake expert, but this is a decent first draft. I believe it
will be possible to get to a point where you can build openocd just with
simple tools on Windows, no need for CYGWIN or even a bash shell
script. These scripts have been tested on Linux with a variety of
cable types.
They have not been tested on Windows. Windows support may need a little
more work, 1 hour or at most. I will ask somebody that works with
Windows to do that for their own benefit please. I have carried the
water pretty far here, and the Windows folks can certainly go the extra
3 feet.
Start by installing the patch, and then reading about "out of source
builds" in the above URL, repeated here again:
http://www.vtk.org/Wiki/CMake_FAQ
The "out of source build" support lets you manage any number of release
or debug builds, targeted for any cable or device family, and keep them
all around concurrently.
Also read the comments at the top of src/CMakeLists.txt
Enjoy,
Dick
Index: src/helper/CMakeLists.txt
===================================================================
--- src/helper/CMakeLists.txt (revision 0)
+++ src/helper/CMakeLists.txt (revision 0)
@@ -0,0 +1,27 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+
+set( HELPER_SRCS
+ binarybuffer.c
+ command.c
+ configuration.c
+ fileio.c
+ ioutil.c
+ log.c
+ replacements.c
+ startup_tcl.c
+ time_support.c
+)
+
+
+if(NOT ECOSBOARD)
+
+ # omit these srcs if ECOSBOARD
+ set( HELPER_SRCS ${HELPER_SRCS} options.c jim.c jim-eventloop.c )
+
+endif(NOT ECOSBOARD)
+
+
+add_library(helper STATIC ${HELPER_SRCS})
Property changes on: src/helper/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/pld/CMakeLists.txt
===================================================================
--- src/pld/CMakeLists.txt (revision 0)
+++ src/pld/CMakeLists.txt (revision 0)
@@ -0,0 +1,11 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+SET(PLD_SRCS
+ pld.c
+ xilinx_bit.c
+ virtex2.c
+)
+
+add_library(pld STATIC ${PLD_SRCS})
Property changes on: src/pld/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/jtag/CMakeLists.txt
===================================================================
--- src/jtag/CMakeLists.txt (revision 0)
+++ src/jtag/CMakeLists.txt (revision 0)
@@ -0,0 +1,78 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/rlink
+ )
+
+set(JTAG_SRCS jtag.c)
+
+
+if(BUILD_BITBANG OR BUILD_DUMMY OR BUILD_EP93XX OR BUILD_ECOSBOARD OR BUILD_PARPORT OR BUILD_AT91RM9200)
+ list(APPEND JTAG_SRCS bitbang.c)
+endif(BUILD_BITBANG OR BUILD_DUMMY OR BUILD_EP93XX OR BUILD_ECOSBOARD OR BUILD_PARPORT OR BUILD_AT91RM9200)
+
+if(BUILD_PARPORT)
+ list(APPEND JTAG_SRCS parport.c)
+endif(BUILD_PARPORT)
+
+if(BUILD_DUMMY)
+ list(APPEND JTAG_SRCS dummy.c)
+endif(BUILD_DUMMY)
+
+if(BUILD_FT2232_FTD2XX OR BUILD_FT2232_LIBFTDI)
+ list(APPEND JTAG_SRCS ft2232.c)
+endif(BUILD_FT2232_FTD2XX OR BUILD_FT2232_LIBFTDI)
+
+if(BUILD_AMTJTAGACCEL)
+ list(APPEND JTAG_SRCS amt_jtagaccel.c)
+endif(BUILD_AMTJTAGACCEL)
+
+if(BUILD_EP93XX)
+ list(APPEND JTAG_SRCS ep93xx.c)
+endif(BUILD_EP93XX)
+
+if(BUILD_AT91RM9200)
+ list(APPEND JTAG_SRCS at91rm9200.c)
+endif(BUILD_AT91RM9200)
+
+if(BUILD_GW16012)
+ list(APPEND JTAG_SRCS gw16012.c)
+endif(BUILD_GW16012)
+
+if(BUILD_BITQ)
+ list(APPEND JTAG_SRCS bitq.c)
+endif(BUILD_BITQ)
+
+if(BUILD_PRESTO)
+ list(APPEND JTAG_SRCS presto.c)
+endif(BUILD_PRESTO)
+
+if(BUILD_USBPROG)
+ list(APPEND JTAG_SRCS usbprog.c)
+endif(BUILD_USBPROG)
+
+if(BUILD_ECOSBOARD)
+ list(APPEND JTAG_SRCS zy1000.c)
+endif(BUILD_ECOSBOARD)
+
+if(BUILD_JLINK)
+ list(APPEND JTAG_SRCS jlink.c)
+endif(BUILD_JLINK)
+
+if(BUILD_RLINK)
+ list(APPEND JTAG_SRCS rlink/rlink.c rlink/rlink_speed_table.c)
+endif(BUILD_RLINK)
+
+if(BUILD_VSLLINK)
+ list(APPEND JTAG_SRCS vsllink.c)
+endif(BUILD_VSLLINK)
+
+if(BUILD_ARM_JTAG_EW)
+ list(APPEND JTAG_SRCS arm-jtag-ew.c)
+endif(BUILD_ARM_JTAG_EW)
+
+
+add_library(jtag STATIC ${JTAG_SRCS})
Property changes on: src/jtag/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/target/CMakeLists.txt
===================================================================
--- src/target/CMakeLists.txt (revision 0)
+++ src/target/CMakeLists.txt (revision 0)
@@ -0,0 +1,74 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+
+SET(TARGET_SRCS
+ target.c
+ register.c
+ breakpoints.c
+ armv4_5.c
+ embeddedice.c
+ etm.c
+ arm7tdmi.c
+ arm9tdmi.c
+ arm_jtag.c
+ arm7_9_common.c
+ algorithm.c
+ arm920t.c
+ arm720t.c
+ armv4_5_mmu.c
+ armv4_5_cache.c
+ arm_disassembler.c
+ arm966e.c
+ arm926ejs.c
+ feroceon.c
+ etb.c
+ xscale.c
+ arm_simulator.c
+ image.c
+ armv7m.c
+ cortex_m3.c
+ cortex_swjdp.c
+ etm_dummy.c
+ target_request.c
+ trace.c
+ arm11.c
+ arm11_dbgtap.c
+ mips32.c
+ mips_m4k.c
+ mips32_pracc.c
+ mips32_dmaacc.c
+ mips_ejtag.c
+ )
+
+
+if(OOCD_TRACE)
+ list(APPEND TARGET_SRCS oocd_trace.c)
+endif(OOCD_TRACE)
+
+
+add_library(target STATIC ${TARGET_SRCS})
+
+
+install(
+ FILES xscale/debug_handler.bin
+ DESTINATION ${OPENOCD_LIBS}/xscale
+ COMPONENT xscale/debug_handler
+ )
+
+install(
+ FILES ecos/at91eb40a.elf
+ DESTINATION ${OPENOCD_LIBS}/ecos
+ COMPONENT "ecos/elf stuff"
+ )
+
+# find all cfg files and install them into the OPENOCD_LIBS directory
+install(
+ DIRECTORY target interface board test
+ DESTINATION ${OPENOCD_LIBS}
+ COMPONENT "tcl configuration files"
+ FILES_MATCHING PATTERN "*.cfg"
+ PATTERN ".svn" EXCLUDE
+ )
+
Property changes on: src/target/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/xsvf/CMakeLists.txt
===================================================================
--- src/xsvf/CMakeLists.txt (revision 0)
+++ src/xsvf/CMakeLists.txt (revision 0)
@@ -0,0 +1,9 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+set( XSVF_SRCS
+ xsvf.c
+)
+
+add_library(xsvf STATIC ${XSVF_SRCS})
Property changes on: src/xsvf/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/flash/CMakeLists.txt
===================================================================
--- src/flash/CMakeLists.txt (revision 0)
+++ src/flash/CMakeLists.txt (revision 0)
@@ -0,0 +1,37 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+
+SET(FLASH_SRCS
+ flash.c
+ lpc2000.c
+ cfi.c
+ non_cfi.c
+ at91sam7.c
+ at91sam7_old.c
+ str7x.c
+ str9x.c
+ aduc702x.c
+ nand.c
+ nand_ecc.c
+ lpc3180_nand_controller.c
+ stellaris.c
+ str9xpec.c
+ stm32x.c
+ tms470.c
+ ecos.c
+ orion_nand.c
+ s3c24xx_nand.c
+ s3c2410_nand.c
+ s3c2412_nand.c
+ s3c2440_nand.c
+ s3c2443_nand.c
+ lpc288x.c
+ ocl.c
+ mflash.c
+ pic32mx.c
+)
+
+add_library(flash STATIC ${FLASH_SRCS})
+
Property changes on: src/flash/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/svf/CMakeLists.txt
===================================================================
--- src/svf/CMakeLists.txt (revision 0)
+++ src/svf/CMakeLists.txt (revision 0)
@@ -0,0 +1,10 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+
+SET(SVF_SRCS
+ svf.c
+)
+
+add_library(svf STATIC ${SVF_SRCS})
Property changes on: src/svf/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/server/CMakeLists.txt
===================================================================
--- src/server/CMakeLists.txt (revision 0)
+++ src/server/CMakeLists.txt (revision 0)
@@ -0,0 +1,32 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+set( SERVER_SRCS
+ server.c
+ telnet_server.c
+ gdb_server.c
+ tcl_server.c
+ )
+
+if(BUILD_HTTPD)
+ list(APPEND SERVER_SRCS httpd.c)
+ file(GLOB HTTP_DATA httpd/*.tcl httpd/*.css httpd/menu_cuts/*.png)
+ #message( ${HTTP_DATA} )
+
+ install(
+ DIRECTORY httpd
+ DESTINATION ${OPENOCD_LIBS}
+ COMPONENT "httpd data files"
+ FILES_MATCHING
+ PATTERN "*.tcl"
+ PATTERN "*.css"
+ PATTERN "*.png"
+ PATTERN ".svn" EXCLUDE
+ )
+
+endif(BUILD_HTTPD)
+
+add_library(server STATIC ${SERVER_SRCS})
+
+
Property changes on: src/server/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Index: src/openocd.c
===================================================================
--- src/openocd.c (revision 1454)
+++ src/openocd.c (working copy)
@@ -24,8 +24,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#define OPENOCD_VERSION "Open On-Chip Debugger " VERSION " (" PKGBLDDATE ") "RELSTR PKGBLDREV
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -57,6 +55,10 @@
#include <unistd.h>
#include <errno.h>
+
+#define OPENOCD_VERSION "Open On-Chip Debugger " VERSION " (" PKGBLDDATE ") "RELSTR PKGBLDREV
+
+
void print_version(void)
{
/* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
Index: src/CMakeModules/FindLibUSB.cmake
===================================================================
--- src/CMakeModules/FindLibUSB.cmake (revision 0)
+++ src/CMakeModules/FindLibUSB.cmake (revision 0)
@@ -0,0 +1,40 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+#
+# - Find libusb-1.0 library
+# This module defines
+# LIBUSB_INCLUDE_DIR, where to find bluetooth.h
+# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0.
+# LIBUSB_FOUND, if false, the library was NOT found
+
+
+if(NOT LIBUSB_FOUND)
+
+ if(NOT WIN32 AND NOT LIBUSB_INCLUDE_DIR AND NOT LIBUSB_LIBRARIES )
+ include(FindPkgConfig)
+ pkg_check_modules(LIBUSB_PKG libusb)
+ endif(NOT WIN32 AND NOT LIBUSB_INCLUDE_DIR AND NOT LIBUSB_LIBRARIES )
+
+ find_path(LIBUSB_INCLUDE_DIR NAMES usb.h
+ PATHS
+ ${LIBUSB_PKG_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(LIBUSB_LIBRARIES NAMES usb
+ PATHS
+ ${LIBUSB_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ include(FindPackageHandleStandardArgs)
+
+ # handle the QUIETLY AND REQUIRED arguments AND set LIBUSB_FOUND to TRUE if
+ # all listed variables are TRUE
+ find_package_handle_standard_args(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
+
+ #mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
+
+endif(NOT LIBUSB_FOUND)
Property changes on: src/CMakeModules/FindLibUSB.cmake
___________________________________________________________________
Added: svn:eol-style
+ native
Index: src/CMakeModules/FindLibFTD2XX.cmake
===================================================================
--- src/CMakeModules/FindLibFTD2XX.cmake (revision 0)
+++ src/CMakeModules/FindLibFTD2XX.cmake (revision 0)
@@ -0,0 +1,46 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+#
+# - Try to find libftd2xx
+# Once done this will define
+#
+# LIBFTD2XX_FOUND - system has libftdi
+# LIBFTD2XX_INCLUDE_DIR - the libftdi include directory
+# LIBFTD2XX_LIBRARIES - Link these to use libftdi
+
+
+if (NOT LIBFTD2XX_FOUND)
+
+ if(NOT WIN32)
+ include(FindPkgConfig)
+ pkg_check_modules(LIBFTD2XX_PKG libftd2xx)
+ endif(NOT WIN32)
+
+ find_path(LIBFTD2XX_INCLUDE_DIR
+ NAMES
+ ftd2xx.h
+ PATHS
+ ${LIBFTD2XX_PKG_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(LIBFTD2XX_LIBRARIES
+ NAMES
+ ftd2xx
+ PATHS
+ ${LIBFTD2XX_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ include(FindPackageHandleStandardArgs)
+
+ # handle the QUIETLY AND REQUIRED arguments AND set LIBFTD2XX_FOUND to TRUE if
+ # all listed variables are TRUE
+ find_package_handle_standard_args(LIBFTD2XX DEFAULT_MSG LIBFTD2XX_LIBRARIES LIBFTD2XX_INCLUDE_DIR)
+
+ #mark_as_advanced(LIBFTD2XX_INCLUDE_DIR LIBFTD2XX_LIBRARIES)
+
+endif(NOT LIBFTD2XX_FOUND)
Property changes on: src/CMakeModules/FindLibFTD2XX.cmake
___________________________________________________________________
Added: svn:eol-style
+ native
Index: src/CMakeModules/FindLibFTDI.cmake
===================================================================
--- src/CMakeModules/FindLibFTDI.cmake (revision 0)
+++ src/CMakeModules/FindLibFTDI.cmake (revision 0)
@@ -0,0 +1,46 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+#
+# - Try to find libftdi
+# Once done this will define
+#
+# LIBFTDI_FOUND - system has libftdi
+# LIBFTDI_INCLUDE_DIR - the libftdi include directory
+# LIBFTDI_LIBRARIES - Link these to use libftdi
+
+
+if (NOT LIBFTDI_FOUND)
+
+ if(NOT WIN32)
+ include(FindPkgConfig)
+ pkg_check_modules(LIBFTDI_PKG libftdi)
+ endif(NOT WIN32)
+
+ find_path(LIBFTDI_INCLUDE_DIR
+ NAMES
+ ftdi.h
+ PATHS
+ ${LIBFTDI_PKG_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(LIBFTDI_LIBRARIES
+ NAMES
+ ftdi
+ PATHS
+ ${LIBFTDI_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ include(FindPackageHandleStandardArgs)
+
+ # handle the QUIETLY AND REQUIRED arguments AND set LIBFTDI_FOUND to TRUE if
+ # all listed variables are TRUE
+ find_package_handle_standard_args(LIBFTDI DEFAULT_MSG LIBFTDI_LIBRARIES LIBFTDI_INCLUDE_DIR)
+
+ #mark_as_advanced(LIBFTDI_INCLUDE_DIR LIBFTDI_LIBRARIES)
+
+endif(NOT LIBFTDI_FOUND)
Property changes on: src/CMakeModules/FindLibFTDI.cmake
___________________________________________________________________
Added: svn:eol-style
+ native
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (revision 0)
+++ src/CMakeLists.txt (revision 0)
@@ -0,0 +1,341 @@
+# Copyright 2009 SoftPLC Corporation http://softplc.com
+# Dick Hollenbeck <d...@softplc.com>
+# License: GPL v2
+
+# This is the top level CMake build script for OpenOCD.
+# First created: April 2009
+
+
+# http://www.vtk.org/Wiki/CMake_FAQ
+# Read the above for information on CMake and in particular, "Out of Tree Builds"
+# I have a <base>/release and a <base>/debug directory, at same level as <base>/src.
+# $ cd release
+# cmake -DBUILD_<what1>=1 -DBUILD_<what2>=1 ../src
+# make
+# sudo make install
+
+
+project(openocd C)
+
+if(WIN32)
+ cmake_minimum_required(VERSION 2.6.1 FATAL_ERROR)
+else(WIN32)
+ cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
+endif(WIN32)
+
+# Path to local CMake modules.
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
+
+set(VERSION 1.0) # version of openocd that this is
+
+
+###### Command line options #############################################
+
+# that enable OR disable features in the build.
+# For example, use -DBUILD_PARPORT=ON to enable parport support
+
+option(BUILD_PARPORT "Enable building the pc parallel port driver (default OFF)" OFF)
+option(BUILD_DUMMY "Enable building the dummy port driver (default OFF)" OFF)
+option(BUILD_PARPORT_PPDEV "Enable use of ppdev (/dev/parportN) for parport (default OFF)" OFF)
+option(BUILD_FT2232_FTD2XX "Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com (default OFF)" OFF)
+option(BUILD_FT2232_LIBFTDI "Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX (default OFF)" OFF)
+option(BUILD_AMTJTAGACCEL "Enable building the Amontec JTAG-Accelerator driver (default OFF)" OFF)
+option(BUILD_ECOSBOARD "Enable building support for eCosBoard based JTAG debugger (default OFF)" OFF)
+option(BUILD_IOUTIL "Enable ioutil functions - useful for standalone OpenOCD implementations (default OFF)" OFF)
+option(BUILD_HTTPD "Enable builtin httpd server - useful for standalone OpenOCD implementations (default OFF)" OFF)
+option(BUILD_EP93XX "Enable building support for EP93xx based SBCs (default OFF)" OFF)
+option(BUILD_AT91RM9200 "Enable building support for AT91RM9200 based SBCs (default OFF)" OFF)
+option(BUILD_GW16012 "Enable building support for the Gateworks GW16012 JTAG Programmer (default OFF)" OFF)
+
+#option(BUILD_PRESTO_LIBFTDI "Enable building support for ASIX Presto Programmer using the libftdi driver (default OFF)" OFF)
+#option(BUILD_PRESTO_FTD2XX "Enable building support for ASIX Presto Programmer using the FTD2XX driver (default OFF)" OFF)
+option(BUILD_PRESTO "Enable building support for ASIX Presto Programmer using the selected FT2232 driver (default OFF)" OFF)
+
+option(BUILD_USBPROG "Enable building support for the usbprog JTAG Programmer (default OFF)" OFF)
+option(BUILD_OOCD_TRACE "Enable building support for the OpenOCD+trace ETM capture device (default OFF)" OFF)
+option(BUILD_JLINK "Enable building support for the Segger J-Link JTAG Programmer (default OFF)" OFF)
+option(BUILD_VSLLINK "Enable building support for the Versaloon-Link JTAG Programmer (default OFF)" OFF)
+option(BUILD_RLINK "Enable building support for the Raisonance RLink JTAG Programmer (default OFF)" OFF)
+option(BUILD_ARM_JTAG_EW "Enable building support for the Olimex ARM-JTAG-EW Programmer (default OFF)" OFF)
+option(BUILD_PARPORT_GIVEIO "Enable use of giveio for parport instead of ioperm (default OFF)" OFF)
+option(BUILD_BITQ "Enable a BITQ interface (default ON)" ON)
+
+
+# Having these here seems to keep the find modules from finding standard installations of these libraries,
+# so these are commented out for now
+#set( LIBFTD2XX_LIBRARIES "" CACHE PATH "Path to the ftd2xx library")
+#set( LIBFTD2XX_INCLUDE_DIR "" CACHE PATH "Path to the ftd2xx header files")
+#set( LIBFTI_LIBRARIES "" CACHE PATH "Path to the ftdi library")
+#set( LIBFTDI_INCLUDE_DIR "" CACHE PATH "Path to the ftdi header files")
+#set( LIBUSB_LIBRARIES "" CACHE PATH "Path to the usb library")
+#set( LIBUSB_INCLUDE_DIR "" CACHE PATH "Path to the usb header files")
+
+
+# Locations for install targets.
+set(OPENOCD_BIN bin CACHE PATH "Location of OpenOCD binaries, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+
+if(UNIX)
+ # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
+ set(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "")
+
+ # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
+ set(OPENOCD_DATA share/openocd CACHE PATH "Location of OpenOCD data files, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+ set(OPENOCD_DOCS share/doc/openocd CACHE PATH "Location of OpenOCD documentation files, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+ set(OPENOCD_LIBS lib/openocd CACHE PATH "Location of OpenOCD libary file, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+endif(UNIX)
+
+if(WIN32)
+ # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
+ set(CMAKE_INSTALL_PREFIX c:/OpenOCD CACHE PATH "")
+
+ # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
+ set(OPENOCD_DATA share CACHE PATH "Location of OpenOCD data files, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+ set(OPENOCD_DOCS doc CACHE PATH "Location of OpenOCD documentation files, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+ set(OPENOCD_LIBS lib CACHE PATH "Location of OpenOCD libary file, relative to CMAKE_INSTALL_PREFIX if not absolute path.")
+endif(WIN32)
+
+# set the PKGDATADIR and PKGLIBDIR the same way the install() function creates
+# the intallation path from CMAKE_INSTALL_PREFIX and OPENOCD_DATA or
+# OPENOCD_LIBS respectively. PKGLIBDIR and PKGDATADIR are passed into the *.c code
+# via the config.h file, whereas OPENOCD_DATA and OPENOCD_LIBS are given to the
+# install() function. After install() works on its arguments, it should come up
+# with the same as our PKGDATADIR and PKGLIBDIR.
+if( IS_ABSOLUTE ${OPENOCD_DATA} )
+ set(PKGDATADIR ${OPENOCD_DATA})
+else( IS_ABSOLUTE ${OPENOCD_DATA} )
+ set(PKGDATADIR ${CMAKE_INSTALL_PREFIX}/${OPENOCD_DATA})
+endif( IS_ABSOLUTE ${OPENOCD_DATA} )
+
+if( IS_ABSOLUTE ${OPENOCD_LIBS} )
+ set(PKGLIBDIR ${OPENOCD_LIBS})
+else( IS_ABSOLUTE ${OPENOCD_LIBS} )
+ set(PKGLIBDIR ${CMAKE_INSTALL_PREFIX}/${OPENOCD_LIBS})
+endif( IS_ABSOLUTE ${OPENOCD_LIBS} )
+
+
+# check for include files and functions
+include(CheckIncludeFile)
+check_include_file(elf.h HAVE_ELF_H)
+check_include_file(inttypes.h HAVE_INTTYPES_H)
+check_include_file(jtag_minidriver.h HAVE_JTAG_MINIDRIVER_H)
+check_include_file(memory.h HAVE_MEMORY_H)
+check_include_file(stdbool.h HAVE_STDBOOL_H)
+check_include_file(stdint.h HAVE_STDINT_H)
+check_include_file(stdlib.h HAVE_STDLIB_H)
+check_include_file(strings.h HAVE_STRINGS_H)
+check_include_file(string.h HAVE_STRING_H)
+check_include_file(sys/param.h HAVE_SYS_PARAM_H)
+check_include_file(sys/stat.h HAVE_SYS_STAT_H)
+check_include_file(sys/time.h HAVE_SYS_TIME_H)
+check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file(unistd.h HAVE_UNISTD_H)
+
+include(CheckFunctionExists)
+check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
+check_function_exists(strnlen HAVE_STRNLEN)
+check_function_exists(usleep HAVE_USLEEP)
+check_function_exists(vasprintf HAVE_VASPRINTF)
+
+include(CheckLibraryExists)
+check_library_exists(dl dlopen "" HAVE_LIBDL)
+
+#================================================
+# Set flags for GCC.
+#================================================
+
+if(CMAKE_COMPILER_IS_GNUC)
+ # Set default flags for Release build.
+ set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
+ set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
+
+ # Set default flags for Debug build.
+ set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
+ set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
+endif(CMAKE_COMPILER_IS_GNUC)
+
+
+# CONDITIONAL_LIBS is added to other unconditional libs below
+set( CONDITIONAL_LIBS )
+
+
+if( BUILD_AMTJTAGACCEL OR BUILD_PRESTO OR BUILD_JLINK OR BUILD_ARM_JTAG_EW OR BUILD_FT2232_LIBFTDI OR BUILD_FT2232_FTD2XX OR BUILD_RLINK)
+ #message("Yes USB")
+ set(NEED_USB TRUE)
+else( BUILD_AMTJTAGACCEL OR BUILD_PRESTO OR BUILD_JLINK OR BUILD_ARM_JTAG_EW OR BUILD_FT2232_LIBFTDI OR BUILD_FT2232_FTD2XX OR BUILD_RLINK)
+ #message("No USB")
+ set(NEED_USB FALSE)
+endif( BUILD_AMTJTAGACCEL OR BUILD_PRESTO OR BUILD_JLINK OR BUILD_ARM_JTAG_EW OR BUILD_FT2232_LIBFTDI OR BUILD_FT2232_FTD2XX OR BUILD_RLINK)
+
+
+if(NEED_USB)
+ find_package(LibUSB)
+ set(CONDITIONAL_LIBS ${CONDITIONAL_LIBS} ${LIBUSB_LIBRARIES})
+endif(NEED_USB)
+
+
+if(BUILD_FT2232_FTD2XX)
+ #message( BUILD_FT2232_LIBFTDI=${BUILD_FT2232_LIBFTDI})
+ if(BUILD_FT2232_LIBFTDI)
+ message( FATAL_ERROR "BUILD_FT2232_FTD2XX and BUILD_FT2232_LIBFTDI are mutuall exclusive, please enable only one")
+ endif(BUILD_FT2232_LIBFTDI)
+ find_package(LibFTD2XX)
+ set(CONDITIONAL_LIBS ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS})
+endif(BUILD_FT2232_FTD2XX)
+
+
+if(BUILD_FT2232_LIBFTDI)
+ if(BUILD_FT2232_FTD2XX)
+ message( FATAL_ERROR "BUILD_FT2232_FTD2XX and BUILD_FT2232_LIBFTDI are mutuall exclusive, please enable only one")
+ endif(BUILD_FT2232_FTD2XX)
+ find_package(LibFTDI)
+ set(CONDITIONAL_LIBS ${LIBFTDI_LIBRARIES} ${CONDITIONAL_LIBS})
+endif(BUILD_FT2232_LIBFTDI)
+
+
+if(BUILD_HTTPD)
+ check_library_exists(microhttpd MHD_stop_daemon "/usr/lib" HAVE_LIBMICROHTTPD)
+ #find_package(LibMicroHTTPD)
+ message(BUILD_HTTPD)
+ if(HAVE_LIBMICROHTTPD)
+ message(HAVE_LIBMICROHTTPD)
+ set(CONDITIONAL_LIBS microhttpd ${CONDITIONAL_LIBS})
+ endif(HAVE_LIBMICROHTTPD)
+endif(BUILD_HTTPD)
+
+if(HAVE_LIBDL)
+ set(CONDITIONAL_LIBS ${CONDITIONAL_LIBS} dl)
+endif(HAVE_LIBDL)
+
+include(TestBigEndian)
+test_big_endian( WORDS_BIGENDIAN )
+
+if(RELEASE)
+ set(RELSTR Release)
+ set(PKGBLDREV "")
+else(RELEASE)
+ set(RELSTR svn:)
+ find_package(Subversion)
+ if(Subversion_FOUND)
+ subversion_wc_info( ${PROJECT_SOURCE_DIR} OPENOCD )
+ MESSAGE("Current revision is ${OPENOCD_WC_REVISION}")
+ set(PKGBLDREV ${OPENOCD_WC_REVISION})
+ else(Subversion_FOUND)
+ set(PKGBLDREV "")
+ endif(Subversion_FOUND)
+endif(RELEASE)
+
+# preprocess and output config.h into release or debug directory
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/target
+ ${CMAKE_CURRENT_SOURCE_DIR}/server
+ ${CMAKE_CURRENT_SOURCE_DIR}/helper
+ ${CMAKE_CURRENT_SOURCE_DIR}/jtag
+ ${CMAKE_CURRENT_SOURCE_DIR}/xsvf
+ ${CMAKE_CURRENT_SOURCE_DIR}/svf
+ ${CMAKE_CURRENT_SOURCE_DIR}/flash
+ ${CMAKE_CURRENT_SOURCE_DIR}/pld
+ ${CMAKE_BINARY_DIR}
+ )
+
+if(NOT CMAKE_HOST_UNIX)
+ set(IS_WIN32, true)
+ # http://dev-notes.com/code.php?q=49
+ set(GETDATECMD \\"%date%\\" )
+ #message("yes WIN32")
+else(NOT CMAKE_HOST_UNIX)
+ set(IS_WIN32, false)
+ set(GETDATECMD \\"`date +%F-%R`\\")
+ #message("not WIN32")
+endif(NOT CMAKE_HOST_UNIX)
+
+
+if(CYGWIN)
+ set(IS_CYGWIN, true)
+else(CYGWIN)
+ set(IS_CYGWIN, false)
+endif(CYGWIN)
+
+if(MINGW)
+ set(IS_MINGW, true)
+else(MINGW)
+ set(IS_MINGW, false)
+endif(MINGW)
+
+add_definitions(
+ -DHAVE_CONFIG_H=1
+ )
+
+add_subdirectory(helper)
+add_subdirectory(jtag)
+add_subdirectory(xsvf)
+add_subdirectory(svf)
+add_subdirectory(target)
+add_subdirectory(server)
+add_subdirectory(flash)
+add_subdirectory(pld)
+
+########### openocd target ###############
+
+set_source_files_properties( openocd.c PROPERTIES
+ COMPILE_FLAGS
+ -DPKGBLDDATE=${GETDATECMD}
+)
+
+
+# create OPENOCD_SRCS
+# prepend the main file to OPENOCD_SRCS
+if(ECOSBOARD)
+ set(OPENOCD_SRCS ecosboard.c openocd.c)
+else(ECOSBOARD)
+ set(OPENOCD_SRCS main.c openocd.c)
+endif(ECOSBOARD)
+
+add_executable(openocd ${OPENOCD_SRCS})
+
+target_link_libraries(openocd
+ xsvf
+ svf
+ target
+ jtag
+ server
+ flash
+ target
+ pld
+ helper
+ ${CONDITIONAL_LIBS}
+ )
+
+
+########### install files ###############
+
+install(TARGETS openocd DESTINATION ${OPENOCD_BIN})
+
+install(
+ DIRECTORY tcl
+ DESTINATION ${OPENOCD_LIBS}
+ COMPONENT "tcl configuration files"
+ FILES_MATCHING PATTERN "*.tcl"
+ PATTERN ".svn" EXCLUDE
+ )
+
+# tcl/bitsbytes.tcl
+# tcl/memory.tcl
+# tcl/mmr_helpers.tcl
+# tcl/readable.tcl
+# tcl/chip/atmel/at91/aic.tcl
+# tcl/chip/atmel/at91/at91sam7x128.tcl
+# tcl/chip/atmel/at91/at91sam7x256.tcl
+# tcl/chip/atmel/at91/pmc.tcl
+# tcl/chip/atmel/at91/rtt.tcl
+# tcl/chip/atmel/at91/usarts.tcl
+# tcl/chip/st/stm32/stm32.tcl
+# tcl/chip/st/stm32/stm32_rcc.tcl
+# tcl/chip/st/stm32/stm32_regs.tcl
+# tcl/cpu/arm/arm7tdmi.tcl
+# tcl/cpu/arm/arm920.tcl
+# tcl/cpu/arm/arm946.tcl
+# tcl/cpu/arm/arm966.tcl
+# tcl/cpu/arm/cortex_m3.tcl
Property changes on: src/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Property changes on: tools/xsvf_tools/xsvfdump.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: tools/xsvf_tools/svf2xsvf.py
___________________________________________________________________
Added: svn:executable
+ *
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development