From 32ee0e5874def51ef6ede0f3778e8d8a5765f828 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 9 Feb 2014 15:20:38 -0600 Subject: [PATCH] cmake updates fox osx. still not building (need qt plugin) --- alethzero/CMakeLists.txt | 107 +++++++++++++------------------------ libethereum/CMakeLists.txt | 8 ++- secp256k1/CMakeLists.txt | 6 ++- 3 files changed, 48 insertions(+), 73 deletions(-) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 9dbe21904..6a34514ac 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -6,6 +6,8 @@ aux_source_directory(. SRC_LIST) include_directories(..) link_directories(../libethereum) +# brew install qt5 libpng +# install X11 (now called XQuartz) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") execute_process( COMMAND brew info qt5 | grep Cellar | awk -F ' ' '{print $1}' @@ -17,20 +19,6 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") find_package(Qt5Widgets REQUIRED) -if(APPLE AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local") - set(CMAKE_INSTALL_PREFIX "./") -endif() - -if(NOT CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]") - add_definitions(-DQT_NO_DEBUG_OUTPUT) - set(CMAKE_BUILD_RELEASE TRUE) -else() - set(CMAKE_BUILD_RELEASE FALSE) -endif() - - -# set(ICONS_DIR "${${PROJECT_NAME}_SOURCE_DIR}/icons") - if(!APPLE) add_executable(alethzero Main.ui ${SRC_LIST}) @@ -39,6 +27,7 @@ if(!APPLE) target_link_libraries(alethzero ethereum) install( TARGETS alethzero RUNTIME DESTINATION bin ) else() + set(CMAKE_INSTALL_PREFIX ./) set(BIN_INSTALL_DIR ".") set(DOC_INSTALL_DIR ".") @@ -48,83 +37,59 @@ else() set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}") - # set(MACOSX_BUNDLE_ICON_FILE "audio-input-microphone.icns") set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}") set(MACOSX_BUNDLE_BUNDLE_NAME "AlethZero") - # set(MACOSX_BUNDLE_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/Resources") - # set(MACOSX_BUNDLE_ICON "${ICONS_DIR}/${MACOSX_BUNDLE_ICON_FILE}") - # execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${MACOSX_BUNDLE_RESOURCES}) - # execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MACOSX_BUNDLE_ICON} ${MACOSX_BUNDLE_RESOURCES}) -# SET(CPACK_GENERATOR "DragNDrop") -# SET(CPACK_DMG_FORMAT "UDBZ") -# SET(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") -# SET(CPACK_SYSTEM_NAME "OSX") -# SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") -# # set(CPACK_PACKAGE_ICON "${ICONS_DIR}/DMG.icns") -# # set(CPACK_DMG_DS_STORE "${ICONS_DIR}/DMGDSStore") -# # set(CPACK_DMG_BACKGROUND_IMAGE "${ICONS_DIR}/DMGBackground.png") -# INCLUDE(CPack) - - set(EXECUTABLE "AlethZero.app") INCLUDE(BundleUtilities) - + ADD_EXECUTABLE( AlethZero MACOSX_BUNDLE Main.ui ${SRC_LIST} ) - set_target_properties(AlethZero PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}//EthereumMacOSXBundleInfo.plist.in") + set_target_properties(AlethZero PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/EthereumMacOSXBundleInfo.plist.in") qt5_wrap_ui(ui_Main.h Main.ui) qt5_use_modules(AlethZero Widgets Network) target_link_libraries(AlethZero ethereum) + # target_link_libraries(ethereum secp256k1 cryptopp) + SET_SOURCE_FILES_PROPERTIES( AlethZero PROPERTIES MACOSX_PACKAGE_LOCATION MacOS ) - - # install( TARGETS AlethZero RUNTIME DESTINATION bin ) - - # fixup_bundle("${EXECUTABLE}" "" "${MACOSX_BUNDLE_RESOURCES}") - - # set(APPS AlethZero) - # install(CODE " - # include(BundleUtilities) - # set(BU_CHMOD_BUNDLE_ITEMS 1) - # fixup_bundle(\"${APPS}\" \"${BUNDLELIBS}\" \"${SEARCHDIRS}\") - # " COMPONENT RUNTIME ) -endif() - + SET_SOURCE_FILES_PROPERTIES( + /usr/local/opt/qt5/plugins/platforms/libqcocoa.dylib + PROPERTIES + MACOSX_PACKAGE_LOCATION PlugIns + ) + # SET_SOURCE_FILES_PROPERTIES(BUNDLELIBS + # ethereum + # secp256k1 + # cryptopp + # ${CRYPTOPP_LIBRARIES} + # # /usr/local/lib/libethereum.a + # # /usr/local/lib/libsecp256k1.0.dylib + # # /usr/local/lib/libminiupnpc.dylib + # # /usr/local/lib/libgmp.dylib + # # /usr/local/lib/libboost_system.dylib + # # /usr/local/lib/libboost_filesystem.dylib + # PROPERTIES + # MACOSX_PACKAGE_LOCATION MacOS + # ) + + set(BUILD_TYPE ${CMAKE_BUILD_TYPE}) + get_filename_component(APP_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} REALPATH) + set(APPS "\${CMAKE_CURRENT_BINARY_DIR}/alethzero/Debug/AlethZero.app") + install(CODE " + include(BundleUtilities) + set(BU_CHMOD_BUNDLE_ITEMS 1) + fixup_bundle(\"${APPS}\" \"${BUNDLELIBS}\" \"\") + " COMPONENT RUNTIME ) +endif() -# if(APPLE) -# set(MY_APP_NAME AlethZero) -# set(MY_APP_VERSION ETH_VERSION) -# set(MACOSX_BUNDLE true) -# set(MACOSX_BUNDLE_BUNDLE_NAME ${MY_APP_NAME}) -# set(MACOSX_BUNDLE_INFO_STRING "${MY_APP_NAME} ${MY_APP_VERSION}") -# set(MACOSX_BUNDLE_LONG_VERSION_STRING "${MY_APP_VERSION}") -# set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MY_APP_VERSION}") -# set(MACOSX_BUNDLE_BUNDLE_VERSION "${MY_APP_VERSION}") -# # set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/${MY_APP_NAME}.icns") -# -# # ADD_EXECUTABLE( -# # alerthzero -# # MACOSX_BUNDLE -# # ) -# -# SET_SOURCE_FILES_PROPERTIES( -# alethzero -# PROPERTIES -# MACOSX_PACKAGE_LOCATION MacOS -# ) -# # SET_SOURCE_FILES_PROPERTIES( -# # PROPERTIES -# # MACOSX_PACKAGE_LOCATION Resources -# # ) -# endif() \ No newline at end of file diff --git a/libethereum/CMakeLists.txt b/libethereum/CMakeLists.txt index 0675439b4..f9bcfe3be 100644 --- a/libethereum/CMakeLists.txt +++ b/libethereum/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_policy(SET CMP0015 NEW) aux_source_directory(. SRC_LIST) -add_library(ethereum ${SRC_LIST}) + +if(NOT APPLE) + add_library(ethereum ${SRC_LIST}) +else() + add_library(ethereum SHARED ${SRC_LIST}) +endif() + file(GLOB HEADERS "*.h") find_package(Threads REQUIRED) diff --git a/secp256k1/CMakeLists.txt b/secp256k1/CMakeLists.txt index d4c6ba548..cabb5f1cb 100644 --- a/secp256k1/CMakeLists.txt +++ b/secp256k1/CMakeLists.txt @@ -3,7 +3,11 @@ cmake_policy(SET CMP0015 NEW) set(CMAKE_ASM_COMPILER "yasm") #aux_source_directory(. SRC_LIST) -add_library(secp256k1 secp256k1.c field_5x52_asm.asm) +if(NOT APPLE) + add_library(secp256k1 secp256k1.c field_5x52_asm.asm) +else() + add_library(secp256k1 SHARED secp256k1.c field_5x52_asm.asm) +endif() #set(CMAKE_C_FLAGS "-DUSE_FIELD_5X52 -DUSE_FIELD_5X52_ASM -DUSE_NUM_OPENSSL -DUSE_FIELD_INV_BUILTIN") #target_link_libraries(secp256k1 crypto)