写文章
 找回密码
 立即注册
搜索
0赞
赞赏
手机版
扫码打开手机版
把文字装进口袋

amcax-daemon中cmake报错

jpjpsnow 2024-2-7 15:57:18
本帖最后由 jpjpsnow 于 2024-2-7 16:16 编辑


                               
登录/注册后可看大图
这几个变量找不到,请问该如何处理


内核库文件夹有debug和release目录,有exp和lib文件:AMCAXKernel.exp  AMCAXKernel.lib



1111111.png
您需要登录后才可以回帖 立即登录
内核库里面也有debug和release文件夹
2024-2-7 16:13:07
本帖最后由 Ray 于 2024-3-1 16:33 编辑

您好,cmakelists.txt需要更改一下,请使用如下的cmakelist.txt,注意调整相应的路径(qt和amcax内核库)

cmake_minimum_required(VERSION 3.5)
project(AmcaxDaemon VERSION 1.0.0.2)
set(CMAKE_CXX_STANDARD 17)

configure_file(./Resources/Version.rc.in ./Resources/Version.rc)

if (MSVC)
    add_compile_options(/utf-8)
    add_compile_options(/bigobj)
endif()

if(DEFINED CMAKE_PREFIX_PATH)
    message("CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
elseif(DEFINED ENV{CMAKE_PREFIX_PATH})
    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
    message("CMAKE_PREFIX_PATH not defined, set to env: ${CMAKE_PREFIX_PATH}")
else()
    set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\")
    message("CMAKE_PREFIX_PATH not defined, set to default: ${CMAKE_PREFIX_PATH}")
endif()

#Turn on automoc/autouic, must have
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

#find depended qt libraries
find_package(Qt5 COMPONENTS Widgets Core Gui OpenGL REQUIRED)

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};AMCAX)
set(AMCAX_DLL_PATH "AMCAX/bin/<CONFIG>")

find_package(AMCAXCommon REQUIRED)
find_package(AMCAXPart REQUIRED)
find_package(AMCAXStep REQUIRED)

link_libraries(AMCAXCommon AMCAXPart AMCAXStep)


qt5_add_resources(QRC_FILES Resources/Resource.qrc)


FILE(GLOB Command_File "Src/Command/*.cpp" "Src/Command/*.h")

FILE(GLOB Core_FILE "Src/Core/*.cpp" "Src/Core/*.h")

FILE(GLOB Object_FILE "Src/Object/*.cpp" "Src/Object/*.h")

FILE(GLOB ObjectDraw_FILE "Src/ObjectDraw/*.cpp" "Src/ObjectDraw/*.h")

FILE(GLOB Operate_FILE "Src/Operation/*.cpp" "Src/Operation/*.h")

FILE(GLOB Windows_FILE "Src/Windows/*.cpp" "Src/Windows/*.h")

FILE(GLOB QGLViewer_FILE "Src/Windows/QGLViewer/*.cpp" "Src/Windows/QGLViewer/*.h")

FILE(GLOB Record_FILE "Src/Record/*.h" "Src/Record/*.cpp")

FILE(GLOB Utils_FILE "Src/Utils/*.h" "Src/Utils/*.cpp")

FILE(GLOB WIN32_RESOURCE_FILE "Resources/Version.rc")

add_compile_definitions(NOMINMAX)
add_compile_definitions(_USE_MATH_DEFINES)


add_executable(${PROJECT_NAME}  
    ${QRC_FILES}
    ${Command_FILE}
    ${Core_FILE}
    ${Object_FILE}
    ${ObjectDraw_FILE}
    ${Operate_FILE}
    ${Windows_FILE}
    ${QGLViewer_FILE}
    ${Record_FILE}
    ${Utils_FILE}
    "Src/Main.cpp")

source_group(Command FILES ${Command_FILE})
source_group(Core FILES ${Core_FILE})
source_group(Object FILES ${Object_FILE})
source_group(ObjectDraw FILES ${ObjectDraw_FILE})
source_group(Operate FILES ${Operate_FILE})
source_group(Widgets FILES ${Windows_FILE})
source_group(QGLViewer FILES ${QGLViewer_FILE})
source_group(Record FILES ${Record_FILE})
source_group(Utils FILES ${Utils_FILE})

target_sources(${PROJECT_NAME} PRIVATE ${WIN32_RESOURCE_FILE})


target_link_libraries(${PROJECT_NAME}
    Qt5::Widgets
    Qt5::Core
    Qt5::Gui
    Qt5::OpenGL
    opengl32
    glu32
)

message("CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")

#copy AMCAX library to output path
file(GLOB_RECURSE dll_files ${AMCAX_DLL_PATH}/*.dll)
foreach(dll_file ${dll_files})
    get_filename_component(dll_filename ${dll_file} NAME)
    add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
                       COMMAND ${CMAKE_COMMAND} -E copy_if_different
                                 ${dll_file}
                                 ${CMAKE_BINARY_DIR}/${dll_filename}
                       BYPRODUCTS ${CMAKE_BINARY_DIR}/${dll_filename})
endforeach()
Ray
2024-2-20 14:23
请到官网amcax.net上申请下载 
高山隐者
2024-2-20 10:51
没有用到最新版,用的之前比较老的版本,请问怎么获得最新版呢? 
Ray
2024-2-20 09:12
请问一下您用的是3.5.1的最新版么? 
jpjpsnow
2024-2-19 14:54
好的,谢谢,用了这个新的又提示找不到AMCAXCommon,是不是内核版本不对啊? 
2024-2-12 10:27:57
CMake Error at C:\Users\xxx\Documents\GitHub\amcax-daemon\CMakeLists.txt:34 (find_package):
  By not providing "FindAMCAXCommon.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "AMCAXCommon", but CMake did not find one.

  Could not find a package configuration file provided by "AMCAXCommon" with
  any of the following names:

    AMCAXCommonConfig.cmake
    amcaxcommon-config.cmake

  Add the installation prefix of "AMCAXCommon" to CMAKE_PREFIX_PATH or set
  "AMCAXCommon_DIR" to a directory containing one of the above files.  If
  "AMCAXCommon" provides a separate development package or SDK, be sure it
  has been installed.        AmcaxDaemon        C:\Users\xxx\Documents\GitHub\amcax-daemon\CMakeLists.txt        34     
Ray
2024-3-1 16:35
另外,如果您是完全按照github上的目录结构安排的话,应该是需要调整一下CMakeLists.txt中的CMAKE_PREFIX_PATH和AMCAX路径的设置,我刚才重新改写了一下。 
Ray
2024-2-29 11:41
检查一下这一行: set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};../AMCAX) 在后面添加一行 message("CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") 看看CMAKE_PREFIX_PATH是否包含AMCAX路径  
jpjpsnow
2024-2-27 16:02
用了最新的内核包和cmake文件,还是报错 :( 
2024-2-27 16:01:45
主题数5
返回顶部