CMakeLists.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. cmake_minimum_required (VERSION 3.5)
  2. project (tree-gen)
  3. set(CMAKE_CXX_STANDARD 14)
  4. set(CMAKE_CXX_STANDARD_REQUIRED on)
  5. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  6. set(CMAKE_BUILD_TYPE "Release")
  7. endif()
  8. set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
  9. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  10. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  11. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  12. # compile flags
  13. if(APPLE)
  14. add_definitions(-Wno-missing-braces)
  15. endif(APPLE)
  16. if(MSVC)
  17. add_definitions(/D_CRT_SECURE_NO_WARNINGS /wd4018 /wd4244 /wd4305 /wd4800 /wd4267)
  18. set(CMAKE_CXX_FLAGS "/EHsc")
  19. endif(MSVC)
  20. add_definitions(-DYGL_OPENGL=1)
  21. find_package(OpenGL REQUIRED)
  22. if(APPLE)
  23. include_directories(/usr/local/include)
  24. link_directories(/usr/local/lib)
  25. find_library(GLFW_LIBRARY NAMES glfw3 glfw PATHS /usr/local/lib)
  26. endif(APPLE)
  27. if(WIN32)
  28. include_directories(${CMAKE_SOURCE_DIR}/apps/w32/include)
  29. link_directories(${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
  30. find_library(GLEW_LIBRARIES NAMES glew32 PATHS ${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
  31. find_library(GLFW_LIBRARY NAMES glfw3dll PATHS ${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
  32. endif(WIN32)
  33. if(UNIX AND NOT APPLE)
  34. include_directories(/usr/include /usr/local/include)
  35. find_library(GLFW_LIBRARY NAMES glfw3 glfw PATHS /usr/lib /usr/local/lib64 /usr/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu)
  36. find_package(GLEW REQUIRED)
  37. endif(UNIX AND NOT APPLE)
  38. add_library(yocto_gl src/yocto/yocto_gl.h src/yocto/yocto_gl.cpp src/yocto/ext/stb_image.cpp src/yocto/ext/nanosvg.cpp src/yocto/ext/imgui/imgui.cpp src/yocto/ext/imgui/imgui_draw.cpp src/yocto/ext/imgui/imgui_impl_glfw_gl3.cpp src/yocto/ext/imgui/imgui_extra_fonts.cpp)
  39. target_link_libraries(yocto_gl ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARY} ${GLEW_LIBRARIES} ${X11_LIBRARIES} X11 Xxf86vm Xrandr GL GLU Xi dl Xinerama rt GLEW m Xcursor)
  40. if(UNIX AND NOT APPLE)
  41. find_package(Threads REQUIRED)
  42. target_link_libraries(yocto_gl Threads::Threads)
  43. endif(UNIX AND NOT APPLE)
  44. add_library(voro++ src/voro++/src/voro++.hh src/voro++/src/c_loops.hh src/voro++/src/cell.hh
  45. src/voro++/src/common.hh src/voro++/src/config.hh src/voro++/src/container.hh
  46. src/voro++/src/container_prd.hh src/voro++/src/rad_option.hh src/voro++/src/pre_container.hh
  47. src/voro++/src/unitcell.hh src/voro++/src/v_base.hh src/voro++/src/v_compute.hh
  48. src/voro++/src/wall.hh src/voro++/src/worklist.hh src/voro++/src/voro++.cc
  49. src/voro++/src/c_loops.cc src/voro++/src/cell.cc src/voro++/src/common.cc
  50. src/voro++/src/container.cc src/voro++/src/container_prd.cc src/voro++/src/pre_container.cc
  51. src/voro++/src/unitcell.cc src/voro++/src/v_base.cc src/voro++/src/v_compute.cc
  52. src/voro++/src/wall.cc)
  53. set_target_properties(voro++ PROPERTIES LINKER_LANGUAGE CXX)
  54. add_executable(tree-gen src/tree-gen.cpp)
  55. target_link_libraries(tree-gen yocto_gl voro++)