Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ list(REMOVE_ITEM srcs ${include_sources})

add_executable(axpbox ${srcs} src/Main.cpp)
target_include_directories(axpbox PRIVATE src src/base src/gui ${CMAKE_BINARY_DIR}/src)
find_package(Threads REQUIRED)
target_link_libraries(axpbox pthread)

# Configuration options
Expand Down Expand Up @@ -127,6 +128,17 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -DNDEBUG")
endif()

find_package(Git)
if (GIT_FOUND)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=40 --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

set(PACKAGE_GITSHA "\"${GIT_SHA}\"")
endif()

set(PACKAGE ${PROJECT_NAME})
set(PACKAGE_BUGREPORT "[email protected]")
set(PACKAGE_NAME string(TOLOWER ${PROJECT_NAME}))
Expand Down
12 changes: 7 additions & 5 deletions src/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
//
// Created by tglozar on 21.09.20.
//

#include "config.h"
#include <cstring>
#include <iostream>

using namespace std;

int main_sim(int argc, char *argv[]);
int main_cfg(int argc, char *argv[]);

int main(int argc, char **argv) {
if (argc <= 1 || (strcmp(argv[1], "run") && strcmp(argv[1], "configure"))) {
cerr << "AXPBox Alpha Emulator (version 0.1)" << endl
<< "Usage: " << argv[0] << " run|configure <options>" << endl;
std::cerr << "AXPBox Alpha Emulator";
#ifdef PACKAGE_GITSHA
std::cerr << " (commit " << std::string(PACKAGE_GITSHA) << ")";
#endif
std::cerr << std::endl;
std::cerr << "Usage: " << argv[0] << " run|configure <options>" << std::endl;
return 1;
}

Expand Down
4 changes: 4 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@

/* Define to the git revision of this package. */
#cmakedefine PACKAGE_GITSHA @PACKAGE_GITSHA@


/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#cmakedefine PTHREAD_CREATE_JOINABLE @PTHREAD_CREATE_JOINABLE@
Expand Down