2022-05-11 23:48:56 +00:00
|
|
|
|
2023-09-26 11:40:17 +00:00
|
|
|
|
|
|
|
set( FONT_SRCS
|
|
|
|
../font/font.cpp
|
|
|
|
../font/glyph.cpp
|
|
|
|
../font/stroke_font.cpp
|
|
|
|
../font/outline_font.cpp
|
|
|
|
../font/outline_decomposer.cpp
|
|
|
|
../font/text_attributes.cpp
|
|
|
|
)
|
|
|
|
|
2022-05-11 23:48:56 +00:00
|
|
|
set( GAL_SRCS
|
|
|
|
# Common part
|
2022-05-13 02:50:33 +00:00
|
|
|
../callback_gal.cpp
|
2023-09-07 00:23:19 +00:00
|
|
|
painter.cpp
|
2022-05-11 23:48:56 +00:00
|
|
|
cursors.cpp
|
|
|
|
dpi_scaling.cpp
|
|
|
|
gal_display_options.cpp
|
|
|
|
graphics_abstraction_layer.cpp
|
|
|
|
hidpi_gl_canvas.cpp
|
2022-06-21 23:38:22 +00:00
|
|
|
hidpi_gl_3D_canvas.cpp
|
2022-05-11 23:48:56 +00:00
|
|
|
|
2023-09-26 11:40:17 +00:00
|
|
|
../view/view.cpp
|
2022-05-11 23:48:56 +00:00
|
|
|
../view/view_controls.cpp
|
2023-09-26 11:40:17 +00:00
|
|
|
../view/view_group.cpp
|
2022-05-11 23:48:56 +00:00
|
|
|
../view/view_overlay.cpp
|
|
|
|
../view/zoom_controller.cpp
|
2023-09-26 11:40:17 +00:00
|
|
|
../view/view_item.cpp
|
|
|
|
|
|
|
|
${FONT_SRCS}
|
2022-05-11 23:48:56 +00:00
|
|
|
|
2023-09-23 23:39:12 +00:00
|
|
|
3d/camera.cpp
|
|
|
|
|
2022-05-11 23:48:56 +00:00
|
|
|
# OpenGL GAL
|
|
|
|
opengl/opengl_gal.cpp
|
|
|
|
opengl/gl_resources.cpp
|
2022-05-13 03:37:29 +00:00
|
|
|
|
2023-09-20 03:06:44 +00:00
|
|
|
opengl/gl_context_mgr.cpp
|
2022-05-11 23:48:56 +00:00
|
|
|
opengl/shader.cpp
|
|
|
|
opengl/vertex_item.cpp
|
|
|
|
opengl/vertex_container.cpp
|
|
|
|
opengl/cached_container.cpp
|
|
|
|
opengl/cached_container_gpu.cpp
|
|
|
|
opengl/cached_container_ram.cpp
|
|
|
|
opengl/noncached_container.cpp
|
|
|
|
opengl/vertex_manager.cpp
|
|
|
|
opengl/gpu_manager.cpp
|
|
|
|
opengl/antialiasing.cpp
|
|
|
|
opengl/opengl_compositor.cpp
|
|
|
|
opengl/utils.cpp
|
|
|
|
|
|
|
|
# Cairo GAL
|
|
|
|
cairo/cairo_gal.cpp
|
|
|
|
cairo/cairo_compositor.cpp
|
|
|
|
cairo/cairo_print.cpp
|
|
|
|
)
|
|
|
|
|
2023-09-26 11:40:17 +00:00
|
|
|
add_library( gal SHARED ${GAL_SRCS} )
|
2022-05-11 23:48:56 +00:00
|
|
|
|
2023-04-07 17:12:43 +00:00
|
|
|
if( WIN32 )
|
|
|
|
# we need the gdiplus library for cairo printing on windows
|
|
|
|
set( GDI_PLUS_LIBRARIES gdiplus )
|
|
|
|
endif()
|
2022-08-24 03:15:11 +00:00
|
|
|
|
2022-05-11 23:48:56 +00:00
|
|
|
target_link_libraries( gal
|
2023-09-15 01:08:05 +00:00
|
|
|
kicommon
|
2022-05-11 23:48:56 +00:00
|
|
|
kimath
|
2023-09-07 00:33:51 +00:00
|
|
|
kiplatform
|
2022-05-11 23:48:56 +00:00
|
|
|
nlohmann_json
|
|
|
|
${GLEW_LIBRARIES}
|
2023-04-07 17:12:43 +00:00
|
|
|
${CAIRO_LIBRARIES}
|
|
|
|
${PIXMAN_LIBRARIES}
|
2022-05-11 23:48:56 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
2023-04-07 17:12:43 +00:00
|
|
|
${GDI_PLUS_LIBRARIES}
|
2022-05-13 02:50:33 +00:00
|
|
|
# outline font support
|
2023-04-07 17:12:43 +00:00
|
|
|
${FREETYPE_LIBRARIES}
|
|
|
|
${HarfBuzz_LIBRARIES}
|
|
|
|
${Fontconfig_LIBRARIES}
|
2022-05-11 23:48:56 +00:00
|
|
|
)
|
2023-09-26 11:40:17 +00:00
|
|
|
|
|
|
|
target_compile_definitions( gal PRIVATE GAL_DLL=1 )
|
|
|
|
|
|
|
|
install( TARGETS gal
|
|
|
|
RUNTIME DESTINATION ${KICAD_LIB}
|
|
|
|
LIBRARY DESTINATION ${KICAD_LIB}
|
|
|
|
COMPONENT binary
|
|
|
|
)
|
|
|
|
|
|
|
|
include( ${KICAD_CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
|
|
|
include( ${KICAD_CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
|
|
|
create_git_version_header(${CMAKE_SOURCE_DIR})
|
|
|
|
|
|
|
|
# Extract the major and minor build version as a string
|
|
|
|
string( REGEX MATCH
|
|
|
|
"([0-9]+)\\.([0-9]+)\\.([0-9]+)"
|
|
|
|
KICAD_MAJOR_MINOR_PATCH_VERSION
|
|
|
|
"${KICAD_VERSION}"
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties( gal PROPERTIES
|
|
|
|
OUTPUT_NAME gal
|
|
|
|
SOVERSION ${KICAD_MAJOR_MINOR_PATCH_VERSION}
|
|
|
|
)
|
|
|
|
|
|
|
|
if( APPLE )
|
|
|
|
# puts library into the main kicad.app bundle in build tree
|
|
|
|
set_target_properties( gal PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
|
|
|
INSTALL_NAME_DIR "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
|
|
|
)
|
|
|
|
set_target_properties( gal PROPERTIES INSTALL_RPATH
|
|
|
|
"@executable_path/../Frameworks" )
|
|
|
|
set_target_properties( gal PROPERTIES BUILD_WITH_INSTALL_RPATH 1 )
|
|
|
|
endif()
|
|
|
|
|
2022-05-13 02:50:33 +00:00
|
|
|
function( add_shader outTarget inFile shaderName )
|
|
|
|
set(outCppName "${shaderName}.cpp")
|
|
|
|
set(outHeaderName "${shaderName}.h")
|
2022-05-11 23:48:56 +00:00
|
|
|
|
2022-05-13 02:50:33 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${outCppName}
|
|
|
|
${CMAKE_BINARY_DIR}/include/gal/shaders/${outHeaderName}
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2022-05-14 15:39:14 +00:00
|
|
|
-DSOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/shaders/${inFile}"
|
|
|
|
-DOUT_CPP_DIR="${CMAKE_CURRENT_BINARY_DIR}/"
|
|
|
|
-DOUT_HEADER_DIR="${CMAKE_BINARY_DIR}/include/gal/shaders/"
|
|
|
|
-DOUT_CPP_FILENAME="${outCppName}"
|
|
|
|
-DOUT_HEADER_FILENAME="${outHeaderName}"
|
|
|
|
-DOUT_VAR_NAME="${shaderName}"
|
2023-01-04 00:12:56 +00:00
|
|
|
-P ${KICAD_CMAKE_MODULE_PATH}/BuildSteps/CreateShaderCpp.cmake
|
2022-05-13 02:50:33 +00:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/shaders/${inFile}
|
2023-01-04 00:12:56 +00:00
|
|
|
${KICAD_CMAKE_MODULE_PATH}/BuildSteps/CreateShaderCpp.cmake
|
2022-05-13 02:50:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_sources( ${outTarget} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${outCppName} )
|
|
|
|
target_include_directories( ${outTarget} PUBLIC ${CMAKE_BINARY_DIR}/include/gal/shaders/ )
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
add_shader( gal kicad_frag.glsl glsl_kicad_frag )
|
2022-05-13 03:37:29 +00:00
|
|
|
add_shader( gal kicad_vert.glsl glsl_kicad_vert )
|
|
|
|
add_shader( gal smaa_base.glsl glsl_smaa_base )
|
|
|
|
add_shader( gal smaa_pass_1_frag_color.glsl glsl_smaa_pass_1_frag_color )
|
|
|
|
add_shader( gal smaa_pass_1_frag_luma.glsl glsl_smaa_pass_1_frag_luma )
|
|
|
|
add_shader( gal smaa_pass_1_vert.glsl glsl_smaa_pass_1_vert )
|
|
|
|
add_shader( gal smaa_pass_2_frag.glsl glsl_smaa_pass_2_frag )
|
|
|
|
add_shader( gal smaa_pass_2_vert.glsl glsl_smaa_pass_2_vert )
|
|
|
|
add_shader( gal smaa_pass_3_frag.glsl glsl_smaa_pass_3_frag )
|
2023-04-07 17:12:43 +00:00
|
|
|
add_shader( gal smaa_pass_3_vert.glsl glsl_smaa_pass_3_vert )
|