-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from chuma/CMakeBuild-clean
C make build clean The executable is in CMake directory (as opposed to the Readme)
- Loading branch information
Showing
22 changed files
with
863 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
|
||
project(einstein) | ||
|
||
set(INCLUDEPKGS TestBigEndian FindPkgConfig CheckLibraryExists) | ||
foreach(pname IN LISTS INCLUDEPKGS) | ||
include(${pname}) | ||
endforeach() | ||
|
||
option(portaudio "PortAudio output support" OFF) | ||
option(nativeportaudio "PortAudio (native library) support" OFF) | ||
option(pulseaudio "PulseAudio output support" ON) | ||
option(armlejit "Use ARMLE JIT" OFF) | ||
option(appX11 "X11+CLI application" ON) | ||
option(appFLTK "FLTK application" OFF) | ||
|
||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}) | ||
|
||
# Release / Debug compile flags. | ||
set(_FLAGS_DEBUG "-g -O0 -DDEBUG -DDEBUG_SOUND -DPA_ENABLE_DEBUG_OUTPUT -DHAS_C99_LONGLONG") | ||
set(_FLAGS_RELEASE "-O3 -DRELEASE -DHAS_C99_LONGLONG") | ||
|
||
set(CMAKE_CXX_FLAGS_RELEASE "${_FLAGS_RELEASE}") | ||
set(CMAKE_C_FLAGS_RELEASE "${_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${_FLAGS_DEBUG}") | ||
set(CMAKE_C_FLAGS_DEBUG "${_FLAGS_DEBUG}") | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES GNU) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wwrite-strings -Wno-multichar -Wfloat-equal -Wshadow -Wpointer-arith -Wconversion") | ||
endif() | ||
|
||
set(LINKLIBS) | ||
|
||
find_library(M_LIB m) | ||
list(APPEND LINKLIBS ${M_LIB}) | ||
|
||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
|
||
set(CMAKE_THREAD_PREFER_PTHREAD) | ||
find_package(Threads) | ||
if (Threads_FOUND) | ||
list(APPEND LINKLIBS pthread) | ||
else() | ||
message(FATAL_ERROR "Missing library: pthread") | ||
endif() | ||
|
||
|
||
find_library(FFI_LIB ffi) | ||
find_library(DL_LIB dl) | ||
list(APPEND LINKLIBS ${DL_LIB} ${PTHREAD_LIB} ${FFI_LIB}) | ||
endif() | ||
|
||
TEST_BIG_ENDIAN(_IS_BIG_ENDIAN) | ||
add_definitions(-DTARGET_RT_BIG_ENDIAN=$<BOOL:${_IS_BIG_ENDIAN}> -DTARGET_RT_LITTLE_ENDIAN=$<NOT:${_IS_BIG_ENDIAN}>) | ||
|
||
# K Libs | ||
add_subdirectory(K) | ||
|
||
########################### | ||
# Einstein library code | ||
|
||
## 1) Gather all common sources | ||
|
||
file(GLOB elib_common_sources "Emulator/*.cp") | ||
# file(GLOB elib_Monitor_sources "Monitor/*.cp") | ||
|
||
set_source_files_properties(${elib_common_sources} PROPERTIES LANGUAGE CXX) | ||
# set_source_files_properties(${elib_Monitor_sources} PROPERTIES LANGUAGE CXX) | ||
|
||
# Add "einsteinlib" as a library target | ||
add_library(einsteinlib STATIC ${elib_common_sources}) | ||
|
||
# add include directories ... do I need this? | ||
target_include_directories(einsteinlib PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:einsteinlib> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/Emulator | ||
$<INSTALL_INTERFACE:einsteinlib>/Emulator | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/Emulator/JIT/Generic | ||
$<INSTALL_INTERFACE:einsteinlib>/Emulator/JIT/Generic | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/Monitor/ | ||
$<INSTALL_INTERFACE:einsteinlib>/Monitor/ | ||
) | ||
|
||
# Platform-specific stuff | ||
if(${WIN32}) | ||
target_sources(einsteinlib PUBLIC "Emulator/Win32/CompatibilityWin32.cp") | ||
set(EINSTEIN_TARGET "WIN32") | ||
set(EINSTEIN_SCREEN_MANAGER "FL") | ||
|
||
target_include_directories(einsteinlib PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/Emulator/Win32 | ||
$<INSTALL_INTERFACE:einsteinlib>/Emulator/Win32 | ||
) | ||
set_source_files_properties("Emulator/Win32/CompatibilityWin32.cp" PROPERTIES LANGUAGE CXX) | ||
elseif(${UNIX}) | ||
|
||
if (${APPLE}) | ||
# FIXME OS X is called OPENSTEP ... | ||
set(EINSTEIN_TARGET "OPENSTEP") | ||
# FIXME add OS X sources here. | ||
set(EINSTEIN_SCREEN_MANAGER "Cocoa") | ||
else() | ||
if (appX11) | ||
set(EINSTEIN_SCREEN_MANAGER "X11") | ||
endif() | ||
|
||
if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "BSD") | ||
set(EINSTEIN_TARGET "BSD") | ||
|
||
else() | ||
set(EINSTEIN_TARGET "LINUX") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
add_definitions(-DTARGET_OS_${EINSTEIN_TARGET}) | ||
|
||
if (portaudio OR nativeportaudio) | ||
add_definitions("-DAUDIO_PORTAUDIO=1") | ||
endif() | ||
|
||
if (pulseaudio) | ||
add_definitions("-DAUDIO_PULSEAUDIO=1") | ||
endif() | ||
|
||
# Add the Emulator/ sub-dir, which has CMakeLists all the way down | ||
add_subdirectory(Emulator) | ||
add_subdirectory(Monitor) | ||
|
||
install(TARGETS einsteinlib DESTINATION lib/${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}) | ||
|
||
target_link_libraries(einsteinlib monitor files host jit log nativecalls network pcmcia platform rom screen serial sound ${LINKLIBS} k) | ||
|
||
|
||
############################ | ||
# EINSTEIN EMULATOR | ||
add_executable(einstein app/einstein.cp app/TCLIApp.cp) | ||
|
||
install(TARGETS einstein | ||
DESTINATION bin/${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}) | ||
|
||
set_source_files_properties(app/einstein.cp app/TCLIApp.cp PROPERTIES LANGUAGE CXX) | ||
target_link_libraries(einstein k einsteinlib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Emulator CMakeLists.txt | ||
|
||
add_subdirectory(Files) | ||
add_subdirectory(Host) | ||
add_subdirectory(JIT) | ||
add_subdirectory(Log) | ||
add_subdirectory(NativeCalls) | ||
add_subdirectory(Network) | ||
add_subdirectory(PCMCIA) | ||
add_subdirectory(Platform) | ||
add_subdirectory(ROM) | ||
add_subdirectory(Screen) | ||
add_subdirectory(Serial) | ||
add_subdirectory(Sound) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Files CMakeLists.txt | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(files STATIC ${sources}) | ||
target_include_directories(files PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic | ||
../../ | ||
) | ||
|
||
target_link_libraries(files k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Host CMakeLists | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(host STATIC ${sources}) | ||
target_include_directories(host PUBLIC | ||
../ | ||
../../ | ||
) | ||
|
||
target_link_libraries(host k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# JIT CMakeLists.txt | ||
|
||
set(elib_JIT_sources | ||
"TJITCache.cp" | ||
"TJITPage.cp" | ||
#"Generic/TJITGenericRetarget.cp" | ||
#"Generic/TJITGenericRetargetMap.cpp" | ||
"Generic/TJITGenericROMPatch.cp" | ||
"Generic/TJITGeneric_BlockDataTransfer.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_MRS.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_ArithmeticOp.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_LogicalOp.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_MRS.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_MSR.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_MoveOp.cp" | ||
"Generic/TJITGeneric_DataProcessingPSRTransfer_TestOp.cp" | ||
"Generic/TJITGeneric_Multiply.cp" | ||
"Generic/TJITGeneric_MultiplyAndAccumulate.cp" | ||
"Generic/TJITGeneric_Other.cp" | ||
"Generic/TJITGeneric_SingleDataSwap.cp" | ||
"Generic/TJITGeneric_SingleDataTransfer.cp" | ||
"Generic/TJITGeneric_Other.cp" | ||
"Generic/TJITGeneric_Test.cp" | ||
) | ||
|
||
set(elib_jit_generic_sources | ||
"Generic/TJITGeneric.cp" | ||
"Generic/TJITGenericPage.cp" | ||
) | ||
|
||
set(elib_jit_armle_sources | ||
"ARMLE/TJITARMLE.cp" | ||
"ARMLE/TJITARMLEPage.cp" | ||
"ARMLE/JITARMLEGlue.s" | ||
) | ||
|
||
if(armlejit) | ||
set(elib_JIT_sources ${elib_JIT_sources} ${elib_jit_armle_sources}) | ||
else() | ||
set(elib_JIT_sources ${elib_JIT_sources} ${elib_jit_generic_sources}) | ||
endif() | ||
|
||
set_source_files_properties(${elib_JIT_sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(jit STATIC ${elib_JIT_sources}) | ||
|
||
target_include_directories(jit PUBLIC | ||
Generic/ | ||
../ | ||
../JIT | ||
../JIT/Generic | ||
../ROM | ||
../../ | ||
../../Monitor | ||
) | ||
|
||
target_link_libraries(jit k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Log CMakeLists | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(log STATIC ${sources}) | ||
target_include_directories(log PUBLIC | ||
../ | ||
../../ | ||
) | ||
|
||
target_link_libraries(log k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# NativeCalls CMakeLists | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(nativecalls STATIC ${sources}) | ||
target_include_directories(nativecalls PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic/ | ||
../../ | ||
) | ||
|
||
target_link_libraries(nativecalls k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Network CMakeLists.txt | ||
|
||
# Only this one compiles for now ... | ||
set(sources TNetworkManager.cp TUsermodeNetwork.cp) | ||
|
||
# TODO virtual serial port | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(network STATIC ${sources}) | ||
|
||
target_include_directories(network PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic | ||
../../ | ||
) | ||
|
||
target_link_libraries(network k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# CMakeLists.txt | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(pcmcia STATIC ${sources}) | ||
target_include_directories(pcmcia PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic | ||
../../ | ||
) | ||
|
||
target_link_libraries(pcmcia k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Platform CMakeLists | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(platform STATIC ${sources}) | ||
target_include_directories(platform PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic | ||
../../ | ||
) | ||
|
||
target_link_libraries(platform host pcmcia k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ROM CMakeLists | ||
|
||
file(GLOB headers *.h) | ||
file(GLOB sources *.cp) | ||
|
||
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX) | ||
|
||
add_library(rom STATIC ${sources}) | ||
target_include_directories(rom PUBLIC | ||
../ | ||
../JIT/ | ||
../JIT/Generic/ | ||
../Screen/ | ||
../../ | ||
) | ||
|
||
target_link_libraries(rom k) |
Oops, something went wrong.