[cmake] Enable cmod tools building
parent
b8850a0d03
commit
d652219482
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(cmod)
|
||||
add_subdirectory(stardb)
|
||||
add_subdirectory(xyzv2bin)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
build_cmod_tool(3dstocmod)
|
|
@ -0,0 +1,24 @@
|
|||
macro(build_cmod_tool)
|
||||
if(${ARGC} LESS 1)
|
||||
message(FATAL_ERROR "build_cmod_tool requires at least 1 argument")
|
||||
endif()
|
||||
|
||||
set(__source0 ${ARGV0})
|
||||
set(__sources ${ARGV})
|
||||
list(REMOVE_AT __sources 0 0)
|
||||
|
||||
include_directories("../common")
|
||||
|
||||
add_executable(${__source0} ${__source0}.cpp ${__sources})
|
||||
target_link_libraries(${__source0} celmodel cel3ds cmodcommon)
|
||||
add_dependencies(${__source0} celmodel cel3ds cmodcommon)
|
||||
|
||||
install(TARGETS ${__source0} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endmacro()
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(3dstocmod)
|
||||
add_subdirectory(cmodfix)
|
||||
add_subdirectory(cmodsphere)
|
||||
add_subdirectory(cmodview)
|
||||
add_subdirectory(itokawa)
|
|
@ -0,0 +1 @@
|
|||
build_cmod_tool(cmodfix)
|
|
@ -0,0 +1 @@
|
|||
build_cmod_tool(cmodsphere)
|
|
@ -0,0 +1,22 @@
|
|||
if(NOT ENABLE_QT)
|
||||
message("Qt frontend is disabled, not building cmodview.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
# Homebrew installs Qt5 (up to at least 5.9.1) in
|
||||
# /usr/local/qt5, ensure it can be found by CMake since
|
||||
# it is not in the default /usr/local prefix.
|
||||
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
|
||||
endif()
|
||||
|
||||
set(QT_LIBS Widgets OpenGL)
|
||||
find_package(Qt5 COMPONENTS ${QT_LIBS} CONFIG REQUIRED)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
build_cmod_tool(cmodview glframebuffer.cpp glshader.cpp mainwindow.cpp materialwidget.cpp modelviewwidget.cpp)
|
||||
qt5_use_modules(cmodview ${QT_LIBS})
|
|
@ -0,0 +1,11 @@
|
|||
set(CMODCOMMON_SOURCES
|
||||
cmodops.cpp
|
||||
cmodops.h
|
||||
convert3ds.cpp
|
||||
convert3ds.h
|
||||
convertobj.cpp
|
||||
convertobj.h
|
||||
)
|
||||
|
||||
add_library(cmodcommon STATIC ${CMODCOMMON_SOURCES})
|
||||
cotire(cmodcommon)
|
|
@ -0,0 +1 @@
|
|||
build_cmod_tool(txt2cmod)
|
Loading…
Reference in New Issue