summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2019-07-19 12:16:43 -0500
committerJohn Fultz <jfultz@wolfram.com>2019-07-19 12:16:43 -0500
commitf9e9448738a5fae6f50223eb9905fc54fa4d8d1d (patch)
treecee58c30850bf940c9588e25fadcfd1da41eddcc
parent20fa14103552e05540a2943335a220f22766c90b (diff)
First cut of a cmake build.
Building on macOS right now. cmake will soon replace qmake as the supported build system. Some notes about the implementation: * libquackle and libquackleio can be separately built as before. * quacker still links to the static libraries for libquackle and libquackleio, but quacker's cmake file includes those projects, which means everything builds at once. No more need to run separate builds of everything to get a GUI. And debugging is easier now that the libraries are incorporated into the quacker project. * I tried to get cmake to build the macOS app bundle, but cmake is unable, by conventional means, to build a non-flat Resources directory (which many people have complained about). Right now, the default build just builds the binary, and you have to run it from the command-line. But -DBUNDLE=ON will build a shell of a bundle. It won't work, but I intend to create an Xcode project from it for building the bundle, to make it easier for me to deliver a code-signed and notarized app bundle. * I've got CMakeLists.txt files for the resources, but they're not really doing anything right now. Maybe later. * Minimum macOS version for the cmake build is 10.10.
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt77
-rw-r--r--Settings.cmake6
-rw-r--r--data/CMakeLists.txt9
-rw-r--r--data/alphabets/CMakeLists.txt18
-rw-r--r--data/lexica/CMakeLists.txt17
-rw-r--r--data/strategy/CMakeLists.txt5
-rw-r--r--data/themes/CMakeLists.txt5
-rw-r--r--quacker/CMakeLists.txt114
-rw-r--r--quackle.sublime-project2
-rw-r--r--quackleio/CMakeLists.txt47
11 files changed, 300 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index ed743b0..0064b00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
.tags*
.qmake.stash
.vs
+build*
obj
Makefile
Makefile.Debug
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..759f6fc
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,77 @@
+cmake_minimum_required (VERSION 3.10)
+
+project (libquackle)
+
+message("-- Configuring libquackle")
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/Settings.cmake")
+
+set(LIBQUACKLE_SOURCES
+ alphabetparameters.cpp
+ bag.cpp
+ board.cpp
+ boardparameters.cpp
+ bogowinplayer.cpp
+ catchall.cpp
+ clock.cpp
+ computerplayer.cpp
+ computerplayercollection.cpp
+ datamanager.cpp
+ endgame.cpp
+ endgameplayer.cpp
+ enumerator.cpp
+ evaluator.cpp
+ game.cpp
+ gameparameters.cpp
+ generator.cpp
+ lexiconparameters.cpp
+ move.cpp
+ player.cpp
+ playerlist.cpp
+ preendgame.cpp
+ rack.cpp
+ reporter.cpp
+ resolvent.cpp
+ sim.cpp
+ strategyparameters.cpp
+)
+
+set(LIBQUACKLE_HEADERS
+ alphabetparameters.h
+ bag.h
+ board.h
+ boardparameters.h
+ bogowinplayer.h
+ catchall.h
+ clock.h
+ computerplayer.h
+ computerplayercollection.h
+ datamanager.h
+ endgame.h
+ endgameplayer.h
+ enumerator.h
+ evaluator.h
+ fixedstring.h
+ gaddag.h
+ game.h
+ gameparameters.h
+ generator.h
+ lexiconparameters.h
+ move.h
+ player.h
+ playerlist.h
+ preendgame.h
+ rack.h
+ reporter.h
+ resolvent.h
+ sim.h
+ strategyparameters.h
+ uv.h
+)
+
+add_library(libquackle
+ ${LIBQUACKLE_SOURCES} ${LIBQUACKLE_HEADERS}
+)
+
+set_target_properties(libquackle PROPERTIES COMPILE_FLAGS -fsanitize=address)
+set_target_properties(libquackle PROPERTIES LINK_FLAGS -fsanitize=address)
diff --git a/Settings.cmake b/Settings.cmake
new file mode 100644
index 0000000..df21391
--- /dev/null
+++ b/Settings.cmake
@@ -0,0 +1,6 @@
+include_guard()
+
+message("-- Including settings")
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..a69bee2
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory(alphabets)
+add_subdirectory(lexica)
+add_subdirectory(strategy)
+add_subdirectory(themes)
+
+set(DATA_ALPHABETS ${DATA_ALPHABETS} PARENT_SCOPE)
+set(DATA_LEXICA ${DATA_LEXICA} PARENT_SCOPE)
+set(DATA_STRATEGY ${DATA_STRATEGY} PARENT_SCOPE)
+set(DATA_THEMES ${DATA_THEMES} PARENT_SCOPE)
diff --git a/data/alphabets/CMakeLists.txt b/data/alphabets/CMakeLists.txt
new file mode 100644
index 0000000..ae34de5
--- /dev/null
+++ b/data/alphabets/CMakeLists.txt
@@ -0,0 +1,18 @@
+set(DATA_ALPHABETS
+ ${CMAKE_CURRENT_LIST_DIR}/english.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/english_super.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/english_wild.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/french.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/greek.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/korean.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/mandarin.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/norwegian.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/pinyin.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/polish.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/russian.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/swedish.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/turkish.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/tuvan.quackle_alphabet
+ ${CMAKE_CURRENT_LIST_DIR}/zhuyin.quackle_alphabet
+ PARENT_SCOPE
+)
diff --git a/data/lexica/CMakeLists.txt b/data/lexica/CMakeLists.txt
new file mode 100644
index 0000000..efc059b
--- /dev/null
+++ b/data/lexica/CMakeLists.txt
@@ -0,0 +1,17 @@
+set(DATA_LEXICA
+ ${CMAKE_CURRENT_LIST_DIR}/copyrights.txt
+ ${CMAKE_CURRENT_LIST_DIR}/naspa.gif
+
+ ${CMAKE_CURRENT_LIST_DIR}/csw12.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/csw15.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/cswapr07.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/greek.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/korean.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/norwegian.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/ods5.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/osps.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/sowpods.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/turkish.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/twl06.dawg
+ ${CMAKE_CURRENT_LIST_DIR}/twl98.dawg
+)
diff --git a/data/strategy/CMakeLists.txt b/data/strategy/CMakeLists.txt
new file mode 100644
index 0000000..c7c93fc
--- /dev/null
+++ b/data/strategy/CMakeLists.txt
@@ -0,0 +1,5 @@
+file(GLOB DATA_STRATEGY
+ LIST_DIRECTORIES false
+ CONFIGURE_DEPENDS
+ */*
+)
diff --git a/data/themes/CMakeLists.txt b/data/themes/CMakeLists.txt
new file mode 100644
index 0000000..06aa3b1
--- /dev/null
+++ b/data/themes/CMakeLists.txt
@@ -0,0 +1,5 @@
+set(DATA_THEMES
+ ${CMAKE_CURRENT_LIST_DIR}/modern.ini
+ ${CMAKE_CURRENT_LIST_DIR}/plain.ini
+ ${CMAKE_CURRENT_LIST_DIR}/traditional.ini
+)
diff --git a/quacker/CMakeLists.txt b/quacker/CMakeLists.txt
new file mode 100644
index 0000000..f964f22
--- /dev/null
+++ b/quacker/CMakeLists.txt
@@ -0,0 +1,114 @@
+cmake_minimum_required (VERSION 3.10)
+
+project (Quackle VERSION 1.0.4)
+
+message("-- Configuring Quackle")
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../Settings.cmake")
+
+option(BUNDLE "Build app bundle on macOS; does not populate with resources" OFF)
+
+add_subdirectory(.. libquackle)
+add_subdirectory(../quackleio quackleio)
+add_subdirectory(../data data)
+
+find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
+set(CMAKE_AUTOMOC ON)
+
+set(QUACKLE_SOURCES
+ bagdisplay.cpp
+ boarddisplay.cpp
+ boardsetup.cpp
+ boardsetupdialog.cpp
+ brb.cpp
+ configdialog.cpp
+ configpages.cpp
+ dashboard.cpp
+ geometry.cpp
+ graphicalboard.cpp
+ graphicalreporter.cpp
+ history.cpp
+ letterbox.cpp
+ letterboxsettings.cpp
+ lexicondialog.cpp
+ lister.cpp
+ main.cpp
+ movebox.cpp
+ newgame.cpp
+ noteeditor.cpp
+ oppothread.cpp
+ oppothreadprogressbar.cpp
+ quacker.cpp
+ quackersettings.cpp
+ rackdisplay.cpp
+ settings.cpp
+ simviewer.cpp
+ view.cpp
+ widgetfactory.cpp
+)
+
+set(QUACKLE_HEADERS
+ bagdisplay.h
+ boarddisplay.h
+ boardsetup.h
+ boardsetupdialog.h
+ brb.h
+ configdialog.h
+ configpages.h
+ customqsettings.h
+ dashboard.h
+ geometry.h
+ graphicalboard.h
+ graphicalreporter.h
+ history.h
+ letterbox.h
+ letterboxsettings.h
+ lexicondialog.h
+ lister.h
+ movebox.h
+ newgame.h
+ noteeditor.h
+ oppothread.h
+ oppothreadprogressbar.h
+ quacker.h
+ quackersettings.h
+ rackdisplay.h
+ settings.h
+ simviewer.h
+ view.h
+ widgetfactory.h
+)
+
+set(QUACKLE_RESOURCES
+ quacker.icns
+ ${DATA_ALPHABETS}
+)
+
+message( "${QUACKLE_RESOURCES} ${APPLE} $<1:abc>")
+if(APPLE AND BUNDLE)
+ add_executable(Quackle
+ MACOSX_BUNDLE
+ ${QUACKLE_SOURCES} ${QUACKLE_HEADERS} quacker.rc
+ )
+else()
+ add_executable(Quackle
+ ${QUACKLE_SOURCES} ${QUACKLE_HEADERS} quacker.rc
+ )
+endif()
+
+target_link_libraries(Quackle quackleio libquackle)
+target_link_libraries(Quackle Qt5::Core Qt5::Widgets)
+
+if(APPLE)
+ target_link_libraries(Quackle "-framework CoreFoundation")
+ set_target_properties(Quackle PROPERTIES
+ $<$<BOOL:${BUNDLE}>:
+ MACOSX_BUNDLE TRUE
+ RESOURCE "${QUACKLE_RESOURCES}"
+ >
+ )
+endif()
+
+set_target_properties(Quackle PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Quackle.plist")
+set_target_properties(Quackle PROPERTIES COMPILE_FLAGS -fsanitize=address)
+set_target_properties(Quackle PROPERTIES LINK_FLAGS -fsanitize=address)
diff --git a/quackle.sublime-project b/quackle.sublime-project
index 0c4e2c1..300588c 100644
--- a/quackle.sublime-project
+++ b/quackle.sublime-project
@@ -7,7 +7,7 @@
"playabilities.raw", "smaller.raw", ".gitattributes",
"*.Debug", "*.Release", "*.pfx", "*.cer",
"makegaddag", "makeminidawg", "gaddagize", "Makefile", "*.dawg", "*.gaddag"],
- "folder_exclude_patterns" : ["obj", "moc", "build", "*.xcodeproj", "lib",
+ "folder_exclude_patterns" : ["obj", "moc", "build*", "*.xcodeproj", "lib",
"debug", "release", "makeswelexicon", "lisp", "DerivedData"]
}
]
diff --git a/quackleio/CMakeLists.txt b/quackleio/CMakeLists.txt
new file mode 100644
index 0000000..e7d83b5
--- /dev/null
+++ b/quackleio/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required (VERSION 3.10)
+
+project (quackleio)
+
+message("-- Configuring libquackleio")
+
+include("${CMAKE_CURRENT_SOURCE_DIR}/../Settings.cmake")
+
+find_package(Qt5 REQUIRED COMPONENTS Core)
+
+set(QUACKLEIO_SOURCES
+ dawgfactory.cpp
+ dict.cpp
+ dictfactory.cpp
+ dictimplementation.cpp
+ flexiblealphabet.cpp
+ froggetopt.cpp
+ gaddagfactory.cpp
+ gcgio.cpp
+ queenie.cpp
+ streamingreporter.cpp
+ util.cpp
+)
+
+set(QUACKLEIO_HEADERS
+ dawgfactory.h
+ dict.h
+ dictfactory.h
+ dictimplementation.h
+ flexiblealphabet.h
+ froggetopt.h
+ gaddagfactory.h
+ gcgio.h
+ logania.h
+ queenie.h
+ streamingreporter.h
+ util.h
+)
+
+add_library(quackleio
+ ${QUACKLEIO_SOURCES} ${QUACKLEIO_HEADERS}
+)
+target_include_directories(quackleio PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
+target_link_libraries(quackleio Qt5::Core)
+
+set_target_properties(quackleio PROPERTIES COMPILE_FLAGS -fsanitize=address)
+set_target_properties(quackleio PROPERTIES LINK_FLAGS -fsanitize=address)