diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 522c2c9838..a9e017c5fc 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -388,9 +388,6 @@ set( PCB_COMMON_SRCS ../pcbnew/kicad_plugin.cpp ../pcbnew/gpcb_plugin.cpp ../pcbnew/pcb_netlist.cpp - ../pcbnew/specctra.cpp - ../pcbnew/specctra_export.cpp - ../pcbnew/specctra_keywords.cpp pcb_plot_params_keywords.cpp pcb_keywords.cpp ../pcbnew/pcb_parser.cpp @@ -410,25 +407,6 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} ) add_dependencies( pcbcommon lib-dependencies ) -# auto-generate specctra_lexer.h and specctra_keywords.cpp -make_lexer( - ${PROJECT_SOURCE_DIR}/pcbnew/specctra.keywords - ${PROJECT_SOURCE_DIR}/pcbnew/specctra_lexer.h - ${PROJECT_SOURCE_DIR}/pcbnew/specctra_keywords.cpp - DSN - - # Pass header file with dependency on *_lexer.h as extra_arg - specctra.h - ) - -add_custom_target( - specctra_lexer_source_files ALL - DEPENDS - ${PROJECT_SOURCE_DIR}/pcbnew/specctra_lexer.h - ${PROJECT_SOURCE_DIR}/pcbnew/specctra_keywords.cpp - ) - -add_dependencies( pcbcommon specctra_lexer_source_files ) # auto-generate netlist_lexer.h and netlist_keywords.cpp make_lexer( diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 261d4f4b8b..b466debea7 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -272,6 +272,9 @@ set( PCBNEW_CLASS_SRCS print_board_functions.cpp printout_controler.cpp ratsnest.cpp + specctra.cpp + specctra_export.cpp + specctra_keywords.cpp specctra_import.cpp swap_layers.cpp target_edit.cpp @@ -348,6 +351,25 @@ set( PCBNEW_SCRIPTING_PYTHON_HELPERS ) +# auto-generate specctra_lexer.h and specctra_keywords.cpp +make_lexer( + ${CMAKE_CURRENT_SOURCE_DIR}/specctra.keywords + ${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h + ${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp + DSN + + # Pass header file with dependency on *_lexer.h as extra_arg + specctra.h + ) + +add_custom_target( + specctra_lexer_source_files ALL + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h + ${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp + ) + + if( COMPILER_SUPPORTS_WSHADOW ) # .cpp files are compiled with extra ${WSHADOW_FLAGS}, but not .cxx files set_source_files_properties( @@ -591,6 +613,7 @@ add_library( pcbnew_kiface MODULE ${PCBNEW_COMMON_SRCS} ${PCBNEW_SCRIPTING_SRCS} ) + set_target_properties( pcbnew_kiface PROPERTIES # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface @@ -624,6 +647,7 @@ target_link_libraries( pcbnew_kiface ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${OPENMP_LIBRARIES} ) + set_source_files_properties( pcbnew.cpp PROPERTIES # The KIFACE is in pcbnew.cpp, export it: COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL" @@ -641,6 +665,10 @@ endif() # if building pcbnew, then also build pcbnew_kiface if out of date. add_dependencies( pcbnew pcbnew_kiface ) +# add dependency to specctra_lexer_source_files, to force +# generation of autogenerated file +add_dependencies( pcbnew_kiface specctra_lexer_source_files ) + # these 2 binaries are a matched set, keep them together: if( APPLE ) set_target_properties( pcbnew PROPERTIES