forked from clwi/CWPack
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CMakeList.txt and Makefile.cwpack files.
Change-Id: I4a47485a6a7bc27e364f0a73e82c76d886e8dc9b
- Loading branch information
Showing
2 changed files
with
107 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
## | ||
####################################################################################################################### | ||
# | ||
# Modifications Copyright© 2019 Advanced Micro Devices, Inc. All rights reserved. | ||
# | ||
####################################################################################################################### | ||
|
||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(CWPACK C) | ||
|
||
### Create CWPACK Library ############################################################################################ | ||
add_library(cwpack STATIC "") | ||
|
||
### Cached Project Options ############################################################################################# | ||
# No exposed CWPACK options | ||
|
||
### Compiler Options ################################################################################################### | ||
if(WIN32) | ||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") | ||
message(STATUS "Configured ${PROJECT_NAME} compiler options for MSVC.") | ||
else() | ||
message(FATAL_ERROR "Using unknown compiler") | ||
endif() | ||
elseif(UNIX) | ||
if(CMAKE_C_COMPILER_ID MATCHES "GNU") | ||
# SEE: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Option-Summary.html#Option-Summary | ||
# for a list of all options and documentation. | ||
target_compile_options(cwpack PRIVATE -pthread -fPIC) | ||
|
||
message(STATUS "Configured ${PROJECT_NAME} compiler options for GCC.") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
message(WARNING "Clang is untested.") | ||
target_compile_options(cwpack PRIVATE -pthread -fPIC) | ||
else() | ||
message(FATAL_ERROR "Using unknown compiler.") | ||
endif() | ||
endif() | ||
|
||
### Defines/Includes/Sources ########################################################################################### | ||
target_compile_definitions(cwpack PRIVATE COMPILE_FOR_${TARGET_ARCHITECTURE_ENDIANESS}_ENDIAN) | ||
|
||
if(WIN32) | ||
if(TARGET_ARCHITECTURE_BITS EQUAL 32) | ||
target_compile_definitions(cwpack PRIVATE CWP_CALL=__fastcall) | ||
endif() | ||
endif() | ||
|
||
target_include_directories(cwpack PUBLIC src) | ||
|
||
target_sources(cwpack PRIVATE src/cwpack.c) | ||
|
||
### Link Libraries ##################################################################################################### | ||
# No external libraries required for CWPACK. | ||
|
||
### Find headers and build source groups ############################################################################### | ||
#target_find_headers(cwpack) | ||
#target_source_groups(cwpack) | ||
|
||
### Mark all options as advanced ####################################################################################### | ||
if(CWPACK_OPTIONS_MARK_ADVANCED) | ||
mark_grouped_as_advanced(CWPACK) | ||
endif() |
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,44 @@ | ||
#### | ||
# | ||
# Modifications Copyright© 2019 Advanced Micro Devices, Inc. All rights reserved. | ||
# | ||
#### | ||
|
||
#----------------------------------------------------------------------- | ||
# Common CWPack Implementation Files | ||
#----------------------------------------------------------------------- | ||
|
||
vpath %.c $(CWPACK_DEPTH)/src | ||
|
||
CFILES += cwpack.c | ||
|
||
#----------------------------------------------------------------------- | ||
# Common CWPack Includes | ||
#----------------------------------------------------------------------- | ||
|
||
LCINCS += -I$(CWPACK_DEPTH)/src | ||
LCXXINCS += -I$(CWPACK_DEPTH)/src | ||
|
||
#----------------------------------------------------------------------- | ||
# Common CWPack Build Options | ||
#----------------------------------------------------------------------- | ||
|
||
ifneq ($(filter lnx lnx64a, $(CWPACK_OS_BUILD)),) | ||
LCOPTS += -fPIC | ||
endif | ||
|
||
#----------------------------------------------------------------------- | ||
# Common CWPack Defines | ||
#----------------------------------------------------------------------- | ||
|
||
LCDEFS += -DCOMPILE_FOR_LITTLE_ENDIAN=1 | ||
|
||
ifneq ($(filter wNow wNxt, $(CWPACK_OS_BUILD)),) | ||
ifneq ($(filter /Gr, $(LCXXOPTS)),) | ||
LCDEFS += -DCWP_CALL=__fastcall | ||
else | ||
ifneq ($(filter /Gz, $(LCXXOPTS)),) | ||
LCDEFS += -DCWP_CALL=__stdcall | ||
endif | ||
endif | ||
endif |