2010-12-19 21:42:55 +00:00
|
|
|
|
|
|
|
set( STAND_ALONE true )
|
|
|
|
|
|
|
|
if( STAND_ALONE )
|
|
|
|
project(kicad-new)
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
|
|
|
|
|
|
|
|
set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ )
|
|
|
|
|
|
|
|
# Path to local CMake modules.
|
2011-01-17 17:26:19 +00:00
|
|
|
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
2010-12-19 21:42:55 +00:00
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
include( CheckFindPackageResult )
|
2010-12-19 21:42:55 +00:00
|
|
|
|
|
|
|
find_package(Doxygen)
|
|
|
|
|
|
|
|
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
|
|
|
|
if(APPLE)
|
|
|
|
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET)
|
|
|
|
else()
|
|
|
|
find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
|
|
|
|
|
|
|
# Include wxWidgets macros.
|
|
|
|
include( ${wxWidgets_USE_FILE} )
|
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/include )
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
# 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 -static-libgcc")
|
|
|
|
|
|
|
|
# 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_GNUCXX)
|
|
|
|
|
2010-12-27 16:49:39 +00:00
|
|
|
include(Functions)
|
|
|
|
|
2010-12-19 21:42:55 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#================================================
|
|
|
|
# Doxygen Output
|
|
|
|
#================================================
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
add_custom_target( new-docs ${DOXYGEN_EXECUTABLE}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
DEPENDS Doxyfile )
|
|
|
|
else(DOXYGEN_FOUND)
|
|
|
|
message( STATUS "WARNING: Doxygen not found - new-docs (Source Docs) target not created" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2010-12-20 06:06:34 +00:00
|
|
|
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
|
2010-12-19 21:42:55 +00:00
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
#=====<on standby for possible C++ unit testing>================================
|
2010-12-29 20:25:30 +00:00
|
|
|
if( false )
|
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
add_executable( test_dir_lib_source
|
|
|
|
sch_dir_lib_source.cpp
|
|
|
|
)
|
|
|
|
target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
|
2010-12-27 16:49:39 +00:00
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
add_executable( test_sch_part sch_part.cpp )
|
|
|
|
target_link_libraries( test_sch_part ${wxWidgets_LIBRARIES} )
|
2010-12-29 20:25:30 +00:00
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
add_executable( test_lpid
|
|
|
|
sch_lpid.cpp
|
|
|
|
)
|
|
|
|
target_link_libraries( test_lpid ${wxWidgets_LIBRARIES} )
|
2010-12-29 20:25:30 +00:00
|
|
|
|
|
|
|
endif( false )
|
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
#=====</on standby for possible C++ unit testing>===============================
|
|
|
|
|
|
|
|
|
|
|
|
make_lexer(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table.keywords
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_lexer.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_keywords.cpp
|
|
|
|
LT
|
|
|
|
)
|
|
|
|
|
|
|
|
make_lexer(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sweet.keywords
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sweet_lexer.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sweet_keywords.cpp
|
|
|
|
PR
|
|
|
|
)
|
2010-12-29 20:25:30 +00:00
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
add_library( sweet SHARED
|
2010-12-27 21:22:12 +00:00
|
|
|
sch_lib_table.cpp
|
|
|
|
sch_lib_table_keywords.cpp
|
|
|
|
sch_lib.cpp
|
2010-12-29 20:25:30 +00:00
|
|
|
sch_lpid.cpp
|
|
|
|
sch_dir_lib_source.cpp
|
2010-12-30 01:47:14 +00:00
|
|
|
sch_part.cpp
|
|
|
|
sweet_keywords.cpp
|
2010-12-27 21:22:12 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/common/richio.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp
|
|
|
|
)
|
2011-01-17 17:26:19 +00:00
|
|
|
target_link_libraries( sweet ${wxWidgets_LIBRARIES} )
|
2010-12-27 16:49:39 +00:00
|
|
|
|
|
|
|
|
2011-01-17 17:26:19 +00:00
|
|
|
#=====<USE_SWIG>============================================================
|
|
|
|
# if you want a Python scripting layer on top for unit testing or driving.
|
|
|
|
# reference: http://www.swig.org/Doc1.3/Introduction.html#Introduction_build_system
|
|
|
|
|
|
|
|
option( USE_SWIG "Use SWIG to build a python scripting interface (default ON)." ON)
|
|
|
|
if( USE_SWIG )
|
|
|
|
|
|
|
|
find_package( SWIG REQUIRED )
|
|
|
|
include( ${SWIG_USE_FILE} )
|
|
|
|
|
|
|
|
# first install "python-dev" linux package for this:
|
|
|
|
find_package( PythonLibs )
|
|
|
|
include_directories( ${PYTHON_INCLUDE_PATH} )
|
|
|
|
|
|
|
|
set( CMAKE_SWIG_FLAGS "" )
|
|
|
|
|
|
|
|
set_source_files_properties( sweet.i PROPERTIES CPLUSPLUS ON )
|
|
|
|
#set_source_files_properties( sweet.i PROPERTIES SWIG_FLAGS "-includeall" )
|
|
|
|
|
|
|
|
swig_add_module( sweet python sweet.i )
|
|
|
|
swig_link_libraries( sweet ${PYTHON_LIBRARIES} sweet )
|
|
|
|
|
|
|
|
# @todo need a separate interface for each DSNLEXER
|
|
|
|
|
|
|
|
endif()
|
2010-12-30 01:47:14 +00:00
|
|
|
|