Files
create/src/Main/CMakeLists.txt
Bruce B. Lacey d964187504 Install macOS bundle executables into MacOS
* Previously, the macOS bundle executables were installed into
    bin which does not adhere to Apple guidelines and causes
    issues with certain frameworks like Qt.  The install has
    been refactored to install the executables into MacOS

Fixes #2928
2017-03-01 09:33:28 +01:00

163 lines
3.7 KiB
CMake

#add_defintions(-D_FC_GUI_ENABLED_)
#add_defintions(-DFREECADMAINPY)
if(BUILD_GUI)
include_directories(
${Boost_INCLUDE_DIRS}
${COIN3D_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
)
else(BUILD_GUI)
include_directories(
${Boost_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
)
endif(BUILD_GUI)
######################## FreeCADMain ########################
if(BUILD_GUI)
SET(FreeCAD_SRCS
freecad.rc
icon.ico
MainGui.cpp
)
SET(FreeCAD_LIBS
FreeCADGui
)
if (MSVC AND NOT BUILD_QT5)
list(APPEND FreeCAD_LIBS
${QT_QTMAIN_LIBRARY}
)
endif()
add_executable(FreeCADMain WIN32 ${FreeCAD_SRCS})
target_link_libraries(FreeCADMain ${FreeCAD_LIBS})
SET_BIN_DIR(FreeCADMain FreeCAD)
if(WIN32)
INSTALL(TARGETS FreeCADMain
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
elseif(APPLE)
INSTALL(TARGETS FreeCADMain
RUNTIME DESTINATION MacOS
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
INSTALL(TARGETS FreeCADMain
RUNTIME DESTINATION bin
)
endif()
endif(BUILD_GUI)
######################## FreeCADMainCmd ########################
SET(FreeCADMainCmd_SRCS
MainCmd.cpp
)
add_executable(FreeCADMainCmd ${FreeCADMainCmd_SRCS})
SET(FreeCADMainCmd_LIBS
FreeCADApp
)
if (BUILD_QT5)
list(APPEND FreeCADMainCmd_LIBS
${Qt5Core_LIBRARIES}
${Qt5Xml_LIBRARIES}
)
else()
list(APPEND FreeCADMainCmd_LIBS
${QT_QTCORE_LIBRARY}
${QT_QTXML_LIBRARY}
)
endif()
target_link_libraries(FreeCADMainCmd
${FreeCADMainCmd_LIBS}
)
SET_BIN_DIR(FreeCADMainCmd FreeCADCmd)
if(WIN32)
INSTALL(TARGETS FreeCADMainCmd
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
elseif(APPLE)
INSTALL(TARGETS FreeCADMainCmd
RUNTIME DESTINATION MacOS
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
INSTALL(TARGETS FreeCADMainCmd
RUNTIME DESTINATION bin
)
endif()
######################## FreeCADMainPy ########################
SET(FreeCADMainPy_SRCS
MainPy.cpp
)
add_library(FreeCADMainPy SHARED ${FreeCADMainPy_SRCS})
target_link_libraries(FreeCADMainPy FreeCADApp)
SET_BIN_DIR(FreeCADMainPy FreeCAD)
SET_PYTHON_PREFIX_SUFFIX(FreeCADMainPy)
if(WIN32)
INSTALL(TARGETS FreeCADMainPy
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else(WIN32)
INSTALL(TARGETS FreeCADMainPy
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif(WIN32)
######################## FreeCADGuiPy ########################
if(BUILD_GUI)
SET(FreeCADGuiPy_SRCS
FreeCADGuiPy.cpp
)
add_library(FreeCADGuiPy SHARED ${FreeCADGuiPy_SRCS})
target_link_libraries(FreeCADGuiPy FreeCADGui)
SET_BIN_DIR(FreeCADGuiPy FreeCADGui)
SET_PYTHON_PREFIX_SUFFIX(FreeCADGuiPy)
if(WIN32)
# Name clash with target "FreeCADGui"
# Must be called "FreeCADGuiPy_d" and "FreeCADGuiPy" to work so override default
set_target_properties(FreeCADGuiPy PROPERTIES PDB_NAME_DEBUG "FreeCADGuiPy_d")
set_target_properties(FreeCADGuiPy PROPERTIES PDB_NAME_RELEASE "FreeCADGuiPy")
endif(WIN32)
if(WIN32)
INSTALL(TARGETS FreeCADGuiPy
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else(WIN32)
INSTALL(TARGETS FreeCADGuiPy
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif(WIN32)
endif(BUILD_GUI)