[PATCH 2/4] cmake: Initial build system

Edward O'Callaghan funfunctor at folklore1984.net
Sun Feb 5 04:59:07 UTC 2017


V.2: squash in,
  cmake: Add docs manpage build target
  cmake: Add install targets
  cmake: Misc fixes

Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
 CMakeLists.txt              | 40 ++++++++++++++++++++++++++++++++++++++++
 doc/CMakeLists.txt          |  3 +++
 src/CMakeLists.txt          |  6 ++++++
 src/app/CMakeLists.txt      | 24 ++++++++++++++++++++++++
 src/lib/CMakeLists.txt      | 28 ++++++++++++++++++++++++++++
 src/lib/asic/CMakeLists.txt | 20 ++++++++++++++++++++
 src/lib/ip/CMakeLists.txt   | 41 +++++++++++++++++++++++++++++++++++++++++
 7 files changed, 162 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 doc/CMakeLists.txt
 create mode 100644 src/CMakeLists.txt
 create mode 100644 src/app/CMakeLists.txt
 create mode 100644 src/lib/CMakeLists.txt
 create mode 100644 src/lib/asic/CMakeLists.txt
 create mode 100644 src/lib/ip/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..bef94fd
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+cmake_minimum_required(VERSION 3.0.1)
+
+project(umr)
+
+SET(MAJOR_VERSION 1)
+SET(MINOR_VERSION 0)
+
+SET(RELEASE_VERSION \"${MAJOR_VERSION}.${MINOR_VERSION}\")
+execute_process(COMMAND  git describe --abbrev=12 --always
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    OUTPUT_VARIABLE GIT_REV
+)
+add_definitions(-DUMR_BUILD_VER=${RELEASE_VERSION})
+add_definitions(-DUMR_BUILD_REV=\"${GIT_REV}\")
+
+# Add local repository for FindXXX.cmake modules.
+SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH})
+
+find_package(Curses REQUIRED)
+include_directories(${CURSES_INCLUDE_DIRS})
+
+find_package(PCIAccess REQUIRED)
+include_directories(${PCIACCESS_INCLUDE_DIR})
+
+set(REQUIRED_EXTERNAL_LIBS
+  ${CURSES_LIBRARIES}
+  ${PCIACCESS_LIBRARIES}
+)
+
+# Global setting: build everything position independent
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+# CFLAGS += -Wall -W -O2 -g3 -Isrc/ -DPIC -fPIC
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -O2 -g3")
+
+add_subdirectory(src)
+add_subdirectory(doc)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..112ad48
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,3 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+install(FILES umr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..e9eaeeb
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
+
+add_subdirectory(lib)
+add_subdirectory(app)
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
new file mode 100644
index 0000000..117d3f1
--- /dev/null
+++ b/src/app/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+project(umr)
+
+#application objects
+add_library(umrapp
+  print.c
+  print_config.c
+  ring_read.c
+  scan.c
+  scan_log.c
+  top.c
+  umr_lookup.c
+  set_bit.c
+  set_reg.c
+  print_waves.c
+  enum.c
+)
+
+add_executable(umr main.c)
+target_link_libraries(umr umrapp)
+target_link_libraries(umr umrcore)
+
+install(TARGETS umr DESTINATION bin)
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
new file mode 100644
index 0000000..46c75d6
--- /dev/null
+++ b/src/lib/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+add_subdirectory(asic)
+add_subdirectory(ip)
+
+add_library(umrcore STATIC
+  bitfield_print.c
+  close_asic.c
+  create_asic_helper.c
+  discover_by_did.c
+  discover_by_name.c
+  discover.c
+  dump_ib.c
+  find_reg.c
+  mmio.c
+  query_drm.c
+  read_sgpr.c
+  read_vram.c
+  ring_decode.c
+  scan_config.c
+  wave_status.c
+  create_mmio_accel.c
+  $<TARGET_OBJECTS:asic> $<TARGET_OBJECTS:ip>
+)
+
+target_link_libraries(umrcore ${REQUIRED_EXTERNAL_LIBS})
+
+install(TARGETS umrcore DESTINATION lib)
diff --git a/src/lib/asic/CMakeLists.txt b/src/lib/asic/CMakeLists.txt
new file mode 100644
index 0000000..6cfec30
--- /dev/null
+++ b/src/lib/asic/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+#library objects (ASICs blocks)
+add_library(asic OBJECT
+  bonaire.c
+  carrizo.c
+  fiji.c
+  hainan.c
+  kaveri.c
+  oland.c
+  pitcairn.c
+  polaris10.c
+  polaris11.c
+  polaris12.c
+  stoney.c
+  tahiti.c
+  tonga.c
+  topaz.c
+  verde.c
+)
diff --git a/src/lib/ip/CMakeLists.txt b/src/lib/ip/CMakeLists.txt
new file mode 100644
index 0000000..2c2fe68
--- /dev/null
+++ b/src/lib/ip/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Copyright 2017 Edward O'Callaghan <funfunctor at folklore1984.net>
+
+add_library(ip OBJECT
+  bif30.c
+  bif41.c
+  bif50.c
+  bif51.c
+  dce100.c
+  dce110.c
+  dce112.c
+  dce60.c
+  dce80.c
+  gfx60.c
+  gfx70.c
+  gfx72.c
+  gfx80.c
+  gfx81.c
+  gmc60.c
+  gmc70.c
+  gmc71.c
+  gmc81.c
+  gmc82.c
+  oss10.c
+  oss20.c
+  oss30.c
+  smu60.c
+  smu700.c
+  smu701.c
+  smu710.c
+  smu711.c
+  smu712.c
+  smu713.c
+  smu80.c
+  uvd40.c
+  uvd42.c
+  uvd5.c
+  uvd6.c
+  vce1.c
+  vce2.c
+  vce3.c
+)
-- 
2.9.3



More information about the amd-gfx mailing list