kicad/kicad/CMakeLists.txt

152 lines
5.3 KiB
CMake
Raw Normal View History

# .cpp files are compiled with extra ${WSHADOW_FLAGS}
if( COMPILER_SUPPORTS_WSHADOW )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WSHADOW_FLAGS}")
endif()
add_definitions( -DKICAD )
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
../pcbnew
../eeschema
${INC_AFTER}
)
set( KICAD_SRCS
commandframe.cpp
dialogs/dialog_template_selector_base.cpp
dialogs/dialog_template_selector.cpp
files-io.cpp
2018-02-07 13:16:05 +00:00
import_project.cpp
kicad.cpp
mainframe.cpp
2010-02-14 14:59:43 +00:00
menubar.cpp
prjconfig.cpp
project_template.cpp
tree_project_frame.cpp
2018-02-07 13:16:05 +00:00
treeprojectfiles.cpp
treeproject_item.cpp
)
if( MINGW )
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
# KICAD_RESOURCES variable is set by the macro.
mingw_resource_compiler( kicad )
else()
set( KICAD_RESOURCES kicad.rc )
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
endif()
if( APPLE )
set( KICAD_RESOURCES kicad.icns kicad_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/kicad.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/kicad_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE kicad.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad )
set( MACOSX_BUNDLE_NAME kicad )
endif()
add_executable( kicad WIN32 MACOSX_BUNDLE
${KICAD_SRCS}
${KICAD_EXTRA_SRCS}
${KICAD_RESOURCES}
)
if( UNIX )
# for build directory: create kiface symlinks so kicad (exe) can be run in-situ
add_custom_target( kiface_sym_links
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/eeschema/_eeschema.kiface" "${CMAKE_BINARY_DIR}/kicad/_eeschema.kiface"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.kiface" "${CMAKE_BINARY_DIR}/kicad/_pcbnew.kiface"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR}/cvpcb/_cvpcb.kiface" "${CMAKE_BINARY_DIR}/kicad/_cvpcb.kiface"
COMMENT "Making <build-dir>/kicad/<kiface.symlinks>"
)
endif()
if( APPLE )
set_target_properties( kicad PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
target_link_libraries( kicad
common
${wxWidgets_LIBRARIES}
)
else()
target_link_libraries( kicad
common
gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
endif()
install( TARGETS kicad
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
if( APPLE )
# "install( CODE ... )" will launch its own CMake, so no variables from
# this CMake instance are accessible... use helper to transfer
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set( SCRIPTING_HELPER "1" )
else()
set( SCRIPTING_HELPER "0" )
endif()
# make main bundle relocatable
install( CODE "
# find all libs and modules
file( GLOB PLUGINS_KIFACE ${OSX_BUNDLE_INSTALL_KIFACE_DIR}/*.kiface )
file( GLOB_RECURSE PLUGINS_SO ${OSX_BUNDLE_INSTALL_PLUGIN_DIR}/*.so )
set( BUNDLE_FIX_LIBS \${PLUGINS_KIFACE} \${PLUGINS_SO} )
if( ${SCRIPTING_HELPER} )
2015-07-08 17:44:55 +00:00
file( GLOB WXPYTHON_DIR RELATIVE ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR} ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/wx-?.?-osx_cocoa )
file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/*.so )
set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} )
2015-07-08 17:44:55 +00:00
file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/\${WXPYTHON_DIR}/wx/*.so )
set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} )
endif()
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad
\"\${BUNDLE_FIX_LIBS}\"
\"\"
)
" COMPONENT Runtime
)
# move all individual app bundles into main bundle
install( CODE "
# helper function to move a bundle into main bundle
function( move_to_main_bundle bundle_name )
message( STATUS \"Moving \${bundle_name} into main bundle...\" )
file( MAKE_DIRECTORY ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR} )
file( REMOVE_RECURSE ${KICAD_BIN}/\${bundle_name}/${OSX_BUNDLE_LIB_DIR} )
file( RENAME ${KICAD_BIN}/\${bundle_name} ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR}/\${bundle_name} )
execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink \"../../../Frameworks\" \"Frameworks\"
WORKING_DIRECTORY ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_APP_DIR}/\${bundle_name}/Contents
)
# create a top-level link pointing inside main bundle
execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink \"${OSX_BUNDLE_MAIN}/${OSX_BUNDLE_APP_DIR}/\${bundle_name}\" \"\${bundle_name}\"
WORKING_DIRECTORY ${KICAD_BIN}
)
endfunction( move_to_main_bundle )
# move all app bundles
move_to_main_bundle( bitmap2component.app )
move_to_main_bundle( eeschema.app )
move_to_main_bundle( gerbview.app )
move_to_main_bundle( pcb_calculator.app )
move_to_main_bundle( pcbnew.app )
move_to_main_bundle( pl_editor.app )
" COMPONENT Runtime
)
endif()