2015-03-29 00:33:46 +00:00
|
|
|
# global
|
|
|
|
|
2016-02-17 06:22:34 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
include_directories(
|
|
|
|
${OPENGL_INCLUDE_DIR}
|
2016-02-09 15:57:30 +00:00
|
|
|
${PNG_INCLUDE_DIRS}
|
|
|
|
${FREETYPE_INCLUDE_DIRS})
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
link_directories(
|
2016-02-09 15:57:30 +00:00
|
|
|
${PNG_LIBRARY_DIRS}
|
|
|
|
${FREETYPE_LIBRARY_DIRS})
|
2015-03-18 17:02:11 +00:00
|
|
|
|
|
|
|
add_definitions(
|
2015-07-05 05:45:39 +00:00
|
|
|
${PNG_CFLAGS_OTHER})
|
2015-03-18 17:02:11 +00:00
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
include_directories(
|
2016-02-19 10:15:59 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/built
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
if(SPACEWARE_FOUND)
|
|
|
|
include_directories(
|
2016-02-19 10:15:59 +00:00
|
|
|
${SPACEWARE_INCLUDE_DIR})
|
2015-03-29 00:33:46 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(HAVE_SPACEWARE ${SPACEWARE_FOUND})
|
2015-03-18 17:02:11 +00:00
|
|
|
set(HAVE_GTK ${GTKMM_FOUND})
|
2016-02-19 10:15:59 +00:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
# platform utilities
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(util_SOURCES
|
|
|
|
win32/w32util.cpp)
|
|
|
|
else()
|
|
|
|
set(util_SOURCES
|
2015-03-17 15:09:59 +00:00
|
|
|
unix/unixutil.cpp)
|
2015-03-29 00:33:46 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# libslvs
|
|
|
|
|
|
|
|
set(libslvs_SOURCES
|
|
|
|
util.cpp
|
|
|
|
entity.cpp
|
|
|
|
expr.cpp
|
|
|
|
constraint.cpp
|
|
|
|
constrainteq.cpp
|
|
|
|
system.cpp)
|
|
|
|
|
|
|
|
set(libslvs_HEADERS
|
|
|
|
solvespace.h)
|
|
|
|
|
2015-03-18 17:02:11 +00:00
|
|
|
add_library(slvs SHARED
|
2015-03-29 00:33:46 +00:00
|
|
|
${libslvs_SOURCES}
|
|
|
|
${libslvs_HEADERS}
|
|
|
|
${util_SOURCES}
|
|
|
|
lib.cpp)
|
|
|
|
|
|
|
|
target_compile_definitions(slvs
|
|
|
|
PRIVATE -DLIBRARY)
|
|
|
|
|
|
|
|
target_include_directories(slvs
|
2016-02-19 10:15:59 +00:00
|
|
|
PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
set_target_properties(slvs PROPERTIES
|
2016-02-19 10:15:59 +00:00
|
|
|
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/slvs.h
|
2015-03-29 00:33:46 +00:00
|
|
|
VERSION ${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}
|
|
|
|
SOVERSION 1)
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
install(TARGETS slvs
|
2016-02-17 06:22:34 +00:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
2015-03-29 00:33:46 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# generated files
|
|
|
|
|
2015-11-04 03:10:38 +00:00
|
|
|
# `$<TARGET_FILE:tool>` allows us to use binfmt support on Linux
|
|
|
|
# without special-casing anything; running `tool.exe` would succeed
|
|
|
|
# but unlike Windows, Linux does not have the machinery to map
|
|
|
|
# an invocation of `tool` to an executable `tool.exe` in $PATH.
|
|
|
|
|
2016-02-19 10:15:59 +00:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
|
2015-11-04 07:24:59 +00:00
|
|
|
|
2016-02-19 10:15:59 +00:00
|
|
|
file(GLOB icons ${CMAKE_CURRENT_SOURCE_DIR}/icons/*.png)
|
2015-11-04 03:10:38 +00:00
|
|
|
add_custom_command(
|
2016-02-19 10:15:59 +00:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/icons.cpp
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/icons.h
|
2015-11-04 03:10:38 +00:00
|
|
|
COMMAND $<TARGET_FILE:png2c>
|
2016-02-19 10:15:59 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/icons.cpp
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/icons.h
|
2015-11-04 03:10:38 +00:00
|
|
|
${icons}
|
2016-02-19 10:15:59 +00:00
|
|
|
DEPENDS png2c ${icons}
|
|
|
|
VERBATIM)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
2016-02-19 10:15:59 +00:00
|
|
|
file(GLOB chars ${CMAKE_CURRENT_SOURCE_DIR}/fonts/private/*.png)
|
2015-11-04 07:24:59 +00:00
|
|
|
list(SORT chars)
|
|
|
|
add_custom_command(
|
2016-02-19 10:15:59 +00:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/bitmapfont.table.h
|
2015-11-04 07:24:59 +00:00
|
|
|
COMMAND $<TARGET_FILE:unifont2c>
|
2016-02-19 10:15:59 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/bitmapfont.table.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unifont-8.0.01.hex.gz
|
2015-11-04 07:24:59 +00:00
|
|
|
${chars}
|
2016-02-18 05:03:54 +00:00
|
|
|
DEPENDS unifont2c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unifont-8.0.01.hex.gz
|
|
|
|
${chars}
|
2016-02-19 10:15:59 +00:00
|
|
|
VERBATIM)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
2016-02-05 09:28:29 +00:00
|
|
|
add_custom_command(
|
2016-02-19 10:15:59 +00:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
2016-02-05 09:28:29 +00:00
|
|
|
COMMAND $<TARGET_FILE:lff2c>
|
2016-02-18 05:03:54 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unicode.lff.gz
|
|
|
|
DEPENDS lff2c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fonts/unicode.lff.gz
|
2016-02-19 10:15:59 +00:00
|
|
|
VERBATIM)
|
2016-02-05 09:28:29 +00:00
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
set(generated_HEADERS
|
2016-02-05 09:28:29 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/vectorfont.table.h
|
2015-11-04 07:24:59 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/bitmapfont.table.h
|
2015-11-04 03:10:38 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/icons.h)
|
|
|
|
|
|
|
|
set(generated_SOURCES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/icons.cpp)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
# platform dependencies
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(platform_SOURCES
|
2016-04-21 16:59:13 +00:00
|
|
|
win32/w32main.cpp)
|
2015-07-05 05:45:39 +00:00
|
|
|
|
|
|
|
set(platform_LIBRARIES
|
|
|
|
comctl32)
|
2015-03-24 06:45:53 +00:00
|
|
|
elseif(APPLE)
|
|
|
|
add_definitions(
|
|
|
|
-fobjc-arc)
|
|
|
|
|
|
|
|
set(platform_SOURCES
|
|
|
|
cocoa/cocoamain.mm
|
|
|
|
unix/gloffscreen.cpp)
|
|
|
|
|
|
|
|
set(platform_XIBS
|
|
|
|
cocoa/MainMenu.xib
|
|
|
|
cocoa/SaveFormatAccessory.xib)
|
|
|
|
|
|
|
|
set(platform_ICONS
|
|
|
|
cocoa/AppIcon.iconset)
|
|
|
|
|
|
|
|
set(platform_RESOURCES
|
|
|
|
unix/solvespace-48x48.png)
|
|
|
|
|
2015-03-25 00:31:09 +00:00
|
|
|
set(platform_BUNDLED_LIBS
|
2016-04-08 10:23:39 +00:00
|
|
|
${PNG_LIBRARIES}
|
|
|
|
${FREETYPE_LIBRARIES})
|
2015-03-25 00:31:09 +00:00
|
|
|
|
2015-03-24 06:45:53 +00:00
|
|
|
set(platform_LIBRARIES
|
|
|
|
${APPKIT_LIBRARY})
|
2015-03-18 17:02:11 +00:00
|
|
|
elseif(HAVE_GTK)
|
|
|
|
include_directories(
|
|
|
|
${GTKMM_INCLUDE_DIRS}
|
|
|
|
${JSONC_INCLUDE_DIRS}
|
2015-03-20 19:35:04 +00:00
|
|
|
${FONTCONFIG_INCLUDE_DIRS}
|
|
|
|
${GLEW_INCLUDE_DIRS})
|
2015-03-18 17:02:11 +00:00
|
|
|
|
|
|
|
link_directories(
|
|
|
|
${GTKMM_LIBRARY_DIRS}
|
|
|
|
${JSONC_LIBRARY_DIRS}
|
2015-03-20 19:35:04 +00:00
|
|
|
${FONTCONFIG_LIBRARY_DIRS}
|
|
|
|
${GLEW_LIBRARY_DIRS})
|
2015-03-18 17:02:11 +00:00
|
|
|
|
|
|
|
add_definitions(
|
|
|
|
${GTKMM_CFLAGS_OTHER}
|
|
|
|
${JSONC_CFLAGS_OTHER}
|
2015-03-20 19:35:04 +00:00
|
|
|
${FONTCONFIG_CFLAGS_OTHER}
|
|
|
|
${GLEW_CFLAGS_OTHER})
|
2015-03-18 17:02:11 +00:00
|
|
|
|
|
|
|
set(platform_SOURCES
|
2015-03-20 19:35:04 +00:00
|
|
|
gtk/gtkmain.cpp
|
|
|
|
unix/gloffscreen.cpp)
|
2015-03-18 17:02:11 +00:00
|
|
|
|
|
|
|
set(platform_LIBRARIES
|
|
|
|
${GTKMM_LIBRARIES}
|
|
|
|
${JSONC_LIBRARIES}
|
2015-03-20 19:35:04 +00:00
|
|
|
${FONTCONFIG_LIBRARIES}
|
|
|
|
${GLEW_LIBRARIES})
|
2015-03-29 00:33:46 +00:00
|
|
|
endif()
|
|
|
|
|
2015-03-24 06:45:53 +00:00
|
|
|
set(platform_BUNDLED_RESOURCES)
|
|
|
|
|
|
|
|
foreach(xib ${platform_XIBS})
|
|
|
|
get_filename_component(nib ${xib} NAME_WE)
|
|
|
|
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${xib})
|
|
|
|
set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${nib}.nib)
|
|
|
|
list(APPEND platform_BUNDLED_RESOURCES ${target})
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${target}
|
|
|
|
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources
|
|
|
|
COMMAND ibtool --errors --warnings --notices
|
|
|
|
--output-format human-readable-text --compile
|
|
|
|
${target} ${source}
|
|
|
|
COMMENT "Building Interface Builder file ${xib}"
|
2016-02-19 10:15:59 +00:00
|
|
|
DEPENDS ${xib}
|
|
|
|
VERBATIM)
|
2015-03-24 06:45:53 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(icon ${platform_ICONS})
|
|
|
|
get_filename_component(name ${icon} NAME_WE)
|
|
|
|
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${icon})
|
|
|
|
set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${name}.icns)
|
|
|
|
list(APPEND platform_BUNDLED_RESOURCES ${target})
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${target}
|
|
|
|
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources
|
|
|
|
COMMAND iconutil -c icns -o ${target} ${source}
|
|
|
|
COMMENT "Building icon set ${icon}"
|
2016-02-19 10:15:59 +00:00
|
|
|
DEPENDS ${source}
|
|
|
|
VERBATIM)
|
2015-03-24 06:45:53 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(res ${platform_RESOURCES})
|
|
|
|
get_filename_component(name ${res} NAME)
|
|
|
|
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${res})
|
|
|
|
set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${name})
|
|
|
|
list(APPEND platform_BUNDLED_RESOURCES ${target})
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${target}
|
|
|
|
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${source} ${target}
|
|
|
|
COMMENT "Copying resource file ${res}"
|
2016-02-19 10:15:59 +00:00
|
|
|
DEPENDS ${res}
|
|
|
|
VERBATIM)
|
2015-03-24 06:45:53 +00:00
|
|
|
endforeach()
|
|
|
|
|
2015-03-25 00:31:09 +00:00
|
|
|
foreach(lib ${platform_BUNDLED_LIBS})
|
|
|
|
get_filename_component(name ${lib} NAME)
|
|
|
|
set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/MacOS/${name})
|
|
|
|
list(APPEND platform_BUNDLED_RESOURCES ${target})
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${target}
|
|
|
|
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${target}
|
|
|
|
COMMENT "Bundling shared library ${lib}"
|
2016-02-19 10:15:59 +00:00
|
|
|
DEPENDS ${lib}
|
|
|
|
VERBATIM)
|
2015-03-25 00:31:09 +00:00
|
|
|
endforeach()
|
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
# solvespace executable
|
|
|
|
|
|
|
|
set(solvespace_HEADERS
|
|
|
|
config.h
|
|
|
|
dsc.h
|
|
|
|
expr.h
|
|
|
|
polygon.h
|
|
|
|
sketch.h
|
|
|
|
solvespace.h
|
|
|
|
ui.h
|
|
|
|
srf/surface.h)
|
|
|
|
|
|
|
|
set(solvespace_SOURCES
|
|
|
|
bsp.cpp
|
|
|
|
clipboard.cpp
|
|
|
|
confscreen.cpp
|
|
|
|
constraint.cpp
|
|
|
|
constrainteq.cpp
|
|
|
|
describescreen.cpp
|
|
|
|
draw.cpp
|
|
|
|
drawconstraint.cpp
|
|
|
|
drawentity.cpp
|
|
|
|
entity.cpp
|
|
|
|
export.cpp
|
|
|
|
exportstep.cpp
|
|
|
|
exportvector.cpp
|
|
|
|
expr.cpp
|
|
|
|
file.cpp
|
|
|
|
generate.cpp
|
|
|
|
glhelper.cpp
|
|
|
|
graphicswin.cpp
|
|
|
|
group.cpp
|
|
|
|
groupmesh.cpp
|
2016-04-13 08:43:06 +00:00
|
|
|
importdxf.cpp
|
2015-03-29 00:33:46 +00:00
|
|
|
mesh.cpp
|
|
|
|
modify.cpp
|
|
|
|
mouse.cpp
|
|
|
|
polygon.cpp
|
Implement a resource system.
Currently, icons, fonts, etc are converted to C structures at compile
time and are hardcoded to the binary. This presents several problems:
* Cross-compilation is complicated. Right now, it is necessary
to be able to run executables for the target platform; this
happens to work with wine-binfmt installed, but is rather ugly.
* Icons can only have one resolution. On OS X, modern software is
expected to take advantage of high-DPI ("Retina") screens and
use so-called @2x assets when ran in high-DPI mode.
* Localization is complicated. Win32 and OS X provide built-in
support for loading the resource appropriate for the user's
locale.
* Embedding strings can only be done as raw strings, using C++'s
R"(...)" literals. This precludes embedding sizable strings,
e.g. JavaScript libraries as used in Three.js export, and makes
git history less useful. Not embedding the libraries means we
have to rely on external CDNs, which requires an Internet
connection and adds a glaring point of failure.
* Linux distribution guidelines are violated. All architecture-
independent data, especially large data such as fonts, is
expected to be in /usr/share, not in the binary.
* Customization is impossible without recompilation. Minor
modifications like adding a few missing vector font characters
or adjusting localization require a complete development
environment, which is unreasonable to expect from users of
a mechanical CAD.
As such, this commit adds a resource system that bundles (and
sometimes builds) resources with the executable. Where they go is
platform-dependent:
* on Win32: into resources of the executable, which allows us to
keep distributing one file;
* on OS X: into the app bundle;
* on other *nix: into /usr/share/solvespace/ or ../res/ (relative
to the executable path), the latter allowing us to run freshly
built executables without installation.
It also subsides the platform-specific resources that are in src/.
The resource system is not yet used for anything; this will be added
in later commits.
2016-04-21 15:54:18 +00:00
|
|
|
resource.cpp
|
2015-03-29 00:33:46 +00:00
|
|
|
request.cpp
|
|
|
|
solvespace.cpp
|
|
|
|
style.cpp
|
|
|
|
system.cpp
|
|
|
|
textscreens.cpp
|
|
|
|
textwin.cpp
|
|
|
|
toolbar.cpp
|
|
|
|
ttf.cpp
|
|
|
|
undoredo.cpp
|
|
|
|
util.cpp
|
|
|
|
view.cpp
|
|
|
|
srf/boolean.cpp
|
|
|
|
srf/curve.cpp
|
|
|
|
srf/merge.cpp
|
|
|
|
srf/ratpoly.cpp
|
|
|
|
srf/raycast.cpp
|
|
|
|
srf/surface.cpp
|
|
|
|
srf/surfinter.cpp
|
|
|
|
srf/triangulate.cpp)
|
|
|
|
|
2015-03-24 06:45:53 +00:00
|
|
|
add_executable(solvespace WIN32 MACOSX_BUNDLE
|
2015-03-29 00:33:46 +00:00
|
|
|
${libslvs_HEADERS}
|
|
|
|
${libslvs_SOURCES}
|
|
|
|
${util_SOURCES}
|
|
|
|
${platform_SOURCES}
|
2015-03-24 06:45:53 +00:00
|
|
|
${platform_BUNDLED_RESOURCES}
|
2015-11-04 03:10:38 +00:00
|
|
|
${generated_SOURCES}
|
2015-03-29 00:33:46 +00:00
|
|
|
${generated_HEADERS}
|
|
|
|
${solvespace_HEADERS}
|
Implement a resource system.
Currently, icons, fonts, etc are converted to C structures at compile
time and are hardcoded to the binary. This presents several problems:
* Cross-compilation is complicated. Right now, it is necessary
to be able to run executables for the target platform; this
happens to work with wine-binfmt installed, but is rather ugly.
* Icons can only have one resolution. On OS X, modern software is
expected to take advantage of high-DPI ("Retina") screens and
use so-called @2x assets when ran in high-DPI mode.
* Localization is complicated. Win32 and OS X provide built-in
support for loading the resource appropriate for the user's
locale.
* Embedding strings can only be done as raw strings, using C++'s
R"(...)" literals. This precludes embedding sizable strings,
e.g. JavaScript libraries as used in Three.js export, and makes
git history less useful. Not embedding the libraries means we
have to rely on external CDNs, which requires an Internet
connection and adds a glaring point of failure.
* Linux distribution guidelines are violated. All architecture-
independent data, especially large data such as fonts, is
expected to be in /usr/share, not in the binary.
* Customization is impossible without recompilation. Minor
modifications like adding a few missing vector font characters
or adjusting localization require a complete development
environment, which is unreasonable to expect from users of
a mechanical CAD.
As such, this commit adds a resource system that bundles (and
sometimes builds) resources with the executable. Where they go is
platform-dependent:
* on Win32: into resources of the executable, which allows us to
keep distributing one file;
* on OS X: into the app bundle;
* on other *nix: into /usr/share/solvespace/ or ../res/ (relative
to the executable path), the latter allowing us to run freshly
built executables without installation.
It also subsides the platform-specific resources that are in src/.
The resource system is not yet used for anything; this will be added
in later commits.
2016-04-21 15:54:18 +00:00
|
|
|
${solvespace_SOURCES}
|
|
|
|
$<TARGET_PROPERTY:resources,EXTRA_SOURCES>)
|
|
|
|
|
|
|
|
add_dependencies(solvespace
|
|
|
|
resources)
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
target_link_libraries(solvespace
|
2015-11-03 19:05:20 +00:00
|
|
|
dxfrw
|
2016-02-19 10:15:59 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
${PNG_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${FREETYPE_LIBRARIES}
|
|
|
|
${platform_LIBRARIES})
|
2015-03-29 00:33:46 +00:00
|
|
|
|
2015-07-05 05:45:39 +00:00
|
|
|
if(WIN32 AND NOT MINGW)
|
2015-03-29 00:33:46 +00:00
|
|
|
set_target_properties(solvespace PROPERTIES
|
|
|
|
LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(SPACEWARE_FOUND)
|
|
|
|
target_link_libraries(solvespace
|
2016-02-19 10:15:59 +00:00
|
|
|
${SPACEWARE_LIBRARIES})
|
2015-03-29 00:33:46 +00:00
|
|
|
endif()
|
|
|
|
|
2015-03-25 00:31:09 +00:00
|
|
|
if(APPLE)
|
|
|
|
set(fixups)
|
|
|
|
foreach(lib ${platform_BUNDLED_LIBS})
|
2016-01-10 05:20:13 +00:00
|
|
|
get_filename_component(name ${lib} NAME)
|
2015-03-25 00:31:09 +00:00
|
|
|
execute_process(COMMAND otool -XD ${lib}
|
|
|
|
OUTPUT_VARIABLE canonical_lib OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
add_custom_command(TARGET solvespace POST_BUILD
|
2016-02-19 10:15:59 +00:00
|
|
|
COMMAND install_name_tool -change ${canonical_lib} @executable_path/${name}
|
2015-03-25 00:31:09 +00:00
|
|
|
$<TARGET_FILE:solvespace>
|
2016-02-19 10:15:59 +00:00
|
|
|
COMMENT "Fixing up rpath for dylib ${name}"
|
|
|
|
VERBATIM)
|
2015-03-25 00:31:09 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(bundle solvespace)
|
|
|
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${bundle}.dmg
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/${bundle}.dmg
|
|
|
|
COMMAND hdiutil create -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${bundle}.app
|
|
|
|
${CMAKE_BINARY_DIR}/${bundle}.dmg
|
|
|
|
DEPENDS $<TARGET_FILE:${bundle}>
|
2016-02-19 10:15:59 +00:00
|
|
|
COMMENT "Building ${bundle}.dmg"
|
|
|
|
VERBATIM)
|
2015-03-25 00:31:09 +00:00
|
|
|
|
|
|
|
add_custom_target(${bundle}-dmg ALL
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/${bundle}.dmg)
|
|
|
|
endif()
|
|
|
|
|
2016-02-17 06:22:34 +00:00
|
|
|
if(NOT WIN32)
|
|
|
|
install(TARGETS solvespace
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
BUNDLE DESTINATION .)
|
|
|
|
endif()
|
2015-03-29 00:33:46 +00:00
|
|
|
|
|
|
|
# valgrind
|
|
|
|
|
|
|
|
add_custom_target(solvespace-valgrind
|
|
|
|
valgrind
|
|
|
|
--tool=memcheck
|
|
|
|
--verbose
|
|
|
|
--track-fds=yes
|
|
|
|
--log-file=vg.%p.out
|
|
|
|
--num-callers=50
|
|
|
|
--error-limit=no
|
|
|
|
--read-var-info=yes
|
|
|
|
--leak-check=full
|
|
|
|
--leak-resolution=high
|
|
|
|
--show-reachable=yes
|
|
|
|
--track-origins=yes
|
|
|
|
--malloc-fill=0xac
|
|
|
|
--free-fill=0xde
|
|
|
|
$<TARGET_FILE:solvespace>)
|